style: rename libcs and avoid %2F paths to satisfy cspell

This commit is contained in:
Zoltan Kochan
2026-06-19 00:18:39 +02:00
parent a9dbe11673
commit c8f0dc36cf
3 changed files with 13 additions and 13 deletions

View File

@@ -756,12 +756,12 @@ fn platform_targets_from_version(version: &PackageVersion) -> Vec<PlatformAssetT
return Vec::new();
}
let libc_list = string_array(version.other.get("libc"));
let libcs: Vec<Option<String>> =
let libc_values: Vec<Option<String>> =
if libc_list.is_empty() { vec![None] } else { libc_list.into_iter().map(Some).collect() };
let mut targets = Vec::new();
for os in os_list.iter().filter(|os| !os.starts_with('!')) {
for cpu in cpu_list.iter().filter(|cpu| !cpu.starts_with('!')) {
for libc in &libcs {
for libc in &libc_values {
targets.push(PlatformAssetTarget {
os: os.clone(),
cpu: cpu.clone(),

View File

@@ -132,13 +132,13 @@ function getPlatformTargets (manifest: PackageInRegistry): PlatformAssetTarget[]
// for musl) lists. Skip negations and entries missing os/cpu — those aren't
// the per-platform packages this optimization targets.
if (!manifest.os?.length || !manifest.cpu?.length) return []
const libcs = manifest.libc?.length ? manifest.libc : [undefined]
const libcValues = manifest.libc?.length ? manifest.libc : [undefined]
const targets: PlatformAssetTarget[] = []
for (const os of manifest.os) {
if (os.startsWith('!')) continue
for (const cpu of manifest.cpu) {
if (cpu.startsWith('!')) continue
for (const libc of libcs) {
for (const libc of libcValues) {
targets.push({ os, cpu, ...(libc === 'musl' ? { libc: 'musl' } : {}) })
}
}

View File

@@ -29,8 +29,8 @@ function wrapperMeta () {
version: '1.0.0',
bin: { pacquet: 'bin/pacquet' },
optionalDependencies: {
'@pacquet/darwin-arm64': '1.0.0',
'@pacquet/linux-x64': '1.0.0',
'pacquet-darwin-arm64': '1.0.0',
'pacquet-linux-x64': '1.0.0',
} as Record<string, string>,
dist: {
integrity: 'sha512-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC==',
@@ -55,7 +55,7 @@ function platformMeta (name: string, os: string, cpu: string, integrity: string)
dist: {
integrity,
shasum: '1111111111111111111111111111111111111111',
tarball: `https://registry.npmjs.org/${name}/-/${name.slice(name.indexOf('/') + 1)}-1.0.0.tgz`,
tarball: `https://registry.npmjs.org/${name}/-/${name}-1.0.0.tgz`,
},
},
},
@@ -73,10 +73,10 @@ afterEach(async () => {
test('a native bin dependency resolves to a variations resolution over its platform packages', async () => {
const pool = getMockAgent().get(registries.default.replace(/\/$/, ''))
pool.intercept({ path: '/pacquet', method: 'GET' }).reply(200, wrapperMeta())
pool.intercept({ path: '/@pacquet%2Fdarwin-arm64', method: 'GET' })
.reply(200, platformMeta('@pacquet/darwin-arm64', 'darwin', 'arm64', DARWIN_INTEGRITY))
pool.intercept({ path: '/@pacquet%2Flinux-x64', method: 'GET' })
.reply(200, platformMeta('@pacquet/linux-x64', 'linux', 'x64', LINUX_INTEGRITY))
pool.intercept({ path: '/pacquet-darwin-arm64', method: 'GET' })
.reply(200, platformMeta('pacquet-darwin-arm64', 'darwin', 'arm64', DARWIN_INTEGRITY))
pool.intercept({ path: '/pacquet-linux-x64', method: 'GET' })
.reply(200, platformMeta('pacquet-linux-x64', 'linux', 'x64', LINUX_INTEGRITY))
const { resolveFromNpm } = createResolveFromNpm({
storeDir: temporaryDirectory(),
@@ -93,7 +93,7 @@ test('a native bin dependency resolves to a variations resolution over its platf
resolution: {
type: 'binary',
archive: 'tarball',
url: 'https://registry.npmjs.org/@pacquet/darwin-arm64/-/darwin-arm64-1.0.0.tgz',
url: 'https://registry.npmjs.org/pacquet-darwin-arm64/-/pacquet-darwin-arm64-1.0.0.tgz',
integrity: DARWIN_INTEGRITY,
bin: { pacquet: 'pacquet' },
},
@@ -103,7 +103,7 @@ test('a native bin dependency resolves to a variations resolution over its platf
resolution: {
type: 'binary',
archive: 'tarball',
url: 'https://registry.npmjs.org/@pacquet/linux-x64/-/linux-x64-1.0.0.tgz',
url: 'https://registry.npmjs.org/pacquet-linux-x64/-/pacquet-linux-x64-1.0.0.tgz',
integrity: LINUX_INTEGRITY,
bin: { pacquet: 'pacquet' },
},