Comparing version 6.1.2 to 7.0.0
#!/usr/bin/env node | ||
'use strict'; | ||
const {spawn} = require('child_process'); | ||
const binPath = require('.'); | ||
import process from 'node:process'; | ||
import {spawn} from 'node:child_process'; | ||
import binPath from './index.js'; | ||
spawn(binPath, process.argv.slice(2), {stdio: 'inherit'}) | ||
.on('exit', process.exit); |
@@ -1,2 +0,3 @@ | ||
'use strict'; | ||
module.exports = require('./lib').path(); | ||
import lib from './lib/index.js'; | ||
export default lib.path(); |
@@ -1,9 +0,10 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const BinWrapper = require('bin-wrapper'); | ||
const pkg = require('../package.json'); | ||
import fs from 'node:fs'; | ||
import process from 'node:process'; | ||
import {fileURLToPath} from 'node:url'; | ||
import BinWrapper from 'bin-wrapper'; | ||
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url))); | ||
const url = `https://raw.githubusercontent.com/imagemin/cwebp-bin/v${pkg.version}/vendor/`; | ||
module.exports = new BinWrapper() | ||
const binWrapper = new BinWrapper() | ||
.src(`${url}osx/cwebp`, 'darwin') | ||
@@ -13,3 +14,5 @@ .src(`${url}linux/x86/cwebp`, 'linux', 'x86') | ||
.src(`${url}win/x64/cwebp.exe`, 'win32', 'x64') | ||
.dest(path.join(__dirname, '../vendor')) | ||
.dest(fileURLToPath(new URL('../vendor', import.meta.url))) | ||
.use(process.platform === 'win32' ? 'cwebp.exe' : 'cwebp'); | ||
export default binWrapper; |
@@ -1,5 +0,5 @@ | ||
'use strict'; | ||
const binBuild = require('bin-build'); | ||
const path = require('path'); | ||
const bin = require('.'); | ||
import process from 'node:process'; | ||
import {fileURLToPath} from 'node:url'; | ||
import binBuild from 'bin-build'; | ||
import bin from './index.js'; | ||
@@ -13,8 +13,12 @@ bin.run(['-version']).then(() => { | ||
binBuild.file(path.resolve(__dirname, '../vendor/source/libwebp-1.1.0.tar.gz'), [ | ||
`./configure --disable-shared --prefix="${bin.dest()}" --bindir="${bin.dest()}"`, | ||
'make && make install' | ||
]).then(() => { // eslint-disable-line promise/prefer-await-to-then | ||
try { | ||
const source = fileURLToPath(new URL('../vendor/source/libwebp-1.2.1.tar.gz', import.meta.url)); | ||
binBuild.file(source, [ | ||
`./configure --disable-shared --prefix="${bin.dest()}" --bindir="${bin.dest()}"`, | ||
'make && make install', | ||
]); | ||
console.log('cwebp built successfully'); | ||
}).catch(error => { | ||
} catch (error) { | ||
console.error(error.stack); | ||
@@ -24,3 +28,3 @@ | ||
process.exit(1); | ||
}); | ||
} | ||
}); |
{ | ||
"name": "cwebp-bin", | ||
"version": "6.1.2", | ||
"version": "7.0.0", | ||
"description": "cwebp wrapper that makes it seamlessly available as a local dependency", | ||
"license": "MIT", | ||
"repository": "imagemin/cwebp-bin", | ||
"type": "module", | ||
"funding": "https://github.com/imagemin/cwebp-bin?sponsor=1", | ||
@@ -12,7 +13,7 @@ "bin": { | ||
"engines": { | ||
"node": ">=10" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
"postinstall": "node lib/install.js", | ||
"test": "xo && ava --timeout=120s" | ||
"test": "xo && ava --timeout=180s" | ||
}, | ||
@@ -42,9 +43,9 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^3.8.0", | ||
"ava": "^3.15.0", | ||
"bin-check": "^4.1.0", | ||
"compare-size": "^3.0.0", | ||
"execa": "^1.0.0", | ||
"tempy": "^0.5.0", | ||
"xo": "^0.30.0" | ||
"execa": "^5.1.1", | ||
"tempy": "^2.0.0", | ||
"xo": "^0.45.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# cwebp-bin ![GitHub Actions Status](https://github.com/imagemin/cwebp-bin/workflows/test/badge.svg) | ||
# cwebp-bin ![GitHub Actions Status](https://github.com/imagemin/cwebp-bin/workflows/test/badge.svg?branch=main) | ||
@@ -18,4 +18,4 @@ > [WebP](https://developers.google.com/speed/webp/) is a new image format that provides lossless and lossy compression for images on the web. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at equivalent SSIM index. | ||
```js | ||
const {execFile} = require('child_process'); | ||
const cwebp = require('cwebp-bin'); | ||
import {execFile} from 'node:child_process'; | ||
import cwebp from 'cwebp-bin'; | ||
@@ -22,0 +22,0 @@ execFile(cwebp, ['input.png', '-o', 'output.webp'], err => { |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
4105440
45
0
Yes