js-build-tools 3.0.4 → 4.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.
Files changed (213) hide show
  1. package/README.md +166 -426
  2. package/babel.config.js +1 -1
  3. package/dist/build.js +33 -34
  4. package/dist/build.min.js +1 -1
  5. package/dist/bundle.js +14 -9
  6. package/dist/bundle.min.js +1 -1
  7. package/dist/bundleLint.js +15 -11
  8. package/dist/bundleLint.min.js +1 -1
  9. package/dist/bundleMinify.js +11 -5
  10. package/dist/bundleMinify.min.js +1 -1
  11. package/dist/compileReadme.js +7 -10
  12. package/dist/compileReadme.min.js +1 -1
  13. package/dist/copyFonts.js +11 -5
  14. package/dist/copyFonts.min.js +1 -1
  15. package/dist/default.js +13 -9
  16. package/dist/default.min.js +1 -1
  17. package/dist/dist.js +7 -4
  18. package/dist/dist.min.js +1 -1
  19. package/dist/distLint.js +15 -11
  20. package/dist/distLint.min.js +1 -1
  21. package/dist/distMinify.js +11 -5
  22. package/dist/distMinify.min.js +1 -1
  23. package/dist/images.js +7 -4
  24. package/dist/images.min.js +1 -1
  25. package/dist/partials/addToReadme.js +16 -11
  26. package/dist/partials/beginWatcher.js +11 -7
  27. package/dist/partials/clean.js +11 -5
  28. package/dist/partials/copyFor.js +7 -7
  29. package/dist/partials/distFor.js +21 -11
  30. package/dist/partials/distForSrc.js +9 -3
  31. package/dist/partials/distSeries.js +17 -13
  32. package/dist/partials/imagesFor.js +16 -17
  33. package/dist/partials/minifyFor.js +12 -11
  34. package/dist/partials/readmeTemplate.js +13 -9
  35. package/dist/partials/removeDirectory.js +7 -7
  36. package/dist/partials/runOnChange.js +18 -16
  37. package/dist/partials/sassFor.js +19 -12
  38. package/dist/partials/tsFor.js +17 -14
  39. package/dist/partials.js +101 -39
  40. package/dist/partials.min.js +1 -1
  41. package/dist/sass.js +7 -4
  42. package/dist/sass.min.js +1 -1
  43. package/dist/test-helpers/setUp.js +50 -47
  44. package/dist/testFull.js +12 -7
  45. package/dist/testFull.min.js +1 -1
  46. package/dist/testHelpers.js +9 -13
  47. package/dist/testHelpers.min.js +1 -1
  48. package/dist/testQuick.js +12 -7
  49. package/dist/testQuick.min.js +1 -1
  50. package/dist/typeScript.js +6 -4
  51. package/dist/typeScript.min.js +1 -1
  52. package/dist/utilities/dotGet.js +14 -12
  53. package/dist/utilities/dotNotate.js +10 -8
  54. package/dist/utilities/dotSet.js +13 -11
  55. package/dist/utilities/isObject.js +5 -1
  56. package/dist/utilities/strAfter.js +11 -7
  57. package/dist/utilities/strBefore.js +11 -7
  58. package/dist/watchFull.js +7 -7
  59. package/dist/watchFull.min.js +1 -1
  60. package/dist/watchTest.js +13 -9
  61. package/dist/watchTest.min.js +1 -1
  62. package/functions/{build.js → build.mjs} +14 -16
  63. package/functions/{build.test.js → build.test.mjs} +9 -8
  64. package/functions/{bundle.js → bundle.mjs} +5 -7
  65. package/functions/{bundle.test.js → bundle.test.mjs} +5 -4
  66. package/functions/{bundleLint.js → bundleLint.mjs} +4 -6
  67. package/functions/{bundleLint.test.js → bundleLint.test.mjs} +5 -4
  68. package/functions/bundleMinify.mjs +9 -0
  69. package/functions/bundleMinify.test.mjs +15 -0
  70. package/functions/compileReadme.mjs +9 -0
  71. package/functions/{compileReadme.test.js → compileReadme.test.mjs} +4 -4
  72. package/functions/copyFonts.mjs +9 -0
  73. package/functions/{copyFonts.test.js → copyFonts.test.mjs} +4 -3
  74. package/functions/default.mjs +12 -0
  75. package/functions/{default.test.js → default.test.mjs} +8 -7
  76. package/functions/{dist.js → dist.mjs} +2 -4
  77. package/functions/{dist.test.js → dist.test.mjs} +4 -3
  78. package/functions/{distLint.js → distLint.mjs} +4 -6
  79. package/functions/{distLint.test.js → distLint.test.mjs} +5 -4
  80. package/functions/distMinify.mjs +9 -0
  81. package/functions/distMinify.test.mjs +15 -0
  82. package/functions/{images.js → images.mjs} +2 -4
  83. package/functions/{images.test.js → images.test.mjs} +4 -3
  84. package/functions/partials/{addToReadme.js → addToReadme.mjs} +5 -7
  85. package/functions/partials/{addToReadme.test.js → addToReadme.test.mjs} +4 -3
  86. package/functions/partials/beginWatcher.mjs +9 -0
  87. package/functions/partials/{beginWatcher.test.js → beginWatcher.test.mjs} +4 -3
  88. package/functions/partials/clean.mjs +13 -0
  89. package/functions/partials/{clean.test.js → clean.test.mjs} +4 -3
  90. package/functions/partials/{copyFor.js → copyFor.mjs} +2 -4
  91. package/functions/partials/{copyFor.test.js → copyFor.test.mjs} +4 -3
  92. package/functions/partials/distFor.mjs +22 -0
  93. package/functions/partials/{distFor.test.js → distFor.test.mjs} +49 -8
  94. package/functions/partials/{distForSrc.js → distForSrc.mjs} +2 -4
  95. package/functions/partials/{distForSrc.test.js → distForSrc.test.mjs} +3 -2
  96. package/functions/partials/{distSeries.js → distSeries.mjs} +6 -8
  97. package/functions/partials/{distSeries.test.js → distSeries.test.mjs} +7 -6
  98. package/functions/partials/{imagesFor.js → imagesFor.mjs} +5 -13
  99. package/functions/partials/{imagesFor.test.js → imagesFor.test.mjs} +4 -3
  100. package/functions/partials/minifyFor.mjs +15 -0
  101. package/functions/partials/{minifyFor.test.js → minifyFor.test.mjs} +5 -4
  102. package/functions/partials/readmeTemplate.mjs +12 -0
  103. package/functions/partials/{readmeTemplate.test.js → readmeTemplate.test.mjs} +4 -3
  104. package/functions/partials/{removeDirectory.js → removeDirectory.mjs} +2 -4
  105. package/functions/partials/{removeDirectory.test.js → removeDirectory.test.mjs} +28 -28
  106. package/functions/partials/{runOnChange.js → runOnChange.mjs} +6 -8
  107. package/functions/partials/{runOnChange.test.js → runOnChange.test.mjs} +12 -11
  108. package/functions/partials/sassFor.mjs +22 -0
  109. package/functions/partials/{sassFor.test.js → sassFor.test.mjs} +5 -4
  110. package/functions/partials/{tsFor.js → tsFor.mjs} +4 -6
  111. package/functions/partials/{tsFor.test.js → tsFor.test.mjs} +5 -4
  112. package/functions/partials.mjs +23 -0
  113. package/functions/{partials.test.js → partials.test.mjs} +1 -1
  114. package/functions/sass.mjs +4 -0
  115. package/functions/{sass.test.js → sass.test.mjs} +4 -3
  116. package/functions/test-helpers/{setUp.js → setUp.mjs} +25 -27
  117. package/functions/test-helpers/setUp.test.mjs +19 -0
  118. package/functions/{testFull.js → testFull.mjs} +4 -6
  119. package/functions/testFull.test.mjs +17 -0
  120. package/functions/{testHelpers.js → testHelpers.mjs} +1 -6
  121. package/functions/testHelpers.test.mjs +7 -0
  122. package/functions/{testQuick.js → testQuick.mjs} +4 -6
  123. package/functions/testQuick.test.mjs +17 -0
  124. package/functions/{typeScript.js → typeScript.mjs} +2 -4
  125. package/functions/typeScript.test.mjs +11 -0
  126. package/functions/utilities/{dotGet.js → dotGet.mjs} +4 -6
  127. package/functions/utilities/{dotNotate.js → dotNotate.mjs} +2 -4
  128. package/functions/utilities/{dotSet.js → dotSet.mjs} +4 -6
  129. package/functions/utilities/{isObject.js → isObject.mjs} +1 -3
  130. package/functions/utilities/{strAfter.js → strAfter.mjs} +11 -13
  131. package/functions/utilities/{strBefore.js → strBefore.mjs} +11 -13
  132. package/functions/{watchFull.js → watchFull.mjs} +2 -4
  133. package/functions/{watchFull.test.js → watchFull.test.mjs} +8 -7
  134. package/functions/watchTest.mjs +10 -0
  135. package/functions/{watchTest.test.js → watchTest.test.mjs} +7 -6
  136. package/gulp.config.js +20 -19
  137. package/gulp.config.mjs +252 -0
  138. package/gulpfile.base.js +20 -20
  139. package/gulpfile.base.mjs +27 -0
  140. package/package.json +27 -13
  141. package/functions/bundleMinify.js +0 -11
  142. package/functions/bundleMinify.test.js +0 -14
  143. package/functions/compileReadme.js +0 -11
  144. package/functions/copyFonts.js +0 -11
  145. package/functions/default.js +0 -14
  146. package/functions/distMinify.js +0 -11
  147. package/functions/distMinify.test.js +0 -14
  148. package/functions/partials/beginWatcher.js +0 -11
  149. package/functions/partials/clean.js +0 -15
  150. package/functions/partials/distFor.js +0 -17
  151. package/functions/partials/minifyFor.js +0 -15
  152. package/functions/partials/readmeTemplate.js +0 -14
  153. package/functions/partials/sassFor.js +0 -21
  154. package/functions/partials.js +0 -40
  155. package/functions/sass.js +0 -6
  156. package/functions/test-helpers/setUp.test.js +0 -18
  157. package/functions/testFull.test.js +0 -16
  158. package/functions/testHelpers.test.js +0 -7
  159. package/functions/testQuick.test.js +0 -16
  160. package/functions/typeScript.test.js +0 -10
  161. package/functions/watchTest.js +0 -12
  162. package/vendor/array-union/index.js +0 -31
  163. package/vendor/easy-transform-stream/index.js +0 -54
  164. package/vendor/globby/gitignore.js +0 -96
  165. package/vendor/globby/index.js +0 -191
  166. package/vendor/globby/node_modules/slash/index.js +0 -16
  167. package/vendor/globby/stream-utils.js +0 -58
  168. package/vendor/globby/to-path.js +0 -20
  169. package/vendor/gulp-imagemin/index.js +0 -124
  170. package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +0 -265
  171. package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +0 -36
  172. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
  173. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
  174. package/vendor/gulp-plugin-extras/index.js +0 -42
  175. package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +0 -265
  176. package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +0 -36
  177. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
  178. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
  179. package/vendor/gulp-plugin-extras/plugin-error.js +0 -145
  180. package/vendor/ignore/index.js +0 -468
  181. package/vendor/imagemin/index.js +0 -90
  182. package/vendor/imagemin-gifsicle/index.js +0 -33
  183. package/vendor/imagemin-mozjpeg/index.js +0 -100
  184. package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +0 -260
  185. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +0 -47
  186. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +0 -102
  187. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +0 -123
  188. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +0 -47
  189. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +0 -50
  190. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +0 -124
  191. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +0 -238
  192. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +0 -89
  193. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +0 -24
  194. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +0 -44
  195. package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +0 -25
  196. package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +0 -70
  197. package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +0 -52
  198. package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +0 -43
  199. package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +0 -20
  200. package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +0 -17
  201. package/vendor/imagemin-optipng/index.js +0 -44
  202. package/vendor/imagemin-svgo/index.js +0 -27
  203. package/vendor/is-jpg/index.js +0 -12
  204. package/vendor/junk/index.js +0 -49
  205. package/vendor/mozjpeg/index.js +0 -9
  206. package/vendor/mozjpeg/lib/index.js +0 -18
  207. package/vendor/mozjpeg/package.json +0 -49
  208. package/vendor/mozjpeg/vendor/cjpeg +0 -0
  209. package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
  210. package/vendor/p-pipe/index.js +0 -22
  211. package/vendor/plur/index.js +0 -32
  212. package/vendor/pretty-bytes/index.js +0 -71
  213. package/vendor/slash/index.js +0 -12
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = slash;
7
- require("core-js/modules/es.string.replace.js");
8
- function slash(path) {
9
- const isExtendedLengthPath = /^\\\\\?\\/.test(path);
10
- const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
11
-
12
- if (isExtendedLengthPath || hasNonAscii) {
13
- return path;
14
- }
15
- return path.replace(/\\/g, '/');
16
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UniqueStream = exports.FilterStream = void 0;
7
- require("core-js/modules/esnext.set.add-all.js");
8
- require("core-js/modules/esnext.set.delete-all.js");
9
- require("core-js/modules/esnext.set.difference.js");
10
- require("core-js/modules/esnext.set.every.js");
11
- require("core-js/modules/esnext.set.filter.js");
12
- require("core-js/modules/esnext.set.find.js");
13
- require("core-js/modules/esnext.set.intersection.js");
14
- require("core-js/modules/esnext.set.is-disjoint-from.js");
15
- require("core-js/modules/esnext.set.is-subset-of.js");
16
- require("core-js/modules/esnext.set.is-superset-of.js");
17
- require("core-js/modules/esnext.set.join.js");
18
- require("core-js/modules/esnext.set.map.js");
19
- require("core-js/modules/esnext.set.reduce.js");
20
- require("core-js/modules/esnext.set.some.js");
21
- require("core-js/modules/esnext.set.symmetric-difference.js");
22
- require("core-js/modules/esnext.set.union.js");
23
- require("core-js/modules/web.dom-collections.iterator.js");
24
- var _nodeStream = require("node:stream");
25
- class ObjectTransform extends _nodeStream.Transform {
26
- constructor() {
27
- super({
28
- objectMode: true
29
- });
30
- }
31
- }
32
- class FilterStream extends ObjectTransform {
33
- constructor(filter) {
34
- super();
35
- this._filter = filter;
36
- }
37
- _transform(data, encoding, callback) {
38
- if (this._filter(data)) {
39
- this.push(data);
40
- }
41
- callback();
42
- }
43
- }
44
- exports.FilterStream = FilterStream;
45
- class UniqueStream extends ObjectTransform {
46
- constructor() {
47
- super();
48
- this._pushed = new Set();
49
- }
50
- _transform(data, encoding, callback) {
51
- if (!this._pushed.has(data)) {
52
- this.push(data);
53
- this._pushed.add(data);
54
- }
55
- callback();
56
- }
57
- }
58
- exports.UniqueStream = UniqueStream;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("core-js/modules/web.dom-collections.iterator.js");
8
- require("core-js/modules/web.url.js");
9
- require("core-js/modules/web.url-search-params.js");
10
- var _nodeUrl = require("node:url");
11
- const toPath = urlOrPath => {
12
- if (!urlOrPath) {
13
- return urlOrPath;
14
- }
15
- if (urlOrPath instanceof URL) {
16
- urlOrPath = urlOrPath.href;
17
- }
18
- return urlOrPath.startsWith('file://') ? (0, _nodeUrl.fileURLToPath)(urlOrPath) : urlOrPath;
19
- };
20
- var _default = exports.default = toPath;
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = gulpImagemin;
7
- exports.svgo = exports.optipng = exports.mozjpeg = exports.gifsicle = void 0;
8
- require("core-js/modules/es.array.unscopables.flat-map.js");
9
- require("core-js/modules/es.string.replace.js");
10
- require("core-js/modules/esnext.set.add-all.js");
11
- require("core-js/modules/esnext.set.delete-all.js");
12
- require("core-js/modules/esnext.set.difference.js");
13
- require("core-js/modules/esnext.set.every.js");
14
- require("core-js/modules/esnext.set.filter.js");
15
- require("core-js/modules/esnext.set.find.js");
16
- require("core-js/modules/esnext.set.intersection.js");
17
- require("core-js/modules/esnext.set.is-disjoint-from.js");
18
- require("core-js/modules/esnext.set.is-subset-of.js");
19
- require("core-js/modules/esnext.set.is-superset-of.js");
20
- require("core-js/modules/esnext.set.join.js");
21
- require("core-js/modules/esnext.set.map.js");
22
- require("core-js/modules/esnext.set.reduce.js");
23
- require("core-js/modules/esnext.set.some.js");
24
- require("core-js/modules/esnext.set.symmetric-difference.js");
25
- require("core-js/modules/esnext.set.union.js");
26
- require("core-js/modules/esnext.weak-map.delete-all.js");
27
- require("core-js/modules/web.dom-collections.iterator.js");
28
- var _nodePath = _interopRequireDefault(require("node:path"));
29
- var _nodeProcess = _interopRequireDefault(require("node:process"));
30
- var _index = _interopRequireDefault(require("../pretty-bytes/index.js"));
31
- var _index2 = _interopRequireDefault(require("./node_modules/chalk/source/index.js"));
32
- var _index3 = _interopRequireDefault(require("../imagemin/index.js"));
33
- var _index4 = _interopRequireDefault(require("../plur/index.js"));
34
- var _index5 = require("../gulp-plugin-extras/index.js");
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
37
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
38
- const PLUGIN_NAME = 'gulp-imagemin';
39
- const defaultPlugins = ['gifsicle', 'mozjpeg', 'optipng', 'svgo'];
40
- const loadPlugin = async function (pluginName) {
41
- try {
42
- const {
43
- default: plugin
44
- } = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))("../imagemin-".concat(pluginName, "/index.js"));
45
- for (var _len = arguments.length, arguments_ = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
46
- arguments_[_key - 1] = arguments[_key];
47
- }
48
- return plugin(...arguments_);
49
- } catch (error) {
50
- console.log('er', error);
51
- console.log("".concat(PLUGIN_NAME, ": Could not load default plugin `").concat(pluginName, "`"));
52
- }
53
- };
54
- const exposePlugin = async plugin => function () {
55
- for (var _len2 = arguments.length, arguments_ = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
56
- arguments_[_key2] = arguments[_key2];
57
- }
58
- return loadPlugin(plugin, ...arguments_);
59
- };
60
- const getDefaultPlugins = async () => Promise.all(defaultPlugins.flatMap(plugin => loadPlugin(plugin)));
61
- function gulpImagemin(plugins, options) {
62
- if (typeof plugins === 'object' && !Array.isArray(plugins)) {
63
- options = plugins;
64
- plugins = undefined;
65
- }
66
- options = {
67
- // TODO: Remove this when Gulp gets a real logger with levels
68
- silent: _nodeProcess.default.argv.includes('--silent'),
69
- verbose: _nodeProcess.default.argv.includes('--verbose'),
70
- ...options
71
- };
72
- const validExtensions = new Set(['.jpg', '.jpeg', '.png', '.gif', '.svg']);
73
- let totalBytes = 0;
74
- let totalSavedBytes = 0;
75
- let totalFiles = 0;
76
- return (0, _index5.gulpPlugin)('gulp-imagemin', async file => {
77
- var _plugins;
78
- if (!validExtensions.has(_nodePath.default.extname(file.path).toLowerCase())) {
79
- if (options.verbose) {
80
- console.log("".concat(PLUGIN_NAME, ": Skipping unsupported image ").concat(_index2.default.blue(file.relative)));
81
- }
82
- return file;
83
- }
84
- if (Array.isArray(plugins)) {
85
- plugins = await Promise.all(plugins);
86
- }
87
- const localPlugins = (_plugins = plugins) !== null && _plugins !== void 0 ? _plugins : await getDefaultPlugins();
88
- const data = await _index3.default.buffer(file.contents, {
89
- plugins: localPlugins
90
- });
91
- const originalSize = file.contents.length;
92
- const optimizedSize = data.length;
93
- const saved = originalSize - optimizedSize;
94
- const percent = originalSize > 0 ? saved / originalSize * 100 : 0;
95
- const savedMessage = "saved ".concat((0, _index.default)(saved), " - ").concat(percent.toFixed(1).replace(/\.0$/, ''), "%");
96
- const message = saved > 0 ? savedMessage : 'already optimized';
97
- if (saved > 0) {
98
- totalBytes += originalSize;
99
- totalSavedBytes += saved;
100
- totalFiles++;
101
- }
102
- if (options.verbose) {
103
- console.log("".concat(PLUGIN_NAME, ":"), _index2.default.green('✔ ') + file.relative + _index2.default.gray(" (".concat(message, ")")));
104
- }
105
- file.contents = data;
106
- return file;
107
- }, {
108
- async *onFinish() {
109
- // eslint-disable-line require-yield
110
- if (!options.silent) {
111
- const percent = totalBytes > 0 ? totalSavedBytes / totalBytes * 100 : 0;
112
- let message = "Minified ".concat(totalFiles, " ").concat((0, _index4.default)('image', totalFiles));
113
- if (totalFiles > 0) {
114
- message += _index2.default.gray(" (saved ".concat((0, _index.default)(totalSavedBytes), " - ").concat(percent.toFixed(1).replace(/\.0$/, ''), "%)"));
115
- }
116
- console.log("".concat(PLUGIN_NAME, ":"), message);
117
- }
118
- }
119
- });
120
- }
121
- const gifsicle = exports.gifsicle = exposePlugin('gifsicle');
122
- const mozjpeg = exports.mozjpeg = exposePlugin('mozjpeg');
123
- const optipng = exports.optipng = exposePlugin('optipng');
124
- const svgo = exports.svgo = exposePlugin('svgo');
@@ -1,265 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/esnext.weak-map.delete-all.js");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Chalk = void 0;
8
- Object.defineProperty(exports, "backgroundColorNames", {
9
- enumerable: true,
10
- get: function () {
11
- return _index.backgroundColorNames;
12
- }
13
- });
14
- Object.defineProperty(exports, "backgroundColors", {
15
- enumerable: true,
16
- get: function () {
17
- return _index.backgroundColorNames;
18
- }
19
- });
20
- exports.chalkStderr = void 0;
21
- Object.defineProperty(exports, "colorNames", {
22
- enumerable: true,
23
- get: function () {
24
- return _index.colorNames;
25
- }
26
- });
27
- Object.defineProperty(exports, "colors", {
28
- enumerable: true,
29
- get: function () {
30
- return _index.colorNames;
31
- }
32
- });
33
- exports.default = void 0;
34
- Object.defineProperty(exports, "foregroundColorNames", {
35
- enumerable: true,
36
- get: function () {
37
- return _index.foregroundColorNames;
38
- }
39
- });
40
- Object.defineProperty(exports, "foregroundColors", {
41
- enumerable: true,
42
- get: function () {
43
- return _index.foregroundColorNames;
44
- }
45
- });
46
- Object.defineProperty(exports, "modifierNames", {
47
- enumerable: true,
48
- get: function () {
49
- return _index.modifierNames;
50
- }
51
- });
52
- Object.defineProperty(exports, "modifiers", {
53
- enumerable: true,
54
- get: function () {
55
- return _index.modifierNames;
56
- }
57
- });
58
- exports.supportsColorStderr = exports.supportsColor = void 0;
59
- require("core-js/modules/web.dom-collections.iterator.js");
60
- var _index = _interopRequireWildcard(require("./vendor/ansi-styles/index.js"));
61
- var _index2 = _interopRequireDefault(require("./vendor/supports-color/index.js"));
62
- var _utilities = require("./utilities.js");
63
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
64
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
65
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
66
- const {
67
- stdout: stdoutColor,
68
- stderr: stderrColor
69
- } = _index2.default;
70
- exports.supportsColorStderr = stderrColor;
71
- exports.supportsColor = stdoutColor;
72
- const GENERATOR = Symbol('GENERATOR');
73
- const STYLER = Symbol('STYLER');
74
- const IS_EMPTY = Symbol('IS_EMPTY');
75
-
76
- // `supportsColor.level` → `ansiStyles.color[name]` mapping
77
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
78
- const styles = Object.create(null);
79
- const applyOptions = function (object) {
80
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
81
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
82
- throw new Error('The `level` option should be an integer from 0 to 3');
83
- }
84
-
85
- // Detect level if not set manually
86
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
87
- object.level = options.level === undefined ? colorLevel : options.level;
88
- };
89
- class Chalk {
90
- constructor(options) {
91
- // eslint-disable-next-line no-constructor-return
92
- return chalkFactory(options);
93
- }
94
- }
95
- exports.Chalk = Chalk;
96
- const chalkFactory = options => {
97
- const chalk = function () {
98
- for (var _len = arguments.length, strings = new Array(_len), _key = 0; _key < _len; _key++) {
99
- strings[_key] = arguments[_key];
100
- }
101
- return strings.join(' ');
102
- };
103
- applyOptions(chalk, options);
104
- Object.setPrototypeOf(chalk, createChalk.prototype);
105
- return chalk;
106
- };
107
- function createChalk(options) {
108
- return chalkFactory(options);
109
- }
110
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
111
- for (const [styleName, style] of Object.entries(_index.default)) {
112
- styles[styleName] = {
113
- get() {
114
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
115
- Object.defineProperty(this, styleName, {
116
- value: builder
117
- });
118
- return builder;
119
- }
120
- };
121
- }
122
- styles.visible = {
123
- get() {
124
- const builder = createBuilder(this, this[STYLER], true);
125
- Object.defineProperty(this, 'visible', {
126
- value: builder
127
- });
128
- return builder;
129
- }
130
- };
131
- const getModelAnsi = function (model, level, type) {
132
- for (var _len2 = arguments.length, arguments_ = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
133
- arguments_[_key2 - 3] = arguments[_key2];
134
- }
135
- if (model === 'rgb') {
136
- if (level === 'ansi16m') {
137
- return _index.default[type].ansi16m(...arguments_);
138
- }
139
- if (level === 'ansi256') {
140
- return _index.default[type].ansi256(_index.default.rgbToAnsi256(...arguments_));
141
- }
142
- return _index.default[type].ansi(_index.default.rgbToAnsi(...arguments_));
143
- }
144
- if (model === 'hex') {
145
- return getModelAnsi('rgb', level, type, ..._index.default.hexToRgb(...arguments_));
146
- }
147
- return _index.default[type][model](...arguments_);
148
- };
149
- const usedModels = ['rgb', 'hex', 'ansi256'];
150
- for (const model of usedModels) {
151
- styles[model] = {
152
- get() {
153
- const {
154
- level
155
- } = this;
156
- return function () {
157
- for (var _len3 = arguments.length, arguments_ = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
158
- arguments_[_key3] = arguments[_key3];
159
- }
160
- const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), _index.default.color.close, this[STYLER]);
161
- return createBuilder(this, styler, this[IS_EMPTY]);
162
- };
163
- }
164
- };
165
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
166
- styles[bgModel] = {
167
- get() {
168
- const {
169
- level
170
- } = this;
171
- return function () {
172
- for (var _len4 = arguments.length, arguments_ = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
173
- arguments_[_key4] = arguments[_key4];
174
- }
175
- const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), _index.default.bgColor.close, this[STYLER]);
176
- return createBuilder(this, styler, this[IS_EMPTY]);
177
- };
178
- }
179
- };
180
- }
181
- const proto = Object.defineProperties(() => {}, {
182
- ...styles,
183
- level: {
184
- enumerable: true,
185
- get() {
186
- return this[GENERATOR].level;
187
- },
188
- set(level) {
189
- this[GENERATOR].level = level;
190
- }
191
- }
192
- });
193
- const createStyler = (open, close, parent) => {
194
- let openAll;
195
- let closeAll;
196
- if (parent === undefined) {
197
- openAll = open;
198
- closeAll = close;
199
- } else {
200
- openAll = parent.openAll + open;
201
- closeAll = close + parent.closeAll;
202
- }
203
- return {
204
- open,
205
- close,
206
- openAll,
207
- closeAll,
208
- parent
209
- };
210
- };
211
- const createBuilder = (self, _styler, _isEmpty) => {
212
- // Single argument is hot path, implicit coercion is faster than anything
213
- // eslint-disable-next-line no-implicit-coercion
214
- const builder = function () {
215
- for (var _len5 = arguments.length, arguments_ = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
216
- arguments_[_key5] = arguments[_key5];
217
- }
218
- return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
219
- };
220
-
221
- // We alter the prototype because we must return a function, but there is
222
- // no way to create a function with a different prototype
223
- Object.setPrototypeOf(builder, proto);
224
- builder[GENERATOR] = self;
225
- builder[STYLER] = _styler;
226
- builder[IS_EMPTY] = _isEmpty;
227
- return builder;
228
- };
229
- const applyStyle = (self, string) => {
230
- if (self.level <= 0 || !string) {
231
- return self[IS_EMPTY] ? '' : string;
232
- }
233
- let styler = self[STYLER];
234
- if (styler === undefined) {
235
- return string;
236
- }
237
- const {
238
- openAll,
239
- closeAll
240
- } = styler;
241
- if (string.includes('\u001B')) {
242
- while (styler !== undefined) {
243
- // Replace any instances already present with a re-opening code
244
- // otherwise only the part of the string until said closing code
245
- // will be colored, and the rest will simply be 'plain'.
246
- string = (0, _utilities.stringReplaceAll)(string, styler.close, styler.open);
247
- styler = styler.parent;
248
- }
249
- }
250
-
251
- // We can move both next actions out of loop, because remaining actions in loop won't have
252
- // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
253
- // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
254
- const lfIndex = string.indexOf('\n');
255
- if (lfIndex !== -1) {
256
- string = (0, _utilities.stringEncaseCRLFWithFirstIndex)(string, closeAll, openAll, lfIndex);
257
- }
258
- return openAll + string + closeAll;
259
- };
260
- Object.defineProperties(createChalk.prototype, styles);
261
- const chalk = createChalk();
262
- const chalkStderr = exports.chalkStderr = createChalk({
263
- level: stderrColor ? stderrColor.level : 0
264
- });
265
- var _default = exports.default = chalk;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.stringEncaseCRLFWithFirstIndex = stringEncaseCRLFWithFirstIndex;
7
- exports.stringReplaceAll = stringReplaceAll;
8
- // TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
9
- function stringReplaceAll(string, substring, replacer) {
10
- let index = string.indexOf(substring);
11
- if (index === -1) {
12
- return string;
13
- }
14
- const substringLength = substring.length;
15
- let endIndex = 0;
16
- let returnValue = '';
17
- do {
18
- returnValue += string.slice(endIndex, index) + substring + replacer;
19
- endIndex = index + substringLength;
20
- index = string.indexOf(substring, endIndex);
21
- } while (index !== -1);
22
- returnValue += string.slice(endIndex);
23
- return returnValue;
24
- }
25
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
26
- let endIndex = 0;
27
- let returnValue = '';
28
- do {
29
- const gotCR = string[index - 1] === '\r';
30
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
31
- endIndex = index + 1;
32
- index = string.indexOf('\n', endIndex);
33
- } while (index !== -1);
34
- returnValue += string.slice(endIndex);
35
- return returnValue;
36
- }