js-build-tools 3.0.4 → 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 +19 -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,217 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.modifierNames = exports.foregroundColorNames = exports.default = exports.colorNames = exports.backgroundColorNames = void 0;
7
- require("core-js/modules/esnext.async-iterator.map.js");
8
- require("core-js/modules/esnext.iterator.map.js");
9
- require("core-js/modules/esnext.map.delete-all.js");
10
- require("core-js/modules/esnext.map.every.js");
11
- require("core-js/modules/esnext.map.filter.js");
12
- require("core-js/modules/esnext.map.find.js");
13
- require("core-js/modules/esnext.map.find-key.js");
14
- require("core-js/modules/esnext.map.includes.js");
15
- require("core-js/modules/esnext.map.key-of.js");
16
- require("core-js/modules/esnext.map.map-keys.js");
17
- require("core-js/modules/esnext.map.map-values.js");
18
- require("core-js/modules/esnext.map.merge.js");
19
- require("core-js/modules/esnext.map.reduce.js");
20
- require("core-js/modules/esnext.map.some.js");
21
- require("core-js/modules/esnext.map.update.js");
22
- require("core-js/modules/web.dom-collections.iterator.js");
23
- const ANSI_BACKGROUND_OFFSET = 10;
24
- const wrapAnsi16 = function () {
25
- let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
26
- return code => "\x1B[".concat(code + offset, "m");
27
- };
28
- const wrapAnsi256 = function () {
29
- let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
30
- return code => "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
31
- };
32
- const wrapAnsi16m = function () {
33
- let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
34
- return (red, green, blue) => "\x1B[".concat(38 + offset, ";2;").concat(red, ";").concat(green, ";").concat(blue, "m");
35
- };
36
- const styles = {
37
- modifier: {
38
- reset: [0, 0],
39
- // 21 isn't widely supported and 22 does the same thing
40
- bold: [1, 22],
41
- dim: [2, 22],
42
- italic: [3, 23],
43
- underline: [4, 24],
44
- overline: [53, 55],
45
- inverse: [7, 27],
46
- hidden: [8, 28],
47
- strikethrough: [9, 29]
48
- },
49
- color: {
50
- black: [30, 39],
51
- red: [31, 39],
52
- green: [32, 39],
53
- yellow: [33, 39],
54
- blue: [34, 39],
55
- magenta: [35, 39],
56
- cyan: [36, 39],
57
- white: [37, 39],
58
- // Bright color
59
- blackBright: [90, 39],
60
- gray: [90, 39],
61
- // Alias of `blackBright`
62
- grey: [90, 39],
63
- // Alias of `blackBright`
64
- redBright: [91, 39],
65
- greenBright: [92, 39],
66
- yellowBright: [93, 39],
67
- blueBright: [94, 39],
68
- magentaBright: [95, 39],
69
- cyanBright: [96, 39],
70
- whiteBright: [97, 39]
71
- },
72
- bgColor: {
73
- bgBlack: [40, 49],
74
- bgRed: [41, 49],
75
- bgGreen: [42, 49],
76
- bgYellow: [43, 49],
77
- bgBlue: [44, 49],
78
- bgMagenta: [45, 49],
79
- bgCyan: [46, 49],
80
- bgWhite: [47, 49],
81
- // Bright color
82
- bgBlackBright: [100, 49],
83
- bgGray: [100, 49],
84
- // Alias of `bgBlackBright`
85
- bgGrey: [100, 49],
86
- // Alias of `bgBlackBright`
87
- bgRedBright: [101, 49],
88
- bgGreenBright: [102, 49],
89
- bgYellowBright: [103, 49],
90
- bgBlueBright: [104, 49],
91
- bgMagentaBright: [105, 49],
92
- bgCyanBright: [106, 49],
93
- bgWhiteBright: [107, 49]
94
- }
95
- };
96
- const modifierNames = exports.modifierNames = Object.keys(styles.modifier);
97
- const foregroundColorNames = exports.foregroundColorNames = Object.keys(styles.color);
98
- const backgroundColorNames = exports.backgroundColorNames = Object.keys(styles.bgColor);
99
- const colorNames = exports.colorNames = [...foregroundColorNames, ...backgroundColorNames];
100
- function assembleStyles() {
101
- const codes = new Map();
102
- for (const [groupName, group] of Object.entries(styles)) {
103
- for (const [styleName, style] of Object.entries(group)) {
104
- styles[styleName] = {
105
- open: "\x1B[".concat(style[0], "m"),
106
- close: "\x1B[".concat(style[1], "m")
107
- };
108
- group[styleName] = styles[styleName];
109
- codes.set(style[0], style[1]);
110
- }
111
- Object.defineProperty(styles, groupName, {
112
- value: group,
113
- enumerable: false
114
- });
115
- }
116
- Object.defineProperty(styles, 'codes', {
117
- value: codes,
118
- enumerable: false
119
- });
120
- styles.color.close = '\u001B[39m';
121
- styles.bgColor.close = '\u001B[49m';
122
- styles.color.ansi = wrapAnsi16();
123
- styles.color.ansi256 = wrapAnsi256();
124
- styles.color.ansi16m = wrapAnsi16m();
125
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
126
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
127
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
128
-
129
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
130
- Object.defineProperties(styles, {
131
- rgbToAnsi256: {
132
- value(red, green, blue) {
133
- // We use the extended greyscale palette here, with the exception of
134
- // black and white. normal palette only has 4 greyscale shades.
135
- if (red === green && green === blue) {
136
- if (red < 8) {
137
- return 16;
138
- }
139
- if (red > 248) {
140
- return 231;
141
- }
142
- return Math.round((red - 8) / 247 * 24) + 232;
143
- }
144
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
145
- },
146
- enumerable: false
147
- },
148
- hexToRgb: {
149
- value(hex) {
150
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
151
- if (!matches) {
152
- return [0, 0, 0];
153
- }
154
- let [colorString] = matches;
155
- if (colorString.length === 3) {
156
- colorString = [...colorString].map(character => character + character).join('');
157
- }
158
- const integer = Number.parseInt(colorString, 16);
159
- return [/* eslint-disable no-bitwise */
160
- integer >> 16 & 0xFF, integer >> 8 & 0xFF, integer & 0xFF
161
- /* eslint-enable no-bitwise */];
162
- },
163
- enumerable: false
164
- },
165
- hexToAnsi256: {
166
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
167
- enumerable: false
168
- },
169
- ansi256ToAnsi: {
170
- value(code) {
171
- if (code < 8) {
172
- return 30 + code;
173
- }
174
- if (code < 16) {
175
- return 90 + (code - 8);
176
- }
177
- let red;
178
- let green;
179
- let blue;
180
- if (code >= 232) {
181
- red = ((code - 232) * 10 + 8) / 255;
182
- green = red;
183
- blue = red;
184
- } else {
185
- code -= 16;
186
- const remainder = code % 36;
187
- red = Math.floor(code / 36) / 5;
188
- green = Math.floor(remainder / 6) / 5;
189
- blue = remainder % 6 / 5;
190
- }
191
- const value = Math.max(red, green, blue) * 2;
192
- if (value === 0) {
193
- return 30;
194
- }
195
-
196
- // eslint-disable-next-line no-bitwise
197
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
198
- if (value === 2) {
199
- result += 60;
200
- }
201
- return result;
202
- },
203
- enumerable: false
204
- },
205
- rgbToAnsi: {
206
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
207
- enumerable: false
208
- },
209
- hexToAnsi: {
210
- value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
211
- enumerable: false
212
- }
213
- });
214
- return styles;
215
- }
216
- const ansiStyles = assembleStyles();
217
- var _default = exports.default = ansiStyles;
@@ -1,154 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createSupportsColor = createSupportsColor;
7
- exports.default = void 0;
8
- var _nodeProcess = _interopRequireDefault(require("node:process"));
9
- var _nodeOs = _interopRequireDefault(require("node:os"));
10
- var _nodeTty = _interopRequireDefault(require("node:tty"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
13
- /// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
14
- function hasFlag(flag) {
15
- let argv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalThis.Deno ? globalThis.Deno.args : _nodeProcess.default.argv;
16
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
17
- const position = argv.indexOf(prefix + flag);
18
- const terminatorPosition = argv.indexOf('--');
19
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
20
- }
21
- const {
22
- env
23
- } = _nodeProcess.default;
24
- let flagForceColor;
25
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
26
- flagForceColor = 0;
27
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
28
- flagForceColor = 1;
29
- }
30
- function envForceColor() {
31
- if ('FORCE_COLOR' in env) {
32
- if (env.FORCE_COLOR === 'true') {
33
- return 1;
34
- }
35
- if (env.FORCE_COLOR === 'false') {
36
- return 0;
37
- }
38
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
39
- }
40
- }
41
- function translateLevel(level) {
42
- if (level === 0) {
43
- return false;
44
- }
45
- return {
46
- level,
47
- hasBasic: true,
48
- has256: level >= 2,
49
- has16m: level >= 3
50
- };
51
- }
52
- function _supportsColor(haveStream) {
53
- let {
54
- streamIsTTY,
55
- sniffFlags = true
56
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
57
- const noFlagForceColor = envForceColor();
58
- if (noFlagForceColor !== undefined) {
59
- flagForceColor = noFlagForceColor;
60
- }
61
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
62
- if (forceColor === 0) {
63
- return 0;
64
- }
65
- if (sniffFlags) {
66
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
67
- return 3;
68
- }
69
- if (hasFlag('color=256')) {
70
- return 2;
71
- }
72
- }
73
-
74
- // Check for Azure DevOps pipelines.
75
- // Has to be above the `!streamIsTTY` check.
76
- if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
77
- return 1;
78
- }
79
- if (haveStream && !streamIsTTY && forceColor === undefined) {
80
- return 0;
81
- }
82
- const min = forceColor || 0;
83
- if (env.TERM === 'dumb') {
84
- return min;
85
- }
86
- if (_nodeProcess.default.platform === 'win32') {
87
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
88
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
89
- const osRelease = _nodeOs.default.release().split('.');
90
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
91
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
92
- }
93
- return 1;
94
- }
95
- if ('CI' in env) {
96
- if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
97
- return 3;
98
- }
99
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
100
- return 1;
101
- }
102
- return min;
103
- }
104
- if ('TEAMCITY_VERSION' in env) {
105
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
106
- }
107
- if (env.COLORTERM === 'truecolor') {
108
- return 3;
109
- }
110
- if (env.TERM === 'xterm-kitty') {
111
- return 3;
112
- }
113
- if ('TERM_PROGRAM' in env) {
114
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
115
- switch (env.TERM_PROGRAM) {
116
- case 'iTerm.app':
117
- {
118
- return version >= 3 ? 3 : 2;
119
- }
120
- case 'Apple_Terminal':
121
- {
122
- return 2;
123
- }
124
- // No default
125
- }
126
- }
127
- if (/-256(color)?$/i.test(env.TERM)) {
128
- return 2;
129
- }
130
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
131
- return 1;
132
- }
133
- if ('COLORTERM' in env) {
134
- return 1;
135
- }
136
- return min;
137
- }
138
- function createSupportsColor(stream) {
139
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
140
- const level = _supportsColor(stream, {
141
- streamIsTTY: stream && stream.isTTY,
142
- ...options
143
- });
144
- return translateLevel(level);
145
- }
146
- const supportsColor = {
147
- stdout: createSupportsColor({
148
- isTTY: _nodeTty.default.isatty(1)
149
- }),
150
- stderr: createSupportsColor({
151
- isTTY: _nodeTty.default.isatty(2)
152
- })
153
- };
154
- var _default = exports.default = supportsColor;
@@ -1,145 +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/esnext.async-iterator.filter.js");
8
- require("core-js/modules/esnext.async-iterator.map.js");
9
- require("core-js/modules/esnext.iterator.constructor.js");
10
- require("core-js/modules/esnext.iterator.filter.js");
11
- require("core-js/modules/esnext.iterator.map.js");
12
- require("core-js/modules/esnext.set.add-all.js");
13
- require("core-js/modules/esnext.set.delete-all.js");
14
- require("core-js/modules/esnext.set.difference.js");
15
- require("core-js/modules/esnext.set.every.js");
16
- require("core-js/modules/esnext.set.filter.js");
17
- require("core-js/modules/esnext.set.find.js");
18
- require("core-js/modules/esnext.set.intersection.js");
19
- require("core-js/modules/esnext.set.is-disjoint-from.js");
20
- require("core-js/modules/esnext.set.is-subset-of.js");
21
- require("core-js/modules/esnext.set.is-superset-of.js");
22
- require("core-js/modules/esnext.set.join.js");
23
- require("core-js/modules/esnext.set.map.js");
24
- require("core-js/modules/esnext.set.reduce.js");
25
- require("core-js/modules/esnext.set.some.js");
26
- require("core-js/modules/esnext.set.symmetric-difference.js");
27
- require("core-js/modules/esnext.set.union.js");
28
- require("core-js/modules/web.dom-collections.iterator.js");
29
- var _index = _interopRequireDefault(require("./node_modules/chalk/source/index.js"));
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
- /*
32
- The MIT License (MIT)
33
-
34
- Copyright (c) 2015, 2017-2018, 2022 Blaine Bublitz <blaine.bublitz@gmail.com> and Eric Schoffstall <yo@contra.io>
35
-
36
- Permission is hereby granted, free of charge, to any person obtaining a copy
37
- of this software and associated documentation files (the "Software"), to deal
38
- in the Software without restriction, including without limitation the rights
39
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
- copies of the Software, and to permit persons to whom the Software is
41
- furnished to do so, subject to the following conditions:
42
-
43
- The above copyright notice and this permission notice shall be included in all
44
- copies or substantial portions of the Software.
45
-
46
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
- SOFTWARE.
53
- */
54
-
55
- // Adapted from https://github.com/gulpjs/plugin-error 2.0.1
56
-
57
- const nonEnum = ['message', 'name', 'stack'];
58
- const ignored = new Set([...nonEnum, '__safety', '_stack', 'plugin', 'showProperties', 'showStack', 'domain', 'domainEmitter', 'domainThrown']);
59
- const props = ['fileName', 'lineNumber', 'message', 'name', 'plugin', 'showProperties', 'showStack', 'stack'];
60
- class PluginError extends Error {
61
- constructor(plugin, message, options) {
62
- super();
63
- const options_ = setDefaults(plugin, message, options);
64
- Object.assign(this, options_);
65
- if (typeof options_.error === 'object') {
66
- this.message = options_.error.message;
67
- this.stack = options_.error.stack;
68
- this.cause = options_.error.cause;
69
- Object.assign(this, options_.error);
70
- }
71
- for (const prop of props) {
72
- if (prop in options_) {
73
- this[prop] = options_[prop];
74
- }
75
- }
76
- if (!this.stack) {
77
- const safety = {
78
- toString: this._messageWithDetails.bind(this) + '\nStack:'
79
- };
80
- Error.captureStackTrace(safety, this.constructor);
81
- this.__safety = safety;
82
- }
83
- if (!this.plugin) {
84
- throw new Error('Missing plugin name');
85
- }
86
- if (!this.message) {
87
- throw new Error('Missing error message');
88
- }
89
- if (message instanceof Error && options_.error.isPresentable) {
90
- this.showStack = false;
91
- this.showProperties = false;
92
- }
93
- }
94
- _messageWithDetails() {
95
- let message_ = "Message:\n ".concat(this.message);
96
- const details = this._messageDetails();
97
- if (details) {
98
- message_ += "\n".concat(details);
99
- }
100
- return message_;
101
- }
102
- _messageDetails() {
103
- if (!this.showProperties) {
104
- return '';
105
- }
106
- const relevantProps = Object.keys(this).filter(key => !ignored.has(key));
107
- return relevantProps.length > 0 ? "Details:\n".concat(relevantProps.map(prop => " ".concat(prop, ": ").concat(this[prop])).join('\n')) : '';
108
- }
109
- toString() {
110
- const message_ = this.showStack ? this.__safety ? this.__safety.stack : this.stack : this._messageWithDetails();
111
- return formatMessage(message_, this);
112
- }
113
- }
114
- exports.default = PluginError;
115
- function formatMessage(message, thisArg) {
116
- return "".concat(_index.default.red(thisArg.name), " in plugin \"").concat(_index.default.cyan(thisArg.plugin), "\"\n").concat(message);
117
- }
118
- function setDefaults(plugin, message, options) {
119
- if (typeof plugin === 'object') {
120
- return {
121
- ...plugin
122
- };
123
- }
124
- if (message instanceof Error) {
125
- options = {
126
- ...options,
127
- error: message
128
- };
129
- } else if (typeof message === 'object') {
130
- options = {
131
- ...message
132
- };
133
- } else {
134
- options = {
135
- ...options,
136
- message
137
- };
138
- }
139
- options.plugin = plugin;
140
- return {
141
- showStack: false,
142
- showProperties: true,
143
- ...options
144
- };
145
- }