@jsenv/core 29.1.7 → 29.1.8
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/js/s.js.map +12 -1
- package/dist/js/supervisor.js +1 -1
- package/dist/main.js +433 -784
- package/package.json +4 -4
- package/src/build/build.js +39 -19
- package/src/build/start_build_server.js +4 -0
- package/src/dev/file_service.js +31 -22
- package/src/kitchen/kitchen.js +14 -4
- package/src/kitchen/url_graph/url_info_transformations.js +3 -3
- package/src/plugins/bundling/js_module/bundle_js_modules.js +15 -4
- package/src/plugins/supervisor/client/supervisor.js +4 -1
- package/src/plugins/transpilation/as_js_classic/convert_js_module_to_js_classic.js +22 -3
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_conversion.js +45 -18
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +18 -2
package/dist/main.js
CHANGED
|
@@ -2540,16 +2540,16 @@ const writeFileSync = (destination, content = "") => {
|
|
|
2540
2540
|
}
|
|
2541
2541
|
};
|
|
2542
2542
|
|
|
2543
|
-
const LOG_LEVEL_OFF
|
|
2544
|
-
const LOG_LEVEL_DEBUG
|
|
2545
|
-
const LOG_LEVEL_INFO
|
|
2546
|
-
const LOG_LEVEL_WARN
|
|
2547
|
-
const LOG_LEVEL_ERROR
|
|
2548
|
-
|
|
2549
|
-
const createLogger
|
|
2550
|
-
logLevel = LOG_LEVEL_INFO
|
|
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
|
|
2551
2551
|
} = {}) => {
|
|
2552
|
-
if (logLevel === LOG_LEVEL_DEBUG
|
|
2552
|
+
if (logLevel === LOG_LEVEL_DEBUG) {
|
|
2553
2553
|
return {
|
|
2554
2554
|
level: "debug",
|
|
2555
2555
|
levels: {
|
|
@@ -2558,14 +2558,14 @@ const createLogger$1 = ({
|
|
|
2558
2558
|
warn: true,
|
|
2559
2559
|
error: true
|
|
2560
2560
|
},
|
|
2561
|
-
debug
|
|
2562
|
-
info
|
|
2563
|
-
warn
|
|
2564
|
-
error
|
|
2561
|
+
debug,
|
|
2562
|
+
info,
|
|
2563
|
+
warn,
|
|
2564
|
+
error
|
|
2565
2565
|
};
|
|
2566
2566
|
}
|
|
2567
2567
|
|
|
2568
|
-
if (logLevel === LOG_LEVEL_INFO
|
|
2568
|
+
if (logLevel === LOG_LEVEL_INFO) {
|
|
2569
2569
|
return {
|
|
2570
2570
|
level: "info",
|
|
2571
2571
|
levels: {
|
|
@@ -2574,14 +2574,14 @@ const createLogger$1 = ({
|
|
|
2574
2574
|
warn: true,
|
|
2575
2575
|
error: true
|
|
2576
2576
|
},
|
|
2577
|
-
debug: debugDisabled
|
|
2578
|
-
info
|
|
2579
|
-
warn
|
|
2580
|
-
error
|
|
2577
|
+
debug: debugDisabled,
|
|
2578
|
+
info,
|
|
2579
|
+
warn,
|
|
2580
|
+
error
|
|
2581
2581
|
};
|
|
2582
2582
|
}
|
|
2583
2583
|
|
|
2584
|
-
if (logLevel === LOG_LEVEL_WARN
|
|
2584
|
+
if (logLevel === LOG_LEVEL_WARN) {
|
|
2585
2585
|
return {
|
|
2586
2586
|
level: "warn",
|
|
2587
2587
|
levels: {
|
|
@@ -2590,14 +2590,14 @@ const createLogger$1 = ({
|
|
|
2590
2590
|
warn: true,
|
|
2591
2591
|
error: true
|
|
2592
2592
|
},
|
|
2593
|
-
debug: debugDisabled
|
|
2594
|
-
info: infoDisabled
|
|
2595
|
-
warn
|
|
2596
|
-
error
|
|
2593
|
+
debug: debugDisabled,
|
|
2594
|
+
info: infoDisabled,
|
|
2595
|
+
warn,
|
|
2596
|
+
error
|
|
2597
2597
|
};
|
|
2598
2598
|
}
|
|
2599
2599
|
|
|
2600
|
-
if (logLevel === LOG_LEVEL_ERROR
|
|
2600
|
+
if (logLevel === LOG_LEVEL_ERROR) {
|
|
2601
2601
|
return {
|
|
2602
2602
|
level: "error",
|
|
2603
2603
|
levels: {
|
|
@@ -2606,14 +2606,14 @@ const createLogger$1 = ({
|
|
|
2606
2606
|
warn: false,
|
|
2607
2607
|
error: true
|
|
2608
2608
|
},
|
|
2609
|
-
debug: debugDisabled
|
|
2610
|
-
info: infoDisabled
|
|
2611
|
-
warn: warnDisabled
|
|
2612
|
-
error
|
|
2609
|
+
debug: debugDisabled,
|
|
2610
|
+
info: infoDisabled,
|
|
2611
|
+
warn: warnDisabled,
|
|
2612
|
+
error
|
|
2613
2613
|
};
|
|
2614
2614
|
}
|
|
2615
2615
|
|
|
2616
|
-
if (logLevel === LOG_LEVEL_OFF
|
|
2616
|
+
if (logLevel === LOG_LEVEL_OFF) {
|
|
2617
2617
|
return {
|
|
2618
2618
|
level: "off",
|
|
2619
2619
|
levels: {
|
|
@@ -2622,10 +2622,10 @@ const createLogger$1 = ({
|
|
|
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,
|
|
2626
|
+
info: infoDisabled,
|
|
2627
|
+
warn: warnDisabled,
|
|
2628
|
+
error: errorDisabled
|
|
2629
2629
|
};
|
|
2630
2630
|
}
|
|
2631
2631
|
|
|
@@ -2633,30 +2633,30 @@ const createLogger$1 = ({
|
|
|
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}
|
|
2637
|
+
${LOG_LEVEL_ERROR}
|
|
2638
|
+
${LOG_LEVEL_WARN}
|
|
2639
|
+
${LOG_LEVEL_INFO}
|
|
2640
|
+
${LOG_LEVEL_DEBUG}`);
|
|
2641
2641
|
};
|
|
2642
2642
|
|
|
2643
|
-
const debug
|
|
2643
|
+
const debug = (...args) => console.debug(...args);
|
|
2644
2644
|
|
|
2645
|
-
const debugDisabled
|
|
2645
|
+
const debugDisabled = () => {};
|
|
2646
2646
|
|
|
2647
|
-
const info
|
|
2647
|
+
const info = (...args) => console.info(...args);
|
|
2648
2648
|
|
|
2649
|
-
const infoDisabled
|
|
2649
|
+
const infoDisabled = () => {};
|
|
2650
2650
|
|
|
2651
|
-
const warn
|
|
2651
|
+
const warn = (...args) => console.warn(...args);
|
|
2652
2652
|
|
|
2653
|
-
const warnDisabled
|
|
2653
|
+
const warnDisabled = () => {};
|
|
2654
2654
|
|
|
2655
|
-
const error
|
|
2655
|
+
const error = (...args) => console.error(...args);
|
|
2656
2656
|
|
|
2657
|
-
const errorDisabled
|
|
2657
|
+
const errorDisabled = () => {};
|
|
2658
2658
|
|
|
2659
|
-
function hasFlag
|
|
2659
|
+
function hasFlag(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$1(flag, argv = process$1.argv) {
|
|
|
2664
2664
|
}
|
|
2665
2665
|
|
|
2666
2666
|
const {
|
|
2667
|
-
env
|
|
2667
|
+
env
|
|
2668
2668
|
} = process$1;
|
|
2669
|
-
let flagForceColor
|
|
2669
|
+
let flagForceColor;
|
|
2670
2670
|
|
|
2671
|
-
if (hasFlag
|
|
2672
|
-
flagForceColor
|
|
2673
|
-
} else if (hasFlag
|
|
2674
|
-
flagForceColor
|
|
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;
|
|
2675
2675
|
}
|
|
2676
2676
|
|
|
2677
|
-
function envForceColor
|
|
2678
|
-
if ('FORCE_COLOR' in env
|
|
2679
|
-
if (env
|
|
2677
|
+
function envForceColor() {
|
|
2678
|
+
if ('FORCE_COLOR' in env) {
|
|
2679
|
+
if (env.FORCE_COLOR === 'true') {
|
|
2680
2680
|
return 1;
|
|
2681
2681
|
}
|
|
2682
2682
|
|
|
2683
|
-
if (env
|
|
2683
|
+
if (env.FORCE_COLOR === 'false') {
|
|
2684
2684
|
return 0;
|
|
2685
2685
|
}
|
|
2686
2686
|
|
|
2687
|
-
return env
|
|
2687
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
2690
|
|
|
2691
|
-
function translateLevel
|
|
2691
|
+
function translateLevel(level) {
|
|
2692
2692
|
if (level === 0) {
|
|
2693
2693
|
return false;
|
|
2694
2694
|
}
|
|
@@ -2701,28 +2701,28 @@ function translateLevel$1(level) {
|
|
|
2701
2701
|
};
|
|
2702
2702
|
}
|
|
2703
2703
|
|
|
2704
|
-
function _supportsColor
|
|
2704
|
+
function _supportsColor(haveStream, {
|
|
2705
2705
|
streamIsTTY,
|
|
2706
2706
|
sniffFlags = true
|
|
2707
2707
|
} = {}) {
|
|
2708
|
-
const noFlagForceColor = envForceColor
|
|
2708
|
+
const noFlagForceColor = envForceColor();
|
|
2709
2709
|
|
|
2710
2710
|
if (noFlagForceColor !== undefined) {
|
|
2711
|
-
flagForceColor
|
|
2711
|
+
flagForceColor = noFlagForceColor;
|
|
2712
2712
|
}
|
|
2713
2713
|
|
|
2714
|
-
const forceColor = sniffFlags ? flagForceColor
|
|
2714
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2715
2715
|
|
|
2716
2716
|
if (forceColor === 0) {
|
|
2717
2717
|
return 0;
|
|
2718
2718
|
}
|
|
2719
2719
|
|
|
2720
2720
|
if (sniffFlags) {
|
|
2721
|
-
if (hasFlag
|
|
2721
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
|
|
2722
2722
|
return 3;
|
|
2723
2723
|
}
|
|
2724
2724
|
|
|
2725
|
-
if (hasFlag
|
|
2725
|
+
if (hasFlag('color=256')) {
|
|
2726
2726
|
return 2;
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
@@ -2733,7 +2733,7 @@ function _supportsColor$1(haveStream, {
|
|
|
2733
2733
|
|
|
2734
2734
|
const min = forceColor || 0;
|
|
2735
2735
|
|
|
2736
|
-
if (env
|
|
2736
|
+
if (env.TERM === 'dumb') {
|
|
2737
2737
|
return min;
|
|
2738
2738
|
}
|
|
2739
2739
|
|
|
@@ -2749,31 +2749,31 @@ function _supportsColor$1(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
|
|
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') {
|
|
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
|
|
2760
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
2761
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2762
2762
|
} // Check for Azure DevOps pipelines
|
|
2763
2763
|
|
|
2764
2764
|
|
|
2765
|
-
if ('TF_BUILD' in env
|
|
2765
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
2766
2766
|
return 1;
|
|
2767
2767
|
}
|
|
2768
2768
|
|
|
2769
|
-
if (env
|
|
2769
|
+
if (env.COLORTERM === 'truecolor') {
|
|
2770
2770
|
return 3;
|
|
2771
2771
|
}
|
|
2772
2772
|
|
|
2773
|
-
if ('TERM_PROGRAM' in env
|
|
2774
|
-
const version = Number.parseInt((env
|
|
2773
|
+
if ('TERM_PROGRAM' in env) {
|
|
2774
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
2775
2775
|
|
|
2776
|
-
switch (env
|
|
2776
|
+
switch (env.TERM_PROGRAM) {
|
|
2777
2777
|
case 'iTerm.app':
|
|
2778
2778
|
return version >= 3 ? 3 : 2;
|
|
2779
2779
|
|
|
@@ -2783,39 +2783,39 @@ function _supportsColor$1(haveStream, {
|
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
|
|
2786
|
-
if (/-256(color)?$/i.test(env
|
|
2786
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
2787
2787
|
return 2;
|
|
2788
2788
|
}
|
|
2789
2789
|
|
|
2790
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env
|
|
2790
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
2791
2791
|
return 1;
|
|
2792
2792
|
}
|
|
2793
2793
|
|
|
2794
|
-
if ('COLORTERM' in env
|
|
2794
|
+
if ('COLORTERM' in env) {
|
|
2795
2795
|
return 1;
|
|
2796
2796
|
}
|
|
2797
2797
|
|
|
2798
2798
|
return min;
|
|
2799
2799
|
}
|
|
2800
2800
|
|
|
2801
|
-
function createSupportsColor
|
|
2802
|
-
const level = _supportsColor
|
|
2801
|
+
function createSupportsColor(stream, options = {}) {
|
|
2802
|
+
const level = _supportsColor(stream, {
|
|
2803
2803
|
streamIsTTY: stream && stream.isTTY,
|
|
2804
2804
|
...options
|
|
2805
2805
|
});
|
|
2806
2806
|
|
|
2807
|
-
return translateLevel
|
|
2807
|
+
return translateLevel(level);
|
|
2808
2808
|
}
|
|
2809
2809
|
({
|
|
2810
|
-
stdout: createSupportsColor
|
|
2810
|
+
stdout: createSupportsColor({
|
|
2811
2811
|
isTTY: tty.isatty(1)
|
|
2812
2812
|
}),
|
|
2813
|
-
stderr: createSupportsColor
|
|
2813
|
+
stderr: createSupportsColor({
|
|
2814
2814
|
isTTY: tty.isatty(2)
|
|
2815
2815
|
})
|
|
2816
2816
|
});
|
|
2817
2817
|
|
|
2818
|
-
const processSupportsBasicColor = createSupportsColor
|
|
2818
|
+
const processSupportsBasicColor = createSupportsColor(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,7 +2849,7 @@ const ANSI = {
|
|
|
2849
2849
|
color: setANSIColor
|
|
2850
2850
|
};
|
|
2851
2851
|
|
|
2852
|
-
function isUnicodeSupported
|
|
2852
|
+
function isUnicodeSupported() {
|
|
2853
2853
|
if (process$1.platform !== 'win32') {
|
|
2854
2854
|
return process$1.env.TERM !== 'linux'; // Linux console (kernel)
|
|
2855
2855
|
}
|
|
@@ -2861,7 +2861,7 @@ function isUnicodeSupported$1() {
|
|
|
2861
2861
|
}
|
|
2862
2862
|
|
|
2863
2863
|
// see also https://github.com/sindresorhus/figures
|
|
2864
|
-
const canUseUnicode = isUnicodeSupported
|
|
2864
|
+
const canUseUnicode = isUnicodeSupported();
|
|
2865
2865
|
const COMMAND_RAW = canUseUnicode ? `❯` : `>`;
|
|
2866
2866
|
const OK_RAW = canUseUnicode ? `✔` : `√`;
|
|
2867
2867
|
const FAILURE_RAW = canUseUnicode ? `✖` : `×`;
|
|
@@ -2895,7 +2895,7 @@ const UNICODE = {
|
|
|
2895
2895
|
supported: canUseUnicode
|
|
2896
2896
|
};
|
|
2897
2897
|
|
|
2898
|
-
const createDetailedMessage$
|
|
2898
|
+
const createDetailedMessage$1 = (message, details = {}) => {
|
|
2899
2899
|
let string = `${message}`;
|
|
2900
2900
|
Object.keys(details).forEach(key => {
|
|
2901
2901
|
const value = details[key];
|
|
@@ -3194,26 +3194,26 @@ const distributePercentages = (namedNumbers, {
|
|
|
3194
3194
|
return percentages;
|
|
3195
3195
|
};
|
|
3196
3196
|
|
|
3197
|
-
const ESC
|
|
3198
|
-
const OSC
|
|
3199
|
-
const BEL
|
|
3200
|
-
const SEP
|
|
3201
|
-
const isTerminalApp
|
|
3202
|
-
const ansiEscapes
|
|
3197
|
+
const ESC = '\u001B[';
|
|
3198
|
+
const OSC = '\u001B]';
|
|
3199
|
+
const BEL = '\u0007';
|
|
3200
|
+
const SEP = ';';
|
|
3201
|
+
const isTerminalApp = process$1.env.TERM_PROGRAM === 'Apple_Terminal';
|
|
3202
|
+
const ansiEscapes = {};
|
|
3203
3203
|
|
|
3204
|
-
ansiEscapes
|
|
3204
|
+
ansiEscapes.cursorTo = (x, y) => {
|
|
3205
3205
|
if (typeof x !== 'number') {
|
|
3206
3206
|
throw new TypeError('The `x` argument is required');
|
|
3207
3207
|
}
|
|
3208
3208
|
|
|
3209
3209
|
if (typeof y !== 'number') {
|
|
3210
|
-
return ESC
|
|
3210
|
+
return ESC + (x + 1) + 'G';
|
|
3211
3211
|
}
|
|
3212
3212
|
|
|
3213
|
-
return ESC
|
|
3213
|
+
return ESC + (y + 1) + SEP + (x + 1) + 'H';
|
|
3214
3214
|
};
|
|
3215
3215
|
|
|
3216
|
-
ansiEscapes
|
|
3216
|
+
ansiEscapes.cursorMove = (x, y) => {
|
|
3217
3217
|
if (typeof x !== 'number') {
|
|
3218
3218
|
throw new TypeError('The `x` argument is required');
|
|
3219
3219
|
}
|
|
@@ -3221,71 +3221,71 @@ ansiEscapes$1.cursorMove = (x, y) => {
|
|
|
3221
3221
|
let returnValue = '';
|
|
3222
3222
|
|
|
3223
3223
|
if (x < 0) {
|
|
3224
|
-
returnValue += ESC
|
|
3224
|
+
returnValue += ESC + -x + 'D';
|
|
3225
3225
|
} else if (x > 0) {
|
|
3226
|
-
returnValue += ESC
|
|
3226
|
+
returnValue += ESC + x + 'C';
|
|
3227
3227
|
}
|
|
3228
3228
|
|
|
3229
3229
|
if (y < 0) {
|
|
3230
|
-
returnValue += ESC
|
|
3230
|
+
returnValue += ESC + -y + 'A';
|
|
3231
3231
|
} else if (y > 0) {
|
|
3232
|
-
returnValue += ESC
|
|
3232
|
+
returnValue += ESC + y + 'B';
|
|
3233
3233
|
}
|
|
3234
3234
|
|
|
3235
3235
|
return returnValue;
|
|
3236
3236
|
};
|
|
3237
3237
|
|
|
3238
|
-
ansiEscapes
|
|
3238
|
+
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
|
|
3239
3239
|
|
|
3240
|
-
ansiEscapes
|
|
3240
|
+
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
|
|
3241
3241
|
|
|
3242
|
-
ansiEscapes
|
|
3242
|
+
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
|
|
3243
3243
|
|
|
3244
|
-
ansiEscapes
|
|
3244
|
+
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
|
|
3245
3245
|
|
|
3246
|
-
ansiEscapes
|
|
3247
|
-
ansiEscapes
|
|
3248
|
-
ansiEscapes
|
|
3249
|
-
ansiEscapes
|
|
3250
|
-
ansiEscapes
|
|
3251
|
-
ansiEscapes
|
|
3252
|
-
ansiEscapes
|
|
3253
|
-
ansiEscapes
|
|
3246
|
+
ansiEscapes.cursorLeft = ESC + 'G';
|
|
3247
|
+
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
|
|
3248
|
+
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
|
|
3249
|
+
ansiEscapes.cursorGetPosition = ESC + '6n';
|
|
3250
|
+
ansiEscapes.cursorNextLine = ESC + 'E';
|
|
3251
|
+
ansiEscapes.cursorPrevLine = ESC + 'F';
|
|
3252
|
+
ansiEscapes.cursorHide = ESC + '?25l';
|
|
3253
|
+
ansiEscapes.cursorShow = ESC + '?25h';
|
|
3254
3254
|
|
|
3255
|
-
ansiEscapes
|
|
3255
|
+
ansiEscapes.eraseLines = count => {
|
|
3256
3256
|
let clear = '';
|
|
3257
3257
|
|
|
3258
3258
|
for (let i = 0; i < count; i++) {
|
|
3259
|
-
clear += ansiEscapes
|
|
3259
|
+
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
|
|
3260
3260
|
}
|
|
3261
3261
|
|
|
3262
3262
|
if (count) {
|
|
3263
|
-
clear += ansiEscapes
|
|
3263
|
+
clear += ansiEscapes.cursorLeft;
|
|
3264
3264
|
}
|
|
3265
3265
|
|
|
3266
3266
|
return clear;
|
|
3267
3267
|
};
|
|
3268
3268
|
|
|
3269
|
-
ansiEscapes
|
|
3270
|
-
ansiEscapes
|
|
3271
|
-
ansiEscapes
|
|
3272
|
-
ansiEscapes
|
|
3273
|
-
ansiEscapes
|
|
3274
|
-
ansiEscapes
|
|
3275
|
-
ansiEscapes
|
|
3276
|
-
ansiEscapes
|
|
3277
|
-
ansiEscapes
|
|
3278
|
-
ansiEscapes
|
|
3269
|
+
ansiEscapes.eraseEndLine = ESC + 'K';
|
|
3270
|
+
ansiEscapes.eraseStartLine = ESC + '1K';
|
|
3271
|
+
ansiEscapes.eraseLine = ESC + '2K';
|
|
3272
|
+
ansiEscapes.eraseDown = ESC + 'J';
|
|
3273
|
+
ansiEscapes.eraseUp = ESC + '1J';
|
|
3274
|
+
ansiEscapes.eraseScreen = ESC + '2J';
|
|
3275
|
+
ansiEscapes.scrollUp = ESC + 'S';
|
|
3276
|
+
ansiEscapes.scrollDown = ESC + 'T';
|
|
3277
|
+
ansiEscapes.clearScreen = '\u001Bc';
|
|
3278
|
+
ansiEscapes.clearTerminal = process$1.platform === 'win32' ? `${ansiEscapes.eraseScreen}${ESC}0f` // 1. Erases the screen (Only done in case `2` is not supported)
|
|
3279
3279
|
// 2. Erases the whole screen including scrollback buffer
|
|
3280
3280
|
// 3. Moves cursor to the top-left position
|
|
3281
3281
|
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
3282
|
-
: `${ansiEscapes
|
|
3283
|
-
ansiEscapes
|
|
3282
|
+
: `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
|
|
3283
|
+
ansiEscapes.beep = BEL;
|
|
3284
3284
|
|
|
3285
|
-
ansiEscapes
|
|
3285
|
+
ansiEscapes.link = (text, url) => [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
|
|
3286
3286
|
|
|
3287
|
-
ansiEscapes
|
|
3288
|
-
let returnValue = `${OSC
|
|
3287
|
+
ansiEscapes.image = (buffer, options = {}) => {
|
|
3288
|
+
let returnValue = `${OSC}1337;File=inline=1`;
|
|
3289
3289
|
|
|
3290
3290
|
if (options.width) {
|
|
3291
3291
|
returnValue += `;width=${options.width}`;
|
|
@@ -3299,14 +3299,14 @@ ansiEscapes$1.image = (buffer, options = {}) => {
|
|
|
3299
3299
|
returnValue += ';preserveAspectRatio=0';
|
|
3300
3300
|
}
|
|
3301
3301
|
|
|
3302
|
-
return returnValue + ':' + buffer.toString('base64') + BEL
|
|
3302
|
+
return returnValue + ':' + buffer.toString('base64') + BEL;
|
|
3303
3303
|
};
|
|
3304
3304
|
|
|
3305
|
-
ansiEscapes
|
|
3306
|
-
setCwd: (cwd = process$1.cwd()) => `${OSC
|
|
3305
|
+
ansiEscapes.iTerm = {
|
|
3306
|
+
setCwd: (cwd = process$1.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
3307
3307
|
|
|
3308
3308
|
annotation(message, options = {}) {
|
|
3309
|
-
let returnValue = `${OSC
|
|
3309
|
+
let returnValue = `${OSC}1337;`;
|
|
3310
3310
|
const hasX = typeof options.x !== 'undefined';
|
|
3311
3311
|
const hasY = typeof options.y !== 'undefined';
|
|
3312
3312
|
|
|
@@ -3323,7 +3323,7 @@ ansiEscapes$1.iTerm = {
|
|
|
3323
3323
|
returnValue += message;
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
3326
|
-
return returnValue + BEL
|
|
3326
|
+
return returnValue + BEL;
|
|
3327
3327
|
}
|
|
3328
3328
|
|
|
3329
3329
|
};
|
|
@@ -3409,7 +3409,7 @@ const createLog = ({
|
|
|
3409
3409
|
}
|
|
3410
3410
|
|
|
3411
3411
|
clearAttemptResult = true;
|
|
3412
|
-
return ansiEscapes
|
|
3412
|
+
return ansiEscapes.eraseLines(visualLineCount);
|
|
3413
3413
|
};
|
|
3414
3414
|
|
|
3415
3415
|
const spyStream = () => {
|
|
@@ -3477,586 +3477,144 @@ const createLog = ({
|
|
|
3477
3477
|
return log;
|
|
3478
3478
|
};
|
|
3479
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
|
-
}
|
|
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';
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
|
-
if (y < 0) {
|
|
3961
|
-
returnValue += ESC + -y + 'A';
|
|
3962
|
-
} else if (y > 0) {
|
|
3963
|
-
returnValue += ESC + y + 'B';
|
|
3964
|
-
}
|
|
3965
|
-
|
|
3966
|
-
return returnValue;
|
|
3967
|
-
};
|
|
3968
|
-
|
|
3969
|
-
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
|
|
3970
|
-
|
|
3971
|
-
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
|
|
3972
|
-
|
|
3973
|
-
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
|
|
3974
|
-
|
|
3975
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
|
|
3480
|
+
const noopStreamSpy = () => ""; // could be inlined but vscode do not correctly
|
|
3481
|
+
// expand/collapse template strings, so I put it at the bottom
|
|
3976
3482
|
|
|
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';
|
|
3985
3483
|
|
|
3986
|
-
|
|
3987
|
-
|
|
3484
|
+
const addNewLines = (string, newLine) => {
|
|
3485
|
+
if (newLine === "before") {
|
|
3486
|
+
return `
|
|
3487
|
+
${string}`;
|
|
3488
|
+
}
|
|
3988
3489
|
|
|
3989
|
-
|
|
3990
|
-
|
|
3490
|
+
if (newLine === "after") {
|
|
3491
|
+
return `${string}
|
|
3492
|
+
`;
|
|
3991
3493
|
}
|
|
3992
3494
|
|
|
3993
|
-
if (
|
|
3994
|
-
|
|
3495
|
+
if (newLine === "around") {
|
|
3496
|
+
return `
|
|
3497
|
+
${string}
|
|
3498
|
+
`;
|
|
3995
3499
|
}
|
|
3996
3500
|
|
|
3997
|
-
return
|
|
3501
|
+
return string;
|
|
3998
3502
|
};
|
|
3999
3503
|
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
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
|
+
};
|
|
4015
3520
|
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
3521
|
+
const update = message => {
|
|
3522
|
+
spinner.message = running ? `${frames[frameIndex]} ${message}` : message;
|
|
3523
|
+
return spinner.message;
|
|
3524
|
+
};
|
|
4019
3525
|
|
|
4020
|
-
|
|
4021
|
-
let
|
|
3526
|
+
spinner.update = update;
|
|
3527
|
+
let cleanup;
|
|
4022
3528
|
|
|
4023
|
-
if (
|
|
4024
|
-
|
|
4025
|
-
|
|
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
|
+
}
|
|
4026
3542
|
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
3543
|
+
return update(render());
|
|
3544
|
+
});
|
|
3545
|
+
}, 1000 / fps);
|
|
4030
3546
|
|
|
4031
|
-
|
|
4032
|
-
|
|
3547
|
+
if (!keepProcessAlive) {
|
|
3548
|
+
interval.unref();
|
|
3549
|
+
}
|
|
3550
|
+
} else {
|
|
3551
|
+
log.write(update(render()));
|
|
4033
3552
|
}
|
|
4034
3553
|
|
|
4035
|
-
|
|
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';
|
|
3554
|
+
const stop = message => {
|
|
3555
|
+
running = false;
|
|
4044
3556
|
|
|
4045
|
-
if (
|
|
4046
|
-
|
|
3557
|
+
if (interval) {
|
|
3558
|
+
clearInterval(interval);
|
|
3559
|
+
interval = null;
|
|
4047
3560
|
}
|
|
4048
3561
|
|
|
4049
|
-
|
|
4050
|
-
|
|
3562
|
+
if (cleanup) {
|
|
3563
|
+
cleanup();
|
|
3564
|
+
cleanup = null;
|
|
3565
|
+
}
|
|
4051
3566
|
|
|
4052
|
-
if (
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
returnValue += message;
|
|
3567
|
+
if (log && message) {
|
|
3568
|
+
log.write(update(message));
|
|
3569
|
+
log = null;
|
|
4056
3570
|
}
|
|
3571
|
+
};
|
|
4057
3572
|
|
|
4058
|
-
|
|
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
|
+
};
|
|
4059
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
|
+
};
|
|
4060
3618
|
};
|
|
4061
3619
|
|
|
4062
3620
|
const memoize = compute => {
|
|
@@ -6736,7 +6294,7 @@ const startServer = async ({
|
|
|
6736
6294
|
}) => {
|
|
6737
6295
|
const statusType = statusToType(status);
|
|
6738
6296
|
addRequestLog(requestNode, {
|
|
6739
|
-
type: {
|
|
6297
|
+
type: status === 404 && request.pathname === "/favicon.ico" ? "debug" : {
|
|
6740
6298
|
information: "info",
|
|
6741
6299
|
success: "info",
|
|
6742
6300
|
redirection: "info",
|
|
@@ -8992,7 +8550,7 @@ const createUrlInfoTransformer = ({
|
|
|
8992
8550
|
sourcemaps,
|
|
8993
8551
|
sourcemapsSourcesProtocol,
|
|
8994
8552
|
sourcemapsSourcesContent,
|
|
8995
|
-
|
|
8553
|
+
sourcemapsSourcesRelative,
|
|
8996
8554
|
urlGraph,
|
|
8997
8555
|
injectSourcemapPlaceholder,
|
|
8998
8556
|
foundSourcemap
|
|
@@ -9182,7 +8740,7 @@ const createUrlInfoTransformer = ({
|
|
|
9182
8740
|
sourcemapUrlInfo.contentType = "application/json";
|
|
9183
8741
|
const sourcemap = urlInfo.sourcemap;
|
|
9184
8742
|
|
|
9185
|
-
if (
|
|
8743
|
+
if (sourcemapsSourcesRelative) {
|
|
9186
8744
|
sourcemap.sources = sourcemap.sources.map(source => {
|
|
9187
8745
|
const sourceRelative = urlToRelativeUrl(source, urlInfo.url);
|
|
9188
8746
|
return sourceRelative || ".";
|
|
@@ -9210,7 +8768,7 @@ const createUrlInfoTransformer = ({
|
|
|
9210
8768
|
urlInfo.content = SOURCEMAP.writeComment({
|
|
9211
8769
|
contentType: urlInfo.contentType,
|
|
9212
8770
|
content: urlInfo.content,
|
|
9213
|
-
specifier: sourcemaps === "file" &&
|
|
8771
|
+
specifier: sourcemaps === "file" && sourcemapsSourcesRelative ? urlToRelativeUrl(sourcemapReference.url, urlInfo.url) : sourcemapReference.generatedSpecifier
|
|
9214
8772
|
});
|
|
9215
8773
|
}
|
|
9216
8774
|
}
|
|
@@ -9539,7 +9097,7 @@ const createResolveUrlError = ({
|
|
|
9539
9097
|
reason,
|
|
9540
9098
|
...details
|
|
9541
9099
|
}) => {
|
|
9542
|
-
const resolveError = new Error(createDetailedMessage$
|
|
9100
|
+
const resolveError = new Error(createDetailedMessage$1(`Failed to resolve url reference`, {
|
|
9543
9101
|
reason,
|
|
9544
9102
|
...details,
|
|
9545
9103
|
"specifier": `"${reference.specifier}"`,
|
|
@@ -9575,7 +9133,7 @@ const createFetchUrlContentError = ({
|
|
|
9575
9133
|
reason,
|
|
9576
9134
|
...details
|
|
9577
9135
|
}) => {
|
|
9578
|
-
const fetchError = new Error(createDetailedMessage$
|
|
9136
|
+
const fetchError = new Error(createDetailedMessage$1(`Failed to fetch url content`, {
|
|
9579
9137
|
reason,
|
|
9580
9138
|
...details,
|
|
9581
9139
|
"url": urlInfo.url,
|
|
@@ -9631,7 +9189,7 @@ const createTransformUrlContentError = ({
|
|
|
9631
9189
|
reason,
|
|
9632
9190
|
...details
|
|
9633
9191
|
}) => {
|
|
9634
|
-
const transformError = new Error(createDetailedMessage$
|
|
9192
|
+
const transformError = new Error(createDetailedMessage$1(`"transformUrlContent" error on "${urlInfo.type}"`, {
|
|
9635
9193
|
reason,
|
|
9636
9194
|
...details,
|
|
9637
9195
|
"url": urlInfo.url,
|
|
@@ -9687,7 +9245,7 @@ const createFinalizeUrlContentError = ({
|
|
|
9687
9245
|
urlInfo,
|
|
9688
9246
|
error
|
|
9689
9247
|
}) => {
|
|
9690
|
-
const finalizeError = new Error(createDetailedMessage$
|
|
9248
|
+
const finalizeError = new Error(createDetailedMessage$1(`"finalizeUrlContent" error on "${urlInfo.type}"`, { ...detailsFromValueThrown(error),
|
|
9691
9249
|
"url": urlInfo.url,
|
|
9692
9250
|
"url reference trace": reference.trace.message,
|
|
9693
9251
|
...detailsFromPluginController(pluginController)
|
|
@@ -9945,11 +9503,11 @@ const createKitchen = ({
|
|
|
9945
9503
|
// "programmatic" and "file" also allowed
|
|
9946
9504
|
sourcemapsSourcesProtocol,
|
|
9947
9505
|
sourcemapsSourcesContent,
|
|
9948
|
-
|
|
9506
|
+
sourcemapsSourcesRelative,
|
|
9949
9507
|
writeGeneratedFiles,
|
|
9950
9508
|
outDirectoryUrl
|
|
9951
9509
|
}) => {
|
|
9952
|
-
const logger = createLogger
|
|
9510
|
+
const logger = createLogger({
|
|
9953
9511
|
logLevel
|
|
9954
9512
|
});
|
|
9955
9513
|
const pluginController = createPluginController({
|
|
@@ -10161,7 +9719,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
10161
9719
|
sourcemaps,
|
|
10162
9720
|
sourcemapsSourcesProtocol,
|
|
10163
9721
|
sourcemapsSourcesContent,
|
|
10164
|
-
|
|
9722
|
+
sourcemapsSourcesRelative,
|
|
10165
9723
|
clientRuntimeCompat,
|
|
10166
9724
|
injectSourcemapPlaceholder: ({
|
|
10167
9725
|
urlInfo,
|
|
@@ -10214,7 +9772,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
10214
9772
|
const fetchUrlContentReturnValue = await pluginController.callAsyncHooksUntil("fetchUrlContent", urlInfo, contextDuringFetch);
|
|
10215
9773
|
|
|
10216
9774
|
if (!fetchUrlContentReturnValue) {
|
|
10217
|
-
logger.warn(createDetailedMessage$
|
|
9775
|
+
logger.warn(createDetailedMessage$1(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
|
|
10218
9776
|
"url": urlInfo.url,
|
|
10219
9777
|
"url reference trace": reference.trace.message
|
|
10220
9778
|
}));
|
|
@@ -10521,7 +10079,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
10521
10079
|
} = urlInfo;
|
|
10522
10080
|
|
|
10523
10081
|
if (generatedUrl && generatedUrl.startsWith("file:")) {
|
|
10524
|
-
if (urlInfo.type === "directory") ; else {
|
|
10082
|
+
if (urlInfo.type === "directory") ; else if (urlInfo.content === null) ; else {
|
|
10525
10083
|
writeFileSync(new URL(generatedUrl), urlInfo.content);
|
|
10526
10084
|
const {
|
|
10527
10085
|
sourcemapGeneratedUrl,
|
|
@@ -10727,8 +10285,8 @@ const adjustUrlSite = (urlInfo, {
|
|
|
10727
10285
|
isOriginal: true,
|
|
10728
10286
|
url: inlineUrlSite.url,
|
|
10729
10287
|
content: inlineUrlSite.content,
|
|
10730
|
-
line: inlineUrlSite.line + urlSite.line,
|
|
10731
|
-
column: inlineUrlSite.column + urlSite.column
|
|
10288
|
+
line: inlineUrlSite.line === undefined ? urlSite.line : inlineUrlSite.line + urlSite.line,
|
|
10289
|
+
column: inlineUrlSite.column === undefined ? urlSite.column : inlineUrlSite.column + urlSite.column
|
|
10732
10290
|
}, parentUrlInfo);
|
|
10733
10291
|
};
|
|
10734
10292
|
|
|
@@ -16916,10 +16474,25 @@ const convertJsModuleToJsClassic = async ({
|
|
|
16916
16474
|
|
|
16917
16475
|
if (systemJsInjection && jsClassicFormat === "system" && urlInfo.isEntryPoint) {
|
|
16918
16476
|
const magicSource = createMagicSource(code);
|
|
16919
|
-
|
|
16477
|
+
let systemJsFileContent = readFileSync(systemJsClientFileUrl, {
|
|
16920
16478
|
as: "string"
|
|
16921
16479
|
});
|
|
16922
|
-
|
|
16480
|
+
const sourcemapFound = SOURCEMAP.readComment({
|
|
16481
|
+
contentType: "text/javascript",
|
|
16482
|
+
content: systemJsFileContent
|
|
16483
|
+
});
|
|
16484
|
+
|
|
16485
|
+
if (sourcemapFound) {
|
|
16486
|
+
// for now let's remove s.js sourcemap
|
|
16487
|
+
// because it would likely mess the sourcemap of the entry point itself
|
|
16488
|
+
systemJsFileContent = SOURCEMAP.writeComment({
|
|
16489
|
+
contentType: "text/javascript",
|
|
16490
|
+
content: systemJsFileContent,
|
|
16491
|
+
specifier: ""
|
|
16492
|
+
});
|
|
16493
|
+
}
|
|
16494
|
+
|
|
16495
|
+
magicSource.prepend(`${systemJsFileContent}\n\n`);
|
|
16923
16496
|
const magicResult = magicSource.toContentAndSourcemap();
|
|
16924
16497
|
sourcemap = await composeTwoSourcemaps(sourcemap, magicResult.sourcemap);
|
|
16925
16498
|
return {
|
|
@@ -16943,14 +16516,42 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
16943
16516
|
systemJsClientFileUrl,
|
|
16944
16517
|
generateJsClassicFilename
|
|
16945
16518
|
}) => {
|
|
16519
|
+
const isReferencingJsModule = reference => {
|
|
16520
|
+
if (reference.type === "js_import_export" || reference.subtype === "system_register_arg" || reference.subtype === "system_import_arg") {
|
|
16521
|
+
return true;
|
|
16522
|
+
}
|
|
16523
|
+
|
|
16524
|
+
if (reference.type === "js_url_specifier") {
|
|
16525
|
+
if (reference.expectedType === "js_classic") {
|
|
16526
|
+
return false;
|
|
16527
|
+
}
|
|
16528
|
+
|
|
16529
|
+
if (reference.expectedType === undefined && CONTENT_TYPE.fromUrlExtension(reference.url) === "text/javascript") {
|
|
16530
|
+
// by default, js referenced by new URL is considered as "js_module"
|
|
16531
|
+
// in case this is not desired code must use "?js_classic" like
|
|
16532
|
+
// new URL('./file.js?js_classic', import.meta.url)
|
|
16533
|
+
return true;
|
|
16534
|
+
}
|
|
16535
|
+
}
|
|
16536
|
+
|
|
16537
|
+
return false;
|
|
16538
|
+
};
|
|
16539
|
+
|
|
16946
16540
|
const shouldPropagateJsClassic = (reference, context) => {
|
|
16947
|
-
|
|
16541
|
+
if (isReferencingJsModule(reference)) {
|
|
16542
|
+
const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl);
|
|
16948
16543
|
|
|
16949
|
-
|
|
16950
|
-
|
|
16544
|
+
if (!parentUrlInfo) {
|
|
16545
|
+
return false;
|
|
16546
|
+
} // if (parentUrlInfo.isEntryPoint) {
|
|
16547
|
+
// return true
|
|
16548
|
+
// }
|
|
16549
|
+
|
|
16550
|
+
|
|
16551
|
+
return new URL(parentUrlInfo.url).searchParams.has("as_js_classic");
|
|
16951
16552
|
}
|
|
16952
16553
|
|
|
16953
|
-
return
|
|
16554
|
+
return false;
|
|
16954
16555
|
};
|
|
16955
16556
|
|
|
16956
16557
|
const markAsJsClassicProxy = reference => {
|
|
@@ -16973,18 +16574,16 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
16973
16574
|
if (reference.searchParams.has("as_js_classic")) {
|
|
16974
16575
|
markAsJsClassicProxy(reference);
|
|
16975
16576
|
return null;
|
|
16976
|
-
}
|
|
16577
|
+
} // We want to propagate transformation of js module to js classic to:
|
|
16578
|
+
// - import specifier (static/dynamic import + re-export)
|
|
16579
|
+
// - url specifier when inside System.register/_context.import()
|
|
16580
|
+
// (because it's the transpiled equivalent of static and dynamic imports)
|
|
16581
|
+
// And not other references otherwise we could try to transform inline resources
|
|
16582
|
+
// or specifiers inside new URL()...
|
|
16977
16583
|
|
|
16978
|
-
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
// - url specifier when inside System.register/_context.import()
|
|
16982
|
-
// (because it's the transpiled equivalent of static and dynamic imports)
|
|
16983
|
-
// And not other references otherwise we could try to transform inline resources
|
|
16984
|
-
// or specifiers inside new URL()...
|
|
16985
|
-
if (shouldPropagateJsClassic(reference, context)) {
|
|
16986
|
-
return turnIntoJsClassicProxy(reference);
|
|
16987
|
-
}
|
|
16584
|
+
|
|
16585
|
+
if (shouldPropagateJsClassic(reference, context)) {
|
|
16586
|
+
return turnIntoJsClassicProxy(reference);
|
|
16988
16587
|
}
|
|
16989
16588
|
|
|
16990
16589
|
return null;
|
|
@@ -17195,9 +16794,23 @@ const jsenvPluginAsJsClassicHtml = ({
|
|
|
17195
16794
|
|
|
17196
16795
|
if (needsSystemJs) {
|
|
17197
16796
|
mutations.push(async () => {
|
|
17198
|
-
|
|
16797
|
+
let systemJsFileContent = readFileSync$1(new URL(systemJsClientFileUrl), {
|
|
17199
16798
|
encoding: "utf8"
|
|
17200
16799
|
});
|
|
16800
|
+
const sourcemapFound = SOURCEMAP.readComment({
|
|
16801
|
+
contentType: "text/javascript",
|
|
16802
|
+
content: systemJsFileContent
|
|
16803
|
+
});
|
|
16804
|
+
|
|
16805
|
+
if (sourcemapFound) {
|
|
16806
|
+
const sourcemapFileUrl = new URL(sourcemapFound.specifier, systemJsClientFileUrl);
|
|
16807
|
+
systemJsFileContent = SOURCEMAP.writeComment({
|
|
16808
|
+
contentType: "text/javascript",
|
|
16809
|
+
content: systemJsFileContent,
|
|
16810
|
+
specifier: urlToRelativeUrl(sourcemapFileUrl, urlInfo.url)
|
|
16811
|
+
});
|
|
16812
|
+
}
|
|
16813
|
+
|
|
17201
16814
|
const [systemJsReference, systemJsUrlInfo] = context.referenceUtils.inject({
|
|
17202
16815
|
type: "script_src",
|
|
17203
16816
|
expectedType: "js_classic",
|
|
@@ -17471,24 +17084,34 @@ const rollupPluginJsenv = ({
|
|
|
17471
17084
|
const rollupFileInfo = rollupResult[fileName]; // there is 3 types of file: "placeholder", "asset", "chunk"
|
|
17472
17085
|
|
|
17473
17086
|
if (rollupFileInfo.type === "chunk") {
|
|
17087
|
+
const sourceUrls = Object.keys(rollupFileInfo.modules).map(id => fileUrlConverter.asFileUrl(id));
|
|
17474
17088
|
let url;
|
|
17089
|
+
let originalUrl;
|
|
17475
17090
|
|
|
17476
17091
|
if (rollupFileInfo.facadeModuleId) {
|
|
17477
17092
|
url = fileUrlConverter.asFileUrl(rollupFileInfo.facadeModuleId);
|
|
17093
|
+
originalUrl = url;
|
|
17478
17094
|
} else {
|
|
17479
17095
|
url = new URL(rollupFileInfo.fileName, buildDirectoryUrl).href;
|
|
17096
|
+
|
|
17097
|
+
if (rollupFileInfo.isDynamicEntry) {
|
|
17098
|
+
originalUrl = sourceUrls[sourceUrls.length - 1];
|
|
17099
|
+
} else {
|
|
17100
|
+
originalUrl = url;
|
|
17101
|
+
}
|
|
17480
17102
|
}
|
|
17481
17103
|
|
|
17482
17104
|
const jsModuleBundleUrlInfo = {
|
|
17483
17105
|
url,
|
|
17484
|
-
originalUrl
|
|
17106
|
+
originalUrl,
|
|
17485
17107
|
type: format === "esm" ? "js_module" : "common_js",
|
|
17486
17108
|
data: {
|
|
17487
17109
|
generatedBy: "rollup",
|
|
17488
17110
|
bundleRelativeUrl: rollupFileInfo.fileName,
|
|
17489
|
-
usesImport: rollupFileInfo.imports.length > 0 || rollupFileInfo.dynamicImports.length > 0
|
|
17111
|
+
usesImport: rollupFileInfo.imports.length > 0 || rollupFileInfo.dynamicImports.length > 0,
|
|
17112
|
+
isDynamicEntry: rollupFileInfo.isDynamicEntry
|
|
17490
17113
|
},
|
|
17491
|
-
sourceUrls
|
|
17114
|
+
sourceUrls,
|
|
17492
17115
|
contentType: "text/javascript",
|
|
17493
17116
|
content: rollupFileInfo.code,
|
|
17494
17117
|
sourcemap: rollupFileInfo.map
|
|
@@ -17713,7 +17336,7 @@ const buildWithRollup = async ({
|
|
|
17713
17336
|
return resultRef.current;
|
|
17714
17337
|
} catch (e) {
|
|
17715
17338
|
if (e.code === "MISSING_EXPORT") {
|
|
17716
|
-
const detailedMessage = createDetailedMessage$
|
|
17339
|
+
const detailedMessage = createDetailedMessage$1(e.message, {
|
|
17717
17340
|
frame: e.frame
|
|
17718
17341
|
});
|
|
17719
17342
|
throw new Error(detailedMessage, {
|
|
@@ -24278,7 +23901,7 @@ const build = async ({
|
|
|
24278
23901
|
signal,
|
|
24279
23902
|
logLevel
|
|
24280
23903
|
}) => {
|
|
24281
|
-
const logger = createLogger
|
|
23904
|
+
const logger = createLogger({
|
|
24282
23905
|
logLevel
|
|
24283
23906
|
});
|
|
24284
23907
|
const buildOperation = Abort.startOperation();
|
|
@@ -24347,7 +23970,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
24347
23970
|
const buildUrlsGenerator = createBuilUrlsGenerator({
|
|
24348
23971
|
buildDirectoryUrl
|
|
24349
23972
|
});
|
|
24350
|
-
const
|
|
23973
|
+
const buildDirectoryRedirections = new Map();
|
|
24351
23974
|
|
|
24352
23975
|
const associateBuildUrlAndRawUrl = (buildUrl, rawUrl, reason) => {
|
|
24353
23976
|
if (urlIsInsideOf(rawUrl, buildDirectoryUrl)) {
|
|
@@ -24358,7 +23981,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
24358
23981
|
${ANSI.color(rawUrl, ANSI.GREY)} ->
|
|
24359
23982
|
${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
24360
23983
|
`);
|
|
24361
|
-
|
|
23984
|
+
buildDirectoryRedirections.set(buildUrl, rawUrl);
|
|
24362
23985
|
};
|
|
24363
23986
|
|
|
24364
23987
|
const buildUrls = new Map();
|
|
@@ -24389,7 +24012,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24389
24012
|
resolveUrl: reference => {
|
|
24390
24013
|
const getUrl = () => {
|
|
24391
24014
|
if (reference.type === "filesystem") {
|
|
24392
|
-
const parentRawUrl =
|
|
24015
|
+
const parentRawUrl = buildDirectoryRedirections.get(reference.parentUrl);
|
|
24393
24016
|
const baseUrl = ensurePathnameTrailingSlash(parentRawUrl);
|
|
24394
24017
|
return new URL(reference.specifier, baseUrl).href;
|
|
24395
24018
|
}
|
|
@@ -24420,7 +24043,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24420
24043
|
} // already a build url
|
|
24421
24044
|
|
|
24422
24045
|
|
|
24423
|
-
const rawUrl =
|
|
24046
|
+
const rawUrl = buildDirectoryRedirections.get(reference.url);
|
|
24424
24047
|
|
|
24425
24048
|
if (rawUrl) {
|
|
24426
24049
|
return reference.url;
|
|
@@ -24590,14 +24213,14 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24590
24213
|
return bundleUrlInfo;
|
|
24591
24214
|
}
|
|
24592
24215
|
|
|
24593
|
-
const rawUrl =
|
|
24216
|
+
const rawUrl = buildDirectoryRedirections.get(url) || url;
|
|
24594
24217
|
const rawUrlInfo = rawGraph.getUrlInfo(rawUrl);
|
|
24595
24218
|
|
|
24596
24219
|
if (!rawUrlInfo) {
|
|
24597
|
-
throw new Error(createDetailedMessage$
|
|
24220
|
+
throw new Error(createDetailedMessage$1(`Cannot find url`, {
|
|
24598
24221
|
url,
|
|
24599
|
-
"raw urls":
|
|
24600
|
-
"build urls":
|
|
24222
|
+
"raw urls": Array.from(buildDirectoryRedirections.values()),
|
|
24223
|
+
"build urls": Array.from(buildDirectoryRedirections.keys())
|
|
24601
24224
|
}));
|
|
24602
24225
|
} // logger.debug(`fetching from raw graph ${url}`)
|
|
24603
24226
|
|
|
@@ -24626,7 +24249,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24626
24249
|
|
|
24627
24250
|
if (reference.injected) {
|
|
24628
24251
|
const [ref, rawUrlInfo] = rawGraphKitchen.injectReference({ ...reference,
|
|
24629
|
-
parentUrl:
|
|
24252
|
+
parentUrl: buildDirectoryRedirections.get(reference.parentUrl)
|
|
24630
24253
|
});
|
|
24631
24254
|
await rawGraphKitchen.cook(rawUrlInfo, {
|
|
24632
24255
|
reference: ref
|
|
@@ -24657,7 +24280,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24657
24280
|
}],
|
|
24658
24281
|
sourcemaps,
|
|
24659
24282
|
sourcemapsSourcesContent,
|
|
24660
|
-
|
|
24283
|
+
sourcemapsSourcesRelative: !versioning,
|
|
24661
24284
|
writeGeneratedFiles,
|
|
24662
24285
|
outDirectoryUrl: new URL(".jsenv/postbuild/", rootDirectoryUrl)
|
|
24663
24286
|
});
|
|
@@ -24841,10 +24464,10 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24841
24464
|
|
|
24842
24465
|
if (bundlerGeneratedUrlInfo.sourceUrls) {
|
|
24843
24466
|
bundlerGeneratedUrlInfo.sourceUrls.forEach(sourceUrl => {
|
|
24844
|
-
const
|
|
24467
|
+
const sourceRawUrlInfo = rawGraph.getUrlInfo(sourceUrl);
|
|
24845
24468
|
|
|
24846
|
-
if (
|
|
24847
|
-
|
|
24469
|
+
if (sourceRawUrlInfo) {
|
|
24470
|
+
sourceRawUrlInfo.data.bundled = true;
|
|
24848
24471
|
}
|
|
24849
24472
|
});
|
|
24850
24473
|
}
|
|
@@ -24854,7 +24477,14 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24854
24477
|
});
|
|
24855
24478
|
bundleRedirections.set(url, buildUrl);
|
|
24856
24479
|
|
|
24857
|
-
if (urlIsInsideOf(url, buildDirectoryUrl)) {
|
|
24480
|
+
if (urlIsInsideOf(url, buildDirectoryUrl)) {
|
|
24481
|
+
if (bundlerGeneratedUrlInfo.data.isDynamicEntry) {
|
|
24482
|
+
const rawUrlInfo = rawGraph.getUrlInfo(bundlerGeneratedUrlInfo.originalUrl);
|
|
24483
|
+
rawUrlInfo.data.bundled = false;
|
|
24484
|
+
bundleRedirections.set(bundlerGeneratedUrlInfo.originalUrl, buildUrl);
|
|
24485
|
+
associateBuildUrlAndRawUrl(buildUrl, bundlerGeneratedUrlInfo.originalUrl, "bundle");
|
|
24486
|
+
} else {// chunk generated by rollup to share code
|
|
24487
|
+
}
|
|
24858
24488
|
} else {
|
|
24859
24489
|
associateBuildUrlAndRawUrl(buildUrl, url, "bundle");
|
|
24860
24490
|
}
|
|
@@ -25117,7 +24747,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25117
24747
|
},
|
|
25118
24748
|
fetchUrlContent: versionedUrlInfo => {
|
|
25119
24749
|
if (versionedUrlInfo.isInline) {
|
|
25120
|
-
const rawUrlInfo = rawGraph.getUrlInfo(
|
|
24750
|
+
const rawUrlInfo = rawGraph.getUrlInfo(buildDirectoryRedirections.get(versionedUrlInfo.url));
|
|
25121
24751
|
const finalUrlInfo = finalGraph.getUrlInfo(versionedUrlInfo.url);
|
|
25122
24752
|
return {
|
|
25123
24753
|
content: versionedUrlInfo.content,
|
|
@@ -25132,7 +24762,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25132
24762
|
}],
|
|
25133
24763
|
sourcemaps,
|
|
25134
24764
|
sourcemapsSourcesContent,
|
|
25135
|
-
|
|
24765
|
+
sourcemapsSourcesRelative: true,
|
|
25136
24766
|
writeGeneratedFiles,
|
|
25137
24767
|
outDirectoryUrl: new URL(".jsenv/postbuild/", finalGraphKitchen.rootDirectoryUrl)
|
|
25138
24768
|
});
|
|
@@ -25202,7 +24832,8 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25202
24832
|
/*
|
|
25203
24833
|
* Update <link rel="preload"> and friends after build (once we know everything)
|
|
25204
24834
|
* - Used to remove resource hint targeting an url that is no longer used:
|
|
25205
|
-
* -
|
|
24835
|
+
* - because of bundlings
|
|
24836
|
+
* - because of import assertions transpilation (file is inlined into JS)
|
|
25206
24837
|
*/
|
|
25207
24838
|
|
|
25208
24839
|
|
|
@@ -25245,7 +24876,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25245
24876
|
}
|
|
25246
24877
|
|
|
25247
24878
|
if (buildUrlInfo.dependents.size === 0) {
|
|
25248
|
-
logger.
|
|
24879
|
+
logger.warn(`remove resource hint because "${href}" not used anymore`);
|
|
25249
24880
|
mutations.push(() => {
|
|
25250
24881
|
removeHtmlNode(node);
|
|
25251
24882
|
});
|
|
@@ -25268,7 +24899,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25268
24899
|
const rawUrlInfo = rawGraph.getUrlInfo(url);
|
|
25269
24900
|
|
|
25270
24901
|
if (rawUrlInfo && rawUrlInfo.data.bundled) {
|
|
25271
|
-
logger.
|
|
24902
|
+
logger.warn(`remove resource hint on "${href}" because it was bundled`);
|
|
25272
24903
|
mutations.push(() => {
|
|
25273
24904
|
removeHtmlNode(node);
|
|
25274
24905
|
});
|
|
@@ -25276,6 +24907,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
25276
24907
|
url = bundleRedirections.get(url) || url;
|
|
25277
24908
|
url = bundleInternalRedirections.get(url) || url;
|
|
25278
24909
|
url = finalRedirections.get(url) || url;
|
|
24910
|
+
url = findKey(buildDirectoryRedirections, url) || url;
|
|
25279
24911
|
onBuildUrl(url);
|
|
25280
24912
|
}
|
|
25281
24913
|
} else {
|
|
@@ -25897,7 +25529,18 @@ const createFileService = ({
|
|
|
25897
25529
|
}
|
|
25898
25530
|
|
|
25899
25531
|
if (!watch) {
|
|
25900
|
-
|
|
25532
|
+
let fileContentAsBuffer;
|
|
25533
|
+
|
|
25534
|
+
try {
|
|
25535
|
+
fileContentAsBuffer = readFileSync$1(new URL(urlInfo.url));
|
|
25536
|
+
} catch (e) {
|
|
25537
|
+
if (e.code === "ENOENT") {
|
|
25538
|
+
return false;
|
|
25539
|
+
}
|
|
25540
|
+
|
|
25541
|
+
return false;
|
|
25542
|
+
}
|
|
25543
|
+
|
|
25901
25544
|
const fileContentEtag = bufferToEtag$1(fileContentAsBuffer);
|
|
25902
25545
|
|
|
25903
25546
|
if (fileContentEtag !== urlInfo.originalContentEtag) {
|
|
@@ -26018,27 +25661,27 @@ const createFileService = ({
|
|
|
26018
25661
|
const ifNoneMatch = request.headers["if-none-match"];
|
|
26019
25662
|
const urlInfoTargetedByCache = urlGraph.getParentIfInline(urlInfo);
|
|
26020
25663
|
|
|
26021
|
-
|
|
26022
|
-
|
|
25664
|
+
try {
|
|
25665
|
+
if (ifNoneMatch) {
|
|
25666
|
+
const [clientOriginalContentEtag, clientContentEtag] = ifNoneMatch.split("_");
|
|
25667
|
+
|
|
25668
|
+
if (urlInfoTargetedByCache.originalContentEtag === clientOriginalContentEtag && urlInfoTargetedByCache.contentEtag === clientContentEtag && urlInfoTargetedByCache.isValid()) {
|
|
25669
|
+
const headers = {
|
|
25670
|
+
"cache-control": `private,max-age=0,must-revalidate`
|
|
25671
|
+
};
|
|
25672
|
+
Object.keys(urlInfo.headers).forEach(key => {
|
|
25673
|
+
if (key !== "content-length") {
|
|
25674
|
+
headers[key] = urlInfo.headers[key];
|
|
25675
|
+
}
|
|
25676
|
+
});
|
|
25677
|
+
return {
|
|
25678
|
+
status: 304,
|
|
25679
|
+
headers
|
|
25680
|
+
};
|
|
25681
|
+
}
|
|
25682
|
+
} // urlInfo objects are reused, they must be "reset" before cooking them again
|
|
26023
25683
|
|
|
26024
|
-
if (urlInfoTargetedByCache.originalContentEtag === clientOriginalContentEtag && urlInfoTargetedByCache.contentEtag === clientContentEtag && urlInfoTargetedByCache.isValid()) {
|
|
26025
|
-
const headers = {
|
|
26026
|
-
"cache-control": `private,max-age=0,must-revalidate`
|
|
26027
|
-
};
|
|
26028
|
-
Object.keys(urlInfo.headers).forEach(key => {
|
|
26029
|
-
if (key !== "content-length") {
|
|
26030
|
-
headers[key] = urlInfo.headers[key];
|
|
26031
|
-
}
|
|
26032
|
-
});
|
|
26033
|
-
return {
|
|
26034
|
-
status: 304,
|
|
26035
|
-
headers
|
|
26036
|
-
};
|
|
26037
|
-
}
|
|
26038
|
-
}
|
|
26039
25684
|
|
|
26040
|
-
try {
|
|
26041
|
-
// urlInfo objects are reused, they must be "reset" before cooking them again
|
|
26042
25685
|
if ((urlInfo.error || urlInfo.contentEtag) && !urlInfo.isInline && urlInfo.type !== "sourcemap") {
|
|
26043
25686
|
urlInfo.error = null;
|
|
26044
25687
|
urlInfo.sourcemap = null;
|
|
@@ -26231,7 +25874,7 @@ const startDevServer = async ({
|
|
|
26231
25874
|
// and mitigates https://github.com/actions/runner-images/issues/3885
|
|
26232
25875
|
writeGeneratedFiles = !process.env.CI
|
|
26233
25876
|
}) => {
|
|
26234
|
-
const logger = createLogger
|
|
25877
|
+
const logger = createLogger({
|
|
26235
25878
|
logLevel
|
|
26236
25879
|
});
|
|
26237
25880
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -26577,7 +26220,7 @@ const readNodeV8CoverageDirectory = async ({
|
|
|
26577
26220
|
return tryReadJsonFile();
|
|
26578
26221
|
}
|
|
26579
26222
|
|
|
26580
|
-
console.warn(createDetailedMessage$
|
|
26223
|
+
console.warn(createDetailedMessage$1(`Error while reading coverage file`, {
|
|
26581
26224
|
"error stack": e.stack,
|
|
26582
26225
|
"file": dirEntryUrl
|
|
26583
26226
|
}));
|
|
@@ -26751,7 +26394,7 @@ const composeV8AndIstanbul = (v8FileByFileCoverage, istanbulFileByFileCoverage,
|
|
|
26751
26394
|
|
|
26752
26395
|
if (v8Coverage) {
|
|
26753
26396
|
if (coverageV8ConflictWarning) {
|
|
26754
|
-
console.warn(createDetailedMessage$
|
|
26397
|
+
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.`, {
|
|
26755
26398
|
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)`,
|
|
26756
26399
|
suggestion: "You can disable this warning with coverageV8ConflictWarning: false"
|
|
26757
26400
|
}));
|
|
@@ -27278,7 +26921,7 @@ const generateFileExecutionSteps = ({
|
|
|
27278
26921
|
}
|
|
27279
26922
|
|
|
27280
26923
|
if (typeof stepConfig !== "object") {
|
|
27281
|
-
throw new TypeError(createDetailedMessage$
|
|
26924
|
+
throw new TypeError(createDetailedMessage$1(`found unexpected value in plan, they must be object`, {
|
|
27282
26925
|
["file relative path"]: fileRelativeUrl,
|
|
27283
26926
|
["execution name"]: executionName,
|
|
27284
26927
|
["value"]: stepConfig
|
|
@@ -27746,7 +27389,7 @@ const executePlan = async (plan, {
|
|
|
27746
27389
|
}
|
|
27747
27390
|
});
|
|
27748
27391
|
});
|
|
27749
|
-
logger.debug(createDetailedMessage$
|
|
27392
|
+
logger.debug(createDetailedMessage$1(`Prepare executing plan`, {
|
|
27750
27393
|
runtimes: JSON.stringify(runtimes, null, " ")
|
|
27751
27394
|
}));
|
|
27752
27395
|
const multipleExecutionsOperation = Abort.startOperation();
|
|
@@ -27778,7 +27421,7 @@ const executePlan = async (plan, {
|
|
|
27778
27421
|
await ensureEmptyDirectory(process.env.NODE_V8_COVERAGE);
|
|
27779
27422
|
} else {
|
|
27780
27423
|
coverageMethodForNodeJs = "Profiler";
|
|
27781
|
-
logger.warn(createDetailedMessage$
|
|
27424
|
+
logger.warn(createDetailedMessage$1(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
|
|
27782
27425
|
"suggestion": `set process.env.NODE_V8_COVERAGE`,
|
|
27783
27426
|
"suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
|
|
27784
27427
|
}));
|
|
@@ -28251,7 +27894,7 @@ const executeTestPlan = async ({
|
|
|
28251
27894
|
coverageReportJsonFile = process.env.CI ? null : "./.coverage/coverage.json",
|
|
28252
27895
|
coverageReportHtmlDirectory = process.env.CI ? "./.coverage/" : null
|
|
28253
27896
|
}) => {
|
|
28254
|
-
const logger = createLogger
|
|
27897
|
+
const logger = createLogger({
|
|
28255
27898
|
logLevel
|
|
28256
27899
|
});
|
|
28257
27900
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -28288,7 +27931,7 @@ const executeTestPlan = async ({
|
|
|
28288
27931
|
|
|
28289
27932
|
if (patternsMatchingCoverAndExecute.length) {
|
|
28290
27933
|
// It would be strange, for a given file to be both covered and executed
|
|
28291
|
-
throw new Error(createDetailedMessage$
|
|
27934
|
+
throw new Error(createDetailedMessage$1(`some file will be both covered and executed`, {
|
|
28292
27935
|
patterns: patternsMatchingCoverAndExecute
|
|
28293
27936
|
}));
|
|
28294
27937
|
}
|
|
@@ -28838,7 +28481,7 @@ const importPlaywright = async ({
|
|
|
28838
28481
|
return namespace;
|
|
28839
28482
|
} catch (e) {
|
|
28840
28483
|
if (e.code === "ERR_MODULE_NOT_FOUND") {
|
|
28841
|
-
throw new Error(createDetailedMessage$
|
|
28484
|
+
throw new Error(createDetailedMessage$1(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
|
|
28842
28485
|
suggestion: `npm install --save-dev playwright`
|
|
28843
28486
|
}), {
|
|
28844
28487
|
cause: e
|
|
@@ -29006,7 +28649,7 @@ const createChildExecOptions = async ({
|
|
|
29006
28649
|
debugModeInheritBreak = true
|
|
29007
28650
|
} = {}) => {
|
|
29008
28651
|
if (typeof debugMode === "string" && AVAILABLE_DEBUG_MODE.indexOf(debugMode) === -1) {
|
|
29009
|
-
throw new TypeError(createDetailedMessage$
|
|
28652
|
+
throw new TypeError(createDetailedMessage$1(`unexpected debug mode.`, {
|
|
29010
28653
|
["debug mode"]: debugMode,
|
|
29011
28654
|
["allowed debug mode"]: AVAILABLE_DEBUG_MODE
|
|
29012
28655
|
}));
|
|
@@ -29303,7 +28946,7 @@ nodeChildProcess.run = async ({
|
|
|
29303
28946
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
29304
28947
|
env: envForChildProcess
|
|
29305
28948
|
});
|
|
29306
|
-
logger.debug(createDetailedMessage$
|
|
28949
|
+
logger.debug(createDetailedMessage$1(`child process forked (pid ${childProcess.pid})`, {
|
|
29307
28950
|
"execArgv": execArgv.join(`\n`),
|
|
29308
28951
|
"custom env": JSON.stringify(env, null, " ")
|
|
29309
28952
|
})); // if we pass stream, pipe them https://github.com/sindresorhus/execa/issues/81
|
|
@@ -29901,7 +29544,7 @@ const startBuildServer = async ({
|
|
|
29901
29544
|
buildServerMainFile = getCallerPosition().url,
|
|
29902
29545
|
cooldownBetweenFileEvents
|
|
29903
29546
|
}) => {
|
|
29904
|
-
const logger = createLogger
|
|
29547
|
+
const logger = createLogger({
|
|
29905
29548
|
logLevel
|
|
29906
29549
|
});
|
|
29907
29550
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
@@ -30045,6 +29688,12 @@ const startBuildServer = async ({
|
|
|
30045
29688
|
})]
|
|
30046
29689
|
});
|
|
30047
29690
|
startBuildServerTask.done();
|
|
29691
|
+
|
|
29692
|
+
if (hostname) {
|
|
29693
|
+
delete server.origins.localip;
|
|
29694
|
+
delete server.origins.externalip;
|
|
29695
|
+
}
|
|
29696
|
+
|
|
30048
29697
|
logger.info(``);
|
|
30049
29698
|
Object.keys(server.origins).forEach(key => {
|
|
30050
29699
|
logger.info(`- ${server.origins[key]}`);
|
|
@@ -30126,7 +29775,7 @@ const execute = async ({
|
|
|
30126
29775
|
runtimeParams,
|
|
30127
29776
|
ignoreError = false
|
|
30128
29777
|
}) => {
|
|
30129
|
-
const logger = createLogger
|
|
29778
|
+
const logger = createLogger({
|
|
30130
29779
|
logLevel
|
|
30131
29780
|
});
|
|
30132
29781
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|