schnee effeckt und fehler Korektur

This commit is contained in:
2023-08-14 17:52:24 +02:00
parent 4a843d4936
commit 79af4e9907
6813 changed files with 343821 additions and 356128 deletions

164
node_modules/gulp-imagemin/index.js generated vendored
View File

@@ -1,91 +1,119 @@
'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2-concurrent');
var assign = require('object-assign');
var prettyBytes = require('pretty-bytes');
var chalk = require('chalk');
var Imagemin = require('imagemin');
var plur = require('plur');
import {createRequire} from 'node:module';
import path from 'node:path';
import process from 'node:process';
import log from 'fancy-log';
import PluginError from 'plugin-error';
import through from 'through2-concurrent';
import prettyBytes from 'pretty-bytes';
import chalk from 'chalk';
import imagemin from 'imagemin';
import plur from 'plur';
module.exports = function (opts) {
opts = assign({
// TODO: remove this when gulp get's a real logger with levels
verbose: process.argv.indexOf('--verbose') !== -1
}, opts);
const require = createRequire(import.meta.url);
var totalBytes = 0;
var totalSavedBytes = 0;
var totalFiles = 0;
var validExts = ['.jpg', '.jpeg', '.png', '.gif', '.svg'];
const PLUGIN_NAME = 'gulp-imagemin';
const defaultPlugins = ['gifsicle', 'mozjpeg', 'optipng', 'svgo'];
return through.obj(function (file, enc, cb) {
const loadPlugin = (plugin, ...args) => {
try {
return require(`imagemin-${plugin}`)(...args);
} catch {
log(`${PLUGIN_NAME}: Could not load default plugin \`${plugin}\``);
}
};
const exposePlugin = plugin => (...args) => loadPlugin(plugin, ...args);
const getDefaultPlugins = () => defaultPlugins.flatMap(plugin => loadPlugin(plugin));
export default function gulpImagemin(plugins, options) {
if (typeof plugins === 'object' && !Array.isArray(plugins)) {
options = plugins;
plugins = undefined;
}
options = {
// TODO: Remove this when Gulp gets a real logger with levels
silent: process.argv.includes('--silent'),
verbose: process.argv.includes('--verbose'),
...options,
};
const validExtensions = new Set(['.jpg', '.jpeg', '.png', '.gif', '.svg']);
let totalBytes = 0;
let totalSavedBytes = 0;
let totalFiles = 0;
return through.obj({
maxConcurrency: 8,
}, (file, encoding, callback) => {
if (file.isNull()) {
cb(null, file);
callback(null, file);
return;
}
if (file.isStream()) {
cb(new gutil.PluginError('gulp-imagemin', 'Streaming not supported'));
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
return;
}
if (validExts.indexOf(path.extname(file.path).toLowerCase()) === -1) {
if (opts.verbose) {
gutil.log('gulp-imagemin: Skipping unsupported image ' + chalk.blue(file.relative));
if (!validExtensions.has(path.extname(file.path).toLowerCase())) {
if (options.verbose) {
log(`${PLUGIN_NAME}: Skipping unsupported image ${chalk.blue(file.relative)}`);
}
cb(null, file);
callback(null, file);
return;
}
var imagemin = new Imagemin()
.src(file.contents)
.use(Imagemin.gifsicle({interlaced: opts.interlaced}))
.use(Imagemin.jpegtran({progressive: opts.progressive}))
.use(Imagemin.optipng({optimizationLevel: opts.optimizationLevel}))
.use(Imagemin.svgo({
plugins: opts.svgoPlugins || [],
multipass: opts.multipass
}));
const localPlugins = plugins || getDefaultPlugins();
if (opts.use) {
opts.use.forEach(imagemin.use.bind(imagemin));
}
(async () => {
try {
const data = await imagemin.buffer(file.contents, {
plugins: localPlugins,
});
const originalSize = file.contents.length;
const optimizedSize = data.length;
const saved = originalSize - optimizedSize;
const percent = originalSize > 0 ? (saved / originalSize) * 100 : 0;
const savedMessage = `saved ${prettyBytes(saved)} - ${percent.toFixed(1).replace(/\.0$/, '')}%`;
const message = saved > 0 ? savedMessage : 'already optimized';
imagemin.run(function (err, files) {
if (err) {
cb(new gutil.PluginError('gulp-imagemin:', err, {fileName: file.path}));
return;
if (saved > 0) {
totalBytes += originalSize;
totalSavedBytes += saved;
totalFiles++;
}
if (options.verbose) {
log(`${PLUGIN_NAME}:`, chalk.green('✔ ') + file.relative + chalk.gray(` (${message})`));
}
file.contents = data;
callback(null, file);
} catch (error) {
callback(new PluginError(PLUGIN_NAME, error, {fileName: file.path}));
}
})();
}, callback => {
if (!options.silent) {
const percent = totalBytes > 0 ? (totalSavedBytes / totalBytes) * 100 : 0;
let message = `Minified ${totalFiles} ${plur('image', totalFiles)}`;
if (totalFiles > 0) {
message += chalk.gray(` (saved ${prettyBytes(totalSavedBytes)} - ${percent.toFixed(1).replace(/\.0$/, '')}%)`);
}
var originalSize = file.contents.length;
var optimizedSize = files[0].contents.length;
var saved = originalSize - optimizedSize;
var percent = originalSize > 0 ? (saved / originalSize) * 100 : 0;
var savedMsg = 'saved ' + prettyBytes(saved) + ' - ' + percent.toFixed(1).replace(/\.0$/, '') + '%';
var msg = saved > 0 ? savedMsg : 'already optimized';
totalBytes += originalSize;
totalSavedBytes += saved;
totalFiles++;
if (opts.verbose) {
gutil.log('gulp-imagemin:', chalk.green('✔ ') + file.relative + chalk.gray(' (' + msg + ')'));
}
file.contents = files[0].contents;
cb(null, file);
});
}, function (cb) {
var percent = totalBytes > 0 ? (totalSavedBytes / totalBytes) * 100 : 0;
var msg = 'Minified ' + totalFiles + ' ' + plur('image', totalFiles);
if (totalFiles > 0) {
msg += chalk.gray(' (saved ' + prettyBytes(totalSavedBytes) + ' - ' + percent.toFixed(1).replace(/\.0$/, '') + '%)');
log(`${PLUGIN_NAME}:`, message);
}
gutil.log('gulp-imagemin:', msg);
cb();
callback();
});
};
}
export const gifsicle = exposePlugin('gifsicle');
export const mozjpeg = exposePlugin('mozjpeg');
export const optipng = exposePlugin('optipng');
export const svgo = exposePlugin('svgo');

22
node_modules/gulp-imagemin/license generated vendored
View File

@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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:
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 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.
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

@@ -1,50 +1,70 @@
{
"name": "gulp-imagemin",
"version": "2.4.0",
"description": "Minify PNG, JPEG, GIF and SVG images",
"license": "MIT",
"repository": "sindresorhus/gulp-imagemin",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && mocha --timeout 50000"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"imagemin",
"image",
"img",
"picture",
"photo",
"minify",
"minifier",
"compress",
"png",
"jpg",
"jpeg",
"gif",
"svg"
],
"dependencies": {
"chalk": "^1.0.0",
"gulp-util": "^3.0.0",
"imagemin": "^4.0.0",
"object-assign": "^4.0.1",
"plur": "^2.0.0",
"pretty-bytes": "^2.0.1",
"through2-concurrent": "^1.1.0"
},
"devDependencies": {
"imagemin-pngquant": "^4.1.0",
"xo": "*"
}
"name": "gulp-imagemin",
"version": "8.0.0",
"description": "Minify PNG, JPEG, GIF and SVG images",
"license": "MIT",
"repository": "sindresorhus/gulp-imagemin",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"imagemin",
"image",
"img",
"picture",
"photo",
"minify",
"minifier",
"compress",
"png",
"jpg",
"jpeg",
"gif",
"svg"
],
"dependencies": {
"chalk": "^4.1.2",
"fancy-log": "^1.3.3",
"imagemin": "^8.0.1",
"plugin-error": "^1.0.1",
"plur": "^4.0.0",
"pretty-bytes": "^5.6.0",
"through2-concurrent": "^2.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"get-stream": "^6.0.1",
"imagemin-pngquant": "^9.0.2",
"vinyl": "^2.2.1",
"xo": "^0.44.0"
},
"optionalDependencies": {
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^9.0.0"
},
"peerDependencies": {
"gulp": ">=4"
},
"peerDependenciesMeta": {
"gulp": {
"optional": true
}
}
}

151
node_modules/gulp-imagemin/readme.md generated vendored
View File

@@ -1,9 +1,8 @@
# gulp-imagemin [![Build Status](https://travis-ci.org/sindresorhus/gulp-imagemin.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-imagemin)
# gulp-imagemin
> Minify PNG, JPEG, GIF and SVG images with [imagemin](https://github.com/kevva/imagemin)
*Issues with the output should be reported on the imagemin [issue tracker](https://github.com/kevva/imagemin/issues).*
> Minify PNG, JPEG, GIF and SVG images with [`imagemin`](https://github.com/imagemin/imagemin)
*Issues with the output should be reported on the [`imagemin` issue tracker](https://github.com/imagemin/imagemin/issues).*
## Install
@@ -11,98 +10,100 @@
$ npm install --save-dev gulp-imagemin
```
## Usage
```js
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const pngquant = require('imagemin-pngquant');
### Basic
gulp.task('default', () => {
return gulp.src('src/images/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/images'));
});
```js
import gulp from 'gulp';
import imagemin from 'gulp-imagemin';
export default () => (
gulp.src('src/images/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'))
);
```
### Custom plugin options
```js
// …
.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.mozjpeg({quality: 75, progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
]
})
]))
// …
```
### Custom plugin options and custom `gulp-imagemin` options
```js
// …
.pipe(imagemin([
imagemin.svgo({
plugins: [
{
removeViewBox: true
}
]
})
], {
verbose: true
}))
// …
```
## API
Comes bundled with the following **lossless** optimizers:
Comes bundled with the following optimizers:
- [gifsicle](https://github.com/kevva/imagemin-gifsicle) — *Compress GIF images*
- [jpegtran](https://github.com/kevva/imagemin-jpegtran) — *Compress JPEG images*
- [optipng](https://github.com/kevva/imagemin-optipng) — *Compress PNG images*
- [svgo](https://github.com/kevva/imagemin-svgo) — *Compress SVG images*
- [gifsicle](https://github.com/imagemin/imagemin-gifsicle) — *Compress GIF images, lossless*
- [mozjpeg](https://github.com/imagemin/imagemin-mozjpeg) — *Compress JPEG images, lossy*
- [optipng](https://github.com/imagemin/imagemin-optipng) — *Compress PNG images, lossless*
- [svgo](https://github.com/imagemin/imagemin-svgo) — *Compress SVG images, lossless*
### imagemin([options])
These are bundled for convenience and most users will not need anything else.
### imagemin(plugins?, options?)
Unsupported files are ignored.
#### plugins
Type: `Array`\
Default: `[imagemin.gifsicle(), imagemin.mozjpeg(), imagemin.optipng(), imagemin.svgo()]`
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. This will completely overwrite all the default plugins. So, if you want to use custom plugins and you need some of defaults too, then you should pass default plugins as well. Note that the default plugins come with good defaults and should be sufficient in most cases. See the individual plugins for supported options.
#### options
Options are applied to the correct files.
Type: `object`
##### optimizationLevel *(png)*
##### verbose
Type: `number`
Default: `3`
Select an optimization level between `0` and `7`.
> The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial. The trial chosen is what. OptiPNG thinks its probably the most effective. The optimization levels 2 and higher enable multiple IDAT compression trials; the higher the level, the more trials.
Level and trials:
1. 1 trial
2. 8 trials
3. 16 trials
4. 24 trials
5. 48 trials
6. 120 trials
7. 240 trials
##### progressive *(jpg)*
Type: `boolean`
Type: `boolean`\
Default: `false`
Lossless conversion to progressive.
Enabling this will log info on every image passed to `gulp-imagemin`:
##### interlaced *(gif)*
```
gulp-imagemin: ✔ image1.png (already optimized)
gulp-imagemin: ✔ image2.png (saved 91 B - 0.4%)
```
Type: `boolean`
##### silent
Type: `boolean`\
Default: `false`
Interlace gif for progressive rendering.
Don't log the number of images that have been minified.
##### multipass *(svg)*
Type: `boolean`
Default: `false`
Optimize svg multiple times until it's fully optimized.
##### svgoPlugins *(svg)*
Type: `array`
Default: `[]`
Customize which SVGO plugins to use. [More here](https://github.com/sindresorhus/grunt-svgmin#available-optionsplugins).
##### use
Type: `array`
Default: `null`
Additional [plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use with imagemin.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
You can also enable this from the command-line with the `--silent` flag if the option is not already specified.