js-build-tools 3.0.3 → 4.0.0

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 +431 -691
  2. package/babel.config.js +1 -1
  3. package/dist/build.js +58 -59
  4. package/dist/build.min.js +1 -1
  5. package/dist/bundle.js +17 -12
  6. package/dist/bundle.min.js +1 -1
  7. package/dist/bundleLint.js +21 -17
  8. package/dist/bundleLint.min.js +1 -1
  9. package/dist/bundleMinify.js +14 -8
  10. package/dist/bundleMinify.min.js +1 -1
  11. package/dist/compileReadme.js +10 -13
  12. package/dist/compileReadme.min.js +1 -1
  13. package/dist/copyFonts.js +14 -8
  14. package/dist/copyFonts.min.js +1 -1
  15. package/dist/default.js +19 -15
  16. package/dist/default.min.js +1 -1
  17. package/dist/dist.js +10 -7
  18. package/dist/dist.min.js +1 -1
  19. package/dist/distLint.js +21 -17
  20. package/dist/distLint.min.js +1 -1
  21. package/dist/distMinify.js +14 -8
  22. package/dist/distMinify.min.js +1 -1
  23. package/dist/images.js +10 -7
  24. package/dist/images.min.js +1 -1
  25. package/dist/partials/addToReadme.js +19 -14
  26. package/dist/partials/beginWatcher.js +14 -10
  27. package/dist/partials/clean.js +17 -11
  28. package/dist/partials/copyFor.js +10 -10
  29. package/dist/partials/distFor.js +27 -17
  30. package/dist/partials/distForSrc.js +16 -10
  31. package/dist/partials/distSeries.js +24 -20
  32. package/dist/partials/imagesFor.js +27 -28
  33. package/dist/partials/minifyFor.js +17 -16
  34. package/dist/partials/readmeTemplate.js +16 -12
  35. package/dist/partials/removeDirectory.js +12 -12
  36. package/dist/partials/runOnChange.js +30 -28
  37. package/dist/partials/sassFor.js +28 -21
  38. package/dist/partials/tsFor.js +24 -21
  39. package/dist/partials.js +103 -41
  40. package/dist/partials.min.js +1 -1
  41. package/dist/sass.js +10 -7
  42. package/dist/sass.min.js +1 -1
  43. package/dist/test-helpers/setUp.js +68 -65
  44. package/dist/testFull.js +22 -17
  45. package/dist/testFull.min.js +1 -1
  46. package/dist/testHelpers.js +11 -15
  47. package/dist/testHelpers.min.js +1 -1
  48. package/dist/testQuick.js +24 -19
  49. package/dist/testQuick.min.js +1 -1
  50. package/dist/typeScript.js +9 -7
  51. package/dist/typeScript.min.js +1 -1
  52. package/dist/utilities/dotGet.js +45 -43
  53. package/dist/utilities/dotNotate.js +53 -51
  54. package/dist/utilities/dotSet.js +39 -37
  55. package/dist/utilities/isObject.js +9 -5
  56. package/dist/utilities/strAfter.js +18 -14
  57. package/dist/utilities/strBefore.js +18 -14
  58. package/dist/watchFull.js +10 -10
  59. package/dist/watchFull.min.js +1 -1
  60. package/dist/watchTest.js +17 -13
  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 +20 -14
  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,42 +1,44 @@
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
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.dotNotate = void 0;
7
+ require("core-js/modules/esnext.async-iterator.map.js");
8
+ require("core-js/modules/esnext.iterator.map.js");
9
+ var _isObject = require("./isObject.js");
8
10
  /**
9
11
  * Convert an array of keys into a regex, return a function to test if incoming keys match.
10
12
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
11
13
  * @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) {
14
+ */
15
+ const handleRetainObjects = function () {
16
+ let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17
+ if (!retainObjects.length) {
16
18
  /**
17
19
  * Bypass the test function if there are no retainObjects.
18
20
  * @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('|'), ")$"));
21
+ */
22
+ return (currentKey, value, results) => false;
23
+ }
24
+ retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
25
+ const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
24
26
  /**
25
27
  * Test if a key should be retained as an object.
26
28
  * @param {string} currentKey - The key to test
27
29
  * @param {*} value - The value of the key
28
30
  * @param {Object} results - The result object to add to
29
31
  * @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
-
32
+ */
33
+ return (currentKey, value, results) => {
34
+ if (!currentKey.match(retainRegex)) {
35
+ return false;
36
+ }
37
+ results[currentKey] = value;
38
+ return true;
39
+ };
40
+ };
41
+
40
42
  /**
41
43
  * The underlying logic function for converting arrays to dot-notation.
42
44
  * @param {Object} arrayObject - The array or object to dot-notate
@@ -44,34 +46,34 @@ const handleRetainObjects = function () {
44
46
  * @param {string} [prepend=''] - The path for the property being processed
45
47
  * @param {Object<string, *>} [results={}] - The final notated object to return
46
48
  * @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
-
49
+ */
50
+ const performDotNotate = function (arrayObject, didRetain) {
51
+ let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
52
+ let results = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
53
+ for (let key in arrayObject) {
54
+ const value = arrayObject[key];
55
+ const currentKey = `${prepend}${key}`;
56
+ if (didRetain(currentKey, value, results)) {
57
+ continue;
58
+ }
59
+ if ((0, _isObject.isObject)(value)) {
60
+ performDotNotate(value, didRetain, `${currentKey}.`, results);
61
+ continue;
62
+ }
63
+ results[currentKey] = value;
64
+ }
65
+ return results;
66
+ };
67
+
66
68
  /**
67
69
  * Convert an array or object to a single dimensional associative array with dot notation.
68
70
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
69
71
  * @param {Object} arrayObject - The array or object to dot-notate
70
72
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
71
73
  * @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
- };
77
- module.exports = dotNotate;
74
+ */
75
+ const dotNotate = function (arrayObject) {
76
+ let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
77
+ return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
78
+ };
79
+ exports.dotNotate = dotNotate;
@@ -1,9 +1,12 @@
1
- "use strict";
2
-
3
- const isObject = require('./isObject');
4
- const strAfter = require('./strAfter');
5
- const strBefore = require('./strBefore');
6
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.dotSet = void 0;
7
+ var _isObject = require("./isObject.js");
8
+ var _strAfter = require("./strAfter.js");
9
+ var _strBefore = require("./strBefore.js");
7
10
  /**
8
11
  * Set a nested property value an object.
9
12
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotSet.ts Sí, funciona}
@@ -11,34 +14,33 @@ const strBefore = require('./strBefore');
11
14
  * @param {string} dotNotation - The path for the property
12
15
  * @param {*} value - The default value to return if the property is not found
13
16
  * @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
- };
44
- module.exports = dotSet;
17
+ */
18
+ const dotSet = function (arrayObject, dotNotation) {
19
+ let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
20
+ let key = (0, _strBefore.strBefore)(dotNotation, '.');
21
+ const lastKey = !key;
22
+ if (lastKey) {
23
+ key = dotNotation;
24
+ }
25
+ if (key === '*') {
26
+ for (let wildKey in arrayObject) {
27
+ if (lastKey) {
28
+ arrayObject[wildKey] = value;
29
+ continue;
30
+ }
31
+ if (!(0, _isObject.isObject)(arrayObject[wildKey])) {
32
+ continue;
33
+ }
34
+ dotSet(arrayObject[wildKey], (0, _strAfter.strAfter)(dotNotation, '.'), value);
35
+ }
36
+ return arrayObject;
37
+ }
38
+ if (lastKey) {
39
+ arrayObject[dotNotation] = value;
40
+ return arrayObject;
41
+ }
42
+ const next = arrayObject[key] ?? [];
43
+ arrayObject[key] = dotSet(next, (0, _strAfter.strAfter)(dotNotation, '.'), value);
44
+ return arrayObject;
45
+ };
46
+ exports.dotSet = dotSet;
@@ -1,10 +1,14 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isObject = void 0;
3
7
  /**
4
8
  * Check if the provided thing is an object / array.
5
9
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/isObject.ts Sí, funciona}
6
10
  * @param {*} object
7
11
  * @returns {boolean}
8
- */
9
- const isObject = object => typeof object === 'object' && object !== null;
10
- module.exports = isObject;
12
+ */
13
+ const isObject = object => typeof object === 'object' && object !== null;
14
+ exports.isObject = isObject;
@@ -1,14 +1,18 @@
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;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strAfter = void 0;
7
+ /**
8
+ * Retrieve the string part after the search match.
9
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
10
+ * @param {string} str
11
+ * @param {string} search
12
+ * @returns {string}
13
+ */
14
+ const strAfter = (str, search) => {
15
+ const index = str.indexOf(search);
16
+ return index === -1 ? '' : str.substring(index + search.length);
17
+ };
18
+ exports.strAfter = strAfter;
@@ -1,14 +1,18 @@
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;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strBefore = void 0;
7
+ /**
8
+ * Retrieve the string part before the search match.
9
+ * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
10
+ * @param {string} str
11
+ * @param {string} search
12
+ * @returns {string}
13
+ */
14
+ const strBefore = (str, search) => {
15
+ const index = str.indexOf(search);
16
+ return index === -1 ? '' : str.slice(0, index);
17
+ };
18
+ exports.strBefore = strBefore;
package/dist/watchFull.js CHANGED
@@ -1,14 +1,14 @@
1
- 'use strict'
2
-
3
- const {
4
- beginWatcher,
5
- runOnChange
6
- } = require('./partials')
7
-
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.watchFull = void 0
7
+ var _partials = require('./partials.js')
8
8
  /**
9
9
  * Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
10
10
  * @memberOf module:js-build-tools
11
11
  * @returns {FSWatcher}
12
- */
13
- const watchFull = () => beginWatcher().on('change', runOnChange)
14
- module.exports = watchFull
12
+ */
13
+ const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
14
+ exports.watchFull = watchFull
@@ -1 +1 @@
1
- "use strict";const{beginWatcher:beginWatcher,runOnChange:runOnChange}=require("./partials"),watchFull=()=>beginWatcher().on("change",runOnChange);module.exports=watchFull;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchFull=void 0;var _partials=require("./partials.js");const watchFull=()=>(0,_partials.beginWatcher)().on("change",_partials.runOnChange);exports.watchFull=watchFull;
package/dist/watchTest.js CHANGED
@@ -1,17 +1,21 @@
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
+ require('core-js/modules/esnext.weak-map.delete-all.js')
4
+ Object.defineProperty(exports, '__esModule', {
5
+ value: true
6
+ })
7
+ exports.watchTest = void 0
8
+ var gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
9
+ var _gulp = require('gulp')
10
+ var _testQuick = require('./testQuick.js')
11
+ function _getRequireWildcardCache (e) { if (typeof WeakMap !== 'function') return null; var r = new WeakMap(); var t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r })(e) }
12
+ function _interopRequireWildcard (e, r) { if (!r && e && e.__esModule) return e; if (e === null || typeof e !== 'object' && typeof e !== 'function') return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }; var a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (u !== 'default' && {}.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 }
9
13
  /**
10
14
  * Watch for changes and run the tests.
11
15
  * @memberOf module:js-build-tools
12
16
  * @returns {*}
13
- */
14
- const watchTest = () => watch(gulpConfig.get('test.watch'), {
15
- ignoreInitial: false
16
- }, testQuick)
17
- module.exports = watchTest
17
+ */
18
+ const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
19
+ ignoreInitial: false
20
+ }, _testQuick.testQuick)
21
+ exports.watchTest = watchTest
@@ -1 +1 @@
1
- "use strict";const gulpConfig=require("../gulp.config.js"),{watch:watch}=require("gulp"),testQuick=require("./testQuick"),watchTest=()=>watch(gulpConfig.get("test.watch"),{ignoreInitial:!1},testQuick);module.exports=watchTest;
1
+ "use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchTest=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp"),_testQuick=require("./testQuick.js");function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(e){return e?r:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&{}.hasOwnProperty.call(e,n)){var a=u?Object.getOwnPropertyDescriptor(e,n):null;a&&(a.get||a.set)?Object.defineProperty(i,n,a):i[n]=e[n]}return i.default=e,r&&r.set(e,i),i}const watchTest=()=>(0,_gulp.watch)(gulpConfig.get("test.watch"),{ignoreInitial:!1},_testQuick.testQuick);exports.watchTest=watchTest;
@@ -1,16 +1,16 @@
1
- const bundle = require('./bundle')
2
- const bundleLint = require('./bundleLint')
3
- const bundleMinify = require('./bundleMinify')
4
- const { clean, distSeries } = require('./partials')
5
- const compileReadme = require('./compileReadme')
6
- const distLint = require('./distLint')
7
- const distMinify = require('./distMinify')
8
- const { parallel, series } = require('gulp')
9
- const gulpConfig = require('../gulp.config.js')
10
- const copyFonts = require('./copyFonts.js')
11
- const images = require('./images.js')
12
- const sass = require('./sass.js')
13
- const testFull = require('./testFull')
1
+ import { bundle } from './bundle.mjs'
2
+ import { bundleLint } from './bundleLint.mjs'
3
+ import { bundleMinify } from './bundleMinify.mjs'
4
+ import { clean, distSeries } from './partials.mjs'
5
+ import { compileReadme } from './compileReadme.mjs'
6
+ import { distLint } from './distLint.mjs'
7
+ import { distMinify } from './distMinify.mjs'
8
+ import { parallel, series } from 'gulp'
9
+ import * as gulpConfig from '../gulp.config.mjs'
10
+ import { copyFonts } from './copyFonts.mjs'
11
+ import { images } from './images.mjs'
12
+ import { sass } from './sass.mjs'
13
+ import { testFull } from './testFull.mjs'
14
14
 
15
15
  /**
16
16
  * Runs several processes to build and validate the project.
@@ -18,7 +18,7 @@ const testFull = require('./testFull')
18
18
  * @memberOf module:js-build-tools
19
19
  * @returns {stream.Stream}
20
20
  */
21
- const build = (done = null) => {
21
+ export const build = (done = null) => {
22
22
  const distLintMinify = parallel(distLint, distMinify)
23
23
  const bundleLintMinify = parallel(bundleLint, bundleMinify)
24
24
  const buildActions = [clean, distSeries(), distLintMinify]
@@ -55,5 +55,3 @@ const build = (done = null) => {
55
55
  ...runActions
56
56
  )(done)
57
57
  }
58
-
59
- module.exports = build
@@ -1,16 +1,17 @@
1
- const fs = require('fs')
2
- const setUp = require('./test-helpers/setUp')
1
+ import fs from 'fs'
2
+ import * as setUp from './test-helpers/setUp.mjs'
3
+ import { build } from './build.mjs'
4
+ import { clean } from './partials/clean.mjs'
5
+ import { testFull } from './testFull.mjs'
6
+ import { countMatches } from 'test-filesystem'
7
+
3
8
  setUp.setDefaults('test-build')
4
9
  const gulpConfig = setUp.gulpConfig
5
- const build = require('./build')
6
- const clean = require('./partials/clean')
7
- const testFull = require('./testFull')
8
- const { countMatches } = require('test-filesystem')
9
10
 
10
11
  const genericFunction = () => Promise.resolve(true)
11
12
 
12
- jest.mock('./partials/clean', () => jest.fn(genericFunction))
13
- jest.mock('./testFull', () => jest.fn(genericFunction))
13
+ jest.mock('./partials/clean.mjs', () => ({ clean: jest.fn(genericFunction) }))
14
+ jest.mock('./testFull.mjs', () => ({ testFull: jest.fn(genericFunction) }))
14
15
 
15
16
  const file1Contents = '/**\n' +
16
17
  ' * Console log out a greeting with given input.\n' +
@@ -1,16 +1,14 @@
1
- const browserify = require('browserify')
2
- const { dest } = require('gulp')
3
- const gulpConfig = require('../gulp.config.js')
4
- const source = require('vinyl-source-stream')
1
+ import browserify from 'browserify'
2
+ import { dest } from 'gulp'
3
+ import * as gulpConfig from '../gulp.config.mjs'
4
+ import source from 'vinyl-source-stream'
5
5
 
6
6
  /**
7
7
  * Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
8
8
  * @memberOf module:js-build-tools
9
9
  * @returns {stream.Stream}
10
10
  */
11
- const bundle = () => browserify(gulpConfig.get('dist.main'))
11
+ export const bundle = () => browserify(gulpConfig.get('dist.main'))
12
12
  .bundle()
13
13
  .pipe(source(`${gulpConfig.get('browser.name')}.js`))
14
14
  .pipe(dest(gulpConfig.get('browser.to')))
15
-
16
- module.exports = bundle
@@ -1,9 +1,10 @@
1
- const fs = require('fs')
2
- const setUp = require('./test-helpers/setUp')
1
+ import fs from 'fs'
2
+ import * as setUp from './test-helpers/setUp.mjs'
3
+ import { bundle } from './bundle.mjs'
4
+ import { countMatches } from 'test-filesystem'
5
+
3
6
  setUp.setDefaults('test-bundle')
4
7
  const gulpConfig = setUp.gulpConfig
5
- const bundle = require('./bundle')
6
- const { countMatches } = require('test-filesystem')
7
8
 
8
9
  const file1Contents = 'function file1 () {\n' +
9
10
  ' console.log(\'Hello from file1\')\n' +
@@ -1,18 +1,16 @@
1
- const { dest, src } = require('gulp')
2
- const gulpConfig = require('../gulp.config.js')
3
- const standard = require('gulp-standard')
1
+ import { dest, src } from 'gulp'
2
+ import * as gulpConfig from '../gulp.config.mjs'
3
+ import standard from 'gulp-standard'
4
4
 
5
5
  /**
6
6
  * Applies Standard code style linting to bundled file.
7
7
  * @memberOf module:js-build-tools
8
8
  * @returns {stream.Stream}
9
9
  */
10
- const bundleLint = () => src(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`)
10
+ export const bundleLint = () => src(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`)
11
11
  .pipe(standard({ fix: true }))
12
12
  .pipe(standard.reporter('default', {
13
13
  fix: true,
14
14
  quiet: true
15
15
  }))
16
16
  .pipe(dest(gulpConfig.get('browser.to')))
17
-
18
- module.exports = bundleLint
@@ -1,9 +1,10 @@
1
- const fs = require('fs')
2
- const setUp = require('./test-helpers/setUp')
1
+ import fs from 'fs'
2
+ import * as setUp from './test-helpers/setUp.mjs'
3
+ import { bundleLint } from './bundleLint.mjs'
4
+ import { countMatches } from 'test-filesystem'
5
+
3
6
  setUp.setDefaults('test-bundle-lint')
4
7
  const gulpConfig = setUp.gulpConfig
5
- const bundleLint = require('./bundleLint')
6
- const { countMatches } = require('test-filesystem')
7
8
 
8
9
  const lintableContents = 'const gulpConfig = require("../gulp.config.js");\n' +
9
10
  'const { dest, src } = require("gulp");\n' +
@@ -0,0 +1,9 @@
1
+ import * as gulpConfig from '../gulp.config.mjs'
2
+ import { minifyFor } from './partials/minifyFor.mjs'
3
+
4
+ /**
5
+ * Creates the minified bundle file.
6
+ * @memberOf module:js-build-tools
7
+ * @returns {*}
8
+ */
9
+ export const bundleMinify = () => minifyFor(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
@@ -0,0 +1,15 @@
1
+ import { testHelpers } from './testHelpers.mjs'
2
+ import { bundleMinify } from './bundleMinify.mjs'
3
+ import { minifyFor } from './partials/minifyFor.mjs'
4
+
5
+ const gulpConfig = testHelpers.gulpConfig
6
+
7
+ jest.mock('./partials/minifyFor.mjs', () => ({ minifyFor: jest.fn(() => Promise.resolve(true)) }))
8
+
9
+ describe('bundleMinify', () => {
10
+ test('calls minifyFor with configurations', () => {
11
+ expect.assertions(1)
12
+ bundleMinify()
13
+ expect(minifyFor).toHaveBeenCalledWith(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
14
+ })
15
+ })
@@ -0,0 +1,9 @@
1
+ import { addToReadme, readmeTemplate } from './partials.mjs'
2
+ import { series } from 'gulp'
3
+
4
+ /**
5
+ * Generate the README.md file based off of the template, then append the generated documentation.
6
+ * @memberOf module:js-build-tools
7
+ * @returns {stream.Stream}
8
+ */
9
+ export const compileReadme = series(readmeTemplate, addToReadme)
@@ -1,9 +1,9 @@
1
- const compileReadme = require('./compileReadme')
2
- const { addToReadme, readmeTemplate} = require('./partials')
1
+ import { compileReadme } from './compileReadme.mjs'
2
+ import { addToReadme, readmeTemplate } from './partials.mjs'
3
3
 
4
4
  const genericFunction = () => Promise.resolve(true)
5
- jest.mock('./partials/addToReadme', () => jest.fn(genericFunction))
6
- jest.mock('./partials/readmeTemplate', () => jest.fn(genericFunction))
5
+ jest.mock('./partials/addToReadme.mjs', () => ({ addToReadme: jest.fn(genericFunction) }))
6
+ jest.mock('./partials/readmeTemplate.mjs', () => ({ readmeTemplate: jest.fn(genericFunction) }))
7
7
 
8
8
  describe('compileReadme', () => {
9
9
  test('calls readmeTemplate and addToReadme', done => {
@@ -0,0 +1,9 @@
1
+ import { copyFor } from './partials/copyFor.mjs'
2
+ import * as gulpConfig from '../gulp.config.mjs'
3
+
4
+ /**
5
+ * Move the font files into the browser directory.
6
+ * @memberOf module:js-build-tools
7
+ * @return {stream.Stream}
8
+ */
9
+ export const copyFonts = () => copyFor(gulpConfig.get('fonts.from'), gulpConfig.get('fonts.to'))
@@ -1,8 +1,9 @@
1
- const fs = require('fs')
2
- const setUp = require('./test-helpers/setUp')
1
+ import fs from 'fs'
2
+ import * as setUp from './test-helpers/setUp.mjs'
3
+ import { copyFonts } from './copyFonts.mjs'
4
+
3
5
  setUp.setDefaults('test-copy-fonts')
4
6
  const gulpConfig = setUp.gulpConfig
5
- const copyFonts = require('./copyFonts')
6
7
 
7
8
  const fontContent = 'comic sans'
8
9
 
@@ -0,0 +1,12 @@
1
+ import { dist } from './dist.mjs'
2
+ import { bundle } from './bundle.mjs'
3
+ import * as gulpConfig from '../gulp.config.mjs'
4
+ import { series } from 'gulp'
5
+
6
+ /**
7
+ * Recommended as the default task, runs the simple dist and bundle tasks.
8
+ * @memberOf module:js-build-tools
9
+ * @param {function} [done=null]
10
+ * @returns {stream.Stream}
11
+ */
12
+ export const defaultCmd = (done = null) => gulpConfig.get('browser.enabled') ? series(dist, bundle)(done) : series(dist)(done)