@jsenv/core 29.1.5 → 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.
- package/dist/main.js +822 -348
- 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$
|
|
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) +
|
|
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`
|
|
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
|
-
|
|
3309
|
-
|
|
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 = () => {
|
|
@@ -3486,134 +3487,576 @@ const addNewLines = (string, newLine) => {
|
|
|
3486
3487
|
${string}`;
|
|
3487
3488
|
}
|
|
3488
3489
|
|
|
3489
|
-
if (newLine === "after") {
|
|
3490
|
-
return `${string}
|
|
3491
|
-
`;
|
|
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
|
+
}
|
|
3907
|
+
|
|
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
|
+
}
|
|
3912
|
+
|
|
3913
|
+
// see also https://github.com/sindresorhus/figures
|
|
3914
|
+
isUnicodeSupported();
|
|
3915
|
+
|
|
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}`;
|
|
3924
|
+
});
|
|
3925
|
+
return string;
|
|
3926
|
+
};
|
|
3927
|
+
|
|
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 = {};
|
|
3934
|
+
|
|
3935
|
+
ansiEscapes.cursorTo = (x, y) => {
|
|
3936
|
+
if (typeof x !== 'number') {
|
|
3937
|
+
throw new TypeError('The `x` argument is required');
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
if (typeof y !== 'number') {
|
|
3941
|
+
return ESC + (x + 1) + 'G';
|
|
3942
|
+
}
|
|
3943
|
+
|
|
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');
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
let returnValue = '';
|
|
3953
|
+
|
|
3954
|
+
if (x < 0) {
|
|
3955
|
+
returnValue += ESC + -x + 'D';
|
|
3956
|
+
} else if (x > 0) {
|
|
3957
|
+
returnValue += ESC + x + 'C';
|
|
3492
3958
|
}
|
|
3493
3959
|
|
|
3494
|
-
if (
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3960
|
+
if (y < 0) {
|
|
3961
|
+
returnValue += ESC + -y + 'A';
|
|
3962
|
+
} else if (y > 0) {
|
|
3963
|
+
returnValue += ESC + y + 'B';
|
|
3498
3964
|
}
|
|
3499
3965
|
|
|
3500
|
-
return
|
|
3966
|
+
return returnValue;
|
|
3501
3967
|
};
|
|
3502
3968
|
|
|
3503
|
-
|
|
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
|
-
|
|
3521
|
-
spinner.message = running ? `${frames[frameIndex]} ${message}` : message;
|
|
3522
|
-
return spinner.message;
|
|
3523
|
-
};
|
|
3971
|
+
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
|
|
3524
3972
|
|
|
3525
|
-
|
|
3526
|
-
let cleanup;
|
|
3973
|
+
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
|
|
3527
3974
|
|
|
3528
|
-
|
|
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
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
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
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
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
|
-
|
|
3554
|
-
|
|
3993
|
+
if (count) {
|
|
3994
|
+
clear += ansiEscapes.cursorLeft;
|
|
3995
|
+
}
|
|
3555
3996
|
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
interval = null;
|
|
3559
|
-
}
|
|
3997
|
+
return clear;
|
|
3998
|
+
};
|
|
3560
3999
|
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
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
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
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
|
-
|
|
4020
|
+
ansiEscapes.image = (buffer, options = {}) => {
|
|
4021
|
+
let returnValue = `${OSC}1337;File=inline=1`;
|
|
3573
4022
|
|
|
3574
|
-
if (
|
|
3575
|
-
|
|
4023
|
+
if (options.width) {
|
|
4024
|
+
returnValue += `;width=${options.width}`;
|
|
3576
4025
|
}
|
|
3577
4026
|
|
|
3578
|
-
|
|
3579
|
-
}
|
|
4027
|
+
if (options.height) {
|
|
4028
|
+
returnValue += `;height=${options.height}`;
|
|
4029
|
+
}
|
|
3580
4030
|
|
|
3581
|
-
|
|
3582
|
-
|
|
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
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
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 => {
|
|
@@ -4450,8 +4893,10 @@ const observableFromValue = value => {
|
|
|
4450
4893
|
};
|
|
4451
4894
|
|
|
4452
4895
|
// https://github.com/jamestalmage/stream-to-observable/blob/master/index.js
|
|
4453
|
-
const
|
|
4454
|
-
|
|
4896
|
+
const observableFromNodeStream = (nodeStream, {
|
|
4897
|
+
readableStreamLifetime = 120_000 // 2s
|
|
4898
|
+
|
|
4899
|
+
} = {}) => {
|
|
4455
4900
|
const observable = createObservable(({
|
|
4456
4901
|
next,
|
|
4457
4902
|
error,
|
|
@@ -4490,13 +4935,13 @@ const nodeStreamToObservable = nodeStream => {
|
|
|
4490
4935
|
// safe measure, ensure the readable stream gets
|
|
4491
4936
|
// used in the next ${readableStreamLifetimeInSeconds} otherwise destroys it
|
|
4492
4937
|
const timeout = setTimeout(() => {
|
|
4493
|
-
process.emitWarning(`Readable stream not used after ${
|
|
4938
|
+
process.emitWarning(`Readable stream not used after ${readableStreamLifetime / 1000} seconds. It will be destroyed to release resources`, {
|
|
4494
4939
|
CODE: "READABLE_STREAM_TIMEOUT",
|
|
4495
4940
|
// url is for http client request
|
|
4496
4941
|
detail: `path: ${nodeStream.path}, fd: ${nodeStream.fd}, url: ${nodeStream.url}`
|
|
4497
4942
|
});
|
|
4498
4943
|
nodeStream.destroy();
|
|
4499
|
-
},
|
|
4944
|
+
}, readableStreamLifetime);
|
|
4500
4945
|
observable.timeout = timeout;
|
|
4501
4946
|
onceReadableStreamUsedOrClosed(nodeStream, () => {
|
|
4502
4947
|
clearTimeout(timeout);
|
|
@@ -4550,10 +4995,13 @@ const headersFromObject = headersObject => {
|
|
|
4550
4995
|
|
|
4551
4996
|
const fromNodeRequest = (nodeRequest, {
|
|
4552
4997
|
serverOrigin,
|
|
4553
|
-
signal
|
|
4998
|
+
signal,
|
|
4999
|
+
requestBodyLifetime
|
|
4554
5000
|
}) => {
|
|
4555
5001
|
const headers = headersFromObject(nodeRequest.headers);
|
|
4556
|
-
const body =
|
|
5002
|
+
const body = observableFromNodeStream(nodeRequest, {
|
|
5003
|
+
readableStreamLifetime: requestBodyLifetime
|
|
5004
|
+
});
|
|
4557
5005
|
let requestOrigin;
|
|
4558
5006
|
|
|
4559
5007
|
if (nodeRequest.upgrade) {
|
|
@@ -4671,7 +5119,7 @@ const normalizeBodyMethods = body => {
|
|
|
4671
5119
|
|
|
4672
5120
|
if (isNodeStream(body)) {
|
|
4673
5121
|
return {
|
|
4674
|
-
asObservable: () =>
|
|
5122
|
+
asObservable: () => observableFromNodeStream(body),
|
|
4675
5123
|
destroy: () => {
|
|
4676
5124
|
body.destroy();
|
|
4677
5125
|
}
|
|
@@ -4702,7 +5150,7 @@ const fileHandleToReadableStream = fileHandle => {
|
|
|
4702
5150
|
};
|
|
4703
5151
|
|
|
4704
5152
|
const fileHandleToObservable = fileHandle => {
|
|
4705
|
-
return
|
|
5153
|
+
return observableFromNodeStream(fileHandleToReadableStream(fileHandle));
|
|
4706
5154
|
};
|
|
4707
5155
|
|
|
4708
5156
|
const isNodeStream = value => {
|
|
@@ -4717,7 +5165,7 @@ const isNodeStream = value => {
|
|
|
4717
5165
|
return false;
|
|
4718
5166
|
};
|
|
4719
5167
|
|
|
4720
|
-
const
|
|
5168
|
+
const writeNodeResponse = async (responseStream, {
|
|
4721
5169
|
status,
|
|
4722
5170
|
statusText,
|
|
4723
5171
|
headers,
|
|
@@ -5487,7 +5935,16 @@ const startServer = async ({
|
|
|
5487
5935
|
"request url": request.url,
|
|
5488
5936
|
"request headers": JSON.stringify(request.headers, null, " ")
|
|
5489
5937
|
}));
|
|
5490
|
-
}
|
|
5938
|
+
},
|
|
5939
|
+
// timeAllocated to start responding to a request
|
|
5940
|
+
// after this delay the server will respond with 504
|
|
5941
|
+
responseTimeout = 60_000 * 10,
|
|
5942
|
+
// 10s
|
|
5943
|
+
// time allocated to server code to start reading the request body
|
|
5944
|
+
// after this delay the underlying stream is destroyed, attempting to read it would throw
|
|
5945
|
+
// if used the stream stays opened, it's only if the stream is not read at all that it gets destroyed
|
|
5946
|
+
requestBodyLifetime = 60_000 * 2 // 2s
|
|
5947
|
+
|
|
5491
5948
|
} = {}) => {
|
|
5492
5949
|
const logger = createLogger({
|
|
5493
5950
|
logLevel
|
|
@@ -5972,7 +6429,7 @@ const startServer = async ({
|
|
|
5972
6429
|
abortController.abort();
|
|
5973
6430
|
} else if (!http2Stream.pushAllowed) {
|
|
5974
6431
|
abortController.abort();
|
|
5975
|
-
} else if (responseProperties
|
|
6432
|
+
} else if (responseProperties.requestAborted) {} else {
|
|
5976
6433
|
const responseLength = responseProperties.headers["content-length"] || 0;
|
|
5977
6434
|
const {
|
|
5978
6435
|
effectiveRecvDataLength,
|
|
@@ -6047,87 +6504,104 @@ const startServer = async ({
|
|
|
6047
6504
|
let handleRequestReturnValue;
|
|
6048
6505
|
let errorWhileHandlingRequest = null;
|
|
6049
6506
|
let handleRequestTimings = serverTiming ? {} : null;
|
|
6507
|
+
let timeout;
|
|
6508
|
+
const timeoutPromise = new Promise(resolve => {
|
|
6509
|
+
timeout = setTimeout(() => {
|
|
6510
|
+
resolve({
|
|
6511
|
+
// the correct status code should be 500 because it's
|
|
6512
|
+
// we don't really know what takes time
|
|
6513
|
+
// in practice it's often because server is trying to reach an other server
|
|
6514
|
+
// that is not responding so 504 is more correct
|
|
6515
|
+
status: 504,
|
|
6516
|
+
statusText: `server timeout after ${responseTimeout / 1000}s waiting to handle request`
|
|
6517
|
+
});
|
|
6518
|
+
}, responseTimeout);
|
|
6519
|
+
});
|
|
6520
|
+
const handleRequestPromise = serviceController.callAsyncHooksUntil("handleRequest", request, {
|
|
6521
|
+
timing: handleRequestTimings,
|
|
6522
|
+
warn,
|
|
6523
|
+
pushResponse: async ({
|
|
6524
|
+
path,
|
|
6525
|
+
method
|
|
6526
|
+
}) => {
|
|
6527
|
+
if (typeof path !== "string" || path[0] !== "/") {
|
|
6528
|
+
addRequestLog(requestNode, {
|
|
6529
|
+
type: "warn",
|
|
6530
|
+
value: `response push ignored because path is invalid (must be a string starting with "/", found ${path})`
|
|
6531
|
+
});
|
|
6532
|
+
return;
|
|
6533
|
+
}
|
|
6050
6534
|
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
}) => {
|
|
6059
|
-
if (typeof path !== "string" || path[0] !== "/") {
|
|
6060
|
-
addRequestLog(requestNode, {
|
|
6061
|
-
type: "warn",
|
|
6062
|
-
value: `response push ignored because path is invalid (must be a string starting with "/", found ${path})`
|
|
6063
|
-
});
|
|
6064
|
-
return;
|
|
6065
|
-
}
|
|
6066
|
-
|
|
6067
|
-
if (!request.http2) {
|
|
6068
|
-
addRequestLog(requestNode, {
|
|
6069
|
-
type: "warn",
|
|
6070
|
-
value: `response push ignored because request is not http2`
|
|
6071
|
-
});
|
|
6072
|
-
return;
|
|
6073
|
-
}
|
|
6074
|
-
|
|
6075
|
-
const canPushStream = testCanPushStream(nodeResponse.stream);
|
|
6535
|
+
if (!request.http2) {
|
|
6536
|
+
addRequestLog(requestNode, {
|
|
6537
|
+
type: "warn",
|
|
6538
|
+
value: `response push ignored because request is not http2`
|
|
6539
|
+
});
|
|
6540
|
+
return;
|
|
6541
|
+
}
|
|
6076
6542
|
|
|
6077
|
-
|
|
6078
|
-
addRequestLog(requestNode, {
|
|
6079
|
-
type: "debug",
|
|
6080
|
-
value: `response push ignored because ${canPushStream.reason}`
|
|
6081
|
-
});
|
|
6082
|
-
return;
|
|
6083
|
-
}
|
|
6543
|
+
const canPushStream = testCanPushStream(nodeResponse.stream);
|
|
6084
6544
|
|
|
6085
|
-
|
|
6545
|
+
if (!canPushStream.can) {
|
|
6546
|
+
addRequestLog(requestNode, {
|
|
6547
|
+
type: "debug",
|
|
6548
|
+
value: `response push ignored because ${canPushStream.reason}`
|
|
6549
|
+
});
|
|
6550
|
+
return;
|
|
6551
|
+
}
|
|
6086
6552
|
|
|
6087
|
-
|
|
6088
|
-
preventedByService = serviceController.getCurrentService();
|
|
6089
|
-
};
|
|
6553
|
+
let preventedByService = null;
|
|
6090
6554
|
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
}, {
|
|
6095
|
-
request,
|
|
6096
|
-
warn,
|
|
6097
|
-
prevent
|
|
6098
|
-
}, () => preventedByService);
|
|
6099
|
-
|
|
6100
|
-
if (preventedByService) {
|
|
6101
|
-
addRequestLog(requestNode, {
|
|
6102
|
-
type: "debug",
|
|
6103
|
-
value: `response push prevented by "${preventedByService.name}" service`
|
|
6104
|
-
});
|
|
6105
|
-
return;
|
|
6106
|
-
}
|
|
6555
|
+
const prevent = () => {
|
|
6556
|
+
preventedByService = serviceController.getCurrentService();
|
|
6557
|
+
};
|
|
6107
6558
|
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6559
|
+
serviceController.callHooksUntil("onResponsePush", {
|
|
6560
|
+
path,
|
|
6561
|
+
method
|
|
6562
|
+
}, {
|
|
6563
|
+
request,
|
|
6564
|
+
warn,
|
|
6565
|
+
prevent
|
|
6566
|
+
}, () => preventedByService);
|
|
6567
|
+
|
|
6568
|
+
if (preventedByService) {
|
|
6569
|
+
addRequestLog(requestNode, {
|
|
6570
|
+
type: "debug",
|
|
6571
|
+
value: `response push prevented by "${preventedByService.name}" service`
|
|
6119
6572
|
});
|
|
6573
|
+
return;
|
|
6120
6574
|
}
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6575
|
+
|
|
6576
|
+
const requestChildNode = {
|
|
6577
|
+
logs: [],
|
|
6578
|
+
children: []
|
|
6579
|
+
};
|
|
6580
|
+
requestNode.children.push(requestChildNode);
|
|
6581
|
+
await pushResponse({
|
|
6582
|
+
path,
|
|
6583
|
+
method
|
|
6584
|
+
}, {
|
|
6585
|
+
requestNode: requestChildNode,
|
|
6586
|
+
parentHttp2Stream: nodeResponse.stream
|
|
6587
|
+
});
|
|
6588
|
+
}
|
|
6589
|
+
});
|
|
6590
|
+
|
|
6591
|
+
try {
|
|
6592
|
+
handleRequestReturnValue = await Promise.race([timeoutPromise, handleRequestPromise]);
|
|
6593
|
+
} catch (e) {
|
|
6594
|
+
errorWhileHandlingRequest = e;
|
|
6124
6595
|
}
|
|
6125
6596
|
|
|
6597
|
+
clearTimeout(timeout);
|
|
6126
6598
|
let responseProperties;
|
|
6127
6599
|
|
|
6128
6600
|
if (errorWhileHandlingRequest) {
|
|
6129
6601
|
if (errorWhileHandlingRequest.name === "AbortError" && request.signal.aborted) {
|
|
6130
|
-
responseProperties =
|
|
6602
|
+
responseProperties = {
|
|
6603
|
+
requestAborted: true
|
|
6604
|
+
};
|
|
6131
6605
|
} else {
|
|
6132
6606
|
// internal error, create 500 response
|
|
6133
6607
|
if ( // stopOnInternalError stops server only if requestToResponse generated
|
|
@@ -6237,7 +6711,7 @@ const startServer = async ({
|
|
|
6237
6711
|
await new Promise(resolve => setTimeout(resolve));
|
|
6238
6712
|
}
|
|
6239
6713
|
|
|
6240
|
-
await
|
|
6714
|
+
await writeNodeResponse(responseStream, responseProperties, {
|
|
6241
6715
|
signal,
|
|
6242
6716
|
ignoreBody,
|
|
6243
6717
|
onAbort: () => {
|
|
@@ -6348,7 +6822,8 @@ const startServer = async ({
|
|
|
6348
6822
|
});
|
|
6349
6823
|
const request = fromNodeRequest(nodeRequest, {
|
|
6350
6824
|
serverOrigin: websocketOrigin,
|
|
6351
|
-
signal: new AbortController().signal
|
|
6825
|
+
signal: new AbortController().signal,
|
|
6826
|
+
requestBodyLifetime
|
|
6352
6827
|
});
|
|
6353
6828
|
serviceController.callAsyncHooksUntil("handleWebsocket", websocket, {
|
|
6354
6829
|
request
|
|
@@ -6456,7 +6931,6 @@ const testCanPushStream = http2Stream => {
|
|
|
6456
6931
|
};
|
|
6457
6932
|
};
|
|
6458
6933
|
|
|
6459
|
-
const ABORTED_RESPONSE_PROPERTIES = {};
|
|
6460
6934
|
const PROCESS_TEARDOWN_EVENTS_MAP = {
|
|
6461
6935
|
SIGHUP: STOP_REASON_PROCESS_SIGHUP,
|
|
6462
6936
|
SIGTERM: STOP_REASON_PROCESS_SIGTERM,
|
|
@@ -9065,7 +9539,7 @@ const createResolveUrlError = ({
|
|
|
9065
9539
|
reason,
|
|
9066
9540
|
...details
|
|
9067
9541
|
}) => {
|
|
9068
|
-
const resolveError = new Error(createDetailedMessage$
|
|
9542
|
+
const resolveError = new Error(createDetailedMessage$2(`Failed to resolve url reference`, {
|
|
9069
9543
|
reason,
|
|
9070
9544
|
...details,
|
|
9071
9545
|
"specifier": `"${reference.specifier}"`,
|
|
@@ -9101,7 +9575,7 @@ const createFetchUrlContentError = ({
|
|
|
9101
9575
|
reason,
|
|
9102
9576
|
...details
|
|
9103
9577
|
}) => {
|
|
9104
|
-
const fetchError = new Error(createDetailedMessage$
|
|
9578
|
+
const fetchError = new Error(createDetailedMessage$2(`Failed to fetch url content`, {
|
|
9105
9579
|
reason,
|
|
9106
9580
|
...details,
|
|
9107
9581
|
"url": urlInfo.url,
|
|
@@ -9157,7 +9631,7 @@ const createTransformUrlContentError = ({
|
|
|
9157
9631
|
reason,
|
|
9158
9632
|
...details
|
|
9159
9633
|
}) => {
|
|
9160
|
-
const transformError = new Error(createDetailedMessage$
|
|
9634
|
+
const transformError = new Error(createDetailedMessage$2(`"transformUrlContent" error on "${urlInfo.type}"`, {
|
|
9161
9635
|
reason,
|
|
9162
9636
|
...details,
|
|
9163
9637
|
"url": urlInfo.url,
|
|
@@ -9213,7 +9687,7 @@ const createFinalizeUrlContentError = ({
|
|
|
9213
9687
|
urlInfo,
|
|
9214
9688
|
error
|
|
9215
9689
|
}) => {
|
|
9216
|
-
const finalizeError = new Error(createDetailedMessage$
|
|
9690
|
+
const finalizeError = new Error(createDetailedMessage$2(`"finalizeUrlContent" error on "${urlInfo.type}"`, { ...detailsFromValueThrown(error),
|
|
9217
9691
|
"url": urlInfo.url,
|
|
9218
9692
|
"url reference trace": reference.trace.message,
|
|
9219
9693
|
...detailsFromPluginController(pluginController)
|
|
@@ -9475,7 +9949,7 @@ const createKitchen = ({
|
|
|
9475
9949
|
writeGeneratedFiles,
|
|
9476
9950
|
outDirectoryUrl
|
|
9477
9951
|
}) => {
|
|
9478
|
-
const logger = createLogger({
|
|
9952
|
+
const logger = createLogger$1({
|
|
9479
9953
|
logLevel
|
|
9480
9954
|
});
|
|
9481
9955
|
const pluginController = createPluginController({
|
|
@@ -9740,7 +10214,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
9740
10214
|
const fetchUrlContentReturnValue = await pluginController.callAsyncHooksUntil("fetchUrlContent", urlInfo, contextDuringFetch);
|
|
9741
10215
|
|
|
9742
10216
|
if (!fetchUrlContentReturnValue) {
|
|
9743
|
-
logger.warn(createDetailedMessage$
|
|
10217
|
+
logger.warn(createDetailedMessage$2(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
|
|
9744
10218
|
"url": urlInfo.url,
|
|
9745
10219
|
"url reference trace": reference.trace.message
|
|
9746
10220
|
}));
|
|
@@ -17239,7 +17713,7 @@ const buildWithRollup = async ({
|
|
|
17239
17713
|
return resultRef.current;
|
|
17240
17714
|
} catch (e) {
|
|
17241
17715
|
if (e.code === "MISSING_EXPORT") {
|
|
17242
|
-
const detailedMessage = createDetailedMessage$
|
|
17716
|
+
const detailedMessage = createDetailedMessage$2(e.message, {
|
|
17243
17717
|
frame: e.frame
|
|
17244
17718
|
});
|
|
17245
17719
|
throw new Error(detailedMessage, {
|
|
@@ -23804,7 +24278,7 @@ const build = async ({
|
|
|
23804
24278
|
signal,
|
|
23805
24279
|
logLevel
|
|
23806
24280
|
}) => {
|
|
23807
|
-
const logger = createLogger({
|
|
24281
|
+
const logger = createLogger$1({
|
|
23808
24282
|
logLevel
|
|
23809
24283
|
});
|
|
23810
24284
|
const buildOperation = Abort.startOperation();
|
|
@@ -24120,7 +24594,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24120
24594
|
const rawUrlInfo = rawGraph.getUrlInfo(rawUrl);
|
|
24121
24595
|
|
|
24122
24596
|
if (!rawUrlInfo) {
|
|
24123
|
-
throw new Error(createDetailedMessage$
|
|
24597
|
+
throw new Error(createDetailedMessage$2(`Cannot find url`, {
|
|
24124
24598
|
url,
|
|
24125
24599
|
"raw urls": Object.values(buildToRawUrls),
|
|
24126
24600
|
"build urls": Object.keys(buildToRawUrls)
|
|
@@ -25757,7 +26231,7 @@ const startDevServer = async ({
|
|
|
25757
26231
|
// and mitigates https://github.com/actions/runner-images/issues/3885
|
|
25758
26232
|
writeGeneratedFiles = !process.env.CI
|
|
25759
26233
|
}) => {
|
|
25760
|
-
const logger = createLogger({
|
|
26234
|
+
const logger = createLogger$1({
|
|
25761
26235
|
logLevel
|
|
25762
26236
|
});
|
|
25763
26237
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -26103,7 +26577,7 @@ const readNodeV8CoverageDirectory = async ({
|
|
|
26103
26577
|
return tryReadJsonFile();
|
|
26104
26578
|
}
|
|
26105
26579
|
|
|
26106
|
-
console.warn(createDetailedMessage$
|
|
26580
|
+
console.warn(createDetailedMessage$2(`Error while reading coverage file`, {
|
|
26107
26581
|
"error stack": e.stack,
|
|
26108
26582
|
"file": dirEntryUrl
|
|
26109
26583
|
}));
|
|
@@ -26277,7 +26751,7 @@ const composeV8AndIstanbul = (v8FileByFileCoverage, istanbulFileByFileCoverage,
|
|
|
26277
26751
|
|
|
26278
26752
|
if (v8Coverage) {
|
|
26279
26753
|
if (coverageV8ConflictWarning) {
|
|
26280
|
-
console.warn(createDetailedMessage$
|
|
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.`, {
|
|
26281
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)`,
|
|
26282
26756
|
suggestion: "You can disable this warning with coverageV8ConflictWarning: false"
|
|
26283
26757
|
}));
|
|
@@ -26804,7 +27278,7 @@ const generateFileExecutionSteps = ({
|
|
|
26804
27278
|
}
|
|
26805
27279
|
|
|
26806
27280
|
if (typeof stepConfig !== "object") {
|
|
26807
|
-
throw new TypeError(createDetailedMessage$
|
|
27281
|
+
throw new TypeError(createDetailedMessage$2(`found unexpected value in plan, they must be object`, {
|
|
26808
27282
|
["file relative path"]: fileRelativeUrl,
|
|
26809
27283
|
["execution name"]: executionName,
|
|
26810
27284
|
["value"]: stepConfig
|
|
@@ -27272,7 +27746,7 @@ const executePlan = async (plan, {
|
|
|
27272
27746
|
}
|
|
27273
27747
|
});
|
|
27274
27748
|
});
|
|
27275
|
-
logger.debug(createDetailedMessage$
|
|
27749
|
+
logger.debug(createDetailedMessage$2(`Prepare executing plan`, {
|
|
27276
27750
|
runtimes: JSON.stringify(runtimes, null, " ")
|
|
27277
27751
|
}));
|
|
27278
27752
|
const multipleExecutionsOperation = Abort.startOperation();
|
|
@@ -27304,7 +27778,7 @@ const executePlan = async (plan, {
|
|
|
27304
27778
|
await ensureEmptyDirectory(process.env.NODE_V8_COVERAGE);
|
|
27305
27779
|
} else {
|
|
27306
27780
|
coverageMethodForNodeJs = "Profiler";
|
|
27307
|
-
logger.warn(createDetailedMessage$
|
|
27781
|
+
logger.warn(createDetailedMessage$2(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
|
|
27308
27782
|
"suggestion": `set process.env.NODE_V8_COVERAGE`,
|
|
27309
27783
|
"suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
|
|
27310
27784
|
}));
|
|
@@ -27777,7 +28251,7 @@ const executeTestPlan = async ({
|
|
|
27777
28251
|
coverageReportJsonFile = process.env.CI ? null : "./.coverage/coverage.json",
|
|
27778
28252
|
coverageReportHtmlDirectory = process.env.CI ? "./.coverage/" : null
|
|
27779
28253
|
}) => {
|
|
27780
|
-
const logger = createLogger({
|
|
28254
|
+
const logger = createLogger$1({
|
|
27781
28255
|
logLevel
|
|
27782
28256
|
});
|
|
27783
28257
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -27814,7 +28288,7 @@ const executeTestPlan = async ({
|
|
|
27814
28288
|
|
|
27815
28289
|
if (patternsMatchingCoverAndExecute.length) {
|
|
27816
28290
|
// It would be strange, for a given file to be both covered and executed
|
|
27817
|
-
throw new Error(createDetailedMessage$
|
|
28291
|
+
throw new Error(createDetailedMessage$2(`some file will be both covered and executed`, {
|
|
27818
28292
|
patterns: patternsMatchingCoverAndExecute
|
|
27819
28293
|
}));
|
|
27820
28294
|
}
|
|
@@ -28364,7 +28838,7 @@ const importPlaywright = async ({
|
|
|
28364
28838
|
return namespace;
|
|
28365
28839
|
} catch (e) {
|
|
28366
28840
|
if (e.code === "ERR_MODULE_NOT_FOUND") {
|
|
28367
|
-
throw new Error(createDetailedMessage$
|
|
28841
|
+
throw new Error(createDetailedMessage$2(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
|
|
28368
28842
|
suggestion: `npm install --save-dev playwright`
|
|
28369
28843
|
}), {
|
|
28370
28844
|
cause: e
|
|
@@ -28532,7 +29006,7 @@ const createChildExecOptions = async ({
|
|
|
28532
29006
|
debugModeInheritBreak = true
|
|
28533
29007
|
} = {}) => {
|
|
28534
29008
|
if (typeof debugMode === "string" && AVAILABLE_DEBUG_MODE.indexOf(debugMode) === -1) {
|
|
28535
|
-
throw new TypeError(createDetailedMessage$
|
|
29009
|
+
throw new TypeError(createDetailedMessage$2(`unexpected debug mode.`, {
|
|
28536
29010
|
["debug mode"]: debugMode,
|
|
28537
29011
|
["allowed debug mode"]: AVAILABLE_DEBUG_MODE
|
|
28538
29012
|
}));
|
|
@@ -28829,7 +29303,7 @@ nodeChildProcess.run = async ({
|
|
|
28829
29303
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
28830
29304
|
env: envForChildProcess
|
|
28831
29305
|
});
|
|
28832
|
-
logger.debug(createDetailedMessage$
|
|
29306
|
+
logger.debug(createDetailedMessage$2(`child process forked (pid ${childProcess.pid})`, {
|
|
28833
29307
|
"execArgv": execArgv.join(`\n`),
|
|
28834
29308
|
"custom env": JSON.stringify(env, null, " ")
|
|
28835
29309
|
})); // if we pass stream, pipe them https://github.com/sindresorhus/execa/issues/81
|
|
@@ -29427,7 +29901,7 @@ const startBuildServer = async ({
|
|
|
29427
29901
|
buildServerMainFile = getCallerPosition().url,
|
|
29428
29902
|
cooldownBetweenFileEvents
|
|
29429
29903
|
}) => {
|
|
29430
|
-
const logger = createLogger({
|
|
29904
|
+
const logger = createLogger$1({
|
|
29431
29905
|
logLevel
|
|
29432
29906
|
});
|
|
29433
29907
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -29652,7 +30126,7 @@ const execute = async ({
|
|
|
29652
30126
|
runtimeParams,
|
|
29653
30127
|
ignoreError = false
|
|
29654
30128
|
}) => {
|
|
29655
|
-
const logger = createLogger({
|
|
30129
|
+
const logger = createLogger$1({
|
|
29656
30130
|
logLevel
|
|
29657
30131
|
});
|
|
29658
30132
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|