@nitro/gulp 11.0.0-beta.3 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitro/gulp",
3
- "version": "11.0.0-beta.3",
3
+ "version": "11.0.1",
4
4
  "description": "Nitro gulp",
5
5
  "license": "MIT",
6
6
  "author": "The Nitro Team",
@@ -23,12 +23,12 @@
23
23
  "gulp"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@nitro/app": ">=11.0.0-beta.3",
26
+ "@nitro/app": ">=11.0.1",
27
27
  "gulp": ">=5.0.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "compression": "1.8.1",
31
- "config": "4.3.0",
31
+ "config": "4.4.0",
32
32
  "del": "8.0.1",
33
33
  "get-port": "7.1.0",
34
34
  "gulp": "5.0.1",
@@ -13,9 +13,12 @@ module.exports = (gulp, plugins) => {
13
13
  if (copyAssetsConfig && copyAssetsConfig.src && copyAssetsConfig.dest) {
14
14
  streams.push(
15
15
  gulp
16
- .src(copyAssetsConfig.src, { encoding: false })
16
+ .src(copyAssetsConfig.src, {
17
+ encoding: false,
18
+ dot: true,
19
+ })
17
20
  .pipe(plugins.newer(copyAssetsConfig.dest))
18
- .pipe(gulp.dest(copyAssetsConfig.dest))
21
+ .pipe(gulp.dest(copyAssetsConfig.dest)),
19
22
  );
20
23
  }
21
24
  });
@@ -1,78 +1,109 @@
1
- 'use strict';
2
-
3
- const config = require('config');
4
- const ordered = require('ordered-read-streams');
5
- const utils = require('../lib/utils');
6
-
7
- async function loadImageminPlugins() {
8
- const plugins = [];
9
-
10
- try {
11
- const mozjpeg = (await import('imagemin-mozjpeg')).default;
12
- plugins.push(mozjpeg({ quality: 75, progressive: true }));
13
- } catch { /* empty */ }
14
-
15
- try {
16
- const optipng = (await import('imagemin-optipng')).default;
17
- plugins.push(optipng({ optimizationLevel: 7 }));
18
- } catch { /* empty */ }
19
-
20
- try {
21
- const pngquant = (await import('imagemin-pngquant')).default;
22
- plugins.push(pngquant());
23
- } catch { /* empty */ }
24
-
25
- try {
26
- const svgo = (await import('imagemin-svgo')).default;
27
- plugins.push(svgo({
28
- plugins: [
29
- { name: 'collapseGroups', active: false },
30
- // { name: 'cleanupIDs', active: false },
31
- { name: 'removeUnknownsAndDefaults', active: false },
32
- { name: 'removeViewBox', active: false },
33
- ],
34
- }));
35
- } catch { /* empty */ }
36
-
37
- return plugins;
38
- }
39
-
40
- module.exports = (gulp, plugins) => {
41
-
42
- return (done) => {
43
- const minifyImagesConfigs = config.has('gulp.minifyImages') ? config.get('gulp.minifyImages') : {};
44
-
45
- Promise.all([loadImageminPlugins(), import('gulp-imagemin')])
46
- .then(([imageminPlugins, imageminModule]) => {
47
- const imagemin = imageminModule.default;
48
- const streams = [];
49
-
50
- utils.each(minifyImagesConfigs, (minifyImagesConfig) => {
51
- if (minifyImagesConfig && minifyImagesConfig.src && minifyImagesConfig.dest) {
52
- const srcStream = gulp.src(minifyImagesConfig.src, { encoding: false, allowEmpty: true });
53
-
54
- streams.push(
55
- srcStream
56
- .pipe(plugins.newer(minifyImagesConfig.dest))
57
- .pipe(
58
- imagemin(imageminPlugins)
59
- )
60
- .pipe(gulp.dest(minifyImagesConfig.dest))
61
- );
62
- }
63
- });
64
-
65
- if (!streams.length) {
66
- done();
67
- return;
68
- }
69
-
70
- const merged = ordered(streams);
71
- merged.on('error', done);
72
- merged.on('finish', done);
73
- merged.on('end', done);
74
- merged.resume();
75
- })
76
- .catch(done);
77
- };
78
- };
1
+ 'use strict';
2
+
3
+ const config = require('config');
4
+ const ordered = require('ordered-read-streams');
5
+ const utils = require('../lib/utils');
6
+
7
+ async function loadImageminPlugins() {
8
+ const plugins = [];
9
+
10
+ try {
11
+ const mozjpeg = (await import('imagemin-mozjpeg')).default;
12
+ plugins.push(mozjpeg({ quality: 75, progressive: true }));
13
+ } catch { /* empty */ }
14
+
15
+ try {
16
+ const optipng = (await import('imagemin-optipng')).default;
17
+ plugins.push(optipng({ optimizationLevel: 7 }));
18
+ } catch { /* empty */ }
19
+
20
+ try {
21
+ const pngquant = (await import('imagemin-pngquant')).default;
22
+ plugins.push(pngquant());
23
+ } catch { /* empty */ }
24
+
25
+ try {
26
+ const svgo = (await import('imagemin-svgo')).default;
27
+ plugins.push(svgo({
28
+ plugins: [
29
+ // deactivate preset
30
+ { name: 'preset-default', active: false },
31
+
32
+ // optimize
33
+ { name: 'cleanupAttrs', active: true },
34
+ { name: 'cleanupNumericValues', active: true },
35
+ { name: 'convertColors', active: true },
36
+ { name: 'convertPathData', active: true },
37
+ { name: 'convertShapeToPath', active: true },
38
+ { name: 'convertStyleToAttrs', active: true },
39
+ { name: 'convertTransform', active: true },
40
+ { name: 'mergePaths', active: true },
41
+ { name: 'minifyStyles', active: true },
42
+ { name: 'removeDoctype', active: true },
43
+ { name: 'removeEditorsNSData', active: true },
44
+ { name: 'removeEmptyAttrs', active: true },
45
+ { name: 'removeEmptyContainers', active: true },
46
+ { name: 'removeEmptyText', active: true },
47
+ { name: 'removeMetadata', active: true },
48
+ { name: 'removeTitle', active: true },
49
+ { name: 'removeDesc', active: true },
50
+ { name: 'removeDimensions', active: true },
51
+ { name: 'removeUselessStrokeAndFill', active: true },
52
+ { name: 'removeXMLNS', active: true },
53
+
54
+ { name: 'collapseGroups', active: false },
55
+ { name: 'removeUnknownsAndDefaults', active: false },
56
+ { name: 'removeViewBox', active: false },
57
+
58
+ // for icons/sprites with <symbol>
59
+ { name: 'removeUselessDefs', active: false },
60
+ ],
61
+ }));
62
+ } catch { /* empty */ }
63
+
64
+ return plugins;
65
+ }
66
+
67
+ module.exports = (gulp, plugins) => {
68
+
69
+ return (done) => {
70
+ const minifyImagesConfigs = config.has('gulp.minifyImages') ? config.get('gulp.minifyImages') : {};
71
+
72
+ Promise.all([loadImageminPlugins(), import('gulp-imagemin')])
73
+ .then(([imageminPlugins, imageminModule]) => {
74
+ const imagemin = imageminModule.default;
75
+ const streams = [];
76
+
77
+ utils.each(minifyImagesConfigs, (minifyImagesConfig) => {
78
+ if (minifyImagesConfig && minifyImagesConfig.src && minifyImagesConfig.dest) {
79
+ const srcStream = gulp.src(minifyImagesConfig.src, {
80
+ encoding: false,
81
+ allowEmpty: true,
82
+ dot: true,
83
+ });
84
+
85
+ streams.push(
86
+ srcStream
87
+ .pipe(plugins.newer(minifyImagesConfig.dest))
88
+ .pipe(
89
+ imagemin(imageminPlugins)
90
+ )
91
+ .pipe(gulp.dest(minifyImagesConfig.dest))
92
+ );
93
+ }
94
+ });
95
+
96
+ if (!streams.length) {
97
+ done();
98
+ return;
99
+ }
100
+
101
+ const merged = ordered(streams);
102
+ merged.on('error', done);
103
+ merged.on('finish', done);
104
+ merged.on('end', done);
105
+ merged.resume();
106
+ })
107
+ .catch(done);
108
+ };
109
+ };