@swc-node/core
Advanced tools
Comparing version 0.4.2 to 0.5.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [0.5.0](https://github.com/Brooooooklyn/swc-node/compare/@swc-node/core@0.4.2...@swc-node/core@0.5.0) (2020-08-28) | ||
### Features | ||
- **core:** provide jest hoist plugin ([f3638f2](https://github.com/Brooooooklyn/swc-node/commit/f3638f2004b9fb323261a301b6fe354255846965)) | ||
## [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) | ||
@@ -8,0 +14,0 @@ |
@@ -22,2 +22,11 @@ export interface Options { | ||
export function transformJest( | ||
source: string | Buffer, | ||
path: string, | ||
options?: Options, | ||
): { | ||
code: string | ||
map: string | ||
} | ||
export function transform( | ||
@@ -24,0 +33,0 @@ source: string | Buffer, |
30
index.js
@@ -46,3 +46,3 @@ const { platform } = require('os') | ||
jsc: { | ||
target: 'es2018', | ||
target: opts.target || 'es2018', | ||
parser: { | ||
@@ -68,2 +68,28 @@ syntax: 'typescript', | ||
}, | ||
transformJest: function transformJest(source, path, options) { | ||
const opts = options == null ? {} : options | ||
const swcOptions = { | ||
filename: path, | ||
jsc: { | ||
target: opts.target || 'es2018', | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: typeof opts.jsx !== 'undefined' ? opts.jsx : path.endsWith('.tsx'), | ||
decorators: Boolean(opts.experimentalDecorators), | ||
dynamicImport: Boolean(opts.dynamicImport), | ||
}, | ||
transform: { | ||
legacyDecorator: Boolean(opts.experimentalDecorators), | ||
decoratorMetadata: Boolean(opts.emitDecoratorMetadata), | ||
}, | ||
}, | ||
isModule: true, | ||
module: { | ||
type: opts.module || 'commonjs', | ||
}, | ||
sourceMaps: typeof opts.sourcemap === 'undefined' ? true : opts.sourcemap, | ||
swcrc: false, | ||
} | ||
return bindings.transformJest(source, path, Buffer.from(JSON.stringify(swcOptions))) | ||
}, | ||
transform: function transform(source, path, options) { | ||
@@ -74,3 +100,3 @@ const opts = options == null ? {} : options | ||
jsc: { | ||
target: 'es2018', | ||
target: opts.target || 'es2018', | ||
parser: { | ||
@@ -77,0 +103,0 @@ syntax: 'typescript', |
{ | ||
"name": "@swc-node/core", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"description": "Faster swc nodejs binding", | ||
@@ -57,10 +57,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@node-rs/helper": "^0.3.0" | ||
"@node-rs/helper": "^0.3.1" | ||
}, | ||
"gitHead": "acb6af39d64f3264038c0f311f4fd3c16163d612", | ||
"gitHead": "eda0507e6e5013f46d82245cf27ca0d44745a4f1", | ||
"optionalDependencies": { | ||
"@swc-node/core-darwin": "^0.4.2", | ||
"@swc-node/core-linux": "^0.4.2", | ||
"@swc-node/core-win32": "^0.4.2" | ||
"@swc-node/core-darwin": "^0.5.0", | ||
"@swc-node/core-linux": "^0.5.0", | ||
"@swc-node/core-win32": "^0.5.0" | ||
} | ||
} |
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
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
12275
149
+ Added@swc-node/core-darwin@0.5.0(transitive)
+ Added@swc-node/core-linux@0.5.0(transitive)
+ Added@swc-node/core-win32@0.5.0(transitive)
- Removed@swc-node/core-darwin@0.4.2(transitive)
- Removed@swc-node/core-linux@0.4.2(transitive)
- Removed@swc-node/core-win32@0.4.2(transitive)
Updated@node-rs/helper@^0.3.1