ubdate
This commit is contained in:
9
node_modules/jpegtran-bin/cli.js
generated
vendored
Executable file
9
node_modules/jpegtran-bin/cli.js
generated
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const {spawn} = require('child_process');
|
||||
const jpegtran = require('.');
|
||||
|
||||
const input = process.argv.slice(2);
|
||||
|
||||
spawn(jpegtran, input, {stdio: 'inherit'})
|
||||
.on('exit', process.exit);
|
||||
2
node_modules/jpegtran-bin/index.js
generated
vendored
Normal file
2
node_modules/jpegtran-bin/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = require('./lib').path();
|
||||
21
node_modules/jpegtran-bin/lib/index.js
generated
vendored
Normal file
21
node_modules/jpegtran-bin/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const BinWrapper = require('bin-wrapper');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const url = `https://raw.githubusercontent.com/imagemin/jpegtran-bin/v${pkg.version}/vendor/`;
|
||||
|
||||
module.exports = new BinWrapper()
|
||||
.src(`${url}macos/jpegtran`, 'darwin')
|
||||
.src(`${url}linux/x86/jpegtran`, 'linux', 'x86')
|
||||
.src(`${url}linux/x64/jpegtran`, 'linux', 'x64')
|
||||
.src(`${url}freebsd/x86/jpegtran`, 'freebsd', 'x86')
|
||||
.src(`${url}freebsd/x64/jpegtran`, 'freebsd', 'x64')
|
||||
.src(`${url}sunos/x86/jpegtran`, 'sunos', 'x86')
|
||||
.src(`${url}sunos/x64/jpegtran`, 'sunos', 'x64')
|
||||
.src(`${url}win/x86/jpegtran.exe`, 'win32', 'x86')
|
||||
.src(`${url}win/x64/jpegtran.exe`, 'win32', 'x64')
|
||||
.src(`${url}win/x86/libjpeg-62.dll`, 'win32', 'x86')
|
||||
.src(`${url}win/x64/libjpeg-62.dll`, 'win32', 'x64')
|
||||
.dest(path.join(__dirname, '../vendor'))
|
||||
.use(process.platform === 'win32' ? 'jpegtran.exe' : 'jpegtran');
|
||||
37
node_modules/jpegtran-bin/lib/install.js
generated
vendored
Normal file
37
node_modules/jpegtran-bin/lib/install.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const binBuild = require('bin-build');
|
||||
const log = require('logalot');
|
||||
const bin = require('.');
|
||||
|
||||
const args = [
|
||||
'-copy',
|
||||
'none',
|
||||
'-optimize',
|
||||
'-outfile',
|
||||
path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
|
||||
path.join(__dirname, '../test/fixtures/test.jpg')
|
||||
];
|
||||
|
||||
bin.run(args).then(() => {
|
||||
log.success('jpegtran pre-build test passed successfully');
|
||||
}).catch(error => {
|
||||
log.warn(error.message);
|
||||
log.warn('jpegtran pre-build test failed');
|
||||
log.info('compiling from source');
|
||||
|
||||
const cfg = [
|
||||
'./configure --disable-shared',
|
||||
`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`
|
||||
].join(' ');
|
||||
|
||||
binBuild.url('https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz', [
|
||||
'touch configure.ac aclocal.m4 configure Makefile.am Makefile.in',
|
||||
cfg,
|
||||
'make install'
|
||||
]).then(() => {
|
||||
log.success('jpegtran built successfully');
|
||||
}).catch(error => {
|
||||
log.error(error.stack);
|
||||
});
|
||||
});
|
||||
21
node_modules/jpegtran-bin/license
generated
vendored
Normal file
21
node_modules/jpegtran-bin/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Imagemin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
63
node_modules/jpegtran-bin/package.json
generated
vendored
Normal file
63
node_modules/jpegtran-bin/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "jpegtran-bin",
|
||||
"version": "4.0.0",
|
||||
"description": "jpegtran (part of libjpeg-turbo) bin-wrapper that makes it seamlessly available as a local dependency",
|
||||
"license": "MIT",
|
||||
"repository": "imagemin/jpegtran-bin",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"bin": {
|
||||
"jpegtran": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node lib/install.js",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js",
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"keywords": [
|
||||
"imagemin",
|
||||
"compress",
|
||||
"image",
|
||||
"img",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"minify",
|
||||
"optimize",
|
||||
"jpegtran"
|
||||
],
|
||||
"dependencies": {
|
||||
"bin-build": "^3.0.0",
|
||||
"bin-wrapper": "^4.0.0",
|
||||
"logalot": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"bin-check": "^4.0.1",
|
||||
"compare-size": "^3.0.0",
|
||||
"execa": "^1.0.0",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
40
node_modules/jpegtran-bin/readme.md
generated
vendored
Normal file
40
node_modules/jpegtran-bin/readme.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# jpegtran-bin [](https://travis-ci.org/imagemin/jpegtran-bin)
|
||||
|
||||
> [libjpeg-turbo](http://libjpeg-turbo.virtualgl.org/) is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal.
|
||||
|
||||
You probably want [`imagemin-jpegtran`](https://github.com/imagemin/imagemin-jpegtran) instead.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save jpegtran-bin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var execFile = require('child_process').execFile;
|
||||
var jpegtran = require('jpegtran-bin');
|
||||
|
||||
execFile(jpegtran, ['-outfile', 'output.jpg', 'input.jpg'], function (err) {
|
||||
console.log('Image minified!');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ npm install --global jpegtran-bin
|
||||
```
|
||||
|
||||
```
|
||||
$ jpegtran --help
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Imagemin](https://github.com/imagemin)
|
||||
BIN
node_modules/jpegtran-bin/test/fixtures/test-optimized.jpg
generated
vendored
Normal file
BIN
node_modules/jpegtran-bin/test/fixtures/test-optimized.jpg
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 927 B |
BIN
node_modules/jpegtran-bin/test/fixtures/test.jpg
generated
vendored
Normal file
BIN
node_modules/jpegtran-bin/test/fixtures/test.jpg
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
45
node_modules/jpegtran-bin/test/test.js
generated
vendored
Normal file
45
node_modules/jpegtran-bin/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const test = require('ava');
|
||||
const execa = require('execa');
|
||||
const tempy = require('tempy');
|
||||
const binCheck = require('bin-check');
|
||||
const binBuild = require('bin-build');
|
||||
const compareSize = require('compare-size');
|
||||
const jpegtran = require('..');
|
||||
|
||||
test('rebuild the jpegtran binaries', async t => {
|
||||
const tmp = tempy.directory();
|
||||
const cfg = [
|
||||
'./configure --disable-shared',
|
||||
`--prefix="${tmp}" --bindir="${tmp}"`
|
||||
].join(' ');
|
||||
|
||||
await binBuild.url('https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz', [
|
||||
cfg,
|
||||
'make install'
|
||||
]);
|
||||
|
||||
t.true(fs.existsSync(path.join(tmp, 'jpegtran')));
|
||||
});
|
||||
|
||||
test('return path to binary and verify that it is working', async t => {
|
||||
t.true(await binCheck(jpegtran, ['-version']));
|
||||
});
|
||||
|
||||
test('minify a JPG', async t => {
|
||||
const tmp = tempy.directory();
|
||||
const src = path.join(__dirname, 'fixtures/test.jpg');
|
||||
const dest = path.join(tmp, 'test.jpg');
|
||||
const args = [
|
||||
'-outfile',
|
||||
dest,
|
||||
src
|
||||
];
|
||||
|
||||
await execa(jpegtran, args);
|
||||
const res = await compareSize(src, dest);
|
||||
|
||||
t.true(res[dest] < res[src]);
|
||||
});
|
||||
BIN
node_modules/jpegtran-bin/vendor/jpegtran
generated
vendored
Executable file
BIN
node_modules/jpegtran-bin/vendor/jpegtran
generated
vendored
Executable file
Binary file not shown.
Reference in New Issue
Block a user