MCPcopy Create free account
hub / github.com/claude-code-internals/claude-code-runnable / getPlatformMapping

Function getPlatformMapping

scripts/postinstall.cjs:24–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22const binaryDir = path.join(__dirname, 'vendor', 'ripgrep')
23
24function getPlatformMapping() {
25 const arch = process.arch
26 const platform = process.platform
27 if (platform === 'darwin') {
28 if (arch === 'arm64') return { target: 'aarch64-apple-darwin', ext: 'tar.gz' }
29 if (arch === 'x64') return { target: 'x86_64-apple-darwin', ext: 'tar.gz' }
30 throw new Error(`Unsupported macOS arch: ${arch}`)
31 }
32 if (platform === 'win32') {
33 if (arch === 'x64') return { target: 'x86_64-pc-windows-msvc', ext: 'zip' }
34 if (arch === 'arm64') return { target: 'aarch64-pc-windows-msvc', ext: 'zip' }
35 throw new Error(`Unsupported Windows arch: ${arch}`)
36 }
37 if (platform === 'linux') {
38 const isMusl = detectMusl()
39 if (arch === 'x64') return { target: 'x86_64-unknown-linux-musl', ext: 'tar.gz' }
40 if (arch === 'arm64') {
41 return isMusl
42 ? { target: 'aarch64-unknown-linux-musl', ext: 'tar.gz' }
43 : { target: 'aarch64-unknown-linux-gnu', ext: 'tar.gz' }
44 }
45 throw new Error(`Unsupported Linux arch: ${arch}`)
46 }
47 throw new Error(`Unsupported platform: ${platform}`)
48}
49
50function detectMusl() {
51 const muslArch = process.arch === 'x64' ? 'x86_64' : 'aarch64'

Callers 1

mainFunction · 0.85

Calls 1

detectMuslFunction · 0.85

Tested by

no test coverage detected