rollup 0.63.1 → 0.63.5

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/bin/rollup CHANGED
@@ -6,7 +6,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
  var path = require('path');
7
7
  var path__default = _interopDefault(path);
8
8
  var module$1 = _interopDefault(require('module'));
9
- var os = _interopDefault(require('os'));
10
9
  var rollup = require('../dist/rollup.js');
11
10
  var rollup__default = _interopDefault(rollup);
12
11
  var assert = _interopDefault(require('assert'));
@@ -252,7 +251,7 @@ function isNumber (x) {
252
251
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
253
252
  }
254
253
 
255
- var version = "0.63.1";
254
+ var version = "0.63.5";
256
255
 
257
256
  const __assign = Object.assign || function (target) {
258
257
  for (var source, i = 1; i < arguments.length; i++) {
@@ -647,1892 +646,88 @@ function relativeId(id) {
647
646
  return path.relative(process.cwd(), id);
648
647
  }
649
648
 
650
- function createCommonjsModule(fn, module) {
651
- return module = { exports: {} }, fn(module, module.exports), module.exports;
652
- }
653
-
654
- var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
655
-
656
- var escapeStringRegexp = function (str) {
657
- if (typeof str !== 'string') {
658
- throw new TypeError('Expected a string');
659
- }
660
-
661
- return str.replace(matchOperatorsRe, '\\$&');
662
- };
663
-
664
- var colorName = {
665
- "aliceblue": [240, 248, 255],
666
- "antiquewhite": [250, 235, 215],
667
- "aqua": [0, 255, 255],
668
- "aquamarine": [127, 255, 212],
669
- "azure": [240, 255, 255],
670
- "beige": [245, 245, 220],
671
- "bisque": [255, 228, 196],
672
- "black": [0, 0, 0],
673
- "blanchedalmond": [255, 235, 205],
674
- "blue": [0, 0, 255],
675
- "blueviolet": [138, 43, 226],
676
- "brown": [165, 42, 42],
677
- "burlywood": [222, 184, 135],
678
- "cadetblue": [95, 158, 160],
679
- "chartreuse": [127, 255, 0],
680
- "chocolate": [210, 105, 30],
681
- "coral": [255, 127, 80],
682
- "cornflowerblue": [100, 149, 237],
683
- "cornsilk": [255, 248, 220],
684
- "crimson": [220, 20, 60],
685
- "cyan": [0, 255, 255],
686
- "darkblue": [0, 0, 139],
687
- "darkcyan": [0, 139, 139],
688
- "darkgoldenrod": [184, 134, 11],
689
- "darkgray": [169, 169, 169],
690
- "darkgreen": [0, 100, 0],
691
- "darkgrey": [169, 169, 169],
692
- "darkkhaki": [189, 183, 107],
693
- "darkmagenta": [139, 0, 139],
694
- "darkolivegreen": [85, 107, 47],
695
- "darkorange": [255, 140, 0],
696
- "darkorchid": [153, 50, 204],
697
- "darkred": [139, 0, 0],
698
- "darksalmon": [233, 150, 122],
699
- "darkseagreen": [143, 188, 143],
700
- "darkslateblue": [72, 61, 139],
701
- "darkslategray": [47, 79, 79],
702
- "darkslategrey": [47, 79, 79],
703
- "darkturquoise": [0, 206, 209],
704
- "darkviolet": [148, 0, 211],
705
- "deeppink": [255, 20, 147],
706
- "deepskyblue": [0, 191, 255],
707
- "dimgray": [105, 105, 105],
708
- "dimgrey": [105, 105, 105],
709
- "dodgerblue": [30, 144, 255],
710
- "firebrick": [178, 34, 34],
711
- "floralwhite": [255, 250, 240],
712
- "forestgreen": [34, 139, 34],
713
- "fuchsia": [255, 0, 255],
714
- "gainsboro": [220, 220, 220],
715
- "ghostwhite": [248, 248, 255],
716
- "gold": [255, 215, 0],
717
- "goldenrod": [218, 165, 32],
718
- "gray": [128, 128, 128],
719
- "green": [0, 128, 0],
720
- "greenyellow": [173, 255, 47],
721
- "grey": [128, 128, 128],
722
- "honeydew": [240, 255, 240],
723
- "hotpink": [255, 105, 180],
724
- "indianred": [205, 92, 92],
725
- "indigo": [75, 0, 130],
726
- "ivory": [255, 255, 240],
727
- "khaki": [240, 230, 140],
728
- "lavender": [230, 230, 250],
729
- "lavenderblush": [255, 240, 245],
730
- "lawngreen": [124, 252, 0],
731
- "lemonchiffon": [255, 250, 205],
732
- "lightblue": [173, 216, 230],
733
- "lightcoral": [240, 128, 128],
734
- "lightcyan": [224, 255, 255],
735
- "lightgoldenrodyellow": [250, 250, 210],
736
- "lightgray": [211, 211, 211],
737
- "lightgreen": [144, 238, 144],
738
- "lightgrey": [211, 211, 211],
739
- "lightpink": [255, 182, 193],
740
- "lightsalmon": [255, 160, 122],
741
- "lightseagreen": [32, 178, 170],
742
- "lightskyblue": [135, 206, 250],
743
- "lightslategray": [119, 136, 153],
744
- "lightslategrey": [119, 136, 153],
745
- "lightsteelblue": [176, 196, 222],
746
- "lightyellow": [255, 255, 224],
747
- "lime": [0, 255, 0],
748
- "limegreen": [50, 205, 50],
749
- "linen": [250, 240, 230],
750
- "magenta": [255, 0, 255],
751
- "maroon": [128, 0, 0],
752
- "mediumaquamarine": [102, 205, 170],
753
- "mediumblue": [0, 0, 205],
754
- "mediumorchid": [186, 85, 211],
755
- "mediumpurple": [147, 112, 219],
756
- "mediumseagreen": [60, 179, 113],
757
- "mediumslateblue": [123, 104, 238],
758
- "mediumspringgreen": [0, 250, 154],
759
- "mediumturquoise": [72, 209, 204],
760
- "mediumvioletred": [199, 21, 133],
761
- "midnightblue": [25, 25, 112],
762
- "mintcream": [245, 255, 250],
763
- "mistyrose": [255, 228, 225],
764
- "moccasin": [255, 228, 181],
765
- "navajowhite": [255, 222, 173],
766
- "navy": [0, 0, 128],
767
- "oldlace": [253, 245, 230],
768
- "olive": [128, 128, 0],
769
- "olivedrab": [107, 142, 35],
770
- "orange": [255, 165, 0],
771
- "orangered": [255, 69, 0],
772
- "orchid": [218, 112, 214],
773
- "palegoldenrod": [238, 232, 170],
774
- "palegreen": [152, 251, 152],
775
- "paleturquoise": [175, 238, 238],
776
- "palevioletred": [219, 112, 147],
777
- "papayawhip": [255, 239, 213],
778
- "peachpuff": [255, 218, 185],
779
- "peru": [205, 133, 63],
780
- "pink": [255, 192, 203],
781
- "plum": [221, 160, 221],
782
- "powderblue": [176, 224, 230],
783
- "purple": [128, 0, 128],
784
- "rebeccapurple": [102, 51, 153],
785
- "red": [255, 0, 0],
786
- "rosybrown": [188, 143, 143],
787
- "royalblue": [65, 105, 225],
788
- "saddlebrown": [139, 69, 19],
789
- "salmon": [250, 128, 114],
790
- "sandybrown": [244, 164, 96],
791
- "seagreen": [46, 139, 87],
792
- "seashell": [255, 245, 238],
793
- "sienna": [160, 82, 45],
794
- "silver": [192, 192, 192],
795
- "skyblue": [135, 206, 235],
796
- "slateblue": [106, 90, 205],
797
- "slategray": [112, 128, 144],
798
- "slategrey": [112, 128, 144],
799
- "snow": [255, 250, 250],
800
- "springgreen": [0, 255, 127],
801
- "steelblue": [70, 130, 180],
802
- "tan": [210, 180, 140],
803
- "teal": [0, 128, 128],
804
- "thistle": [216, 191, 216],
805
- "tomato": [255, 99, 71],
806
- "turquoise": [64, 224, 208],
807
- "violet": [238, 130, 238],
808
- "wheat": [245, 222, 179],
809
- "white": [255, 255, 255],
810
- "whitesmoke": [245, 245, 245],
811
- "yellow": [255, 255, 0],
812
- "yellowgreen": [154, 205, 50]
813
- };
814
-
815
- var conversions = createCommonjsModule(function (module) {
816
- /* MIT license */
817
-
818
-
819
- // NOTE: conversions should only return primitive values (i.e. arrays, or
820
- // values that give correct `typeof` results).
821
- // do not use box values types (i.e. Number(), String(), etc.)
822
-
823
- var reverseKeywords = {};
824
- for (var key in colorName) {
825
- if (colorName.hasOwnProperty(key)) {
826
- reverseKeywords[colorName[key]] = key;
827
- }
828
- }
829
-
830
- var convert = module.exports = {
831
- rgb: {channels: 3, labels: 'rgb'},
832
- hsl: {channels: 3, labels: 'hsl'},
833
- hsv: {channels: 3, labels: 'hsv'},
834
- hwb: {channels: 3, labels: 'hwb'},
835
- cmyk: {channels: 4, labels: 'cmyk'},
836
- xyz: {channels: 3, labels: 'xyz'},
837
- lab: {channels: 3, labels: 'lab'},
838
- lch: {channels: 3, labels: 'lch'},
839
- hex: {channels: 1, labels: ['hex']},
840
- keyword: {channels: 1, labels: ['keyword']},
841
- ansi16: {channels: 1, labels: ['ansi16']},
842
- ansi256: {channels: 1, labels: ['ansi256']},
843
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
844
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
845
- gray: {channels: 1, labels: ['gray']}
846
- };
847
-
848
- // hide .channels and .labels properties
849
- for (var model in convert) {
850
- if (convert.hasOwnProperty(model)) {
851
- if (!('channels' in convert[model])) {
852
- throw new Error('missing channels property: ' + model);
853
- }
854
-
855
- if (!('labels' in convert[model])) {
856
- throw new Error('missing channel labels property: ' + model);
857
- }
858
-
859
- if (convert[model].labels.length !== convert[model].channels) {
860
- throw new Error('channel and label counts mismatch: ' + model);
861
- }
862
-
863
- var channels = convert[model].channels;
864
- var labels = convert[model].labels;
865
- delete convert[model].channels;
866
- delete convert[model].labels;
867
- Object.defineProperty(convert[model], 'channels', {value: channels});
868
- Object.defineProperty(convert[model], 'labels', {value: labels});
869
- }
870
- }
871
-
872
- convert.rgb.hsl = function (rgb) {
873
- var r = rgb[0] / 255;
874
- var g = rgb[1] / 255;
875
- var b = rgb[2] / 255;
876
- var min = Math.min(r, g, b);
877
- var max = Math.max(r, g, b);
878
- var delta = max - min;
879
- var h;
880
- var s;
881
- var l;
882
-
883
- if (max === min) {
884
- h = 0;
885
- } else if (r === max) {
886
- h = (g - b) / delta;
887
- } else if (g === max) {
888
- h = 2 + (b - r) / delta;
889
- } else if (b === max) {
890
- h = 4 + (r - g) / delta;
891
- }
892
-
893
- h = Math.min(h * 60, 360);
894
-
895
- if (h < 0) {
896
- h += 360;
897
- }
898
-
899
- l = (min + max) / 2;
900
-
901
- if (max === min) {
902
- s = 0;
903
- } else if (l <= 0.5) {
904
- s = delta / (max + min);
905
- } else {
906
- s = delta / (2 - max - min);
907
- }
908
-
909
- return [h, s * 100, l * 100];
910
- };
911
-
912
- convert.rgb.hsv = function (rgb) {
913
- var rdif;
914
- var gdif;
915
- var bdif;
916
- var h;
917
- var s;
918
-
919
- var r = rgb[0] / 255;
920
- var g = rgb[1] / 255;
921
- var b = rgb[2] / 255;
922
- var v = Math.max(r, g, b);
923
- var diff = v - Math.min(r, g, b);
924
- var diffc = function (c) {
925
- return (v - c) / 6 / diff + 1 / 2;
926
- };
927
-
928
- if (diff === 0) {
929
- h = s = 0;
930
- } else {
931
- s = diff / v;
932
- rdif = diffc(r);
933
- gdif = diffc(g);
934
- bdif = diffc(b);
935
-
936
- if (r === v) {
937
- h = bdif - gdif;
938
- } else if (g === v) {
939
- h = (1 / 3) + rdif - bdif;
940
- } else if (b === v) {
941
- h = (2 / 3) + gdif - rdif;
942
- }
943
- if (h < 0) {
944
- h += 1;
945
- } else if (h > 1) {
946
- h -= 1;
947
- }
948
- }
949
-
950
- return [
951
- h * 360,
952
- s * 100,
953
- v * 100
954
- ];
955
- };
956
-
957
- convert.rgb.hwb = function (rgb) {
958
- var r = rgb[0];
959
- var g = rgb[1];
960
- var b = rgb[2];
961
- var h = convert.rgb.hsl(rgb)[0];
962
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
963
-
964
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
965
-
966
- return [h, w * 100, b * 100];
967
- };
968
-
969
- convert.rgb.cmyk = function (rgb) {
970
- var r = rgb[0] / 255;
971
- var g = rgb[1] / 255;
972
- var b = rgb[2] / 255;
973
- var c;
974
- var m;
975
- var y;
976
- var k;
977
-
978
- k = Math.min(1 - r, 1 - g, 1 - b);
979
- c = (1 - r - k) / (1 - k) || 0;
980
- m = (1 - g - k) / (1 - k) || 0;
981
- y = (1 - b - k) / (1 - k) || 0;
982
-
983
- return [c * 100, m * 100, y * 100, k * 100];
984
- };
985
-
986
- /**
987
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
988
- * */
989
- function comparativeDistance(x, y) {
990
- return (
991
- Math.pow(x[0] - y[0], 2) +
992
- Math.pow(x[1] - y[1], 2) +
993
- Math.pow(x[2] - y[2], 2)
994
- );
995
- }
996
-
997
- convert.rgb.keyword = function (rgb) {
998
- var reversed = reverseKeywords[rgb];
999
- if (reversed) {
1000
- return reversed;
1001
- }
1002
-
1003
- var currentClosestDistance = Infinity;
1004
- var currentClosestKeyword;
1005
-
1006
- for (var keyword in colorName) {
1007
- if (colorName.hasOwnProperty(keyword)) {
1008
- var value = colorName[keyword];
1009
-
1010
- // Compute comparative distance
1011
- var distance = comparativeDistance(rgb, value);
1012
-
1013
- // Check if its less, if so set as closest
1014
- if (distance < currentClosestDistance) {
1015
- currentClosestDistance = distance;
1016
- currentClosestKeyword = keyword;
1017
- }
1018
- }
1019
- }
1020
-
1021
- return currentClosestKeyword;
1022
- };
1023
-
1024
- convert.keyword.rgb = function (keyword) {
1025
- return colorName[keyword];
1026
- };
1027
-
1028
- convert.rgb.xyz = function (rgb) {
1029
- var r = rgb[0] / 255;
1030
- var g = rgb[1] / 255;
1031
- var b = rgb[2] / 255;
1032
-
1033
- // assume sRGB
1034
- r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
1035
- g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
1036
- b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
1037
-
1038
- var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
1039
- var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
1040
- var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
1041
-
1042
- return [x * 100, y * 100, z * 100];
1043
- };
1044
-
1045
- convert.rgb.lab = function (rgb) {
1046
- var xyz = convert.rgb.xyz(rgb);
1047
- var x = xyz[0];
1048
- var y = xyz[1];
1049
- var z = xyz[2];
1050
- var l;
1051
- var a;
1052
- var b;
1053
-
1054
- x /= 95.047;
1055
- y /= 100;
1056
- z /= 108.883;
1057
-
1058
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
1059
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
1060
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
1061
-
1062
- l = (116 * y) - 16;
1063
- a = 500 * (x - y);
1064
- b = 200 * (y - z);
1065
-
1066
- return [l, a, b];
1067
- };
1068
-
1069
- convert.hsl.rgb = function (hsl) {
1070
- var h = hsl[0] / 360;
1071
- var s = hsl[1] / 100;
1072
- var l = hsl[2] / 100;
1073
- var t1;
1074
- var t2;
1075
- var t3;
1076
- var rgb;
1077
- var val;
1078
-
1079
- if (s === 0) {
1080
- val = l * 255;
1081
- return [val, val, val];
1082
- }
1083
-
1084
- if (l < 0.5) {
1085
- t2 = l * (1 + s);
1086
- } else {
1087
- t2 = l + s - l * s;
1088
- }
1089
-
1090
- t1 = 2 * l - t2;
1091
-
1092
- rgb = [0, 0, 0];
1093
- for (var i = 0; i < 3; i++) {
1094
- t3 = h + 1 / 3 * -(i - 1);
1095
- if (t3 < 0) {
1096
- t3++;
1097
- }
1098
- if (t3 > 1) {
1099
- t3--;
1100
- }
1101
-
1102
- if (6 * t3 < 1) {
1103
- val = t1 + (t2 - t1) * 6 * t3;
1104
- } else if (2 * t3 < 1) {
1105
- val = t2;
1106
- } else if (3 * t3 < 2) {
1107
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1108
- } else {
1109
- val = t1;
1110
- }
1111
-
1112
- rgb[i] = val * 255;
1113
- }
1114
-
1115
- return rgb;
1116
- };
1117
-
1118
- convert.hsl.hsv = function (hsl) {
1119
- var h = hsl[0];
1120
- var s = hsl[1] / 100;
1121
- var l = hsl[2] / 100;
1122
- var smin = s;
1123
- var lmin = Math.max(l, 0.01);
1124
- var sv;
1125
- var v;
1126
-
1127
- l *= 2;
1128
- s *= (l <= 1) ? l : 2 - l;
1129
- smin *= lmin <= 1 ? lmin : 2 - lmin;
1130
- v = (l + s) / 2;
1131
- sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
1132
-
1133
- return [h, sv * 100, v * 100];
1134
- };
1135
-
1136
- convert.hsv.rgb = function (hsv) {
1137
- var h = hsv[0] / 60;
1138
- var s = hsv[1] / 100;
1139
- var v = hsv[2] / 100;
1140
- var hi = Math.floor(h) % 6;
1141
-
1142
- var f = h - Math.floor(h);
1143
- var p = 255 * v * (1 - s);
1144
- var q = 255 * v * (1 - (s * f));
1145
- var t = 255 * v * (1 - (s * (1 - f)));
1146
- v *= 255;
1147
-
1148
- switch (hi) {
1149
- case 0:
1150
- return [v, t, p];
1151
- case 1:
1152
- return [q, v, p];
1153
- case 2:
1154
- return [p, v, t];
1155
- case 3:
1156
- return [p, q, v];
1157
- case 4:
1158
- return [t, p, v];
1159
- case 5:
1160
- return [v, p, q];
1161
- }
1162
- };
1163
-
1164
- convert.hsv.hsl = function (hsv) {
1165
- var h = hsv[0];
1166
- var s = hsv[1] / 100;
1167
- var v = hsv[2] / 100;
1168
- var vmin = Math.max(v, 0.01);
1169
- var lmin;
1170
- var sl;
1171
- var l;
1172
-
1173
- l = (2 - s) * v;
1174
- lmin = (2 - s) * vmin;
1175
- sl = s * vmin;
1176
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
1177
- sl = sl || 0;
1178
- l /= 2;
1179
-
1180
- return [h, sl * 100, l * 100];
1181
- };
1182
-
1183
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1184
- convert.hwb.rgb = function (hwb) {
1185
- var h = hwb[0] / 360;
1186
- var wh = hwb[1] / 100;
1187
- var bl = hwb[2] / 100;
1188
- var ratio = wh + bl;
1189
- var i;
1190
- var v;
1191
- var f;
1192
- var n;
1193
-
1194
- // wh + bl cant be > 1
1195
- if (ratio > 1) {
1196
- wh /= ratio;
1197
- bl /= ratio;
1198
- }
1199
-
1200
- i = Math.floor(6 * h);
1201
- v = 1 - bl;
1202
- f = 6 * h - i;
1203
-
1204
- if ((i & 0x01) !== 0) {
1205
- f = 1 - f;
1206
- }
1207
-
1208
- n = wh + f * (v - wh); // linear interpolation
1209
-
1210
- var r;
1211
- var g;
1212
- var b;
1213
- switch (i) {
1214
- default:
1215
- case 6:
1216
- case 0: r = v; g = n; b = wh; break;
1217
- case 1: r = n; g = v; b = wh; break;
1218
- case 2: r = wh; g = v; b = n; break;
1219
- case 3: r = wh; g = n; b = v; break;
1220
- case 4: r = n; g = wh; b = v; break;
1221
- case 5: r = v; g = wh; b = n; break;
1222
- }
1223
-
1224
- return [r * 255, g * 255, b * 255];
1225
- };
1226
-
1227
- convert.cmyk.rgb = function (cmyk) {
1228
- var c = cmyk[0] / 100;
1229
- var m = cmyk[1] / 100;
1230
- var y = cmyk[2] / 100;
1231
- var k = cmyk[3] / 100;
1232
- var r;
1233
- var g;
1234
- var b;
1235
-
1236
- r = 1 - Math.min(1, c * (1 - k) + k);
1237
- g = 1 - Math.min(1, m * (1 - k) + k);
1238
- b = 1 - Math.min(1, y * (1 - k) + k);
1239
-
1240
- return [r * 255, g * 255, b * 255];
1241
- };
1242
-
1243
- convert.xyz.rgb = function (xyz) {
1244
- var x = xyz[0] / 100;
1245
- var y = xyz[1] / 100;
1246
- var z = xyz[2] / 100;
1247
- var r;
1248
- var g;
1249
- var b;
1250
-
1251
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
1252
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
1253
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
1254
-
1255
- // assume sRGB
1256
- r = r > 0.0031308
1257
- ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
1258
- : r * 12.92;
1259
-
1260
- g = g > 0.0031308
1261
- ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
1262
- : g * 12.92;
1263
-
1264
- b = b > 0.0031308
1265
- ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
1266
- : b * 12.92;
1267
-
1268
- r = Math.min(Math.max(0, r), 1);
1269
- g = Math.min(Math.max(0, g), 1);
1270
- b = Math.min(Math.max(0, b), 1);
1271
-
1272
- return [r * 255, g * 255, b * 255];
1273
- };
1274
-
1275
- convert.xyz.lab = function (xyz) {
1276
- var x = xyz[0];
1277
- var y = xyz[1];
1278
- var z = xyz[2];
1279
- var l;
1280
- var a;
1281
- var b;
1282
-
1283
- x /= 95.047;
1284
- y /= 100;
1285
- z /= 108.883;
1286
-
1287
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
1288
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
1289
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
1290
-
1291
- l = (116 * y) - 16;
1292
- a = 500 * (x - y);
1293
- b = 200 * (y - z);
1294
-
1295
- return [l, a, b];
1296
- };
1297
-
1298
- convert.lab.xyz = function (lab) {
1299
- var l = lab[0];
1300
- var a = lab[1];
1301
- var b = lab[2];
1302
- var x;
1303
- var y;
1304
- var z;
1305
-
1306
- y = (l + 16) / 116;
1307
- x = a / 500 + y;
1308
- z = y - b / 200;
1309
-
1310
- var y2 = Math.pow(y, 3);
1311
- var x2 = Math.pow(x, 3);
1312
- var z2 = Math.pow(z, 3);
1313
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
1314
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
1315
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
1316
-
1317
- x *= 95.047;
1318
- y *= 100;
1319
- z *= 108.883;
1320
-
1321
- return [x, y, z];
1322
- };
1323
-
1324
- convert.lab.lch = function (lab) {
1325
- var l = lab[0];
1326
- var a = lab[1];
1327
- var b = lab[2];
1328
- var hr;
1329
- var h;
1330
- var c;
1331
-
1332
- hr = Math.atan2(b, a);
1333
- h = hr * 360 / 2 / Math.PI;
1334
-
1335
- if (h < 0) {
1336
- h += 360;
1337
- }
1338
-
1339
- c = Math.sqrt(a * a + b * b);
1340
-
1341
- return [l, c, h];
1342
- };
1343
-
1344
- convert.lch.lab = function (lch) {
1345
- var l = lch[0];
1346
- var c = lch[1];
1347
- var h = lch[2];
1348
- var a;
1349
- var b;
1350
- var hr;
1351
-
1352
- hr = h / 360 * 2 * Math.PI;
1353
- a = c * Math.cos(hr);
1354
- b = c * Math.sin(hr);
1355
-
1356
- return [l, a, b];
1357
- };
1358
-
1359
- convert.rgb.ansi16 = function (args) {
1360
- var r = args[0];
1361
- var g = args[1];
1362
- var b = args[2];
1363
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
1364
-
1365
- value = Math.round(value / 50);
1366
-
1367
- if (value === 0) {
1368
- return 30;
1369
- }
1370
-
1371
- var ansi = 30
1372
- + ((Math.round(b / 255) << 2)
1373
- | (Math.round(g / 255) << 1)
1374
- | Math.round(r / 255));
1375
-
1376
- if (value === 2) {
1377
- ansi += 60;
1378
- }
1379
-
1380
- return ansi;
1381
- };
1382
-
1383
- convert.hsv.ansi16 = function (args) {
1384
- // optimization here; we already know the value and don't need to get
1385
- // it converted for us.
1386
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1387
- };
1388
-
1389
- convert.rgb.ansi256 = function (args) {
1390
- var r = args[0];
1391
- var g = args[1];
1392
- var b = args[2];
1393
-
1394
- // we use the extended greyscale palette here, with the exception of
1395
- // black and white. normal palette only has 4 greyscale shades.
1396
- if (r === g && g === b) {
1397
- if (r < 8) {
1398
- return 16;
1399
- }
1400
-
1401
- if (r > 248) {
1402
- return 231;
1403
- }
1404
-
1405
- return Math.round(((r - 8) / 247) * 24) + 232;
1406
- }
1407
-
1408
- var ansi = 16
1409
- + (36 * Math.round(r / 255 * 5))
1410
- + (6 * Math.round(g / 255 * 5))
1411
- + Math.round(b / 255 * 5);
1412
-
1413
- return ansi;
1414
- };
1415
-
1416
- convert.ansi16.rgb = function (args) {
1417
- var color = args % 10;
1418
-
1419
- // handle greyscale
1420
- if (color === 0 || color === 7) {
1421
- if (args > 50) {
1422
- color += 3.5;
1423
- }
1424
-
1425
- color = color / 10.5 * 255;
1426
-
1427
- return [color, color, color];
1428
- }
1429
-
1430
- var mult = (~~(args > 50) + 1) * 0.5;
1431
- var r = ((color & 1) * mult) * 255;
1432
- var g = (((color >> 1) & 1) * mult) * 255;
1433
- var b = (((color >> 2) & 1) * mult) * 255;
1434
-
1435
- return [r, g, b];
1436
- };
1437
-
1438
- convert.ansi256.rgb = function (args) {
1439
- // handle greyscale
1440
- if (args >= 232) {
1441
- var c = (args - 232) * 10 + 8;
1442
- return [c, c, c];
1443
- }
1444
-
1445
- args -= 16;
1446
-
1447
- var rem;
1448
- var r = Math.floor(args / 36) / 5 * 255;
1449
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1450
- var b = (rem % 6) / 5 * 255;
1451
-
1452
- return [r, g, b];
1453
- };
1454
-
1455
- convert.rgb.hex = function (args) {
1456
- var integer = ((Math.round(args[0]) & 0xFF) << 16)
1457
- + ((Math.round(args[1]) & 0xFF) << 8)
1458
- + (Math.round(args[2]) & 0xFF);
1459
-
1460
- var string = integer.toString(16).toUpperCase();
1461
- return '000000'.substring(string.length) + string;
1462
- };
1463
-
1464
- convert.hex.rgb = function (args) {
1465
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1466
- if (!match) {
1467
- return [0, 0, 0];
1468
- }
1469
-
1470
- var colorString = match[0];
1471
-
1472
- if (match[0].length === 3) {
1473
- colorString = colorString.split('').map(function (char) {
1474
- return char + char;
1475
- }).join('');
1476
- }
1477
-
1478
- var integer = parseInt(colorString, 16);
1479
- var r = (integer >> 16) & 0xFF;
1480
- var g = (integer >> 8) & 0xFF;
1481
- var b = integer & 0xFF;
1482
-
1483
- return [r, g, b];
1484
- };
1485
-
1486
- convert.rgb.hcg = function (rgb) {
1487
- var r = rgb[0] / 255;
1488
- var g = rgb[1] / 255;
1489
- var b = rgb[2] / 255;
1490
- var max = Math.max(Math.max(r, g), b);
1491
- var min = Math.min(Math.min(r, g), b);
1492
- var chroma = (max - min);
1493
- var grayscale;
1494
- var hue;
1495
-
1496
- if (chroma < 1) {
1497
- grayscale = min / (1 - chroma);
1498
- } else {
1499
- grayscale = 0;
1500
- }
1501
-
1502
- if (chroma <= 0) {
1503
- hue = 0;
1504
- } else
1505
- if (max === r) {
1506
- hue = ((g - b) / chroma) % 6;
1507
- } else
1508
- if (max === g) {
1509
- hue = 2 + (b - r) / chroma;
1510
- } else {
1511
- hue = 4 + (r - g) / chroma + 4;
1512
- }
1513
-
1514
- hue /= 6;
1515
- hue %= 1;
1516
-
1517
- return [hue * 360, chroma * 100, grayscale * 100];
1518
- };
1519
-
1520
- convert.hsl.hcg = function (hsl) {
1521
- var s = hsl[1] / 100;
1522
- var l = hsl[2] / 100;
1523
- var c = 1;
1524
- var f = 0;
1525
-
1526
- if (l < 0.5) {
1527
- c = 2.0 * s * l;
1528
- } else {
1529
- c = 2.0 * s * (1.0 - l);
1530
- }
1531
-
1532
- if (c < 1.0) {
1533
- f = (l - 0.5 * c) / (1.0 - c);
1534
- }
1535
-
1536
- return [hsl[0], c * 100, f * 100];
1537
- };
1538
-
1539
- convert.hsv.hcg = function (hsv) {
1540
- var s = hsv[1] / 100;
1541
- var v = hsv[2] / 100;
1542
-
1543
- var c = s * v;
1544
- var f = 0;
1545
-
1546
- if (c < 1.0) {
1547
- f = (v - c) / (1 - c);
1548
- }
1549
-
1550
- return [hsv[0], c * 100, f * 100];
1551
- };
1552
-
1553
- convert.hcg.rgb = function (hcg) {
1554
- var h = hcg[0] / 360;
1555
- var c = hcg[1] / 100;
1556
- var g = hcg[2] / 100;
1557
-
1558
- if (c === 0.0) {
1559
- return [g * 255, g * 255, g * 255];
1560
- }
1561
-
1562
- var pure = [0, 0, 0];
1563
- var hi = (h % 1) * 6;
1564
- var v = hi % 1;
1565
- var w = 1 - v;
1566
- var mg = 0;
1567
-
1568
- switch (Math.floor(hi)) {
1569
- case 0:
1570
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
1571
- case 1:
1572
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
1573
- case 2:
1574
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
1575
- case 3:
1576
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
1577
- case 4:
1578
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
1579
- default:
1580
- pure[0] = 1; pure[1] = 0; pure[2] = w;
1581
- }
1582
-
1583
- mg = (1.0 - c) * g;
1584
-
1585
- return [
1586
- (c * pure[0] + mg) * 255,
1587
- (c * pure[1] + mg) * 255,
1588
- (c * pure[2] + mg) * 255
1589
- ];
1590
- };
1591
-
1592
- convert.hcg.hsv = function (hcg) {
1593
- var c = hcg[1] / 100;
1594
- var g = hcg[2] / 100;
1595
-
1596
- var v = c + g * (1.0 - c);
1597
- var f = 0;
1598
-
1599
- if (v > 0.0) {
1600
- f = c / v;
1601
- }
1602
-
1603
- return [hcg[0], f * 100, v * 100];
1604
- };
1605
-
1606
- convert.hcg.hsl = function (hcg) {
1607
- var c = hcg[1] / 100;
1608
- var g = hcg[2] / 100;
1609
-
1610
- var l = g * (1.0 - c) + 0.5 * c;
1611
- var s = 0;
1612
-
1613
- if (l > 0.0 && l < 0.5) {
1614
- s = c / (2 * l);
1615
- } else
1616
- if (l >= 0.5 && l < 1.0) {
1617
- s = c / (2 * (1 - l));
1618
- }
1619
-
1620
- return [hcg[0], s * 100, l * 100];
1621
- };
1622
-
1623
- convert.hcg.hwb = function (hcg) {
1624
- var c = hcg[1] / 100;
1625
- var g = hcg[2] / 100;
1626
- var v = c + g * (1.0 - c);
1627
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
1628
- };
1629
-
1630
- convert.hwb.hcg = function (hwb) {
1631
- var w = hwb[1] / 100;
1632
- var b = hwb[2] / 100;
1633
- var v = 1 - b;
1634
- var c = v - w;
1635
- var g = 0;
1636
-
1637
- if (c < 1) {
1638
- g = (v - c) / (1 - c);
1639
- }
1640
-
1641
- return [hwb[0], c * 100, g * 100];
1642
- };
1643
-
1644
- convert.apple.rgb = function (apple) {
1645
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
1646
- };
1647
-
1648
- convert.rgb.apple = function (rgb) {
1649
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
1650
- };
1651
-
1652
- convert.gray.rgb = function (args) {
1653
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1654
- };
1655
-
1656
- convert.gray.hsl = convert.gray.hsv = function (args) {
1657
- return [0, 0, args[0]];
1658
- };
1659
-
1660
- convert.gray.hwb = function (gray) {
1661
- return [0, 100, gray[0]];
1662
- };
1663
-
1664
- convert.gray.cmyk = function (gray) {
1665
- return [0, 0, 0, gray[0]];
1666
- };
1667
-
1668
- convert.gray.lab = function (gray) {
1669
- return [gray[0], 0, 0];
1670
- };
1671
-
1672
- convert.gray.hex = function (gray) {
1673
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
1674
- var integer = (val << 16) + (val << 8) + val;
1675
-
1676
- var string = integer.toString(16).toUpperCase();
1677
- return '000000'.substring(string.length) + string;
1678
- };
1679
-
1680
- convert.rgb.gray = function (rgb) {
1681
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1682
- return [val / 255 * 100];
1683
- };
1684
- });
1685
- var conversions_1 = conversions.rgb;
1686
- var conversions_2 = conversions.hsl;
1687
- var conversions_3 = conversions.hsv;
1688
- var conversions_4 = conversions.hwb;
1689
- var conversions_5 = conversions.cmyk;
1690
- var conversions_6 = conversions.xyz;
1691
- var conversions_7 = conversions.lab;
1692
- var conversions_8 = conversions.lch;
1693
- var conversions_9 = conversions.hex;
1694
- var conversions_10 = conversions.keyword;
1695
- var conversions_11 = conversions.ansi16;
1696
- var conversions_12 = conversions.ansi256;
1697
- var conversions_13 = conversions.hcg;
1698
- var conversions_14 = conversions.apple;
1699
- var conversions_15 = conversions.gray;
1700
-
1701
- /*
1702
- this function routes a model to all other models.
1703
-
1704
- all functions that are routed have a property `.conversion` attached
1705
- to the returned synthetic function. This property is an array
1706
- of strings, each with the steps in between the 'from' and 'to'
1707
- color models (inclusive).
1708
-
1709
- conversions that are not possible simply are not included.
1710
- */
1711
-
1712
- function buildGraph() {
1713
- var graph = {};
1714
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1715
- var models = Object.keys(conversions);
1716
-
1717
- for (var len = models.length, i = 0; i < len; i++) {
1718
- graph[models[i]] = {
1719
- // http://jsperf.com/1-vs-infinity
1720
- // micro-opt, but this is simple.
1721
- distance: -1,
1722
- parent: null
1723
- };
1724
- }
1725
-
1726
- return graph;
1727
- }
1728
-
1729
- // https://en.wikipedia.org/wiki/Breadth-first_search
1730
- function deriveBFS(fromModel) {
1731
- var graph = buildGraph();
1732
- var queue = [fromModel]; // unshift -> queue -> pop
1733
-
1734
- graph[fromModel].distance = 0;
1735
-
1736
- while (queue.length) {
1737
- var current = queue.pop();
1738
- var adjacents = Object.keys(conversions[current]);
1739
-
1740
- for (var len = adjacents.length, i = 0; i < len; i++) {
1741
- var adjacent = adjacents[i];
1742
- var node = graph[adjacent];
1743
-
1744
- if (node.distance === -1) {
1745
- node.distance = graph[current].distance + 1;
1746
- node.parent = current;
1747
- queue.unshift(adjacent);
1748
- }
1749
- }
1750
- }
1751
-
1752
- return graph;
1753
- }
649
+ const defineProperty = Object.defineProperty;
1754
650
 
1755
- function link(from, to) {
1756
- return function (args) {
1757
- return to(from(args));
1758
- };
1759
- }
1760
-
1761
- function wrapConversion(toModel, graph) {
1762
- var path$$1 = [graph[toModel].parent, toModel];
1763
- var fn = conversions[graph[toModel].parent][toModel];
1764
-
1765
- var cur = graph[toModel].parent;
1766
- while (graph[cur].parent) {
1767
- path$$1.unshift(graph[cur].parent);
1768
- fn = link(conversions[graph[cur].parent][cur], fn);
1769
- cur = graph[cur].parent;
1770
- }
1771
-
1772
- fn.conversion = path$$1;
1773
- return fn;
1774
- }
1775
-
1776
- var route = function (fromModel) {
1777
- var graph = deriveBFS(fromModel);
1778
- var conversion = {};
1779
-
1780
- var models = Object.keys(graph);
1781
- for (var len = models.length, i = 0; i < len; i++) {
1782
- var toModel = models[i];
1783
- var node = graph[toModel];
1784
-
1785
- if (node.parent === null) {
1786
- // no possible conversion, or this node is the source model.
1787
- continue;
1788
- }
1789
-
1790
- conversion[toModel] = wrapConversion(toModel, graph);
1791
- }
1792
-
1793
- return conversion;
1794
- };
1795
-
1796
- var convert = {};
1797
-
1798
- var models = Object.keys(conversions);
1799
-
1800
- function wrapRaw(fn) {
1801
- var wrappedFn = function (args) {
1802
- if (args === undefined || args === null) {
1803
- return args;
1804
- }
1805
-
1806
- if (arguments.length > 1) {
1807
- args = Array.prototype.slice.call(arguments);
1808
- }
1809
-
1810
- return fn(args);
1811
- };
1812
-
1813
- // preserve .conversion property if there is one
1814
- if ('conversion' in fn) {
1815
- wrappedFn.conversion = fn.conversion;
1816
- }
1817
-
1818
- return wrappedFn;
1819
- }
1820
-
1821
- function wrapRounded(fn) {
1822
- var wrappedFn = function (args) {
1823
- if (args === undefined || args === null) {
1824
- return args;
1825
- }
1826
-
1827
- if (arguments.length > 1) {
1828
- args = Array.prototype.slice.call(arguments);
1829
- }
1830
-
1831
- var result = fn(args);
1832
-
1833
- // we're assuming the result is an array here.
1834
- // see notice in conversions.js; don't use box types
1835
- // in conversion functions.
1836
- if (typeof result === 'object') {
1837
- for (var len = result.length, i = 0; i < len; i++) {
1838
- result[i] = Math.round(result[i]);
1839
- }
1840
- }
1841
-
1842
- return result;
1843
- };
1844
-
1845
- // preserve .conversion property if there is one
1846
- if ('conversion' in fn) {
1847
- wrappedFn.conversion = fn.conversion;
1848
- }
1849
-
1850
- return wrappedFn;
1851
- }
1852
-
1853
- models.forEach(function (fromModel) {
1854
- convert[fromModel] = {};
1855
-
1856
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
1857
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
1858
-
1859
- var routes = route(fromModel);
1860
- var routeModels = Object.keys(routes);
1861
-
1862
- routeModels.forEach(function (toModel) {
1863
- var fn = routes[toModel];
1864
-
1865
- convert[fromModel][toModel] = wrapRounded(fn);
1866
- convert[fromModel][toModel].raw = wrapRaw(fn);
1867
- });
1868
- });
1869
-
1870
- var colorConvert = convert;
1871
-
1872
- var ansiStyles = createCommonjsModule(function (module) {
1873
-
1874
-
1875
- const wrapAnsi16 = (fn, offset) => function () {
1876
- const code = fn.apply(colorConvert, arguments);
1877
- return `\u001B[${code + offset}m`;
1878
- };
1879
-
1880
- const wrapAnsi256 = (fn, offset) => function () {
1881
- const code = fn.apply(colorConvert, arguments);
1882
- return `\u001B[${38 + offset};5;${code}m`;
1883
- };
1884
-
1885
- const wrapAnsi16m = (fn, offset) => function () {
1886
- const rgb = fn.apply(colorConvert, arguments);
1887
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1888
- };
1889
-
1890
- function assembleStyles() {
1891
- const codes = new Map();
1892
- const styles = {
1893
- modifier: {
1894
- reset: [0, 0],
1895
- // 21 isn't widely supported and 22 does the same thing
1896
- bold: [1, 22],
1897
- dim: [2, 22],
1898
- italic: [3, 23],
1899
- underline: [4, 24],
1900
- inverse: [7, 27],
1901
- hidden: [8, 28],
1902
- strikethrough: [9, 29]
1903
- },
1904
- color: {
1905
- black: [30, 39],
1906
- red: [31, 39],
1907
- green: [32, 39],
1908
- yellow: [33, 39],
1909
- blue: [34, 39],
1910
- magenta: [35, 39],
1911
- cyan: [36, 39],
1912
- white: [37, 39],
1913
- gray: [90, 39],
1914
-
1915
- // Bright color
1916
- redBright: [91, 39],
1917
- greenBright: [92, 39],
1918
- yellowBright: [93, 39],
1919
- blueBright: [94, 39],
1920
- magentaBright: [95, 39],
1921
- cyanBright: [96, 39],
1922
- whiteBright: [97, 39]
1923
- },
1924
- bgColor: {
1925
- bgBlack: [40, 49],
1926
- bgRed: [41, 49],
1927
- bgGreen: [42, 49],
1928
- bgYellow: [43, 49],
1929
- bgBlue: [44, 49],
1930
- bgMagenta: [45, 49],
1931
- bgCyan: [46, 49],
1932
- bgWhite: [47, 49],
1933
-
1934
- // Bright color
1935
- bgBlackBright: [100, 49],
1936
- bgRedBright: [101, 49],
1937
- bgGreenBright: [102, 49],
1938
- bgYellowBright: [103, 49],
1939
- bgBlueBright: [104, 49],
1940
- bgMagentaBright: [105, 49],
1941
- bgCyanBright: [106, 49],
1942
- bgWhiteBright: [107, 49]
1943
- }
1944
- };
1945
-
1946
- // Fix humans
1947
- styles.color.grey = styles.color.gray;
1948
-
1949
- for (const groupName of Object.keys(styles)) {
1950
- const group = styles[groupName];
1951
-
1952
- for (const styleName of Object.keys(group)) {
1953
- const style = group[styleName];
1954
-
1955
- styles[styleName] = {
1956
- open: `\u001B[${style[0]}m`,
1957
- close: `\u001B[${style[1]}m`
1958
- };
1959
-
1960
- group[styleName] = styles[styleName];
1961
-
1962
- codes.set(style[0], style[1]);
1963
- }
1964
-
1965
- Object.defineProperty(styles, groupName, {
1966
- value: group,
1967
- enumerable: false
1968
- });
1969
-
1970
- Object.defineProperty(styles, 'codes', {
1971
- value: codes,
1972
- enumerable: false
1973
- });
1974
- }
1975
-
1976
- const ansi2ansi = n => n;
1977
- const rgb2rgb = (r, g, b) => [r, g, b];
1978
-
1979
- styles.color.close = '\u001B[39m';
1980
- styles.bgColor.close = '\u001B[49m';
1981
-
1982
- styles.color.ansi = {
1983
- ansi: wrapAnsi16(ansi2ansi, 0)
1984
- };
1985
- styles.color.ansi256 = {
1986
- ansi256: wrapAnsi256(ansi2ansi, 0)
1987
- };
1988
- styles.color.ansi16m = {
1989
- rgb: wrapAnsi16m(rgb2rgb, 0)
1990
- };
1991
-
1992
- styles.bgColor.ansi = {
1993
- ansi: wrapAnsi16(ansi2ansi, 10)
1994
- };
1995
- styles.bgColor.ansi256 = {
1996
- ansi256: wrapAnsi256(ansi2ansi, 10)
1997
- };
1998
- styles.bgColor.ansi16m = {
1999
- rgb: wrapAnsi16m(rgb2rgb, 10)
2000
- };
2001
-
2002
- for (let key of Object.keys(colorConvert)) {
2003
- if (typeof colorConvert[key] !== 'object') {
2004
- continue;
2005
- }
2006
-
2007
- const suite = colorConvert[key];
2008
-
2009
- if (key === 'ansi16') {
2010
- key = 'ansi';
2011
- }
2012
-
2013
- if ('ansi16' in suite) {
2014
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
2015
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
2016
- }
2017
-
2018
- if ('ansi256' in suite) {
2019
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
2020
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
2021
- }
2022
-
2023
- if ('rgb' in suite) {
2024
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
2025
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
2026
- }
2027
- }
2028
-
2029
- return styles;
2030
- }
2031
-
2032
- // Make the export immutable
2033
- Object.defineProperty(module, 'exports', {
2034
- enumerable: true,
2035
- get: assembleStyles
2036
- });
651
+ const Style = (open, close) => ({
652
+ open: `\x1b[${open}m`,
653
+ close: `\x1b[${close}m`,
654
+ strip: new RegExp(`\\x1b\\[${close}m`, "g")
2037
655
  });
2038
656
 
2039
- var hasFlag = (flag, argv) => {
2040
- argv = argv || process.argv;
2041
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
2042
- const pos = argv.indexOf(prefix + flag);
2043
- const terminatorPos = argv.indexOf('--');
2044
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
2045
- };
2046
-
2047
- const env = process.env;
2048
-
2049
- let forceColor;
2050
- if (hasFlag('no-color') ||
2051
- hasFlag('no-colors') ||
2052
- hasFlag('color=false')) {
2053
- forceColor = false;
2054
- } else if (hasFlag('color') ||
2055
- hasFlag('colors') ||
2056
- hasFlag('color=true') ||
2057
- hasFlag('color=always')) {
2058
- forceColor = true;
2059
- }
2060
- if ('FORCE_COLOR' in env) {
2061
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
2062
- }
2063
-
2064
- function translateLevel(level) {
2065
- if (level === 0) {
2066
- return false;
2067
- }
2068
-
2069
- return {
2070
- level,
2071
- hasBasic: true,
2072
- has256: level >= 2,
2073
- has16m: level >= 3
2074
- };
2075
- }
2076
-
2077
- function supportsColor(stream) {
2078
- if (forceColor === false) {
2079
- return 0;
2080
- }
2081
-
2082
- if (hasFlag('color=16m') ||
2083
- hasFlag('color=full') ||
2084
- hasFlag('color=truecolor')) {
2085
- return 3;
2086
- }
2087
-
2088
- if (hasFlag('color=256')) {
2089
- return 2;
2090
- }
2091
-
2092
- if (stream && !stream.isTTY && forceColor !== true) {
2093
- return 0;
2094
- }
2095
-
2096
- const min = forceColor ? 1 : 0;
2097
-
2098
- if (process.platform === 'win32') {
2099
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
2100
- // libuv that enables 256 color output on Windows. Anything earlier and it
2101
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
2102
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
2103
- // release that supports 256 colors. Windows 10 build 14931 is the first release
2104
- // that supports 16m/TrueColor.
2105
- const osRelease = os.release().split('.');
2106
- if (
2107
- Number(process.versions.node.split('.')[0]) >= 8 &&
2108
- Number(osRelease[0]) >= 10 &&
2109
- Number(osRelease[2]) >= 10586
2110
- ) {
2111
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
2112
- }
2113
-
2114
- return 1;
2115
- }
2116
-
2117
- if ('CI' in env) {
2118
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2119
- return 1;
2120
- }
2121
-
2122
- return min;
2123
- }
2124
-
2125
- if ('TEAMCITY_VERSION' in env) {
2126
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2127
- }
2128
-
2129
- if (env.COLORTERM === 'truecolor') {
2130
- return 3;
2131
- }
2132
-
2133
- if ('TERM_PROGRAM' in env) {
2134
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2135
-
2136
- switch (env.TERM_PROGRAM) {
2137
- case 'iTerm.app':
2138
- return version >= 3 ? 3 : 2;
2139
- case 'Apple_Terminal':
2140
- return 2;
2141
- // No default
2142
- }
2143
- }
2144
-
2145
- if (/-256(color)?$/i.test(env.TERM)) {
2146
- return 2;
2147
- }
2148
-
2149
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2150
- return 1;
2151
- }
2152
-
2153
- if ('COLORTERM' in env) {
2154
- return 1;
2155
- }
2156
-
2157
- if (env.TERM === 'dumb') {
2158
- return min;
2159
- }
2160
-
2161
- return min;
2162
- }
2163
-
2164
- function getSupportLevel(stream) {
2165
- const level = supportsColor(stream);
2166
- return translateLevel(level);
2167
- }
2168
-
2169
- var supportsColor_1 = {
2170
- supportsColor: getSupportLevel,
2171
- stdout: getSupportLevel(process.stdout),
2172
- stderr: getSupportLevel(process.stderr)
2173
- };
2174
-
2175
- const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
2176
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
2177
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
2178
- const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
2179
-
2180
- const ESCAPES = new Map([
2181
- ['n', '\n'],
2182
- ['r', '\r'],
2183
- ['t', '\t'],
2184
- ['b', '\b'],
2185
- ['f', '\f'],
2186
- ['v', '\v'],
2187
- ['0', '\0'],
2188
- ['\\', '\\'],
2189
- ['e', '\u001B'],
2190
- ['a', '\u0007']
2191
- ]);
2192
-
2193
- function unescape(c) {
2194
- if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
2195
- return String.fromCharCode(parseInt(c.slice(1), 16));
2196
- }
2197
-
2198
- return ESCAPES.get(c) || c;
2199
- }
2200
-
2201
- function parseArguments(name, args) {
2202
- const results = [];
2203
- const chunks = args.trim().split(/\s*,\s*/g);
2204
- let matches;
2205
-
2206
- for (const chunk of chunks) {
2207
- if (!isNaN(chunk)) {
2208
- results.push(Number(chunk));
2209
- } else if ((matches = chunk.match(STRING_REGEX))) {
2210
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
2211
- } else {
2212
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
2213
- }
2214
- }
2215
-
2216
- return results;
2217
- }
2218
-
2219
- function parseStyle(style) {
2220
- STYLE_REGEX.lastIndex = 0;
2221
-
2222
- const results = [];
2223
- let matches;
2224
-
2225
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
2226
- const name = matches[1];
2227
-
2228
- if (matches[2]) {
2229
- const args = parseArguments(name, matches[2]);
2230
- results.push([name].concat(args));
2231
- } else {
2232
- results.push([name]);
2233
- }
2234
- }
2235
-
2236
- return results;
2237
- }
2238
-
2239
- function buildStyle(chalk, styles) {
2240
- const enabled = {};
2241
-
2242
- for (const layer of styles) {
2243
- for (const style of layer.styles) {
2244
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
2245
- }
2246
- }
2247
-
2248
- let current = chalk;
2249
- for (const styleName of Object.keys(enabled)) {
2250
- if (Array.isArray(enabled[styleName])) {
2251
- if (!(styleName in current)) {
2252
- throw new Error(`Unknown Chalk style: ${styleName}`);
2253
- }
2254
-
2255
- if (enabled[styleName].length > 0) {
2256
- current = current[styleName].apply(current, enabled[styleName]);
2257
- } else {
2258
- current = current[styleName];
2259
- }
2260
- }
2261
- }
2262
-
2263
- return current;
2264
- }
2265
-
2266
- var templates = (chalk, tmp) => {
2267
- const styles = [];
2268
- const chunks = [];
2269
- let chunk = [];
2270
-
2271
- // eslint-disable-next-line max-params
2272
- tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
2273
- if (escapeChar) {
2274
- chunk.push(unescape(escapeChar));
2275
- } else if (style) {
2276
- const str = chunk.join('');
2277
- chunk = [];
2278
- chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
2279
- styles.push({inverse, styles: parseStyle(style)});
2280
- } else if (close) {
2281
- if (styles.length === 0) {
2282
- throw new Error('Found extraneous } in Chalk template literal');
2283
- }
2284
-
2285
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
2286
- chunk = [];
2287
- styles.pop();
2288
- } else {
2289
- chunk.push(chr);
2290
- }
2291
- });
2292
-
2293
- chunks.push(chunk.join(''));
2294
-
2295
- if (styles.length > 0) {
2296
- const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
2297
- throw new Error(errMsg);
2298
- }
2299
-
2300
- return chunks.join('');
2301
- };
2302
-
2303
- var chalk = createCommonjsModule(function (module) {
2304
-
2305
-
2306
- const stdoutColor = supportsColor_1.stdout;
2307
-
2308
-
2309
-
2310
- const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
2311
-
2312
- // `supportsColor.level` → `ansiStyles.color[name]` mapping
2313
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
2314
-
2315
- // `color-convert` models to exclude from the Chalk API due to conflicts and such
2316
- const skipModels = new Set(['gray']);
2317
-
2318
- const styles = Object.create(null);
2319
-
2320
- function applyOptions(obj, options) {
2321
- options = options || {};
2322
-
2323
- // Detect level if not set manually
2324
- const scLevel = stdoutColor ? stdoutColor.level : 0;
2325
- obj.level = options.level === undefined ? scLevel : options.level;
2326
- obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
2327
- }
2328
-
2329
- function Chalk(options) {
2330
- // We check for this.template here since calling `chalk.constructor()`
2331
- // by itself will have a `this` of a previously constructed chalk object
2332
- if (!this || !(this instanceof Chalk) || this.template) {
2333
- const chalk = {};
2334
- applyOptions(chalk, options);
2335
-
2336
- chalk.template = function () {
2337
- const args = [].slice.call(arguments);
2338
- return chalkTag.apply(null, [chalk.template].concat(args));
2339
- };
2340
-
2341
- Object.setPrototypeOf(chalk, Chalk.prototype);
2342
- Object.setPrototypeOf(chalk.template, chalk);
2343
-
2344
- chalk.template.constructor = Chalk;
2345
-
2346
- return chalk.template;
2347
- }
2348
-
2349
- applyOptions(this, options);
2350
- }
2351
-
2352
- // Use bright blue on Windows as the normal blue color is illegible
2353
- if (isSimpleWindowsTerm) {
2354
- ansiStyles.blue.open = '\u001B[94m';
2355
- }
2356
-
2357
- for (const key of Object.keys(ansiStyles)) {
2358
- ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
2359
-
2360
- styles[key] = {
2361
- get() {
2362
- const codes = ansiStyles[key];
2363
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
2364
- }
2365
- };
2366
- }
657
+ const Styles = {
658
+ reset: Style(0, 0),
659
+ bold: Style(1, 22),
660
+ dim: Style(2, 22),
661
+ italic: Style(3, 23),
662
+ underline: Style(4, 24),
663
+ inverse: Style(7, 27),
664
+ hidden: Style(8, 28),
665
+ strikethrough: Style(9, 29),
666
+
667
+ black: Style(30, 39),
668
+ red: Style(31, 39),
669
+ green: Style(32, 39),
670
+ yellow: Style(33, 39),
671
+ blue: Style(34, 39),
672
+ magenta: Style(35, 39),
673
+ cyan: Style(36, 39),
674
+ white: Style(37, 39),
675
+ gray: Style(90, 39),
676
+
677
+ bgBlack: Style(40, 49),
678
+ bgRed: Style(101, 49),
679
+ bgGreen: Style(102, 49),
680
+ bgYellow: Style(103, 49),
681
+ bgBlue: Style(104, 49),
682
+ bgMagenta: Style(105, 49),
683
+ bgCyan: Style(106, 49),
684
+ bgWhite: Style(107, 49)
685
+ };
686
+
687
+ const turbocolor = {
688
+ Styles,
689
+ enabled:
690
+ process.env.FORCE_COLOR ||
691
+ process.platform === "win32" ||
692
+ (process.stdout.isTTY && process.env.TERM && process.env.TERM !== "dumb")
693
+ };
694
+
695
+ const color = function(out) {
696
+ if (!turbocolor.enabled) return out
697
+
698
+ let i, style;
699
+ const names = this.names;
700
+ const length = names.length;
701
+
702
+ for (i = 0, out = out + ""; i < length; i++) {
703
+ style = Styles[names[i]];
704
+ out = `${style.open}${out.replace(style.strip, style.open)}${style.close}`;
705
+ }
2367
706
 
2368
- styles.visible = {
2369
- get() {
2370
- return build.call(this, this._styles || [], true, 'visible');
2371
- }
707
+ return out
2372
708
  };
2373
709
 
2374
- ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
2375
- for (const model of Object.keys(ansiStyles.color.ansi)) {
2376
- if (skipModels.has(model)) {
2377
- continue;
2378
- }
2379
-
2380
- styles[model] = {
2381
- get() {
2382
- const level = this.level;
2383
- return function () {
2384
- const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
2385
- const codes = {
2386
- open,
2387
- close: ansiStyles.color.close,
2388
- closeRe: ansiStyles.color.closeRe
2389
- };
2390
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2391
- };
2392
- }
2393
- };
2394
- }
2395
-
2396
- ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
2397
- for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
2398
- if (skipModels.has(model)) {
2399
- continue;
2400
- }
2401
-
2402
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
2403
- styles[bgModel] = {
2404
- get() {
2405
- const level = this.level;
2406
- return function () {
2407
- const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
2408
- const codes = {
2409
- open,
2410
- close: ansiStyles.bgColor.close,
2411
- closeRe: ansiStyles.bgColor.closeRe
2412
- };
2413
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2414
- };
2415
- }
2416
- };
2417
- }
2418
-
2419
- const proto = Object.defineProperties(() => {}, styles);
2420
-
2421
- function build(_styles, _empty, key) {
2422
- const builder = function () {
2423
- return applyStyle.apply(builder, arguments);
2424
- };
2425
-
2426
- builder._styles = _styles;
2427
- builder._empty = _empty;
2428
-
2429
- const self = this;
2430
-
2431
- Object.defineProperty(builder, 'level', {
2432
- enumerable: true,
2433
- get() {
2434
- return self.level;
2435
- },
2436
- set(level) {
2437
- self.level = level;
2438
- }
2439
- });
2440
-
2441
- Object.defineProperty(builder, 'enabled', {
2442
- enumerable: true,
2443
- get() {
2444
- return self.enabled;
2445
- },
2446
- set(enabled) {
2447
- self.enabled = enabled;
2448
- }
2449
- });
2450
-
2451
- // See below for fix regarding invisible grey/dim combination on Windows
2452
- builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
710
+ for (const name in Styles) {
711
+ defineProperty(turbocolor, name, {
712
+ get() {
713
+ if (this.names === undefined) {
714
+ const chain = {};
715
+ const style = color.bind(chain);
2453
716
 
2454
- // `__proto__` is used because we must return a function, but there is
2455
- // no way to create a function with a different prototype
2456
- builder.__proto__ = proto; // eslint-disable-line no-proto
717
+ style.__proto__ = turbocolor;
718
+ style.names = chain.names = [name];
2457
719
 
2458
- return builder;
2459
- }
2460
-
2461
- function applyStyle() {
2462
- // Support varags, but simply cast to string in case there's only one arg
2463
- const args = arguments;
2464
- const argsLen = args.length;
2465
- let str = String(arguments[0]);
2466
-
2467
- if (argsLen === 0) {
2468
- return '';
2469
- }
2470
-
2471
- if (argsLen > 1) {
2472
- // Don't slice `arguments`, it prevents V8 optimizations
2473
- for (let a = 1; a < argsLen; a++) {
2474
- str += ' ' + args[a];
2475
- }
2476
- }
2477
-
2478
- if (!this.enabled || this.level <= 0 || !str) {
2479
- return this._empty ? '' : str;
2480
- }
2481
-
2482
- // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
2483
- // see https://github.com/chalk/chalk/issues/58
2484
- // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
2485
- const originalDim = ansiStyles.dim.open;
2486
- if (isSimpleWindowsTerm && this.hasGrey) {
2487
- ansiStyles.dim.open = '';
2488
- }
2489
-
2490
- for (const code of this._styles.slice().reverse()) {
2491
- // Replace any instances already present with a re-opening code
2492
- // otherwise only the part of the string until said closing code
2493
- // will be colored, and the rest will simply be 'plain'.
2494
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
2495
-
2496
- // Close the styling before a linebreak and reopen
2497
- // after next line to fix a bleed issue on macOS
2498
- // https://github.com/chalk/chalk/pull/92
2499
- str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
2500
- }
2501
-
2502
- // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
2503
- ansiStyles.dim.open = originalDim;
2504
-
2505
- return str;
2506
- }
2507
-
2508
- function chalkTag(chalk, strings) {
2509
- if (!Array.isArray(strings)) {
2510
- // If chalk() was called by itself or with a string,
2511
- // return the string itself as a string.
2512
- return [].slice.call(arguments, 1).join(' ');
2513
- }
2514
-
2515
- const args = [].slice.call(arguments, 2);
2516
- const parts = [strings.raw[0]];
720
+ return style
721
+ }
2517
722
 
2518
- for (let i = 1; i < strings.length; i++) {
2519
- parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
2520
- parts.push(String(strings.raw[i]));
2521
- }
2522
-
2523
- return templates(chalk, parts.join(''));
723
+ this.names.push(name);
724
+ return this
725
+ }
726
+ });
2524
727
  }
2525
728
 
2526
- Object.defineProperties(Chalk.prototype, styles);
729
+ var turbocolor_1 = turbocolor;
2527
730
 
2528
- module.exports = Chalk(); // eslint-disable-line new-cap
2529
- module.exports.supportsColor = stdoutColor;
2530
- module.exports.default = module.exports; // For TypeScript
2531
- });
2532
- var chalk_1 = chalk.supportsColor;
2533
-
2534
- if (!chalk.supportsColor)
2535
- chalk.enabled = false;
2536
731
  // log to stderr to keep `rollup main.js > bundle.js` from breaking
2537
732
  var stderr = console.error.bind(console); // eslint-disable-line no-console
2538
733
  function handleError(err, recover) {
@@ -2543,10 +738,10 @@ function handleError(err, recover) {
2543
738
  var message = (err.plugin
2544
739
  ? "(" + err.plugin + " plugin) " + description
2545
740
  : description) || err;
2546
- stderr(chalk.bold.red("[!] " + chalk.bold(message.toString())));
741
+ stderr(turbocolor_1.bold.red("[!] " + turbocolor_1.bold(message.toString())));
2547
742
  // TODO should this be "err.url || (err.file && err.loc.file) || err.id"?
2548
743
  if (err.url) {
2549
- stderr(chalk.cyan(err.url));
744
+ stderr(turbocolor_1.cyan(err.url));
2550
745
  }
2551
746
  if (err.loc) {
2552
747
  stderr(relativeId(err.loc.file || err.id) + " (" + err.loc.line + ":" + err.loc.column + ")");
@@ -2555,10 +750,10 @@ function handleError(err, recover) {
2555
750
  stderr(relativeId(err.id));
2556
751
  }
2557
752
  if (err.frame) {
2558
- stderr(chalk.dim(err.frame));
753
+ stderr(turbocolor_1.dim(err.frame));
2559
754
  }
2560
755
  else if (err.stack) {
2561
- stderr(chalk.dim(err.stack));
756
+ stderr(turbocolor_1.dim(err.stack));
2562
757
  }
2563
758
  stderr('');
2564
759
  if (!recover)
@@ -2621,7 +816,7 @@ function batchWarnings() {
2621
816
  }
2622
817
  else {
2623
818
  warnings.forEach(function (warning) {
2624
- stderr(chalk.bold.yellow('(!)') + " " + chalk.bold.yellow(warning.message));
819
+ stderr(turbocolor_1.bold.yellow('(!)') + " " + turbocolor_1.bold.yellow(warning.message));
2625
820
  if (warning.url)
2626
821
  info(warning.url);
2627
822
  var id = (warning.loc && warning.loc.file) || warning.id;
@@ -2629,7 +824,7 @@ function batchWarnings() {
2629
824
  var loc = warning.loc
2630
825
  ? relativeId(id) + ": (" + warning.loc.line + ":" + warning.loc.column + ")"
2631
826
  : relativeId(id);
2632
- stderr(chalk.bold(relativeId(loc)));
827
+ stderr(turbocolor_1.bold(relativeId(loc)));
2633
828
  }
2634
829
  if (warning.frame)
2635
830
  info(warning.frame);
@@ -2650,7 +845,7 @@ var immediateHandlers = {
2650
845
  title("Some options have been renamed");
2651
846
  info("https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32");
2652
847
  warning.deprecations.forEach(function (option) {
2653
- stderr(chalk.bold(option.old) + " is now " + option.new);
848
+ stderr(turbocolor_1.bold(option.old) + " is now " + option.new);
2654
849
  });
2655
850
  },
2656
851
  MISSING_NODE_BUILTINS: function (warning) {
@@ -2695,7 +890,7 @@ var deferredHandlers = {
2695
890
  });
2696
891
  Array.from(dependencies.keys()).forEach(function (dependency) {
2697
892
  var importers = dependencies.get(dependency);
2698
- stderr(chalk.bold(dependency) + " (imported by " + importers.join(', ') + ")");
893
+ stderr(turbocolor_1.bold(dependency) + " (imported by " + importers.join(', ') + ")");
2699
894
  });
2700
895
  }
2701
896
  },
@@ -2705,9 +900,9 @@ var deferredHandlers = {
2705
900
  title('Missing exports');
2706
901
  info('https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module');
2707
902
  warnings.forEach(function (warning) {
2708
- stderr(chalk.bold(warning.importer));
903
+ stderr(turbocolor_1.bold(warning.importer));
2709
904
  stderr(warning.missing + " is not exported by " + warning.exporter);
2710
- stderr(chalk.grey(warning.frame));
905
+ stderr(turbocolor_1.gray(warning.frame));
2711
906
  });
2712
907
  }
2713
908
  },
@@ -2739,7 +934,7 @@ var deferredHandlers = {
2739
934
  fn: function (warnings) {
2740
935
  title("Conflicting re-exports");
2741
936
  warnings.forEach(function (warning) {
2742
- stderr(chalk.bold(relativeId(warning.reexporter)) + " re-exports '" + warning.name + "' from both " + relativeId(warning.sources[0]) + " and " + relativeId(warning.sources[1]) + " (will be ignored)");
937
+ stderr(turbocolor_1.bold(relativeId(warning.reexporter)) + " re-exports '" + warning.name + "' from both " + relativeId(warning.sources[0]) + " and " + relativeId(warning.sources[1]) + " (will be ignored)");
2743
938
  });
2744
939
  }
2745
940
  },
@@ -2749,7 +944,7 @@ var deferredHandlers = {
2749
944
  title("Missing global variable " + (warnings.length > 1 ? 'names' : 'name'));
2750
945
  stderr("Use output.globals to specify browser global variable names corresponding to external modules");
2751
946
  warnings.forEach(function (warning) {
2752
- stderr(chalk.bold(warning.source) + " (guessing '" + warning.guess + "')");
947
+ stderr(turbocolor_1.bold(warning.source) + " (guessing '" + warning.guess + "')");
2753
948
  });
2754
949
  }
2755
950
  },
@@ -2787,7 +982,7 @@ var deferredHandlers = {
2787
982
  var loc = warning.loc
2788
983
  ? relativeId(warning.id) + ": (" + warning.loc.line + ":" + warning.loc.column + ")"
2789
984
  : relativeId(warning.id);
2790
- stderr(chalk.bold(relativeId(loc)));
985
+ stderr(turbocolor_1.bold(relativeId(loc)));
2791
986
  if (warning.frame)
2792
987
  info(warning.frame);
2793
988
  });
@@ -2797,10 +992,10 @@ var deferredHandlers = {
2797
992
  }
2798
993
  };
2799
994
  function title(str) {
2800
- stderr(chalk.bold.yellow('(!)') + " " + chalk.bold.yellow(str));
995
+ stderr(turbocolor_1.bold.yellow('(!)') + " " + turbocolor_1.bold.yellow(str));
2801
996
  }
2802
997
  function info(url) {
2803
- stderr(chalk.grey(url));
998
+ stderr(turbocolor_1.gray(url));
2804
999
  }
2805
1000
  function nest(array, prop) {
2806
1001
  var nested = [];
@@ -2823,8 +1018,8 @@ function showTruncatedWarnings(warnings) {
2823
1018
  var sliced = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
2824
1019
  sliced.forEach(function (_a) {
2825
1020
  var id = _a.key, items = _a.items;
2826
- stderr(chalk.bold(relativeId(id)));
2827
- stderr(chalk.grey(items[0].frame));
1021
+ stderr(turbocolor_1.bold(relativeId(id)));
1022
+ stderr(turbocolor_1.gray(items[0].frame));
2828
1023
  if (items.length > 1) {
2829
1024
  stderr("...and " + (items.length - 1) + " other " + (items.length > 2 ? 'occurrences' : 'occurrence'));
2830
1025
  }
@@ -2918,13 +1113,7 @@ var SOURCEMAPPING_URL$1 = SOURCEMAPPING_URL;
2918
1113
 
2919
1114
  function printTimings(timings) {
2920
1115
  Object.keys(timings).forEach(function (label) {
2921
- var color = chalk;
2922
- if (label[0] === '#') {
2923
- color = color.bold;
2924
- if (label[1] !== '#') {
2925
- color = color.underline;
2926
- }
2927
- }
1116
+ var color = label[0] === '#' ? (label[1] !== '#' ? turbocolor_1.underline : turbocolor_1.bold) : function (text) { return text; };
2928
1117
  console.info(color(label + ": " + timings[label].toFixed(0) + "ms"));
2929
1118
  });
2930
1119
  }
@@ -2951,7 +1140,7 @@ function build(inputOptions, outputOptions, warnings, silent) {
2951
1140
  .map(function (name) { return inputOptions.input[name]; })
2952
1141
  .join(', ');
2953
1142
  }
2954
- stderr(chalk.cyan("\n" + chalk.bold(inputFiles) + " \u2192 " + chalk.bold(files.join(', ')) + "..."));
1143
+ stderr(turbocolor_1.cyan("\n" + turbocolor_1.bold(inputFiles) + " \u2192 " + turbocolor_1.bold(files.join(', ')) + "..."));
2955
1144
  }
2956
1145
  return rollup.rollup(inputOptions)
2957
1146
  .then(function (bundle) {
@@ -2978,7 +1167,7 @@ function build(inputOptions, outputOptions, warnings, silent) {
2978
1167
  .then(function (bundle) {
2979
1168
  warnings.flush();
2980
1169
  if (!silent)
2981
- stderr(chalk.green("created " + chalk.bold(files.join(', ')) + " in " + chalk.bold(prettyMs(Date.now() - start))));
1170
+ stderr(turbocolor_1.green("created " + turbocolor_1.bold(files.join(', ')) + " in " + turbocolor_1.bold(prettyMs(Date.now() - start))));
2982
1171
  if (bundle && bundle.getTimings) {
2983
1172
  printTimings(bundle.getTimings());
2984
1173
  }
@@ -3000,7 +1189,7 @@ function loadConfigFile(configFile, commandOptions) {
3000
1189
  })
3001
1190
  .then(function (bundle) {
3002
1191
  if (!silent && warnings.count > 0) {
3003
- stderr(chalk.bold("loaded " + relativeId(configFile) + " with warnings"));
1192
+ stderr(turbocolor_1.bold("loaded " + relativeId(configFile) + " with warnings"));
3004
1193
  warnings.flush();
3005
1194
  }
3006
1195
  return bundle.generate({
@@ -3082,6 +1271,10 @@ var dateTime = options => {
3082
1271
  .replace(/\..+/, end);
3083
1272
  };
3084
1273
 
1274
+ function createCommonjsModule(fn, module) {
1275
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
1276
+ }
1277
+
3085
1278
  var signals = createCommonjsModule(function (module) {
3086
1279
  // This is not the set of all possible signals.
3087
1280
  //
@@ -3511,7 +1704,7 @@ function watch(configFile, configs, command, silent) {
3511
1704
  handleError(event.error, true);
3512
1705
  break;
3513
1706
  case 'START':
3514
- screenWriter(chalk.underline("rollup v" + rollup.VERSION));
1707
+ screenWriter(turbocolor_1.underline("rollup v" + rollup.VERSION));
3515
1708
  break;
3516
1709
  case 'BUNDLE_START':
3517
1710
  if (!silent) {
@@ -3523,13 +1716,13 @@ function watch(configFile, configs, command, silent) {
3523
1716
  .map(function (key) { return input_1[key]; })
3524
1717
  .join(', ');
3525
1718
  }
3526
- stderr(chalk.cyan("bundles " + chalk.bold(input_1) + " \u2192 " + chalk.bold(event.output.map(relativeId).join(', ')) + "..."));
1719
+ stderr(turbocolor_1.cyan("bundles " + turbocolor_1.bold(input_1) + " \u2192 " + turbocolor_1.bold(event.output.map(relativeId).join(', ')) + "..."));
3527
1720
  }
3528
1721
  break;
3529
1722
  case 'BUNDLE_END':
3530
1723
  warnings.flush();
3531
1724
  if (!silent)
3532
- stderr(chalk.green("created " + chalk.bold(event.output.map(relativeId).join(', ')) + " in " + chalk.bold(prettyMs(event.duration))));
1725
+ stderr(turbocolor_1.green("created " + turbocolor_1.bold(event.output.map(relativeId).join(', ')) + " in " + turbocolor_1.bold(prettyMs(event.duration))));
3533
1726
  if (event.result && event.result.getTimings) {
3534
1727
  printTimings(event.result.getTimings());
3535
1728
  }