Skip to content

Commit

Permalink
chore(bindings/node): Format binding.js (#9738)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjiding authored Nov 14, 2024
1 parent ce20b4d commit 9f8c14f
Showing 1 changed file with 63 additions and 67 deletions.
130 changes: 63 additions & 67 deletions packages/core/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ function requireNative() {
}
} else if (process.platform === 'darwin') {
try {
return require('./swc.darwin-universal.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-darwin-universal')
} catch (e) {
loadErrors.push(e)
}
return require('./swc.darwin-universal.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-darwin-universal')
} catch (e) {
loadErrors.push(e)
}

if (process.arch === 'x64') {
try {
Expand Down Expand Up @@ -196,53 +196,53 @@ function requireNative() {
if (process.arch === 'x64') {
if (isMusl()) {
try {
return require('./swc.linux-x64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-x64-musl')
} catch (e) {
loadErrors.push(e)
}
return require('./swc.linux-x64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-x64-musl')
} catch (e) {
loadErrors.push(e)
}

} else {
try {
return require('./swc.linux-x64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-x64-gnu')
} catch (e) {
loadErrors.push(e)
}
return require('./swc.linux-x64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-x64-gnu')
} catch (e) {
loadErrors.push(e)
}

}
} else if (process.arch === 'arm64') {
if (isMusl()) {
try {
return require('./swc.linux-arm64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-arm64-musl')
} catch (e) {
loadErrors.push(e)
}
return require('./swc.linux-arm64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-arm64-musl')
} catch (e) {
loadErrors.push(e)
}

} else {
try {
return require('./swc.linux-arm64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-arm64-gnu')
} catch (e) {
loadErrors.push(e)
}
return require('./swc.linux-arm64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-arm64-gnu')
} catch (e) {
loadErrors.push(e)
}

}
} else if (process.arch === 'arm') {
Expand All @@ -256,32 +256,29 @@ function requireNative() {
} catch (e) {
loadErrors.push(e)
}

} else if (process.arch === 'riscv64') {
if (isMusl()) {
try {
return require('./swc.linux-riscv64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-riscv64-musl')
} catch (e) {
loadErrors.push(e)
}

return require('./swc.linux-riscv64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-riscv64-musl')
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./swc.linux-riscv64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-riscv64-gnu')
} catch (e) {
loadErrors.push(e)
}

return require('./swc.linux-riscv64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@swc/core-linux-riscv64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 's390x') {
try {
Expand All @@ -294,7 +291,6 @@ function requireNative() {
} catch (e) {
loadErrors.push(e)
}

} else {
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
}
Expand Down

0 comments on commit 9f8c14f

Please sign in to comment.