Comparing version 1.0.1 to 2.0.0
20
index.js
const buble = require('buble') | ||
const fs = require('fs') | ||
const path = require('path') | ||
function createProcess (bubleOptions) { | ||
return function process (src) { | ||
return buble.transform(src, bubleOptions).code | ||
let options = {} | ||
try { | ||
const configLoc = path.resolve(process.cwd(), '.bublerc') | ||
options = JSON.parse(fs.readFileSync(configLoc)) | ||
} catch (e) {} | ||
module.exports = { | ||
process: function process (src) { | ||
return buble.transform(src, options).code | ||
} | ||
} | ||
module.exports = function create (bubleOptions) { | ||
return { process: createProcess(bubleOptions) } | ||
} | ||
module.exports.process = createProcess() |
{ | ||
"name": "jest-buble", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Jest plugin to use buble for transformation.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,21 +20,9 @@ # jest-buble | ||
Jest doesn't support passing in options to transformers, so you can initialise `jest-buble` in another file first: | ||
Jest doesn't support passing in options to transformers through their config, so you can define a `.bublerc` JSON file with your buble options: | ||
```js | ||
// jest.transform.js | ||
const createTransformer = require('jest-buble') | ||
module.exports = createTransformer({ | ||
objectAssign: 'Object.assign' | ||
}) | ||
```json | ||
// .bublerc | ||
{ | ||
"objectAssign": "Object.assign" | ||
} | ||
``` | ||
then for the jest config: | ||
```json | ||
"jest": { | ||
"transform": { | ||
"^.+\\.js$": "./jest.transform.js" | ||
} | ||
} | ||
``` |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
13
0
4089
28
1