js-build-tools 3.0.0 → 3.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 (63) hide show
  1. package/dist/build.js +59 -59
  2. package/dist/bundle.js +12 -12
  3. package/dist/bundleLint.js +17 -17
  4. package/dist/bundleMinify.js +8 -8
  5. package/dist/copyFonts.js +8 -8
  6. package/dist/default.js +15 -15
  7. package/dist/distLint.js +17 -17
  8. package/dist/distMinify.js +8 -8
  9. package/dist/partials/addToReadme.js +13 -13
  10. package/dist/partials/beginWatcher.js +9 -9
  11. package/dist/partials/distFor.js +16 -16
  12. package/dist/partials/distForSrc.js +9 -9
  13. package/dist/partials/distSeries.js +19 -19
  14. package/dist/partials/imagesFor.js +27 -27
  15. package/dist/partials/readmeTemplate.js +11 -11
  16. package/dist/partials/runOnChange.js +27 -27
  17. package/dist/partials/sassFor.js +20 -20
  18. package/dist/partials/tsFor.js +20 -20
  19. package/dist/partials.js +34 -34
  20. package/dist/test-helpers/setUp.js +51 -51
  21. package/dist/testFull.js +17 -17
  22. package/dist/testHelpers.js +8 -8
  23. package/dist/testQuick.js +19 -19
  24. package/dist/utilities/dotGet.js +42 -42
  25. package/dist/utilities/dotNotate.js +50 -50
  26. package/dist/utilities/dotSet.js +36 -36
  27. package/dist/utilities/isObject.js +4 -4
  28. package/dist/utilities/strAfter.js +14 -0
  29. package/dist/utilities/strBefore.js +14 -0
  30. package/dist/watchTest.js +13 -13
  31. package/functions/utilities/dotGet.js +2 -2
  32. package/functions/utilities/dotSet.js +2 -2
  33. package/functions/utilities/strAfter.js +13 -0
  34. package/functions/utilities/strBefore.js +13 -0
  35. package/package.json +3 -3
  36. package/vendor/array-union/index.js +30 -30
  37. package/vendor/easy-transform-stream/index.js +54 -58
  38. package/vendor/globby/gitignore.js +96 -100
  39. package/vendor/globby/index.js +191 -195
  40. package/vendor/globby/stream-utils.js +57 -57
  41. package/vendor/globby/to-path.js +19 -19
  42. package/vendor/gulp-plugin-extras/index.js +42 -46
  43. package/vendor/gulp-plugin-extras/plugin-error.js +144 -144
  44. package/vendor/ignore/index.js +467 -467
  45. package/vendor/imagemin/index.js +90 -94
  46. package/vendor/imagemin-gifsicle/index.js +33 -37
  47. package/vendor/imagemin-mozjpeg/index.js +100 -104
  48. package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +2 -6
  49. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +2 -2
  50. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +2 -6
  51. package/vendor/imagemin-optipng/index.js +43 -43
  52. package/vendor/imagemin-svgo/index.js +26 -26
  53. package/vendor/is-jpg/index.js +11 -11
  54. package/vendor/junk/index.js +48 -48
  55. package/vendor/mozjpeg/index.js +8 -8
  56. package/vendor/mozjpeg/lib/index.js +17 -17
  57. package/vendor/mozjpeg/package.json +49 -50
  58. package/vendor/mozjpeg/vendor/cjpeg +0 -0
  59. package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
  60. package/vendor/p-pipe/index.js +22 -26
  61. package/vendor/plur/index.js +31 -31
  62. package/vendor/pretty-bytes/index.js +70 -70
  63. package/vendor/slash/index.js +11 -11
@@ -1,42 +1,42 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.string.replace.js");
4
- require("core-js/modules/esnext.async-iterator.map.js");
5
- require("core-js/modules/esnext.iterator.map.js");
6
- const isObject = require('./isObject');
7
-
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.string.replace.js");
4
+ require("core-js/modules/esnext.async-iterator.map.js");
5
+ require("core-js/modules/esnext.iterator.map.js");
6
+ const isObject = require('./isObject');
7
+
8
8
  /**
9
9
  * Convert an array of keys into a regex, return a function to test if incoming keys match.
10
10
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
11
11
  * @returns {Function} The dot-notated array
12
- */
13
- const handleRetainObjects = function () {
14
- let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15
- if (!retainObjects.length) {
12
+ */
13
+ const handleRetainObjects = function () {
14
+ let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15
+ if (!retainObjects.length) {
16
16
  /**
17
17
  * Bypass the test function if there are no retainObjects.
18
18
  * @returns {false}
19
- */
20
- return (currentKey, value, results) => false;
21
- }
22
- retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
23
- const retainRegex = new RegExp("(".concat(retainObjects.join('|'), ")$"));
19
+ */
20
+ return (currentKey, value, results) => false;
21
+ }
22
+ retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
23
+ const retainRegex = new RegExp("(".concat(retainObjects.join('|'), ")$"));
24
24
  /**
25
25
  * Test if a key should be retained as an object.
26
26
  * @param {string} currentKey - The key to test
27
27
  * @param {*} value - The value of the key
28
28
  * @param {Object} results - The result object to add to
29
29
  * @returns {boolean}
30
- */
31
- return (currentKey, value, results) => {
32
- if (!currentKey.match(retainRegex)) {
33
- return false;
34
- }
35
- results[currentKey] = value;
36
- return true;
37
- };
38
- };
39
-
30
+ */
31
+ return (currentKey, value, results) => {
32
+ if (!currentKey.match(retainRegex)) {
33
+ return false;
34
+ }
35
+ results[currentKey] = value;
36
+ return true;
37
+ };
38
+ };
39
+
40
40
  /**
41
41
  * The underlying logic function for converting arrays to dot-notation.
42
42
  * @param {Object} arrayObject - The array or object to dot-notate
@@ -44,34 +44,34 @@ const handleRetainObjects = function () {
44
44
  * @param {string} [prepend=''] - The path for the property being processed
45
45
  * @param {Object<string, *>} [results={}] - The final notated object to return
46
46
  * @returns {Object<string, *>} The dot-notated object
47
- */
48
- const performDotNotate = function (arrayObject, didRetain) {
49
- let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
50
- let results = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
51
- for (let key in arrayObject) {
52
- const value = arrayObject[key];
53
- const currentKey = "".concat(prepend).concat(key);
54
- if (didRetain(currentKey, value, results)) {
55
- continue;
56
- }
57
- if (isObject(value)) {
58
- performDotNotate(value, didRetain, "".concat(currentKey, "."), results);
59
- continue;
60
- }
61
- results[currentKey] = value;
62
- }
63
- return results;
64
- };
65
-
47
+ */
48
+ const performDotNotate = function (arrayObject, didRetain) {
49
+ let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
50
+ let results = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
51
+ for (let key in arrayObject) {
52
+ const value = arrayObject[key];
53
+ const currentKey = "".concat(prepend).concat(key);
54
+ if (didRetain(currentKey, value, results)) {
55
+ continue;
56
+ }
57
+ if (isObject(value)) {
58
+ performDotNotate(value, didRetain, "".concat(currentKey, "."), results);
59
+ continue;
60
+ }
61
+ results[currentKey] = value;
62
+ }
63
+ return results;
64
+ };
65
+
66
66
  /**
67
67
  * Convert an array or object to a single dimensional associative array with dot notation.
68
68
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
69
69
  * @param {Object} arrayObject - The array or object to dot-notate
70
70
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
71
71
  * @returns {Object<string, *>} The dot-notated object
72
- */
73
- const dotNotate = function (arrayObject) {
74
- let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
75
- return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
76
- };
72
+ */
73
+ const dotNotate = function (arrayObject) {
74
+ let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
75
+ return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
76
+ };
77
77
  module.exports = dotNotate;
@@ -1,9 +1,9 @@
1
- "use strict";
2
-
3
- const isObject = require('./isObject');
4
- const strAfter = require('common-exports/dist/utilities/strAfter').default;
5
- const strBefore = require('common-exports/dist/utilities/strBefore').default;
6
-
1
+ "use strict";
2
+
3
+ const isObject = require('./isObject');
4
+ const strAfter = require('./strAfter');
5
+ const strBefore = require('./strBefore');
6
+
7
7
  /**
8
8
  * Set a nested property value an object.
9
9
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotSet.ts Sí, funciona}
@@ -11,34 +11,34 @@ const strBefore = require('common-exports/dist/utilities/strBefore').default;
11
11
  * @param {string} dotNotation - The path for the property
12
12
  * @param {*} value - The default value to return if the property is not found
13
13
  * @returns {Object} The modified object
14
- */
15
- const dotSet = function (arrayObject, dotNotation) {
16
- var _arrayObject$key;
17
- let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
18
- let key = strBefore(dotNotation, '.');
19
- const lastKey = !key;
20
- if (lastKey) {
21
- key = dotNotation;
22
- }
23
- if (key === '*') {
24
- for (let wildKey in arrayObject) {
25
- if (lastKey) {
26
- arrayObject[wildKey] = value;
27
- continue;
28
- }
29
- if (!isObject(arrayObject[wildKey])) {
30
- continue;
31
- }
32
- dotSet(arrayObject[wildKey], strAfter(dotNotation, '.'), value);
33
- }
34
- return arrayObject;
35
- }
36
- if (lastKey) {
37
- arrayObject[dotNotation] = value;
38
- return arrayObject;
39
- }
40
- const next = (_arrayObject$key = arrayObject[key]) !== null && _arrayObject$key !== void 0 ? _arrayObject$key : [];
41
- arrayObject[key] = dotSet(next, strAfter(dotNotation, '.'), value);
42
- return arrayObject;
43
- };
14
+ */
15
+ const dotSet = function (arrayObject, dotNotation) {
16
+ var _arrayObject$key;
17
+ let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
18
+ let key = strBefore(dotNotation, '.');
19
+ const lastKey = !key;
20
+ if (lastKey) {
21
+ key = dotNotation;
22
+ }
23
+ if (key === '*') {
24
+ for (let wildKey in arrayObject) {
25
+ if (lastKey) {
26
+ arrayObject[wildKey] = value;
27
+ continue;
28
+ }
29
+ if (!isObject(arrayObject[wildKey])) {
30
+ continue;
31
+ }
32
+ dotSet(arrayObject[wildKey], strAfter(dotNotation, '.'), value);
33
+ }
34
+ return arrayObject;
35
+ }
36
+ if (lastKey) {
37
+ arrayObject[dotNotation] = value;
38
+ return arrayObject;
39
+ }
40
+ const next = (_arrayObject$key = arrayObject[key]) !== null && _arrayObject$key !== void 0 ? _arrayObject$key : [];
41
+ arrayObject[key] = dotSet(next, strAfter(dotNotation, '.'), value);
42
+ return arrayObject;
43
+ };
44
44
  module.exports = dotSet;
@@ -1,10 +1,10 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Check if the provided thing is an object / array.
5
5
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/isObject.ts Sí, funciona}
6
6
  * @param {*} object
7
7
  * @returns {boolean}
8
- */
9
- const isObject = object => typeof object === 'object' && object !== null;
8
+ */
9
+ const isObject = object => typeof object === 'object' && object !== null;
10
10
  module.exports = isObject;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Retrieve the string part after the search match.
5
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
6
+ * @param {string} str
7
+ * @param {string} search
8
+ * @returns {string}
9
+ */
10
+ const strAfter = (str, search) => {
11
+ const index = str.indexOf(search);
12
+ return index === -1 ? '' : str.substring(index + search.length);
13
+ };
14
+ module.exports = strAfter;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Retrieve the string part before the search match.
5
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
6
+ * @param {string} str
7
+ * @param {string} search
8
+ * @returns {string}
9
+ */
10
+ const strBefore = (str, search) => {
11
+ const index = str.indexOf(search);
12
+ return index === -1 ? '' : str.slice(0, index);
13
+ };
14
+ module.exports = strBefore;
package/dist/watchTest.js CHANGED
@@ -1,17 +1,17 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- watch
6
- } = require('gulp')
7
- const testQuick = require('./testQuick')
8
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ watch
6
+ } = require('gulp')
7
+ const testQuick = require('./testQuick')
8
+
9
9
  /**
10
10
  * Watch for changes and run the tests.
11
11
  * @memberOf module:js-build-tools
12
12
  * @returns {*}
13
- */
14
- const watchTest = () => watch(gulpConfig.get('test.watch'), {
15
- ignoreInitial: false
16
- }, testQuick)
17
- module.exports = watchTest
13
+ */
14
+ const watchTest = () => watch(gulpConfig.get('test.watch'), {
15
+ ignoreInitial: false
16
+ }, testQuick)
17
+ module.exports = watchTest
@@ -1,6 +1,6 @@
1
1
  const isObject = require('./isObject')
2
- const strAfter = require('common-exports/dist/utilities/strAfter').default
3
- const strBefore = require('common-exports/dist/utilities/strBefore').default
2
+ const strAfter = require('./strAfter')
3
+ const strBefore = require('./strBefore')
4
4
 
5
5
  /**
6
6
  * Get a nested property value from an object.
@@ -1,6 +1,6 @@
1
1
  const isObject = require('./isObject')
2
- const strAfter = require('common-exports/dist/utilities/strAfter').default
3
- const strBefore = require('common-exports/dist/utilities/strBefore').default
2
+ const strAfter = require('./strAfter')
3
+ const strBefore = require('./strBefore')
4
4
 
5
5
  /**
6
6
  * Set a nested property value an object.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Retrieve the string part after the search match.
3
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
4
+ * @param {string} str
5
+ * @param {string} search
6
+ * @returns {string}
7
+ */
8
+ const strAfter = (str, search) => {
9
+ const index = str.indexOf(search)
10
+ return index === -1 ? '' : str.substring(index + search.length)
11
+ }
12
+
13
+ module.exports = strAfter
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Retrieve the string part before the search match.
3
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
4
+ * @param {string} str
5
+ * @param {string} search
6
+ * @returns {string}
7
+ */
8
+ const strBefore = (str, search) => {
9
+ const index = str.indexOf(search)
10
+ return index === -1 ? '' : str.slice(0, index)
11
+ }
12
+
13
+ module.exports = strBefore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-build-tools",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Standardised build process with gulp.",
5
5
  "main": "gulpfile.base.js",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "@babel/runtime-corejs3": "^7.23.9",
40
40
  "babel-jest": "^29.7.0",
41
41
  "browserify": "^17.0.0",
42
- "common-exports": "^1.0.1",
42
+ "common-exports": "^1.1.0",
43
43
  "core-js": "^3.35.1",
44
44
  "fs": "^0.0.1-security",
45
45
  "glob": "^10.3.10",
@@ -58,7 +58,7 @@
58
58
  "jsdoc-to-markdown": "^8.0.1",
59
59
  "regenerator-runtime": "^0.14.1",
60
60
  "sass": "^1.70.0",
61
- "test-filesystem": "^1.2.0",
61
+ "test-filesystem": "^1.3.1",
62
62
  "vinyl-source-stream": "^2.0.0"
63
63
  },
64
64
  "files": [
@@ -1,31 +1,31 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("core-js/modules/es.array.unscopables.flat.js");
8
- require("core-js/modules/esnext.set.add-all.js");
9
- require("core-js/modules/esnext.set.delete-all.js");
10
- require("core-js/modules/esnext.set.difference.js");
11
- require("core-js/modules/esnext.set.every.js");
12
- require("core-js/modules/esnext.set.filter.js");
13
- require("core-js/modules/esnext.set.find.js");
14
- require("core-js/modules/esnext.set.intersection.js");
15
- require("core-js/modules/esnext.set.is-disjoint-from.js");
16
- require("core-js/modules/esnext.set.is-subset-of.js");
17
- require("core-js/modules/esnext.set.is-superset-of.js");
18
- require("core-js/modules/esnext.set.join.js");
19
- require("core-js/modules/esnext.set.map.js");
20
- require("core-js/modules/esnext.set.reduce.js");
21
- require("core-js/modules/esnext.set.some.js");
22
- require("core-js/modules/esnext.set.symmetric-difference.js");
23
- require("core-js/modules/esnext.set.union.js");
24
- require("core-js/modules/web.dom-collections.iterator.js");
25
- const arrayUnion = function () {
26
- for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
27
- arguments_[_key] = arguments[_key];
28
- }
29
- return [...new Set(arguments_.flat())];
30
- };
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.array.unscopables.flat.js");
8
+ require("core-js/modules/esnext.set.add-all.js");
9
+ require("core-js/modules/esnext.set.delete-all.js");
10
+ require("core-js/modules/esnext.set.difference.js");
11
+ require("core-js/modules/esnext.set.every.js");
12
+ require("core-js/modules/esnext.set.filter.js");
13
+ require("core-js/modules/esnext.set.find.js");
14
+ require("core-js/modules/esnext.set.intersection.js");
15
+ require("core-js/modules/esnext.set.is-disjoint-from.js");
16
+ require("core-js/modules/esnext.set.is-subset-of.js");
17
+ require("core-js/modules/esnext.set.is-superset-of.js");
18
+ require("core-js/modules/esnext.set.join.js");
19
+ require("core-js/modules/esnext.set.map.js");
20
+ require("core-js/modules/esnext.set.reduce.js");
21
+ require("core-js/modules/esnext.set.some.js");
22
+ require("core-js/modules/esnext.set.symmetric-difference.js");
23
+ require("core-js/modules/esnext.set.union.js");
24
+ require("core-js/modules/web.dom-collections.iterator.js");
25
+ const arrayUnion = function () {
26
+ for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ arguments_[_key] = arguments[_key];
28
+ }
29
+ return [...new Set(arguments_.flat())];
30
+ };
31
31
  var _default = exports.default = arrayUnion;
@@ -1,58 +1,54 @@
1
- async function exportEasyTransformStream () {
2
- "use strict";
3
-
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = transformStream;
8
- require("core-js/modules/web.dom-collections.iterator.js");
9
- var _nodeStream = require("node:stream");
10
- function transformStream() {
11
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- let transformer = arguments.length > 1 ? arguments[1] : undefined;
13
- let flusher = arguments.length > 2 ? arguments[2] : undefined;
14
- if (typeof options === 'function') {
15
- flusher = transformer;
16
- transformer = options;
17
- }
18
- return new _nodeStream.Transform({
19
- ...options,
20
- transform(chunk, encoding, callback) {
21
- (async () => {
22
- try {
23
- const value = await transformer(chunk, encoding, this);
24
-
25
- // If the callback throws, we don't want to cause an infinite recursion.
26
- try {
27
- callback(undefined, value);
28
- } catch {}
29
- } catch (error) {
30
- callback(error);
31
- }
32
- })();
33
- },
34
- flush(callback) {
35
- if (typeof flusher !== 'function') {
36
- callback();
37
- return;
38
- }
39
- (async () => {
40
- try {
41
- for await (const chunk of flusher(this)) {
42
- this.push(chunk);
43
- }
44
-
45
- // If the callback throws, we don't want to cause an infinite recursion.
46
- try {
47
- callback();
48
- } catch {}
49
- } catch (error) {
50
- callback(error);
51
- }
52
- })();
53
- }
54
- });
55
- }
56
- }
57
-
58
- exportEasyTransformStream()
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformStream;
7
+ require("core-js/modules/web.dom-collections.iterator.js");
8
+ var _nodeStream = require("node:stream");
9
+ function transformStream() {
10
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
+ let transformer = arguments.length > 1 ? arguments[1] : undefined;
12
+ let flusher = arguments.length > 2 ? arguments[2] : undefined;
13
+ if (typeof options === 'function') {
14
+ flusher = transformer;
15
+ transformer = options;
16
+ }
17
+ return new _nodeStream.Transform({
18
+ ...options,
19
+ transform(chunk, encoding, callback) {
20
+ (async () => {
21
+ try {
22
+ const value = await transformer(chunk, encoding, this);
23
+
24
+ // If the callback throws, we don't want to cause an infinite recursion.
25
+ try {
26
+ callback(undefined, value);
27
+ } catch {}
28
+ } catch (error) {
29
+ callback(error);
30
+ }
31
+ })();
32
+ },
33
+ flush(callback) {
34
+ if (typeof flusher !== 'function') {
35
+ callback();
36
+ return;
37
+ }
38
+ (async () => {
39
+ try {
40
+ for await (const chunk of flusher(this)) {
41
+ this.push(chunk);
42
+ }
43
+
44
+ // If the callback throws, we don't want to cause an infinite recursion.
45
+ try {
46
+ callback();
47
+ } catch {}
48
+ } catch (error) {
49
+ callback(error);
50
+ }
51
+ })();
52
+ }
53
+ });
54
+ }