@jsenv/core 29.1.6 → 29.1.7

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 (2) hide show
  1. package/dist/main.js +735 -292
  2. package/package.json +8 -8
package/dist/main.js CHANGED
@@ -2540,16 +2540,16 @@ const writeFileSync = (destination, content = "") => {
2540
2540
  }
2541
2541
  };
2542
2542
 
2543
- const LOG_LEVEL_OFF = "off";
2544
- const LOG_LEVEL_DEBUG = "debug";
2545
- const LOG_LEVEL_INFO = "info";
2546
- const LOG_LEVEL_WARN = "warn";
2547
- const LOG_LEVEL_ERROR = "error";
2548
-
2549
- const createLogger = ({
2550
- logLevel = LOG_LEVEL_INFO
2543
+ const LOG_LEVEL_OFF$1 = "off";
2544
+ const LOG_LEVEL_DEBUG$1 = "debug";
2545
+ const LOG_LEVEL_INFO$1 = "info";
2546
+ const LOG_LEVEL_WARN$1 = "warn";
2547
+ const LOG_LEVEL_ERROR$1 = "error";
2548
+
2549
+ const createLogger$1 = ({
2550
+ logLevel = LOG_LEVEL_INFO$1
2551
2551
  } = {}) => {
2552
- if (logLevel === LOG_LEVEL_DEBUG) {
2552
+ if (logLevel === LOG_LEVEL_DEBUG$1) {
2553
2553
  return {
2554
2554
  level: "debug",
2555
2555
  levels: {
@@ -2558,14 +2558,14 @@ const createLogger = ({
2558
2558
  warn: true,
2559
2559
  error: true
2560
2560
  },
2561
- debug,
2562
- info,
2563
- warn,
2564
- error
2561
+ debug: debug$1,
2562
+ info: info$1,
2563
+ warn: warn$1,
2564
+ error: error$1
2565
2565
  };
2566
2566
  }
2567
2567
 
2568
- if (logLevel === LOG_LEVEL_INFO) {
2568
+ if (logLevel === LOG_LEVEL_INFO$1) {
2569
2569
  return {
2570
2570
  level: "info",
2571
2571
  levels: {
@@ -2574,14 +2574,14 @@ const createLogger = ({
2574
2574
  warn: true,
2575
2575
  error: true
2576
2576
  },
2577
- debug: debugDisabled,
2578
- info,
2579
- warn,
2580
- error
2577
+ debug: debugDisabled$1,
2578
+ info: info$1,
2579
+ warn: warn$1,
2580
+ error: error$1
2581
2581
  };
2582
2582
  }
2583
2583
 
2584
- if (logLevel === LOG_LEVEL_WARN) {
2584
+ if (logLevel === LOG_LEVEL_WARN$1) {
2585
2585
  return {
2586
2586
  level: "warn",
2587
2587
  levels: {
@@ -2590,14 +2590,14 @@ const createLogger = ({
2590
2590
  warn: true,
2591
2591
  error: true
2592
2592
  },
2593
- debug: debugDisabled,
2594
- info: infoDisabled,
2595
- warn,
2596
- error
2593
+ debug: debugDisabled$1,
2594
+ info: infoDisabled$1,
2595
+ warn: warn$1,
2596
+ error: error$1
2597
2597
  };
2598
2598
  }
2599
2599
 
2600
- if (logLevel === LOG_LEVEL_ERROR) {
2600
+ if (logLevel === LOG_LEVEL_ERROR$1) {
2601
2601
  return {
2602
2602
  level: "error",
2603
2603
  levels: {
@@ -2606,14 +2606,14 @@ const createLogger = ({
2606
2606
  warn: false,
2607
2607
  error: true
2608
2608
  },
2609
- debug: debugDisabled,
2610
- info: infoDisabled,
2611
- warn: warnDisabled,
2612
- error
2609
+ debug: debugDisabled$1,
2610
+ info: infoDisabled$1,
2611
+ warn: warnDisabled$1,
2612
+ error: error$1
2613
2613
  };
2614
2614
  }
2615
2615
 
2616
- if (logLevel === LOG_LEVEL_OFF) {
2616
+ if (logLevel === LOG_LEVEL_OFF$1) {
2617
2617
  return {
2618
2618
  level: "off",
2619
2619
  levels: {
@@ -2622,10 +2622,10 @@ const createLogger = ({
2622
2622
  warn: false,
2623
2623
  error: false
2624
2624
  },
2625
- debug: debugDisabled,
2626
- info: infoDisabled,
2627
- warn: warnDisabled,
2628
- error: errorDisabled
2625
+ debug: debugDisabled$1,
2626
+ info: infoDisabled$1,
2627
+ warn: warnDisabled$1,
2628
+ error: errorDisabled$1
2629
2629
  };
2630
2630
  }
2631
2631
 
@@ -2633,30 +2633,30 @@ const createLogger = ({
2633
2633
  --- logLevel ---
2634
2634
  ${logLevel}
2635
2635
  --- allowed log levels ---
2636
- ${LOG_LEVEL_OFF}
2637
- ${LOG_LEVEL_ERROR}
2638
- ${LOG_LEVEL_WARN}
2639
- ${LOG_LEVEL_INFO}
2640
- ${LOG_LEVEL_DEBUG}`);
2636
+ ${LOG_LEVEL_OFF$1}
2637
+ ${LOG_LEVEL_ERROR$1}
2638
+ ${LOG_LEVEL_WARN$1}
2639
+ ${LOG_LEVEL_INFO$1}
2640
+ ${LOG_LEVEL_DEBUG$1}`);
2641
2641
  };
2642
2642
 
2643
- const debug = (...args) => console.debug(...args);
2643
+ const debug$1 = (...args) => console.debug(...args);
2644
2644
 
2645
- const debugDisabled = () => {};
2645
+ const debugDisabled$1 = () => {};
2646
2646
 
2647
- const info = (...args) => console.info(...args);
2647
+ const info$1 = (...args) => console.info(...args);
2648
2648
 
2649
- const infoDisabled = () => {};
2649
+ const infoDisabled$1 = () => {};
2650
2650
 
2651
- const warn = (...args) => console.warn(...args);
2651
+ const warn$1 = (...args) => console.warn(...args);
2652
2652
 
2653
- const warnDisabled = () => {};
2653
+ const warnDisabled$1 = () => {};
2654
2654
 
2655
- const error = (...args) => console.error(...args);
2655
+ const error$1 = (...args) => console.error(...args);
2656
2656
 
2657
- const errorDisabled = () => {};
2657
+ const errorDisabled$1 = () => {};
2658
2658
 
2659
- function hasFlag(flag, argv = process$1.argv) {
2659
+ function hasFlag$1(flag, argv = process$1.argv) {
2660
2660
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2661
2661
  const position = argv.indexOf(prefix + flag);
2662
2662
  const terminatorPosition = argv.indexOf('--');
@@ -2664,31 +2664,31 @@ function hasFlag(flag, argv = process$1.argv) {
2664
2664
  }
2665
2665
 
2666
2666
  const {
2667
- env
2667
+ env: env$1
2668
2668
  } = process$1;
2669
- let flagForceColor;
2669
+ let flagForceColor$1;
2670
2670
 
2671
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
2672
- flagForceColor = 0;
2673
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2674
- flagForceColor = 1;
2671
+ if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) {
2672
+ flagForceColor$1 = 0;
2673
+ } else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) {
2674
+ flagForceColor$1 = 1;
2675
2675
  }
2676
2676
 
2677
- function envForceColor() {
2678
- if ('FORCE_COLOR' in env) {
2679
- if (env.FORCE_COLOR === 'true') {
2677
+ function envForceColor$1() {
2678
+ if ('FORCE_COLOR' in env$1) {
2679
+ if (env$1.FORCE_COLOR === 'true') {
2680
2680
  return 1;
2681
2681
  }
2682
2682
 
2683
- if (env.FORCE_COLOR === 'false') {
2683
+ if (env$1.FORCE_COLOR === 'false') {
2684
2684
  return 0;
2685
2685
  }
2686
2686
 
2687
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2687
+ return env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env$1.FORCE_COLOR, 10), 3);
2688
2688
  }
2689
2689
  }
2690
2690
 
2691
- function translateLevel(level) {
2691
+ function translateLevel$1(level) {
2692
2692
  if (level === 0) {
2693
2693
  return false;
2694
2694
  }
@@ -2701,28 +2701,28 @@ function translateLevel(level) {
2701
2701
  };
2702
2702
  }
2703
2703
 
2704
- function _supportsColor(haveStream, {
2704
+ function _supportsColor$1(haveStream, {
2705
2705
  streamIsTTY,
2706
2706
  sniffFlags = true
2707
2707
  } = {}) {
2708
- const noFlagForceColor = envForceColor();
2708
+ const noFlagForceColor = envForceColor$1();
2709
2709
 
2710
2710
  if (noFlagForceColor !== undefined) {
2711
- flagForceColor = noFlagForceColor;
2711
+ flagForceColor$1 = noFlagForceColor;
2712
2712
  }
2713
2713
 
2714
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
2714
+ const forceColor = sniffFlags ? flagForceColor$1 : noFlagForceColor;
2715
2715
 
2716
2716
  if (forceColor === 0) {
2717
2717
  return 0;
2718
2718
  }
2719
2719
 
2720
2720
  if (sniffFlags) {
2721
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2721
+ if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) {
2722
2722
  return 3;
2723
2723
  }
2724
2724
 
2725
- if (hasFlag('color=256')) {
2725
+ if (hasFlag$1('color=256')) {
2726
2726
  return 2;
2727
2727
  }
2728
2728
  }
@@ -2733,7 +2733,7 @@ function _supportsColor(haveStream, {
2733
2733
 
2734
2734
  const min = forceColor || 0;
2735
2735
 
2736
- if (env.TERM === 'dumb') {
2736
+ if (env$1.TERM === 'dumb') {
2737
2737
  return min;
2738
2738
  }
2739
2739
 
@@ -2749,31 +2749,31 @@ function _supportsColor(haveStream, {
2749
2749
  return 1;
2750
2750
  }
2751
2751
 
2752
- if ('CI' in env) {
2753
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2752
+ if ('CI' in env$1) {
2753
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
2754
2754
  return 1;
2755
2755
  }
2756
2756
 
2757
2757
  return min;
2758
2758
  }
2759
2759
 
2760
- if ('TEAMCITY_VERSION' in env) {
2761
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2760
+ if ('TEAMCITY_VERSION' in env$1) {
2761
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
2762
2762
  } // Check for Azure DevOps pipelines
2763
2763
 
2764
2764
 
2765
- if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
2765
+ if ('TF_BUILD' in env$1 && 'AGENT_NAME' in env$1) {
2766
2766
  return 1;
2767
2767
  }
2768
2768
 
2769
- if (env.COLORTERM === 'truecolor') {
2769
+ if (env$1.COLORTERM === 'truecolor') {
2770
2770
  return 3;
2771
2771
  }
2772
2772
 
2773
- if ('TERM_PROGRAM' in env) {
2774
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2773
+ if ('TERM_PROGRAM' in env$1) {
2774
+ const version = Number.parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2775
2775
 
2776
- switch (env.TERM_PROGRAM) {
2776
+ switch (env$1.TERM_PROGRAM) {
2777
2777
  case 'iTerm.app':
2778
2778
  return version >= 3 ? 3 : 2;
2779
2779
 
@@ -2783,39 +2783,39 @@ function _supportsColor(haveStream, {
2783
2783
  }
2784
2784
  }
2785
2785
 
2786
- if (/-256(color)?$/i.test(env.TERM)) {
2786
+ if (/-256(color)?$/i.test(env$1.TERM)) {
2787
2787
  return 2;
2788
2788
  }
2789
2789
 
2790
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2790
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
2791
2791
  return 1;
2792
2792
  }
2793
2793
 
2794
- if ('COLORTERM' in env) {
2794
+ if ('COLORTERM' in env$1) {
2795
2795
  return 1;
2796
2796
  }
2797
2797
 
2798
2798
  return min;
2799
2799
  }
2800
2800
 
2801
- function createSupportsColor(stream, options = {}) {
2802
- const level = _supportsColor(stream, {
2801
+ function createSupportsColor$1(stream, options = {}) {
2802
+ const level = _supportsColor$1(stream, {
2803
2803
  streamIsTTY: stream && stream.isTTY,
2804
2804
  ...options
2805
2805
  });
2806
2806
 
2807
- return translateLevel(level);
2807
+ return translateLevel$1(level);
2808
2808
  }
2809
2809
  ({
2810
- stdout: createSupportsColor({
2810
+ stdout: createSupportsColor$1({
2811
2811
  isTTY: tty.isatty(1)
2812
2812
  }),
2813
- stderr: createSupportsColor({
2813
+ stderr: createSupportsColor$1({
2814
2814
  isTTY: tty.isatty(2)
2815
2815
  })
2816
2816
  });
2817
2817
 
2818
- const processSupportsBasicColor = createSupportsColor(process.stdout).hasBasic;
2818
+ const processSupportsBasicColor = createSupportsColor$1(process.stdout).hasBasic;
2819
2819
  let canUseColors = processSupportsBasicColor; // GitHub workflow does support ANSI but "supports-color" returns false
2820
2820
  // because stream.isTTY returns false, see https://github.com/actions/runner/issues/241
2821
2821
 
@@ -2849,18 +2849,19 @@ const ANSI = {
2849
2849
  color: setANSIColor
2850
2850
  };
2851
2851
 
2852
- function isUnicodeSupported() {
2852
+ function isUnicodeSupported$1() {
2853
2853
  if (process$1.platform !== 'win32') {
2854
2854
  return process$1.env.TERM !== 'linux'; // Linux console (kernel)
2855
2855
  }
2856
2856
 
2857
2857
  return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) // Windows Terminal
2858
+ || Boolean(process$1.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
2858
2859
  || process$1.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
2859
- || process$1.env.TERM_PROGRAM === 'vscode' || process$1.env.TERM === 'xterm-256color' || process$1.env.TERM === 'alacritty' || process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
2860
+ || process$1.env.TERM_PROGRAM === 'Terminus-Sublime' || process$1.env.TERM_PROGRAM === 'vscode' || process$1.env.TERM === 'xterm-256color' || process$1.env.TERM === 'alacritty' || process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
2860
2861
  }
2861
2862
 
2862
2863
  // see also https://github.com/sindresorhus/figures
2863
- const canUseUnicode = isUnicodeSupported();
2864
+ const canUseUnicode = isUnicodeSupported$1();
2864
2865
  const COMMAND_RAW = canUseUnicode ? `❯` : `>`;
2865
2866
  const OK_RAW = canUseUnicode ? `✔` : `√`;
2866
2867
  const FAILURE_RAW = canUseUnicode ? `✖` : `×`;
@@ -2894,7 +2895,7 @@ const UNICODE = {
2894
2895
  supported: canUseUnicode
2895
2896
  };
2896
2897
 
2897
- const createDetailedMessage$1 = (message, details = {}) => {
2898
+ const createDetailedMessage$2 = (message, details = {}) => {
2898
2899
  let string = `${message}`;
2899
2900
  Object.keys(details).forEach(key => {
2900
2901
  const value = details[key];
@@ -3193,26 +3194,26 @@ const distributePercentages = (namedNumbers, {
3193
3194
  return percentages;
3194
3195
  };
3195
3196
 
3196
- const ESC = '\u001B[';
3197
- const OSC = '\u001B]';
3198
- const BEL = '\u0007';
3199
- const SEP = ';';
3200
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
3201
- const ansiEscapes = {};
3197
+ const ESC$1 = '\u001B[';
3198
+ const OSC$1 = '\u001B]';
3199
+ const BEL$1 = '\u0007';
3200
+ const SEP$1 = ';';
3201
+ const isTerminalApp$1 = process$1.env.TERM_PROGRAM === 'Apple_Terminal';
3202
+ const ansiEscapes$1 = {};
3202
3203
 
3203
- ansiEscapes.cursorTo = (x, y) => {
3204
+ ansiEscapes$1.cursorTo = (x, y) => {
3204
3205
  if (typeof x !== 'number') {
3205
3206
  throw new TypeError('The `x` argument is required');
3206
3207
  }
3207
3208
 
3208
3209
  if (typeof y !== 'number') {
3209
- return ESC + (x + 1) + 'G';
3210
+ return ESC$1 + (x + 1) + 'G';
3210
3211
  }
3211
3212
 
3212
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
3213
+ return ESC$1 + (y + 1) + SEP$1 + (x + 1) + 'H';
3213
3214
  };
3214
3215
 
3215
- ansiEscapes.cursorMove = (x, y) => {
3216
+ ansiEscapes$1.cursorMove = (x, y) => {
3216
3217
  if (typeof x !== 'number') {
3217
3218
  throw new TypeError('The `x` argument is required');
3218
3219
  }
@@ -3220,73 +3221,71 @@ ansiEscapes.cursorMove = (x, y) => {
3220
3221
  let returnValue = '';
3221
3222
 
3222
3223
  if (x < 0) {
3223
- returnValue += ESC + -x + 'D';
3224
+ returnValue += ESC$1 + -x + 'D';
3224
3225
  } else if (x > 0) {
3225
- returnValue += ESC + x + 'C';
3226
+ returnValue += ESC$1 + x + 'C';
3226
3227
  }
3227
3228
 
3228
3229
  if (y < 0) {
3229
- returnValue += ESC + -y + 'A';
3230
+ returnValue += ESC$1 + -y + 'A';
3230
3231
  } else if (y > 0) {
3231
- returnValue += ESC + y + 'B';
3232
+ returnValue += ESC$1 + y + 'B';
3232
3233
  }
3233
3234
 
3234
3235
  return returnValue;
3235
3236
  };
3236
3237
 
3237
- ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
3238
+ ansiEscapes$1.cursorUp = (count = 1) => ESC$1 + count + 'A';
3238
3239
 
3239
- ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
3240
+ ansiEscapes$1.cursorDown = (count = 1) => ESC$1 + count + 'B';
3240
3241
 
3241
- ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
3242
+ ansiEscapes$1.cursorForward = (count = 1) => ESC$1 + count + 'C';
3242
3243
 
3243
- ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
3244
+ ansiEscapes$1.cursorBackward = (count = 1) => ESC$1 + count + 'D';
3244
3245
 
3245
- ansiEscapes.cursorLeft = ESC + 'G';
3246
- ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
3247
- ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
3248
- ansiEscapes.cursorGetPosition = ESC + '6n';
3249
- ansiEscapes.cursorNextLine = ESC + 'E';
3250
- ansiEscapes.cursorPrevLine = ESC + 'F';
3251
- ansiEscapes.cursorHide = ESC + '?25l';
3252
- ansiEscapes.cursorShow = ESC + '?25h';
3246
+ ansiEscapes$1.cursorLeft = ESC$1 + 'G';
3247
+ ansiEscapes$1.cursorSavePosition = isTerminalApp$1 ? '\u001B7' : ESC$1 + 's';
3248
+ ansiEscapes$1.cursorRestorePosition = isTerminalApp$1 ? '\u001B8' : ESC$1 + 'u';
3249
+ ansiEscapes$1.cursorGetPosition = ESC$1 + '6n';
3250
+ ansiEscapes$1.cursorNextLine = ESC$1 + 'E';
3251
+ ansiEscapes$1.cursorPrevLine = ESC$1 + 'F';
3252
+ ansiEscapes$1.cursorHide = ESC$1 + '?25l';
3253
+ ansiEscapes$1.cursorShow = ESC$1 + '?25h';
3253
3254
 
3254
- ansiEscapes.eraseLines = count => {
3255
+ ansiEscapes$1.eraseLines = count => {
3255
3256
  let clear = '';
3256
3257
 
3257
3258
  for (let i = 0; i < count; i++) {
3258
- clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
3259
+ clear += ansiEscapes$1.eraseLine + (i < count - 1 ? ansiEscapes$1.cursorUp() : '');
3259
3260
  }
3260
3261
 
3261
3262
  if (count) {
3262
- clear += ansiEscapes.cursorLeft;
3263
+ clear += ansiEscapes$1.cursorLeft;
3263
3264
  }
3264
3265
 
3265
3266
  return clear;
3266
3267
  };
3267
3268
 
3268
- ansiEscapes.eraseEndLine = ESC + 'K';
3269
- ansiEscapes.eraseStartLine = ESC + '1K';
3270
- ansiEscapes.eraseLine = ESC + '2K';
3271
- ansiEscapes.eraseDown = ESC + 'J';
3272
- ansiEscapes.eraseUp = ESC + '1J';
3273
- ansiEscapes.eraseScreen = ESC + '2J';
3274
- ansiEscapes.scrollUp = ESC + 'S';
3275
- ansiEscapes.scrollDown = ESC + 'T';
3276
- ansiEscapes.clearScreen = '\u001Bc';
3277
- ansiEscapes.clearTerminal = process.platform === 'win32' ? `${ansiEscapes.eraseScreen}${ESC}0f` : // 1. Erases the screen (Only done in case `2` is not supported)
3269
+ ansiEscapes$1.eraseEndLine = ESC$1 + 'K';
3270
+ ansiEscapes$1.eraseStartLine = ESC$1 + '1K';
3271
+ ansiEscapes$1.eraseLine = ESC$1 + '2K';
3272
+ ansiEscapes$1.eraseDown = ESC$1 + 'J';
3273
+ ansiEscapes$1.eraseUp = ESC$1 + '1J';
3274
+ ansiEscapes$1.eraseScreen = ESC$1 + '2J';
3275
+ ansiEscapes$1.scrollUp = ESC$1 + 'S';
3276
+ ansiEscapes$1.scrollDown = ESC$1 + 'T';
3277
+ ansiEscapes$1.clearScreen = '\u001Bc';
3278
+ ansiEscapes$1.clearTerminal = process$1.platform === 'win32' ? `${ansiEscapes$1.eraseScreen}${ESC$1}0f` // 1. Erases the screen (Only done in case `2` is not supported)
3278
3279
  // 2. Erases the whole screen including scrollback buffer
3279
3280
  // 3. Moves cursor to the top-left position
3280
3281
  // More info: https://www.real-world-systems.com/docs/ANSIcode.html
3281
- `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
3282
- ansiEscapes.beep = BEL;
3282
+ : `${ansiEscapes$1.eraseScreen}${ESC$1}3J${ESC$1}H`;
3283
+ ansiEscapes$1.beep = BEL$1;
3283
3284
 
3284
- ansiEscapes.link = (text, url) => {
3285
- return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
3286
- };
3285
+ ansiEscapes$1.link = (text, url) => [OSC$1, '8', SEP$1, SEP$1, url, BEL$1, text, OSC$1, '8', SEP$1, SEP$1, BEL$1].join('');
3287
3286
 
3288
- ansiEscapes.image = (buffer, options = {}) => {
3289
- let returnValue = `${OSC}1337;File=inline=1`;
3287
+ ansiEscapes$1.image = (buffer, options = {}) => {
3288
+ let returnValue = `${OSC$1}1337;File=inline=1`;
3290
3289
 
3291
3290
  if (options.width) {
3292
3291
  returnValue += `;width=${options.width}`;
@@ -3300,13 +3299,14 @@ ansiEscapes.image = (buffer, options = {}) => {
3300
3299
  returnValue += ';preserveAspectRatio=0';
3301
3300
  }
3302
3301
 
3303
- return returnValue + ':' + buffer.toString('base64') + BEL;
3302
+ return returnValue + ':' + buffer.toString('base64') + BEL$1;
3304
3303
  };
3305
3304
 
3306
- ansiEscapes.iTerm = {
3307
- setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
3308
- annotation: (message, options = {}) => {
3309
- let returnValue = `${OSC}1337;`;
3305
+ ansiEscapes$1.iTerm = {
3306
+ setCwd: (cwd = process$1.cwd()) => `${OSC$1}50;CurrentDir=${cwd}${BEL$1}`,
3307
+
3308
+ annotation(message, options = {}) {
3309
+ let returnValue = `${OSC$1}1337;`;
3310
3310
  const hasX = typeof options.x !== 'undefined';
3311
3311
  const hasY = typeof options.y !== 'undefined';
3312
3312
 
@@ -3323,8 +3323,9 @@ ansiEscapes.iTerm = {
3323
3323
  returnValue += message;
3324
3324
  }
3325
3325
 
3326
- return returnValue + BEL;
3326
+ return returnValue + BEL$1;
3327
3327
  }
3328
+
3328
3329
  };
3329
3330
 
3330
3331
  /*
@@ -3408,7 +3409,7 @@ const createLog = ({
3408
3409
  }
3409
3410
 
3410
3411
  clearAttemptResult = true;
3411
- return ansiEscapes.eraseLines(visualLineCount);
3412
+ return ansiEscapes$1.eraseLines(visualLineCount);
3412
3413
  };
3413
3414
 
3414
3415
  const spyStream = () => {
@@ -3451,169 +3452,611 @@ const createLog = ({
3451
3452
  }
3452
3453
  };
3453
3454
 
3454
- const dynamicWrite = callback => {
3455
- const outputFromOutside = streamOutputSpy();
3456
- const string = callback({
3457
- outputFromOutside
3458
- });
3459
- return write(string, outputFromOutside);
3460
- };
3455
+ const dynamicWrite = callback => {
3456
+ const outputFromOutside = streamOutputSpy();
3457
+ const string = callback({
3458
+ outputFromOutside
3459
+ });
3460
+ return write(string, outputFromOutside);
3461
+ };
3462
+
3463
+ const destroy = () => {
3464
+ if (streamOutputSpy) {
3465
+ streamOutputSpy(); // this uninstalls the spy
3466
+
3467
+ streamOutputSpy = null;
3468
+ lastOutput = "";
3469
+ }
3470
+ };
3471
+
3472
+ Object.assign(log, {
3473
+ write,
3474
+ dynamicWrite,
3475
+ destroy
3476
+ });
3477
+ return log;
3478
+ };
3479
+
3480
+ const noopStreamSpy = () => ""; // could be inlined but vscode do not correctly
3481
+ // expand/collapse template strings, so I put it at the bottom
3482
+
3483
+
3484
+ const addNewLines = (string, newLine) => {
3485
+ if (newLine === "before") {
3486
+ return `
3487
+ ${string}`;
3488
+ }
3489
+
3490
+ if (newLine === "after") {
3491
+ return `${string}
3492
+ `;
3493
+ }
3494
+
3495
+ if (newLine === "around") {
3496
+ return `
3497
+ ${string}
3498
+ `;
3499
+ }
3500
+
3501
+ return string;
3502
+ };
3503
+
3504
+ const startSpinner = ({
3505
+ log,
3506
+ frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
3507
+ fps = 20,
3508
+ keepProcessAlive = false,
3509
+ stopOnWriteFromOutside = true,
3510
+ stopOnVerticalOverflow = true,
3511
+ render = () => "",
3512
+ effect = () => {}
3513
+ }) => {
3514
+ let frameIndex = 0;
3515
+ let interval;
3516
+ let running = true;
3517
+ const spinner = {
3518
+ message: undefined
3519
+ };
3520
+
3521
+ const update = message => {
3522
+ spinner.message = running ? `${frames[frameIndex]} ${message}` : message;
3523
+ return spinner.message;
3524
+ };
3525
+
3526
+ spinner.update = update;
3527
+ let cleanup;
3528
+
3529
+ if (ANSI.supported) {
3530
+ running = true;
3531
+ cleanup = effect();
3532
+ log.write(update(render()));
3533
+ interval = setInterval(() => {
3534
+ frameIndex = frameIndex === frames.length - 1 ? 0 : frameIndex + 1;
3535
+ log.dynamicWrite(({
3536
+ outputFromOutside
3537
+ }) => {
3538
+ if (outputFromOutside && stopOnWriteFromOutside) {
3539
+ stop();
3540
+ return "";
3541
+ }
3542
+
3543
+ return update(render());
3544
+ });
3545
+ }, 1000 / fps);
3546
+
3547
+ if (!keepProcessAlive) {
3548
+ interval.unref();
3549
+ }
3550
+ } else {
3551
+ log.write(update(render()));
3552
+ }
3553
+
3554
+ const stop = message => {
3555
+ running = false;
3556
+
3557
+ if (interval) {
3558
+ clearInterval(interval);
3559
+ interval = null;
3560
+ }
3561
+
3562
+ if (cleanup) {
3563
+ cleanup();
3564
+ cleanup = null;
3565
+ }
3566
+
3567
+ if (log && message) {
3568
+ log.write(update(message));
3569
+ log = null;
3570
+ }
3571
+ };
3572
+
3573
+ spinner.stop = stop;
3574
+
3575
+ if (stopOnVerticalOverflow) {
3576
+ log.onVerticalOverflow = stop;
3577
+ }
3578
+
3579
+ return spinner;
3580
+ };
3581
+
3582
+ const createTaskLog = (label, {
3583
+ disabled = false,
3584
+ stopOnWriteFromOutside
3585
+ } = {}) => {
3586
+ if (disabled) {
3587
+ return {
3588
+ setRightText: () => {},
3589
+ done: () => {},
3590
+ happen: () => {},
3591
+ fail: () => {}
3592
+ };
3593
+ }
3594
+
3595
+ const startMs = Date.now();
3596
+ const log = createLog();
3597
+ let message = label;
3598
+ const taskSpinner = startSpinner({
3599
+ log,
3600
+ render: () => message,
3601
+ stopOnWriteFromOutside
3602
+ });
3603
+ return {
3604
+ setRightText: value => {
3605
+ message = `${label} ${value}`;
3606
+ },
3607
+ done: () => {
3608
+ const msEllapsed = Date.now() - startMs;
3609
+ taskSpinner.stop(`${UNICODE.OK} ${label} (done in ${msAsDuration(msEllapsed)})`);
3610
+ },
3611
+ happen: message => {
3612
+ taskSpinner.stop(`${UNICODE.INFO} ${message} (at ${new Date().toLocaleTimeString()})`);
3613
+ },
3614
+ fail: (message = `failed to ${label}`) => {
3615
+ taskSpinner.stop(`${UNICODE.FAILURE} ${message}`);
3616
+ }
3617
+ };
3618
+ };
3619
+
3620
+ const LOG_LEVEL_OFF = "off";
3621
+ const LOG_LEVEL_DEBUG = "debug";
3622
+ const LOG_LEVEL_INFO = "info";
3623
+ const LOG_LEVEL_WARN = "warn";
3624
+ const LOG_LEVEL_ERROR = "error";
3625
+
3626
+ const createLogger = ({
3627
+ logLevel = LOG_LEVEL_INFO
3628
+ } = {}) => {
3629
+ if (logLevel === LOG_LEVEL_DEBUG) {
3630
+ return {
3631
+ level: "debug",
3632
+ levels: {
3633
+ debug: true,
3634
+ info: true,
3635
+ warn: true,
3636
+ error: true
3637
+ },
3638
+ debug,
3639
+ info,
3640
+ warn,
3641
+ error
3642
+ };
3643
+ }
3644
+
3645
+ if (logLevel === LOG_LEVEL_INFO) {
3646
+ return {
3647
+ level: "info",
3648
+ levels: {
3649
+ debug: false,
3650
+ info: true,
3651
+ warn: true,
3652
+ error: true
3653
+ },
3654
+ debug: debugDisabled,
3655
+ info,
3656
+ warn,
3657
+ error
3658
+ };
3659
+ }
3660
+
3661
+ if (logLevel === LOG_LEVEL_WARN) {
3662
+ return {
3663
+ level: "warn",
3664
+ levels: {
3665
+ debug: false,
3666
+ info: false,
3667
+ warn: true,
3668
+ error: true
3669
+ },
3670
+ debug: debugDisabled,
3671
+ info: infoDisabled,
3672
+ warn,
3673
+ error
3674
+ };
3675
+ }
3676
+
3677
+ if (logLevel === LOG_LEVEL_ERROR) {
3678
+ return {
3679
+ level: "error",
3680
+ levels: {
3681
+ debug: false,
3682
+ info: false,
3683
+ warn: false,
3684
+ error: true
3685
+ },
3686
+ debug: debugDisabled,
3687
+ info: infoDisabled,
3688
+ warn: warnDisabled,
3689
+ error
3690
+ };
3691
+ }
3692
+
3693
+ if (logLevel === LOG_LEVEL_OFF) {
3694
+ return {
3695
+ level: "off",
3696
+ levels: {
3697
+ debug: false,
3698
+ info: false,
3699
+ warn: false,
3700
+ error: false
3701
+ },
3702
+ debug: debugDisabled,
3703
+ info: infoDisabled,
3704
+ warn: warnDisabled,
3705
+ error: errorDisabled
3706
+ };
3707
+ }
3708
+
3709
+ throw new Error(`unexpected logLevel.
3710
+ --- logLevel ---
3711
+ ${logLevel}
3712
+ --- allowed log levels ---
3713
+ ${LOG_LEVEL_OFF}
3714
+ ${LOG_LEVEL_ERROR}
3715
+ ${LOG_LEVEL_WARN}
3716
+ ${LOG_LEVEL_INFO}
3717
+ ${LOG_LEVEL_DEBUG}`);
3718
+ };
3719
+
3720
+ const debug = (...args) => console.debug(...args);
3721
+
3722
+ const debugDisabled = () => {};
3723
+
3724
+ const info = (...args) => console.info(...args);
3725
+
3726
+ const infoDisabled = () => {};
3727
+
3728
+ const warn = (...args) => console.warn(...args);
3729
+
3730
+ const warnDisabled = () => {};
3731
+
3732
+ const error = (...args) => console.error(...args);
3733
+
3734
+ const errorDisabled = () => {};
3735
+
3736
+ function hasFlag(flag, argv = process$1.argv) {
3737
+ const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
3738
+ const position = argv.indexOf(prefix + flag);
3739
+ const terminatorPosition = argv.indexOf('--');
3740
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
3741
+ }
3742
+
3743
+ const {
3744
+ env
3745
+ } = process$1;
3746
+ let flagForceColor;
3747
+
3748
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
3749
+ flagForceColor = 0;
3750
+ } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
3751
+ flagForceColor = 1;
3752
+ }
3753
+
3754
+ function envForceColor() {
3755
+ if ('FORCE_COLOR' in env) {
3756
+ if (env.FORCE_COLOR === 'true') {
3757
+ return 1;
3758
+ }
3759
+
3760
+ if (env.FORCE_COLOR === 'false') {
3761
+ return 0;
3762
+ }
3763
+
3764
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
3765
+ }
3766
+ }
3767
+
3768
+ function translateLevel(level) {
3769
+ if (level === 0) {
3770
+ return false;
3771
+ }
3772
+
3773
+ return {
3774
+ level,
3775
+ hasBasic: true,
3776
+ has256: level >= 2,
3777
+ has16m: level >= 3
3778
+ };
3779
+ }
3780
+
3781
+ function _supportsColor(haveStream, {
3782
+ streamIsTTY,
3783
+ sniffFlags = true
3784
+ } = {}) {
3785
+ const noFlagForceColor = envForceColor();
3786
+
3787
+ if (noFlagForceColor !== undefined) {
3788
+ flagForceColor = noFlagForceColor;
3789
+ }
3790
+
3791
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
3792
+
3793
+ if (forceColor === 0) {
3794
+ return 0;
3795
+ }
3796
+
3797
+ if (sniffFlags) {
3798
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
3799
+ return 3;
3800
+ }
3801
+
3802
+ if (hasFlag('color=256')) {
3803
+ return 2;
3804
+ }
3805
+ }
3806
+
3807
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
3808
+ return 0;
3809
+ }
3810
+
3811
+ const min = forceColor || 0;
3812
+
3813
+ if (env.TERM === 'dumb') {
3814
+ return min;
3815
+ }
3816
+
3817
+ if (process$1.platform === 'win32') {
3818
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
3819
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
3820
+ const osRelease = os.release().split('.');
3821
+
3822
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10_586) {
3823
+ return Number(osRelease[2]) >= 14_931 ? 3 : 2;
3824
+ }
3825
+
3826
+ return 1;
3827
+ }
3828
+
3829
+ if ('CI' in env) {
3830
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
3831
+ return 1;
3832
+ }
3833
+
3834
+ return min;
3835
+ }
3836
+
3837
+ if ('TEAMCITY_VERSION' in env) {
3838
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3839
+ } // Check for Azure DevOps pipelines
3840
+
3841
+
3842
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
3843
+ return 1;
3844
+ }
3845
+
3846
+ if (env.COLORTERM === 'truecolor') {
3847
+ return 3;
3848
+ }
3849
+
3850
+ if ('TERM_PROGRAM' in env) {
3851
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
3852
+
3853
+ switch (env.TERM_PROGRAM) {
3854
+ case 'iTerm.app':
3855
+ return version >= 3 ? 3 : 2;
3856
+
3857
+ case 'Apple_Terminal':
3858
+ return 2;
3859
+ // No default
3860
+ }
3861
+ }
3862
+
3863
+ if (/-256(color)?$/i.test(env.TERM)) {
3864
+ return 2;
3865
+ }
3866
+
3867
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
3868
+ return 1;
3869
+ }
3870
+
3871
+ if ('COLORTERM' in env) {
3872
+ return 1;
3873
+ }
3874
+
3875
+ return min;
3876
+ }
3877
+
3878
+ function createSupportsColor(stream, options = {}) {
3879
+ const level = _supportsColor(stream, {
3880
+ streamIsTTY: stream && stream.isTTY,
3881
+ ...options
3882
+ });
3883
+
3884
+ return translateLevel(level);
3885
+ }
3886
+ ({
3887
+ stdout: createSupportsColor({
3888
+ isTTY: tty.isatty(1)
3889
+ }),
3890
+ stderr: createSupportsColor({
3891
+ isTTY: tty.isatty(2)
3892
+ })
3893
+ });
3894
+
3895
+ createSupportsColor(process.stdout).hasBasic;
3896
+ // because stream.isTTY returns false, see https://github.com/actions/runner/issues/241
3897
+
3898
+ if (process.env.GITHUB_WORKFLOW) {
3899
+ // Check on FORCE_COLOR is to ensure it is prio over GitHub workflow check
3900
+ if (process.env.FORCE_COLOR !== "false") ;
3901
+ } // https://github.com/Marak/colors.js/blob/master/lib/styles.js
3902
+
3903
+ function isUnicodeSupported() {
3904
+ if (process$1.platform !== 'win32') {
3905
+ return process$1.env.TERM !== 'linux'; // Linux console (kernel)
3906
+ }
3461
3907
 
3462
- const destroy = () => {
3463
- if (streamOutputSpy) {
3464
- streamOutputSpy(); // this uninstalls the spy
3908
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) // Windows Terminal
3909
+ || process$1.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
3910
+ || process$1.env.TERM_PROGRAM === 'vscode' || process$1.env.TERM === 'xterm-256color' || process$1.env.TERM === 'alacritty' || process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
3911
+ }
3465
3912
 
3466
- streamOutputSpy = null;
3467
- lastOutput = "";
3468
- }
3469
- };
3913
+ // see also https://github.com/sindresorhus/figures
3914
+ isUnicodeSupported();
3470
3915
 
3471
- Object.assign(log, {
3472
- write,
3473
- dynamicWrite,
3474
- destroy
3916
+ const createDetailedMessage$1 = (message, details = {}) => {
3917
+ let string = `${message}`;
3918
+ Object.keys(details).forEach(key => {
3919
+ const value = details[key];
3920
+ string += `
3921
+ --- ${key} ---
3922
+ ${Array.isArray(value) ? value.join(`
3923
+ `) : value}`;
3475
3924
  });
3476
- return log;
3925
+ return string;
3477
3926
  };
3478
3927
 
3479
- const noopStreamSpy = () => ""; // could be inlined but vscode do not correctly
3480
- // expand/collapse template strings, so I put it at the bottom
3928
+ const ESC = '\u001B[';
3929
+ const OSC = '\u001B]';
3930
+ const BEL = '\u0007';
3931
+ const SEP = ';';
3932
+ const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
3933
+ const ansiEscapes = {};
3481
3934
 
3935
+ ansiEscapes.cursorTo = (x, y) => {
3936
+ if (typeof x !== 'number') {
3937
+ throw new TypeError('The `x` argument is required');
3938
+ }
3482
3939
 
3483
- const addNewLines = (string, newLine) => {
3484
- if (newLine === "before") {
3485
- return `
3486
- ${string}`;
3940
+ if (typeof y !== 'number') {
3941
+ return ESC + (x + 1) + 'G';
3487
3942
  }
3488
3943
 
3489
- if (newLine === "after") {
3490
- return `${string}
3491
- `;
3944
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
3945
+ };
3946
+
3947
+ ansiEscapes.cursorMove = (x, y) => {
3948
+ if (typeof x !== 'number') {
3949
+ throw new TypeError('The `x` argument is required');
3492
3950
  }
3493
3951
 
3494
- if (newLine === "around") {
3495
- return `
3496
- ${string}
3497
- `;
3952
+ let returnValue = '';
3953
+
3954
+ if (x < 0) {
3955
+ returnValue += ESC + -x + 'D';
3956
+ } else if (x > 0) {
3957
+ returnValue += ESC + x + 'C';
3498
3958
  }
3499
3959
 
3500
- return string;
3960
+ if (y < 0) {
3961
+ returnValue += ESC + -y + 'A';
3962
+ } else if (y > 0) {
3963
+ returnValue += ESC + y + 'B';
3964
+ }
3965
+
3966
+ return returnValue;
3501
3967
  };
3502
3968
 
3503
- const startSpinner = ({
3504
- log,
3505
- frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
3506
- fps = 20,
3507
- keepProcessAlive = false,
3508
- stopOnWriteFromOutside = true,
3509
- stopOnVerticalOverflow = true,
3510
- render = () => "",
3511
- effect = () => {}
3512
- }) => {
3513
- let frameIndex = 0;
3514
- let interval;
3515
- let running = true;
3516
- const spinner = {
3517
- message: undefined
3518
- };
3969
+ ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
3519
3970
 
3520
- const update = message => {
3521
- spinner.message = running ? `${frames[frameIndex]} ${message}` : message;
3522
- return spinner.message;
3523
- };
3971
+ ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
3524
3972
 
3525
- spinner.update = update;
3526
- let cleanup;
3973
+ ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
3527
3974
 
3528
- if (ANSI.supported) {
3529
- running = true;
3530
- cleanup = effect();
3531
- log.write(update(render()));
3532
- interval = setInterval(() => {
3533
- frameIndex = frameIndex === frames.length - 1 ? 0 : frameIndex + 1;
3534
- log.dynamicWrite(({
3535
- outputFromOutside
3536
- }) => {
3537
- if (outputFromOutside && stopOnWriteFromOutside) {
3538
- stop();
3539
- return "";
3540
- }
3975
+ ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
3541
3976
 
3542
- return update(render());
3543
- });
3544
- }, 1000 / fps);
3977
+ ansiEscapes.cursorLeft = ESC + 'G';
3978
+ ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
3979
+ ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
3980
+ ansiEscapes.cursorGetPosition = ESC + '6n';
3981
+ ansiEscapes.cursorNextLine = ESC + 'E';
3982
+ ansiEscapes.cursorPrevLine = ESC + 'F';
3983
+ ansiEscapes.cursorHide = ESC + '?25l';
3984
+ ansiEscapes.cursorShow = ESC + '?25h';
3545
3985
 
3546
- if (!keepProcessAlive) {
3547
- interval.unref();
3548
- }
3549
- } else {
3550
- log.write(update(render()));
3986
+ ansiEscapes.eraseLines = count => {
3987
+ let clear = '';
3988
+
3989
+ for (let i = 0; i < count; i++) {
3990
+ clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
3551
3991
  }
3552
3992
 
3553
- const stop = message => {
3554
- running = false;
3993
+ if (count) {
3994
+ clear += ansiEscapes.cursorLeft;
3995
+ }
3555
3996
 
3556
- if (interval) {
3557
- clearInterval(interval);
3558
- interval = null;
3559
- }
3997
+ return clear;
3998
+ };
3560
3999
 
3561
- if (cleanup) {
3562
- cleanup();
3563
- cleanup = null;
3564
- }
4000
+ ansiEscapes.eraseEndLine = ESC + 'K';
4001
+ ansiEscapes.eraseStartLine = ESC + '1K';
4002
+ ansiEscapes.eraseLine = ESC + '2K';
4003
+ ansiEscapes.eraseDown = ESC + 'J';
4004
+ ansiEscapes.eraseUp = ESC + '1J';
4005
+ ansiEscapes.eraseScreen = ESC + '2J';
4006
+ ansiEscapes.scrollUp = ESC + 'S';
4007
+ ansiEscapes.scrollDown = ESC + 'T';
4008
+ ansiEscapes.clearScreen = '\u001Bc';
4009
+ ansiEscapes.clearTerminal = process.platform === 'win32' ? `${ansiEscapes.eraseScreen}${ESC}0f` : // 1. Erases the screen (Only done in case `2` is not supported)
4010
+ // 2. Erases the whole screen including scrollback buffer
4011
+ // 3. Moves cursor to the top-left position
4012
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
4013
+ `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
4014
+ ansiEscapes.beep = BEL;
3565
4015
 
3566
- if (log && message) {
3567
- log.write(update(message));
3568
- log = null;
3569
- }
3570
- };
4016
+ ansiEscapes.link = (text, url) => {
4017
+ return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
4018
+ };
3571
4019
 
3572
- spinner.stop = stop;
4020
+ ansiEscapes.image = (buffer, options = {}) => {
4021
+ let returnValue = `${OSC}1337;File=inline=1`;
3573
4022
 
3574
- if (stopOnVerticalOverflow) {
3575
- log.onVerticalOverflow = stop;
4023
+ if (options.width) {
4024
+ returnValue += `;width=${options.width}`;
3576
4025
  }
3577
4026
 
3578
- return spinner;
3579
- };
4027
+ if (options.height) {
4028
+ returnValue += `;height=${options.height}`;
4029
+ }
3580
4030
 
3581
- const createTaskLog = (label, {
3582
- disabled = false,
3583
- stopOnWriteFromOutside
3584
- } = {}) => {
3585
- if (disabled) {
3586
- return {
3587
- setRightText: () => {},
3588
- done: () => {},
3589
- happen: () => {},
3590
- fail: () => {}
3591
- };
4031
+ if (options.preserveAspectRatio === false) {
4032
+ returnValue += ';preserveAspectRatio=0';
3592
4033
  }
3593
4034
 
3594
- const startMs = Date.now();
3595
- const log = createLog();
3596
- let message = label;
3597
- const taskSpinner = startSpinner({
3598
- log,
3599
- render: () => message,
3600
- stopOnWriteFromOutside
3601
- });
3602
- return {
3603
- setRightText: value => {
3604
- message = `${label} ${value}`;
3605
- },
3606
- done: () => {
3607
- const msEllapsed = Date.now() - startMs;
3608
- taskSpinner.stop(`${UNICODE.OK} ${label} (done in ${msAsDuration(msEllapsed)})`);
3609
- },
3610
- happen: message => {
3611
- taskSpinner.stop(`${UNICODE.INFO} ${message} (at ${new Date().toLocaleTimeString()})`);
3612
- },
3613
- fail: (message = `failed to ${label}`) => {
3614
- taskSpinner.stop(`${UNICODE.FAILURE} ${message}`);
4035
+ return returnValue + ':' + buffer.toString('base64') + BEL;
4036
+ };
4037
+
4038
+ ansiEscapes.iTerm = {
4039
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
4040
+ annotation: (message, options = {}) => {
4041
+ let returnValue = `${OSC}1337;`;
4042
+ const hasX = typeof options.x !== 'undefined';
4043
+ const hasY = typeof options.y !== 'undefined';
4044
+
4045
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
4046
+ throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
3615
4047
  }
3616
- };
4048
+
4049
+ message = message.replace(/\|/g, '');
4050
+ returnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
4051
+
4052
+ if (options.length > 0) {
4053
+ returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join('|');
4054
+ } else {
4055
+ returnValue += message;
4056
+ }
4057
+
4058
+ return returnValue + BEL;
4059
+ }
3617
4060
  };
3618
4061
 
3619
4062
  const memoize = compute => {
@@ -9096,7 +9539,7 @@ const createResolveUrlError = ({
9096
9539
  reason,
9097
9540
  ...details
9098
9541
  }) => {
9099
- const resolveError = new Error(createDetailedMessage$1(`Failed to resolve url reference`, {
9542
+ const resolveError = new Error(createDetailedMessage$2(`Failed to resolve url reference`, {
9100
9543
  reason,
9101
9544
  ...details,
9102
9545
  "specifier": `"${reference.specifier}"`,
@@ -9132,7 +9575,7 @@ const createFetchUrlContentError = ({
9132
9575
  reason,
9133
9576
  ...details
9134
9577
  }) => {
9135
- const fetchError = new Error(createDetailedMessage$1(`Failed to fetch url content`, {
9578
+ const fetchError = new Error(createDetailedMessage$2(`Failed to fetch url content`, {
9136
9579
  reason,
9137
9580
  ...details,
9138
9581
  "url": urlInfo.url,
@@ -9188,7 +9631,7 @@ const createTransformUrlContentError = ({
9188
9631
  reason,
9189
9632
  ...details
9190
9633
  }) => {
9191
- const transformError = new Error(createDetailedMessage$1(`"transformUrlContent" error on "${urlInfo.type}"`, {
9634
+ const transformError = new Error(createDetailedMessage$2(`"transformUrlContent" error on "${urlInfo.type}"`, {
9192
9635
  reason,
9193
9636
  ...details,
9194
9637
  "url": urlInfo.url,
@@ -9244,7 +9687,7 @@ const createFinalizeUrlContentError = ({
9244
9687
  urlInfo,
9245
9688
  error
9246
9689
  }) => {
9247
- const finalizeError = new Error(createDetailedMessage$1(`"finalizeUrlContent" error on "${urlInfo.type}"`, { ...detailsFromValueThrown(error),
9690
+ const finalizeError = new Error(createDetailedMessage$2(`"finalizeUrlContent" error on "${urlInfo.type}"`, { ...detailsFromValueThrown(error),
9248
9691
  "url": urlInfo.url,
9249
9692
  "url reference trace": reference.trace.message,
9250
9693
  ...detailsFromPluginController(pluginController)
@@ -9506,7 +9949,7 @@ const createKitchen = ({
9506
9949
  writeGeneratedFiles,
9507
9950
  outDirectoryUrl
9508
9951
  }) => {
9509
- const logger = createLogger({
9952
+ const logger = createLogger$1({
9510
9953
  logLevel
9511
9954
  });
9512
9955
  const pluginController = createPluginController({
@@ -9771,7 +10214,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
9771
10214
  const fetchUrlContentReturnValue = await pluginController.callAsyncHooksUntil("fetchUrlContent", urlInfo, contextDuringFetch);
9772
10215
 
9773
10216
  if (!fetchUrlContentReturnValue) {
9774
- logger.warn(createDetailedMessage$1(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
10217
+ logger.warn(createDetailedMessage$2(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
9775
10218
  "url": urlInfo.url,
9776
10219
  "url reference trace": reference.trace.message
9777
10220
  }));
@@ -17270,7 +17713,7 @@ const buildWithRollup = async ({
17270
17713
  return resultRef.current;
17271
17714
  } catch (e) {
17272
17715
  if (e.code === "MISSING_EXPORT") {
17273
- const detailedMessage = createDetailedMessage$1(e.message, {
17716
+ const detailedMessage = createDetailedMessage$2(e.message, {
17274
17717
  frame: e.frame
17275
17718
  });
17276
17719
  throw new Error(detailedMessage, {
@@ -23835,7 +24278,7 @@ const build = async ({
23835
24278
  signal,
23836
24279
  logLevel
23837
24280
  }) => {
23838
- const logger = createLogger({
24281
+ const logger = createLogger$1({
23839
24282
  logLevel
23840
24283
  });
23841
24284
  const buildOperation = Abort.startOperation();
@@ -24151,7 +24594,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
24151
24594
  const rawUrlInfo = rawGraph.getUrlInfo(rawUrl);
24152
24595
 
24153
24596
  if (!rawUrlInfo) {
24154
- throw new Error(createDetailedMessage$1(`Cannot find url`, {
24597
+ throw new Error(createDetailedMessage$2(`Cannot find url`, {
24155
24598
  url,
24156
24599
  "raw urls": Object.values(buildToRawUrls),
24157
24600
  "build urls": Object.keys(buildToRawUrls)
@@ -25788,7 +26231,7 @@ const startDevServer = async ({
25788
26231
  // and mitigates https://github.com/actions/runner-images/issues/3885
25789
26232
  writeGeneratedFiles = !process.env.CI
25790
26233
  }) => {
25791
- const logger = createLogger({
26234
+ const logger = createLogger$1({
25792
26235
  logLevel
25793
26236
  });
25794
26237
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -26134,7 +26577,7 @@ const readNodeV8CoverageDirectory = async ({
26134
26577
  return tryReadJsonFile();
26135
26578
  }
26136
26579
 
26137
- console.warn(createDetailedMessage$1(`Error while reading coverage file`, {
26580
+ console.warn(createDetailedMessage$2(`Error while reading coverage file`, {
26138
26581
  "error stack": e.stack,
26139
26582
  "file": dirEntryUrl
26140
26583
  }));
@@ -26308,7 +26751,7 @@ const composeV8AndIstanbul = (v8FileByFileCoverage, istanbulFileByFileCoverage,
26308
26751
 
26309
26752
  if (v8Coverage) {
26310
26753
  if (coverageV8ConflictWarning) {
26311
- console.warn(createDetailedMessage$1(`Coverage conflict on "${key}", found two coverage that cannot be merged together: v8 and istanbul. The istanbul coverage will be ignored.`, {
26754
+ console.warn(createDetailedMessage$2(`Coverage conflict on "${key}", found two coverage that cannot be merged together: v8 and istanbul. The istanbul coverage will be ignored.`, {
26312
26755
  details: `This happens when a file is executed on a runtime using v8 coverage (node or chromium) and on runtime using istanbul coverage (firefox or webkit)`,
26313
26756
  suggestion: "You can disable this warning with coverageV8ConflictWarning: false"
26314
26757
  }));
@@ -26835,7 +27278,7 @@ const generateFileExecutionSteps = ({
26835
27278
  }
26836
27279
 
26837
27280
  if (typeof stepConfig !== "object") {
26838
- throw new TypeError(createDetailedMessage$1(`found unexpected value in plan, they must be object`, {
27281
+ throw new TypeError(createDetailedMessage$2(`found unexpected value in plan, they must be object`, {
26839
27282
  ["file relative path"]: fileRelativeUrl,
26840
27283
  ["execution name"]: executionName,
26841
27284
  ["value"]: stepConfig
@@ -27303,7 +27746,7 @@ const executePlan = async (plan, {
27303
27746
  }
27304
27747
  });
27305
27748
  });
27306
- logger.debug(createDetailedMessage$1(`Prepare executing plan`, {
27749
+ logger.debug(createDetailedMessage$2(`Prepare executing plan`, {
27307
27750
  runtimes: JSON.stringify(runtimes, null, " ")
27308
27751
  }));
27309
27752
  const multipleExecutionsOperation = Abort.startOperation();
@@ -27335,7 +27778,7 @@ const executePlan = async (plan, {
27335
27778
  await ensureEmptyDirectory(process.env.NODE_V8_COVERAGE);
27336
27779
  } else {
27337
27780
  coverageMethodForNodeJs = "Profiler";
27338
- logger.warn(createDetailedMessage$1(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
27781
+ logger.warn(createDetailedMessage$2(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
27339
27782
  "suggestion": `set process.env.NODE_V8_COVERAGE`,
27340
27783
  "suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
27341
27784
  }));
@@ -27808,7 +28251,7 @@ const executeTestPlan = async ({
27808
28251
  coverageReportJsonFile = process.env.CI ? null : "./.coverage/coverage.json",
27809
28252
  coverageReportHtmlDirectory = process.env.CI ? "./.coverage/" : null
27810
28253
  }) => {
27811
- const logger = createLogger({
28254
+ const logger = createLogger$1({
27812
28255
  logLevel
27813
28256
  });
27814
28257
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -27845,7 +28288,7 @@ const executeTestPlan = async ({
27845
28288
 
27846
28289
  if (patternsMatchingCoverAndExecute.length) {
27847
28290
  // It would be strange, for a given file to be both covered and executed
27848
- throw new Error(createDetailedMessage$1(`some file will be both covered and executed`, {
28291
+ throw new Error(createDetailedMessage$2(`some file will be both covered and executed`, {
27849
28292
  patterns: patternsMatchingCoverAndExecute
27850
28293
  }));
27851
28294
  }
@@ -28395,7 +28838,7 @@ const importPlaywright = async ({
28395
28838
  return namespace;
28396
28839
  } catch (e) {
28397
28840
  if (e.code === "ERR_MODULE_NOT_FOUND") {
28398
- throw new Error(createDetailedMessage$1(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
28841
+ throw new Error(createDetailedMessage$2(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
28399
28842
  suggestion: `npm install --save-dev playwright`
28400
28843
  }), {
28401
28844
  cause: e
@@ -28563,7 +29006,7 @@ const createChildExecOptions = async ({
28563
29006
  debugModeInheritBreak = true
28564
29007
  } = {}) => {
28565
29008
  if (typeof debugMode === "string" && AVAILABLE_DEBUG_MODE.indexOf(debugMode) === -1) {
28566
- throw new TypeError(createDetailedMessage$1(`unexpected debug mode.`, {
29009
+ throw new TypeError(createDetailedMessage$2(`unexpected debug mode.`, {
28567
29010
  ["debug mode"]: debugMode,
28568
29011
  ["allowed debug mode"]: AVAILABLE_DEBUG_MODE
28569
29012
  }));
@@ -28860,7 +29303,7 @@ nodeChildProcess.run = async ({
28860
29303
  stdio: ["pipe", "pipe", "pipe", "ipc"],
28861
29304
  env: envForChildProcess
28862
29305
  });
28863
- logger.debug(createDetailedMessage$1(`child process forked (pid ${childProcess.pid})`, {
29306
+ logger.debug(createDetailedMessage$2(`child process forked (pid ${childProcess.pid})`, {
28864
29307
  "execArgv": execArgv.join(`\n`),
28865
29308
  "custom env": JSON.stringify(env, null, " ")
28866
29309
  })); // if we pass stream, pipe them https://github.com/sindresorhus/execa/issues/81
@@ -29458,7 +29901,7 @@ const startBuildServer = async ({
29458
29901
  buildServerMainFile = getCallerPosition().url,
29459
29902
  cooldownBetweenFileEvents
29460
29903
  }) => {
29461
- const logger = createLogger({
29904
+ const logger = createLogger$1({
29462
29905
  logLevel
29463
29906
  });
29464
29907
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -29683,7 +30126,7 @@ const execute = async ({
29683
30126
  runtimeParams,
29684
30127
  ignoreError = false
29685
30128
  }) => {
29686
- const logger = createLogger({
30129
+ const logger = createLogger$1({
29687
30130
  logLevel
29688
30131
  });
29689
30132
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);