@swc-node/core
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.4.2](https://github.com/Brooooooklyn/swc-node/compare/@swc-node/core@0.4.1...@swc-node/core@0.4.2) (2020-08-24) | ||
### Bug Fixes | ||
- **core:** linux musl addon loader ([c6e8a78](https://github.com/Brooooooklyn/swc-node/commit/c6e8a7858f504eaabf07254cf7e3ec42eee432eb)) | ||
## [0.4.1](https://github.com/Brooooooklyn/swc-node/compare/@swc-node/core@0.4.0...@swc-node/core@0.4.1) (2020-08-23) | ||
@@ -8,0 +14,0 @@ |
29
index.js
@@ -6,2 +6,3 @@ const { platform } = require('os') | ||
let bindings | ||
let linuxError = null | ||
@@ -11,9 +12,31 @@ try { | ||
} catch (e) { | ||
const platformName = platform() | ||
try { | ||
bindings = require(`@swc-node/core-${platform()}`) | ||
bindings = require(`@swc-node/core-${platformName}`) | ||
} catch (e) { | ||
throw new TypeError('Not compatible with your platform. Error message: ' + e.message) | ||
if (platformName !== 'linux') { | ||
throw new TypeError('Not compatible with your platform. Error message: ' + e.message) | ||
} else { | ||
linuxError = e | ||
} | ||
} | ||
} | ||
if (!bindings) { | ||
try { | ||
require.resolve('@swc-node/core-linux-musl') | ||
} catch (e) { | ||
throw new TypeError( | ||
`Could not load @swc-node/core-linux, You may need add @swc-node/core-linux-musl to optionalDependencies of your project`, | ||
) | ||
} | ||
try { | ||
bindings = require('@swc-node/core-linux-musl') | ||
} catch (e) { | ||
throw new TypeError( | ||
`Linux glibc version load error: ${linuxError.message}; Linux musl version load error: Error message: ${e.message}`, | ||
) | ||
} | ||
} | ||
module.exports = { | ||
@@ -73,3 +96,3 @@ transformSync: function transformSync(source, path, options) { | ||
SWC_VERSION: 'e619144', | ||
SWC_VERSION: '1.2.21', | ||
} |
{ | ||
"name": "@swc-node/core", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Faster swc nodejs binding", | ||
@@ -59,8 +59,8 @@ "keywords": [ | ||
}, | ||
"gitHead": "dee582f49c2303f36e4efac3f3fdae2d08c10143", | ||
"gitHead": "acb6af39d64f3264038c0f311f4fd3c16163d612", | ||
"optionalDependencies": { | ||
"@swc-node/core-darwin": "^0.4.1", | ||
"@swc-node/core-linux": "^0.4.1", | ||
"@swc-node/core-win32": "^0.4.1" | ||
"@swc-node/core-darwin": "^0.4.2", | ||
"@swc-node/core-linux": "^0.4.2", | ||
"@swc-node/core-win32": "^0.4.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
10907
115