@jsenv/plugin-supervisor 1.4.14 → 1.4.15

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.
@@ -203,14 +203,34 @@ const createAnsi = ({
203
203
  MAGENTA: "\x1b[35m",
204
204
  CYAN: "\x1b[36m",
205
205
  GREY: "\x1b[90m",
206
- color: (text, ANSI_COLOR) => {
207
- return ANSI.supported && ANSI_COLOR ? "".concat(ANSI_COLOR).concat(text).concat(RESET) : text;
206
+ color: (text, color) => {
207
+ if (!ANSI.supported) {
208
+ return text;
209
+ }
210
+ if (!color) {
211
+ return text;
212
+ }
213
+ if (text.trim() === "") {
214
+ // cannot set color of blank chars
215
+ return text;
216
+ }
217
+ return "".concat(color).concat(text).concat(RESET);
208
218
  },
209
219
  BOLD: "\x1b[1m",
210
220
  UNDERLINE: "\x1b[4m",
211
221
  STRIKE: "\x1b[9m",
212
- effect: (text, ANSI_EFFECT) => {
213
- return ANSI.supported && ANSI_EFFECT ? "".concat(ANSI_EFFECT).concat(text).concat(RESET) : text;
222
+ effect: (text, effect) => {
223
+ if (!ANSI.supported) {
224
+ return text;
225
+ }
226
+ if (!effect) {
227
+ return text;
228
+ }
229
+ // cannot add effect to empty string
230
+ if (text === "") {
231
+ return text;
232
+ }
233
+ return "".concat(effect).concat(text).concat(RESET);
214
234
  }
215
235
  };
216
236
  return ANSI;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-supervisor",
3
- "version": "1.4.14",
3
+ "version": "1.4.15",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "/dist/"
27
27
  ],
28
28
  "dependencies": {
29
- "@jsenv/ast": "6.1.2",
30
- "@jsenv/urls": "2.2.8",
31
- "@jsenv/sourcemap": "1.2.11",
29
+ "@jsenv/ast": "6.1.3",
30
+ "@jsenv/urls": "2.2.9",
31
+ "@jsenv/sourcemap": "1.2.12",
32
32
  "launch-editor": "2.8.0"
33
33
  },
34
34
  "scripts": {