Skip to content

Commit

Permalink
fix(argon2,bcrypt,crc32,deno-lint,jieba,xxhash): update js binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 10, 2022
1 parent b172d19 commit 4ac6d2b
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/argon2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const enum Version {
V0x10 = 0,
/**
* Default value
* Version 19 (0x13 in hex, default)
* Version 19 (0x13 in hex)
*/
V0x13 = 1,
}
Expand Down
21 changes: 16 additions & 5 deletions packages/argon2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -114,8 +127,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'argon2.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +152,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'argon2.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand Down
21 changes: 16 additions & 5 deletions packages/bcrypt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -114,8 +127,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +152,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand Down
4 changes: 2 additions & 2 deletions packages/deno-lint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ crate-type = ["cdylib"]
[dependencies]
annotate-snippets = {version = "0.9", features = ["color"]}
anyhow = "1"
deno_ast = "0.7.0"
deno_lint = "0.20.1"
deno_ast = "=0.8.0"
deno_lint = "=0.21.0"
env_logger = "0.9"
global_alloc = {path = "../../crates/alloc"}
globwalk = "0.8"
Expand Down
21 changes: 16 additions & 5 deletions packages/deno-lint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -114,8 +127,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'deno-lint.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +152,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'deno-lint.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand Down
21 changes: 16 additions & 5 deletions packages/jieba/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -114,8 +127,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'jieba.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +152,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'jieba.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand Down
21 changes: 16 additions & 5 deletions packages/xxhash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -114,8 +127,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'xxhash.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +152,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'xxhash.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand Down

0 comments on commit 4ac6d2b

Please sign in to comment.