Skip to content

Commit

Permalink
refactor(napi): change "isolated declarations" to "transform" (#3721)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jun 17, 2024
1 parent 77d5533 commit f42c325
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 73 deletions.
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "oxc_isolated_declarations_napi"
name = "oxc_transform_napi"
version = "0.0.0"
publish = false
authors.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
108 changes: 54 additions & 54 deletions napi/isolated-declarations/index.js → napi/transform/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'isolated-declarations.android-arm64.node'))
localFileExisted = existsSync(join(__dirname, 'transform.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.android-arm64.node')
nativeBinding = require('./transform.android-arm64.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-android-arm64')
nativeBinding = require('@oxc-transform/binding-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'isolated-declarations.android-arm-eabi.node'))
localFileExisted = existsSync(join(__dirname, 'transform.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.android-arm-eabi.node')
nativeBinding = require('./transform.android-arm-eabi.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-android-arm-eabi')
nativeBinding = require('@oxc-transform/binding-android-arm-eabi')
}
} catch (e) {
loadError = e
Expand All @@ -63,41 +63,41 @@ switch (platform) {
switch (arch) {
case 'x64':
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.win32-x64-msvc.node')
join(__dirname, 'transform.win32-x64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.win32-x64-msvc.node')
nativeBinding = require('./transform.win32-x64-msvc.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-win32-x64-msvc')
nativeBinding = require('@oxc-transform/binding-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.win32-ia32-msvc.node')
join(__dirname, 'transform.win32-ia32-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.win32-ia32-msvc.node')
nativeBinding = require('./transform.win32-ia32-msvc.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-win32-ia32-msvc')
nativeBinding = require('@oxc-transform/binding-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.win32-arm64-msvc.node')
join(__dirname, 'transform.win32-arm64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.win32-arm64-msvc.node')
nativeBinding = require('./transform.win32-arm64-msvc.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-win32-arm64-msvc')
nativeBinding = require('@oxc-transform/binding-win32-arm64-msvc')
}
} catch (e) {
loadError = e
Expand All @@ -108,37 +108,37 @@ switch (platform) {
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'isolated-declarations.darwin-universal.node'))
localFileExisted = existsSync(join(__dirname, 'transform.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.darwin-universal.node')
nativeBinding = require('./transform.darwin-universal.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-darwin-universal')
nativeBinding = require('@oxc-transform/binding-darwin-universal')
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'isolated-declarations.darwin-x64.node'))
localFileExisted = existsSync(join(__dirname, 'transform.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.darwin-x64.node')
nativeBinding = require('./transform.darwin-x64.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-darwin-x64')
nativeBinding = require('@oxc-transform/binding-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.darwin-arm64.node')
join(__dirname, 'transform.darwin-arm64.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.darwin-arm64.node')
nativeBinding = require('./transform.darwin-arm64.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-darwin-arm64')
nativeBinding = require('@oxc-transform/binding-darwin-arm64')
}
} catch (e) {
loadError = e
Expand All @@ -152,12 +152,12 @@ switch (platform) {
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'isolated-declarations.freebsd-x64.node'))
localFileExisted = existsSync(join(__dirname, 'transform.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.freebsd-x64.node')
nativeBinding = require('./transform.freebsd-x64.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-freebsd-x64')
nativeBinding = require('@oxc-transform/binding-freebsd-x64')
}
} catch (e) {
loadError = e
Expand All @@ -168,26 +168,26 @@ switch (platform) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-x64-musl.node')
join(__dirname, 'transform.linux-x64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-x64-musl.node')
nativeBinding = require('./transform.linux-x64-musl.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-x64-musl')
nativeBinding = require('@oxc-transform/binding-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-x64-gnu.node')
join(__dirname, 'transform.linux-x64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-x64-gnu.node')
nativeBinding = require('./transform.linux-x64-gnu.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-x64-gnu')
nativeBinding = require('@oxc-transform/binding-linux-x64-gnu')
}
} catch (e) {
loadError = e
Expand All @@ -197,26 +197,26 @@ switch (platform) {
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-arm64-musl.node')
join(__dirname, 'transform.linux-arm64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-arm64-musl.node')
nativeBinding = require('./transform.linux-arm64-musl.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-arm64-musl')
nativeBinding = require('@oxc-transform/binding-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-arm64-gnu.node')
join(__dirname, 'transform.linux-arm64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-arm64-gnu.node')
nativeBinding = require('./transform.linux-arm64-gnu.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-arm64-gnu')
nativeBinding = require('@oxc-transform/binding-linux-arm64-gnu')
}
} catch (e) {
loadError = e
Expand All @@ -226,26 +226,26 @@ switch (platform) {
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-arm-musleabihf.node')
join(__dirname, 'transform.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-arm-musleabihf.node')
nativeBinding = require('./transform.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-arm-musleabihf')
nativeBinding = require('@oxc-transform/binding-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-arm-gnueabihf.node')
join(__dirname, 'transform.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-arm-gnueabihf.node')
nativeBinding = require('./transform.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-arm-gnueabihf')
nativeBinding = require('@oxc-transform/binding-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
Expand All @@ -255,26 +255,26 @@ switch (platform) {
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-riscv64-musl.node')
join(__dirname, 'transform.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-riscv64-musl.node')
nativeBinding = require('./transform.linux-riscv64-musl.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-riscv64-musl')
nativeBinding = require('@oxc-transform/binding-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-riscv64-gnu.node')
join(__dirname, 'transform.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-riscv64-gnu.node')
nativeBinding = require('./transform.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-riscv64-gnu')
nativeBinding = require('@oxc-transform/binding-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
Expand All @@ -283,13 +283,13 @@ switch (platform) {
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'isolated-declarations.linux-s390x-gnu.node')
join(__dirname, 'transform.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./isolated-declarations.linux-s390x-gnu.node')
nativeBinding = require('./transform.linux-s390x-gnu.node')
} else {
nativeBinding = require('@oxc-isolated-declarations/binding-linux-s390x-gnu')
nativeBinding = require('@oxc-transform/binding-linux-s390x-gnu')
}
} catch (e) {
loadError = e
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@oxc-isolated-declarations/binding",
"name": "@oxc-transform/binding",
"private": true,
"scripts": {
"build": "napi build --platform --release",
Expand All @@ -12,7 +12,7 @@
"node": ">=14.*"
},
"napi": {
"name": "isolated-declarations",
"name": "transform",
"triples": {
"defaults": false,
"additional": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f42c325

Please sign in to comment.