Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env node
'use strict';
const spawn = require('child_process').spawn;
const mozjpeg = require('.');
const input = process.argv.slice(2);
spawn(mozjpeg, input, {stdio: 'inherit'})
.on('exit', process.exit);

View File

@@ -0,0 +1,2 @@
'use strict';
module.exports = require('./lib').path();

View 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.githubusercontent.com/imagemin/mozjpeg-bin/v${pkg.version}/vendor/`;
module.exports = new BinWrapper()
.src(`${url}macos/cjpeg`, 'darwin')
.src(`${url}linux/cjpeg`, 'linux')
.src(`${url}win/cjpeg.exe`, 'win32')
.dest(path.join(__dirname, '../vendor'))
.use(process.platform === 'win32' ? 'cjpeg.exe' : 'cjpeg');

View File

@@ -0,0 +1,43 @@
'use strict';
const os = require('os');
const BinBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
const cpuNum = os.cpus().length;
bin.run(['-version'], err => {
if (err) {
log.warn(err.message);
log.warn('mozjpeg pre-build test failed');
log.info('compiling from source');
let cfgExtras = '';
if (process.platform === 'darwin') {
cfgExtras = 'libpng_LIBS=\'/usr/local/lib/libpng16.a -lz\' --enable-static';
}
const cfg = [
`./configure --disable-shared --disable-dependency-tracking --with-jpeg8 ${cfgExtras}`,
`--prefix="${bin.dest()}" --bindir="${bin.dest()}" --libdir="${bin.dest()}"`
].join(' ');
const builder = new BinBuild()
.src('https://github.com/mozilla/mozjpeg/releases/download/v3.2/mozjpeg-3.2-release-source.tar.gz')
.cmd('autoreconf -fiv')
.cmd(cfg)
.cmd(`make -j${cpuNum}`)
.cmd(`make install -j${cpuNum}`);
return builder.run(err => {
if (err) {
log.error(err.stack);
return;
}
log.success('mozjpeg built successfully');
});
}
log.success('mozjpeg pre-build test passed successfully');
});

View 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.

View File

@@ -0,0 +1,97 @@
{
"_from": "mozjpeg@^5.0.0",
"_id": "mozjpeg@5.0.0",
"_inBundle": false,
"_integrity": "sha1-uGccSSRWijY94AP/L9OXq4P3UsU=",
"_location": "/mozjpeg",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "mozjpeg@^5.0.0",
"name": "mozjpeg",
"escapedName": "mozjpeg",
"rawSpec": "^5.0.0",
"saveSpec": null,
"fetchSpec": "^5.0.0"
},
"_requiredBy": [
"/imagemin-mozjpeg"
],
"_resolved": "https://registry.npmjs.org/mozjpeg/-/mozjpeg-5.0.0.tgz",
"_shasum": "b8671c4924568a363de003ff2fd397ab83f752c5",
"_spec": "mozjpeg@^5.0.0",
"_where": "D:\\developments\\teaser-inertia\\nova-components\\NovaLeader\\node_modules\\imagemin-mozjpeg",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"ava": {
"serial": true
},
"bin": {
"mozjpeg": "cli.js"
},
"bugs": {
"url": "https://github.com/imagemin/mozjpeg-bin/issues"
},
"bundleDependencies": false,
"dependencies": {
"bin-build": "^2.2.0",
"bin-wrapper": "^3.0.0",
"logalot": "^2.0.0"
},
"deprecated": false,
"description": "mozjpeg 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": [
"index.js",
"cli.js",
"lib"
],
"homepage": "https://github.com/imagemin/mozjpeg-bin#readme",
"keywords": [
"imagemin",
"jpeg",
"jpg",
"img",
"image",
"compress",
"minify",
"mozjpeg",
"optimize"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Shinnosuke Watanabe",
"url": "github.com/shinnn"
}
],
"name": "mozjpeg",
"repository": {
"type": "git",
"url": "git+https://github.com/imagemin/mozjpeg-bin.git"
},
"scripts": {
"postinstall": "node lib/install.js",
"test": "xo && ava"
},
"version": "5.0.0"
}

View File

@@ -0,0 +1,40 @@
# mozjpeg-bin [![Build Status](https://travis-ci.org/imagemin/mozjpeg-bin.svg?branch=master)](http://travis-ci.org/imagemin/mozjpeg-bin)
> [mozjpeg](https://github.com/mozilla/mozjpeg) is a production-quality JPEG encoder that improves compression while maintaining compatibility with the vast majority of deployed decoders
You probably want [`imagemin-mozjpeg`](https://github.com/imagemin/imagemin-mozjpeg) instead.
## Install
```
$ npm install mozjpeg
```
## Usage
```js
const {execFile} = require('child_process');
const mozjpeg = require('mozjpeg');
execFile(mozjpeg, ['-outfile', 'output.jpg', 'input.jpg'], err => {
console.log('Image minified!');
});
```
## CLI
```
$ npm install --global mozjpeg
```
```
$ mozjpeg --help
```
## License
MIT © [Imagemin](https://github.com/imagemin)

Binary file not shown.