|
1 | 1 | // deno-lint-ignore-file no-cond-assign |
2 | 2 | import { Package, PackageRequirement, Installation } from "types" |
3 | | -import { host, flatmap, undent, validate_plain_obj, validate_str, validate_arr, pkg, TeaError, panic } from "utils" |
| 3 | +import { host, flatmap, undent, validate_plain_obj, validate_str, validate_arr, pkg, TeaError } from "utils" |
4 | 4 | import { isNumber, isPlainObject, isString, isArray, isPrimitive, PlainObject, isBoolean } from "is_what" |
5 | 5 | import { validatePackageRequirement } from "utils/hacks.ts" |
6 | 6 | import { useCellar, usePrefix, usePantry as usePantryBase } from "hooks" |
@@ -76,15 +76,15 @@ const getYAML = (pkg: Package | PackageRequirement) => { |
76 | 76 | } |
77 | 77 |
|
78 | 78 | const getPlatforms = async (pkg: Package | PackageRequirement) => { |
79 | | - let { platform } = await entry(pkg).yml() |
80 | | - if (!platform) return ["linux/x86-64", "linux/aarch64", "darwin/x86-64", "darwin/aarch64"] |
81 | | - if (isString(platform)) platform = [platform] |
82 | | - if (!isArray(platform)) throw new Error(`invalid platform node: ${platform}`) |
| 79 | + let { platforms } = await entry(pkg).yml() |
| 80 | + if (!platforms) return ["linux/x86-64", "linux/aarch64", "darwin/x86-64", "darwin/aarch64"] |
| 81 | + if (isString(platforms)) platforms = [platforms] |
| 82 | + if (!isArray(platforms)) throw new Error(`invalid platform node: ${platforms}`) |
83 | 83 | const rv = [] |
84 | | - for (const p of platform) { |
85 | | - if (p.match(/^(linux|darwin)\/(aarch64|x86-64)$/)) rv.push(p) |
86 | | - else if (p.match(/^(linux|darwin)$/)) rv.push(`${p}/x86-64`, `${p}/aarch64`) |
87 | | - else throw new Error(`invalid platform: ${p}`) |
| 84 | + for (const platform of platforms) { |
| 85 | + if (platform.match(/^(linux|darwin)\/(aarch64|x86-64)$/)) rv.push(platform) |
| 86 | + else if (platform.match(/^(linux|darwin)$/)) rv.push(`${platform}/x86-64`, `${platform}/aarch64`) |
| 87 | + else throw new Error(`invalid platform: ${platform}`) |
88 | 88 | } |
89 | 89 | return rv |
90 | 90 | } |
@@ -289,7 +289,7 @@ function escapeRegExp(string: string) { |
289 | 289 | return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string |
290 | 290 | } |
291 | 291 |
|
292 | | -async function handleComplexVersions(versions: PlainObject): Promise<SemVer[]> { |
| 292 | +function handleComplexVersions(versions: PlainObject): Promise<SemVer[]> { |
293 | 293 | if (versions.github) return handleGitHubVersions(versions) |
294 | 294 | if (versions.url) return handleURLVersions(versions) |
295 | 295 |
|
|
0 commit comments