first commit
This commit is contained in:
49
build/node_modules/imagemin-zopfli/index.js
generated
vendored
Normal file
49
build/node_modules/imagemin-zopfli/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
const execBuffer = require('exec-buffer');
|
||||
const isPng = require('is-png');
|
||||
const zopfli = require('zopflipng-bin');
|
||||
|
||||
module.exports = opts => buf => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (!Buffer.isBuffer(buf)) {
|
||||
return Promise.reject(new TypeError('Expected a buffer'));
|
||||
}
|
||||
|
||||
if (!isPng(buf)) {
|
||||
return Promise.resolve(buf);
|
||||
}
|
||||
|
||||
const args = ['-y'];
|
||||
|
||||
if (opts['8bit']) {
|
||||
args.push('--lossy_8bit');
|
||||
}
|
||||
|
||||
if (opts.transparent) {
|
||||
args.push('--lossy_transparent');
|
||||
}
|
||||
|
||||
if (opts.iterations) {
|
||||
args.push(`--iterations=${opts.iterations}`);
|
||||
}
|
||||
|
||||
if (opts.iterationsLarge) {
|
||||
args.push(`--iterations_large=${opts.iterationsLarge}`);
|
||||
}
|
||||
|
||||
if (opts.more) {
|
||||
args.push('-m');
|
||||
}
|
||||
|
||||
args.push(execBuffer.input, execBuffer.output);
|
||||
|
||||
return execBuffer({
|
||||
input: buf,
|
||||
bin: zopfli,
|
||||
args
|
||||
}).catch(err => {
|
||||
err.message = err.stderr || err.message;
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
21
build/node_modules/imagemin-zopfli/license
generated
vendored
Normal file
21
build/node_modules/imagemin-zopfli/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.
|
||||
1
build/node_modules/imagemin-zopfli/node_modules/.bin/zopflipng
generated
vendored
Symbolic link
1
build/node_modules/imagemin-zopfli/node_modules/.bin/zopflipng
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../zopflipng-bin/cli.js
|
||||
9
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/cli.js
generated
vendored
Executable file
9
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/cli.js
generated
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const spawn = require('child_process').spawn;
|
||||
const zopflipng = require('.');
|
||||
|
||||
const input = process.argv.slice(2);
|
||||
|
||||
spawn(zopflipng, input, {stdio: 'inherit'})
|
||||
.on('exit', process.exit);
|
||||
4
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/index.js
generated
vendored
Normal file
4
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
const lib = require('./lib');
|
||||
|
||||
module.exports = lib.path();
|
||||
13
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/lib/index.js
generated
vendored
Normal file
13
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const BinWrapper = require('bin-wrapper');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const url = `https://raw.github.com/imagemin/zopflipng-bin/v${pkg.version}/vendor/`;
|
||||
|
||||
module.exports = new BinWrapper()
|
||||
.src(`${url}osx/zopflipng`, 'darwin')
|
||||
.src(`${url}linux/zopflipng`, 'linux')
|
||||
.src(`${url}win32/zopflipng.exe`, 'win32')
|
||||
.dest(path.resolve(__dirname, '../vendor'))
|
||||
.use(process.platform === 'win32' ? 'zopflipng.exe' : 'zopflipng');
|
||||
36
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/lib/install.js
generated
vendored
Normal file
36
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/lib/install.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
const BinBuild = require('bin-build');
|
||||
const log = require('logalot');
|
||||
const bin = require('.');
|
||||
|
||||
bin.run(['--help'], err => {
|
||||
if (err) {
|
||||
log.warn(err.message);
|
||||
log.warn('zopflipng pre-build test failed');
|
||||
log.info('compiling from source');
|
||||
|
||||
let makeBin = 'make';
|
||||
let makeArgs = '';
|
||||
|
||||
if (process.platform === 'freebsd') {
|
||||
makeBin = 'gmake';
|
||||
makeArgs = 'CC=cc CXX=c++';
|
||||
}
|
||||
|
||||
const builder = new BinBuild()
|
||||
.src('https://github.com/google/zopfli/archive/64c6f362fefd56dccbf31906fdb3e31f6a6faf80.zip')
|
||||
.cmd(`mkdir -p ${bin.dest()}`)
|
||||
.cmd(`${makeBin} zopflipng ${makeArgs} && mv ./zopflipng ${bin.path()}`);
|
||||
|
||||
return builder.run(err => {
|
||||
if (err) {
|
||||
log.error(err.stack);
|
||||
return;
|
||||
}
|
||||
|
||||
log.success('zopflipng built successfully');
|
||||
});
|
||||
}
|
||||
|
||||
log.success('zopflipng pre-build test passed successfully');
|
||||
});
|
||||
9
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/license
generated
vendored
Normal file
9
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
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.
|
||||
99
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/package.json
generated
vendored
Normal file
99
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/package.json
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"_from": "zopflipng-bin@^4.0.0",
|
||||
"_id": "zopflipng-bin@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-RrzVgzOB5k7OF/FMbv/qIOY5cwA=",
|
||||
"_location": "/imagemin-zopfli/zopflipng-bin",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "zopflipng-bin@^4.0.0",
|
||||
"name": "zopflipng-bin",
|
||||
"escapedName": "zopflipng-bin",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/imagemin-zopfli"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/zopflipng-bin/-/zopflipng-bin-4.1.0.tgz",
|
||||
"_shasum": "46bcd5833381e64ece17f14c6effea20e6397300",
|
||||
"_spec": "zopflipng-bin@^4.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/imagemin-zopfli",
|
||||
"author": {
|
||||
"name": "1000ch",
|
||||
"email": "shogo.sensui@gmail.com",
|
||||
"url": "github.com/1000ch"
|
||||
},
|
||||
"bin": {
|
||||
"zopflipng": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/imagemin/zopflipng-bin/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"bin-build": "^2.2.0",
|
||||
"bin-wrapper": "^3.0.0",
|
||||
"logalot": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "`zopflipng` wrapper that makes it seamlessly available as a local dependency",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"bin-check": "^4.0.1",
|
||||
"compare-size": "^3.0.0",
|
||||
"execa": "^0.8.0",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"cli.js",
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/imagemin/zopflipng-bin#readme",
|
||||
"keywords": [
|
||||
"imagemin",
|
||||
"compress",
|
||||
"image",
|
||||
"img",
|
||||
"minify",
|
||||
"optimize",
|
||||
"png",
|
||||
"zopfli",
|
||||
"zopflipng"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"name": "zopflipng-bin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/imagemin/zopflipng-bin.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node lib/install.js",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
}
|
||||
40
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/readme.md
generated
vendored
Normal file
40
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/readme.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# zopflipng-bin [](https://travis-ci.org/imagemin/zopflipng-bin)
|
||||
|
||||
> [zopfli](https://github.com/google/zopfli) Compression Algorithm is a new zlib (gzip, deflate) compatible compressor that takes more time (~100x slower), but compresses around 5% better than zlib and better than any other zlib-compatible compressor
|
||||
|
||||
You probably want [`imagemin-zopfli`](https://github.com/imagemin/imagemin-zopfli) instead.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install zopflipng-bin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const {execFile} = require('child_process');
|
||||
const zopflipng = require('zopflipng-bin');
|
||||
|
||||
execFile(zopflipng, ['-m', '--lossy_8bit', 'input.png', 'outout.png'], () => {
|
||||
console.log('Image minified!');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ npm install --global zopflipng-bin
|
||||
```
|
||||
|
||||
```
|
||||
$ zopflipng --help
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Imagemin](https://github.com/imagemin)
|
||||
BIN
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/vendor/zopflipng
generated
vendored
Executable file
BIN
build/node_modules/imagemin-zopfli/node_modules/zopflipng-bin/vendor/zopflipng
generated
vendored
Executable file
Binary file not shown.
90
build/node_modules/imagemin-zopfli/package.json
generated
vendored
Normal file
90
build/node_modules/imagemin-zopfli/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_from": "imagemin-zopfli",
|
||||
"_id": "imagemin-zopfli@5.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-X0kDcDVvNvx3nJnLA4KQUOmHl9E=",
|
||||
"_location": "/imagemin-zopfli",
|
||||
"_phantomChildren": {
|
||||
"bin-build": "2.2.0",
|
||||
"bin-wrapper": "3.0.2",
|
||||
"logalot": "2.1.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "imagemin-zopfli",
|
||||
"name": "imagemin-zopfli",
|
||||
"escapedName": "imagemin-zopfli",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/imagemin-zopfli/-/imagemin-zopfli-5.1.0.tgz",
|
||||
"_shasum": "5f490370356f36fc779c99cb03829050e98797d1",
|
||||
"_spec": "imagemin-zopfli",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/imagemin/imagemin-zopfli/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"exec-buffer": "^3.0.0",
|
||||
"is-png": "^1.0.0",
|
||||
"zopflipng-bin": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Zopfli imagemin plugin",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"pify": "^2.3.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/imagemin/imagemin-zopfli#readme",
|
||||
"keywords": [
|
||||
"compress",
|
||||
"image",
|
||||
"imageminplugin",
|
||||
"img",
|
||||
"minify",
|
||||
"optimize",
|
||||
"png",
|
||||
"zopfli",
|
||||
"zopflipng"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"name": "imagemin-zopfli",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/imagemin/imagemin-zopfli.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "5.1.0"
|
||||
}
|
||||
81
build/node_modules/imagemin-zopfli/readme.md
generated
vendored
Normal file
81
build/node_modules/imagemin-zopfli/readme.md
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
# imagemin-zopfli [](https://travis-ci.org/imagemin/imagemin-zopfli) [](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin-zopfli)
|
||||
|
||||
> [Zopfli](https://en.wikipedia.org/wiki/Zopfli) imagemin plugin
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save imagemin-zopfli
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const imagemin = require('imagemin');
|
||||
const imageminZopfli = require('imagemin-zopfli');
|
||||
|
||||
imagemin(['images/*.png'], 'build/images', {
|
||||
use: [
|
||||
imageminZopfli({more: true})
|
||||
]
|
||||
}).then(() => {
|
||||
console.log('Images optimized');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### imageminZopfli([options])(buffer)
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### 8bit
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Convert 16-bit per channel image to 8-bit per channel.
|
||||
|
||||
##### transparent
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Allow altering hidden colors of fully transparent pixels.
|
||||
|
||||
##### iterations
|
||||
|
||||
Type: `integer`<br>
|
||||
Default: `15`
|
||||
|
||||
Number of iterations for images smaller than 200 KiB.
|
||||
|
||||
##### iterationsLarge
|
||||
|
||||
Type: `integer`<br>
|
||||
Default: `5`
|
||||
|
||||
Number of iterations for images larger than 200 KiB.
|
||||
|
||||
##### more
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Compress more using more iterations (depending on file size).
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
Buffer to optimize.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [imagemin](https://github.com/imagemin)
|
||||
Reference in New Issue
Block a user