@formatjs/cli 6.12.1 → 6.13.0
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/formatjs +58 -1581
- package/package.json +3 -3
package/bin/formatjs
CHANGED
|
@@ -16042,1556 +16042,10 @@ var require_json_stable_stringify = __commonJS({
|
|
|
16042
16042
|
}
|
|
16043
16043
|
});
|
|
16044
16044
|
|
|
16045
|
-
// node_modules/.aspect_rules_js/color-name@1.1.4/node_modules/color-name/index.js
|
|
16046
|
-
var require_color_name = __commonJS({
|
|
16047
|
-
"node_modules/.aspect_rules_js/color-name@1.1.4/node_modules/color-name/index.js"(exports, module2) {
|
|
16048
|
-
"use strict";
|
|
16049
|
-
module2.exports = {
|
|
16050
|
-
"aliceblue": [240, 248, 255],
|
|
16051
|
-
"antiquewhite": [250, 235, 215],
|
|
16052
|
-
"aqua": [0, 255, 255],
|
|
16053
|
-
"aquamarine": [127, 255, 212],
|
|
16054
|
-
"azure": [240, 255, 255],
|
|
16055
|
-
"beige": [245, 245, 220],
|
|
16056
|
-
"bisque": [255, 228, 196],
|
|
16057
|
-
"black": [0, 0, 0],
|
|
16058
|
-
"blanchedalmond": [255, 235, 205],
|
|
16059
|
-
"blue": [0, 0, 255],
|
|
16060
|
-
"blueviolet": [138, 43, 226],
|
|
16061
|
-
"brown": [165, 42, 42],
|
|
16062
|
-
"burlywood": [222, 184, 135],
|
|
16063
|
-
"cadetblue": [95, 158, 160],
|
|
16064
|
-
"chartreuse": [127, 255, 0],
|
|
16065
|
-
"chocolate": [210, 105, 30],
|
|
16066
|
-
"coral": [255, 127, 80],
|
|
16067
|
-
"cornflowerblue": [100, 149, 237],
|
|
16068
|
-
"cornsilk": [255, 248, 220],
|
|
16069
|
-
"crimson": [220, 20, 60],
|
|
16070
|
-
"cyan": [0, 255, 255],
|
|
16071
|
-
"darkblue": [0, 0, 139],
|
|
16072
|
-
"darkcyan": [0, 139, 139],
|
|
16073
|
-
"darkgoldenrod": [184, 134, 11],
|
|
16074
|
-
"darkgray": [169, 169, 169],
|
|
16075
|
-
"darkgreen": [0, 100, 0],
|
|
16076
|
-
"darkgrey": [169, 169, 169],
|
|
16077
|
-
"darkkhaki": [189, 183, 107],
|
|
16078
|
-
"darkmagenta": [139, 0, 139],
|
|
16079
|
-
"darkolivegreen": [85, 107, 47],
|
|
16080
|
-
"darkorange": [255, 140, 0],
|
|
16081
|
-
"darkorchid": [153, 50, 204],
|
|
16082
|
-
"darkred": [139, 0, 0],
|
|
16083
|
-
"darksalmon": [233, 150, 122],
|
|
16084
|
-
"darkseagreen": [143, 188, 143],
|
|
16085
|
-
"darkslateblue": [72, 61, 139],
|
|
16086
|
-
"darkslategray": [47, 79, 79],
|
|
16087
|
-
"darkslategrey": [47, 79, 79],
|
|
16088
|
-
"darkturquoise": [0, 206, 209],
|
|
16089
|
-
"darkviolet": [148, 0, 211],
|
|
16090
|
-
"deeppink": [255, 20, 147],
|
|
16091
|
-
"deepskyblue": [0, 191, 255],
|
|
16092
|
-
"dimgray": [105, 105, 105],
|
|
16093
|
-
"dimgrey": [105, 105, 105],
|
|
16094
|
-
"dodgerblue": [30, 144, 255],
|
|
16095
|
-
"firebrick": [178, 34, 34],
|
|
16096
|
-
"floralwhite": [255, 250, 240],
|
|
16097
|
-
"forestgreen": [34, 139, 34],
|
|
16098
|
-
"fuchsia": [255, 0, 255],
|
|
16099
|
-
"gainsboro": [220, 220, 220],
|
|
16100
|
-
"ghostwhite": [248, 248, 255],
|
|
16101
|
-
"gold": [255, 215, 0],
|
|
16102
|
-
"goldenrod": [218, 165, 32],
|
|
16103
|
-
"gray": [128, 128, 128],
|
|
16104
|
-
"green": [0, 128, 0],
|
|
16105
|
-
"greenyellow": [173, 255, 47],
|
|
16106
|
-
"grey": [128, 128, 128],
|
|
16107
|
-
"honeydew": [240, 255, 240],
|
|
16108
|
-
"hotpink": [255, 105, 180],
|
|
16109
|
-
"indianred": [205, 92, 92],
|
|
16110
|
-
"indigo": [75, 0, 130],
|
|
16111
|
-
"ivory": [255, 255, 240],
|
|
16112
|
-
"khaki": [240, 230, 140],
|
|
16113
|
-
"lavender": [230, 230, 250],
|
|
16114
|
-
"lavenderblush": [255, 240, 245],
|
|
16115
|
-
"lawngreen": [124, 252, 0],
|
|
16116
|
-
"lemonchiffon": [255, 250, 205],
|
|
16117
|
-
"lightblue": [173, 216, 230],
|
|
16118
|
-
"lightcoral": [240, 128, 128],
|
|
16119
|
-
"lightcyan": [224, 255, 255],
|
|
16120
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
16121
|
-
"lightgray": [211, 211, 211],
|
|
16122
|
-
"lightgreen": [144, 238, 144],
|
|
16123
|
-
"lightgrey": [211, 211, 211],
|
|
16124
|
-
"lightpink": [255, 182, 193],
|
|
16125
|
-
"lightsalmon": [255, 160, 122],
|
|
16126
|
-
"lightseagreen": [32, 178, 170],
|
|
16127
|
-
"lightskyblue": [135, 206, 250],
|
|
16128
|
-
"lightslategray": [119, 136, 153],
|
|
16129
|
-
"lightslategrey": [119, 136, 153],
|
|
16130
|
-
"lightsteelblue": [176, 196, 222],
|
|
16131
|
-
"lightyellow": [255, 255, 224],
|
|
16132
|
-
"lime": [0, 255, 0],
|
|
16133
|
-
"limegreen": [50, 205, 50],
|
|
16134
|
-
"linen": [250, 240, 230],
|
|
16135
|
-
"magenta": [255, 0, 255],
|
|
16136
|
-
"maroon": [128, 0, 0],
|
|
16137
|
-
"mediumaquamarine": [102, 205, 170],
|
|
16138
|
-
"mediumblue": [0, 0, 205],
|
|
16139
|
-
"mediumorchid": [186, 85, 211],
|
|
16140
|
-
"mediumpurple": [147, 112, 219],
|
|
16141
|
-
"mediumseagreen": [60, 179, 113],
|
|
16142
|
-
"mediumslateblue": [123, 104, 238],
|
|
16143
|
-
"mediumspringgreen": [0, 250, 154],
|
|
16144
|
-
"mediumturquoise": [72, 209, 204],
|
|
16145
|
-
"mediumvioletred": [199, 21, 133],
|
|
16146
|
-
"midnightblue": [25, 25, 112],
|
|
16147
|
-
"mintcream": [245, 255, 250],
|
|
16148
|
-
"mistyrose": [255, 228, 225],
|
|
16149
|
-
"moccasin": [255, 228, 181],
|
|
16150
|
-
"navajowhite": [255, 222, 173],
|
|
16151
|
-
"navy": [0, 0, 128],
|
|
16152
|
-
"oldlace": [253, 245, 230],
|
|
16153
|
-
"olive": [128, 128, 0],
|
|
16154
|
-
"olivedrab": [107, 142, 35],
|
|
16155
|
-
"orange": [255, 165, 0],
|
|
16156
|
-
"orangered": [255, 69, 0],
|
|
16157
|
-
"orchid": [218, 112, 214],
|
|
16158
|
-
"palegoldenrod": [238, 232, 170],
|
|
16159
|
-
"palegreen": [152, 251, 152],
|
|
16160
|
-
"paleturquoise": [175, 238, 238],
|
|
16161
|
-
"palevioletred": [219, 112, 147],
|
|
16162
|
-
"papayawhip": [255, 239, 213],
|
|
16163
|
-
"peachpuff": [255, 218, 185],
|
|
16164
|
-
"peru": [205, 133, 63],
|
|
16165
|
-
"pink": [255, 192, 203],
|
|
16166
|
-
"plum": [221, 160, 221],
|
|
16167
|
-
"powderblue": [176, 224, 230],
|
|
16168
|
-
"purple": [128, 0, 128],
|
|
16169
|
-
"rebeccapurple": [102, 51, 153],
|
|
16170
|
-
"red": [255, 0, 0],
|
|
16171
|
-
"rosybrown": [188, 143, 143],
|
|
16172
|
-
"royalblue": [65, 105, 225],
|
|
16173
|
-
"saddlebrown": [139, 69, 19],
|
|
16174
|
-
"salmon": [250, 128, 114],
|
|
16175
|
-
"sandybrown": [244, 164, 96],
|
|
16176
|
-
"seagreen": [46, 139, 87],
|
|
16177
|
-
"seashell": [255, 245, 238],
|
|
16178
|
-
"sienna": [160, 82, 45],
|
|
16179
|
-
"silver": [192, 192, 192],
|
|
16180
|
-
"skyblue": [135, 206, 235],
|
|
16181
|
-
"slateblue": [106, 90, 205],
|
|
16182
|
-
"slategray": [112, 128, 144],
|
|
16183
|
-
"slategrey": [112, 128, 144],
|
|
16184
|
-
"snow": [255, 250, 250],
|
|
16185
|
-
"springgreen": [0, 255, 127],
|
|
16186
|
-
"steelblue": [70, 130, 180],
|
|
16187
|
-
"tan": [210, 180, 140],
|
|
16188
|
-
"teal": [0, 128, 128],
|
|
16189
|
-
"thistle": [216, 191, 216],
|
|
16190
|
-
"tomato": [255, 99, 71],
|
|
16191
|
-
"turquoise": [64, 224, 208],
|
|
16192
|
-
"violet": [238, 130, 238],
|
|
16193
|
-
"wheat": [245, 222, 179],
|
|
16194
|
-
"white": [255, 255, 255],
|
|
16195
|
-
"whitesmoke": [245, 245, 245],
|
|
16196
|
-
"yellow": [255, 255, 0],
|
|
16197
|
-
"yellowgreen": [154, 205, 50]
|
|
16198
|
-
};
|
|
16199
|
-
}
|
|
16200
|
-
});
|
|
16201
|
-
|
|
16202
|
-
// node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/conversions.js
|
|
16203
|
-
var require_conversions = __commonJS({
|
|
16204
|
-
"node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports, module2) {
|
|
16205
|
-
var cssKeywords = require_color_name();
|
|
16206
|
-
var reverseKeywords = {};
|
|
16207
|
-
for (const key of Object.keys(cssKeywords)) {
|
|
16208
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
16209
|
-
}
|
|
16210
|
-
var convert = {
|
|
16211
|
-
rgb: { channels: 3, labels: "rgb" },
|
|
16212
|
-
hsl: { channels: 3, labels: "hsl" },
|
|
16213
|
-
hsv: { channels: 3, labels: "hsv" },
|
|
16214
|
-
hwb: { channels: 3, labels: "hwb" },
|
|
16215
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
|
16216
|
-
xyz: { channels: 3, labels: "xyz" },
|
|
16217
|
-
lab: { channels: 3, labels: "lab" },
|
|
16218
|
-
lch: { channels: 3, labels: "lch" },
|
|
16219
|
-
hex: { channels: 1, labels: ["hex"] },
|
|
16220
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
|
16221
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
16222
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
16223
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
16224
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
16225
|
-
gray: { channels: 1, labels: ["gray"] }
|
|
16226
|
-
};
|
|
16227
|
-
module2.exports = convert;
|
|
16228
|
-
for (const model of Object.keys(convert)) {
|
|
16229
|
-
if (!("channels" in convert[model])) {
|
|
16230
|
-
throw new Error("missing channels property: " + model);
|
|
16231
|
-
}
|
|
16232
|
-
if (!("labels" in convert[model])) {
|
|
16233
|
-
throw new Error("missing channel labels property: " + model);
|
|
16234
|
-
}
|
|
16235
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
|
16236
|
-
throw new Error("channel and label counts mismatch: " + model);
|
|
16237
|
-
}
|
|
16238
|
-
const { channels, labels } = convert[model];
|
|
16239
|
-
delete convert[model].channels;
|
|
16240
|
-
delete convert[model].labels;
|
|
16241
|
-
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
16242
|
-
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
16243
|
-
}
|
|
16244
|
-
convert.rgb.hsl = function(rgb) {
|
|
16245
|
-
const r = rgb[0] / 255;
|
|
16246
|
-
const g = rgb[1] / 255;
|
|
16247
|
-
const b = rgb[2] / 255;
|
|
16248
|
-
const min = Math.min(r, g, b);
|
|
16249
|
-
const max = Math.max(r, g, b);
|
|
16250
|
-
const delta = max - min;
|
|
16251
|
-
let h;
|
|
16252
|
-
let s;
|
|
16253
|
-
if (max === min) {
|
|
16254
|
-
h = 0;
|
|
16255
|
-
} else if (r === max) {
|
|
16256
|
-
h = (g - b) / delta;
|
|
16257
|
-
} else if (g === max) {
|
|
16258
|
-
h = 2 + (b - r) / delta;
|
|
16259
|
-
} else if (b === max) {
|
|
16260
|
-
h = 4 + (r - g) / delta;
|
|
16261
|
-
}
|
|
16262
|
-
h = Math.min(h * 60, 360);
|
|
16263
|
-
if (h < 0) {
|
|
16264
|
-
h += 360;
|
|
16265
|
-
}
|
|
16266
|
-
const l = (min + max) / 2;
|
|
16267
|
-
if (max === min) {
|
|
16268
|
-
s = 0;
|
|
16269
|
-
} else if (l <= 0.5) {
|
|
16270
|
-
s = delta / (max + min);
|
|
16271
|
-
} else {
|
|
16272
|
-
s = delta / (2 - max - min);
|
|
16273
|
-
}
|
|
16274
|
-
return [h, s * 100, l * 100];
|
|
16275
|
-
};
|
|
16276
|
-
convert.rgb.hsv = function(rgb) {
|
|
16277
|
-
let rdif;
|
|
16278
|
-
let gdif;
|
|
16279
|
-
let bdif;
|
|
16280
|
-
let h;
|
|
16281
|
-
let s;
|
|
16282
|
-
const r = rgb[0] / 255;
|
|
16283
|
-
const g = rgb[1] / 255;
|
|
16284
|
-
const b = rgb[2] / 255;
|
|
16285
|
-
const v = Math.max(r, g, b);
|
|
16286
|
-
const diff = v - Math.min(r, g, b);
|
|
16287
|
-
const diffc = function(c) {
|
|
16288
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
16289
|
-
};
|
|
16290
|
-
if (diff === 0) {
|
|
16291
|
-
h = 0;
|
|
16292
|
-
s = 0;
|
|
16293
|
-
} else {
|
|
16294
|
-
s = diff / v;
|
|
16295
|
-
rdif = diffc(r);
|
|
16296
|
-
gdif = diffc(g);
|
|
16297
|
-
bdif = diffc(b);
|
|
16298
|
-
if (r === v) {
|
|
16299
|
-
h = bdif - gdif;
|
|
16300
|
-
} else if (g === v) {
|
|
16301
|
-
h = 1 / 3 + rdif - bdif;
|
|
16302
|
-
} else if (b === v) {
|
|
16303
|
-
h = 2 / 3 + gdif - rdif;
|
|
16304
|
-
}
|
|
16305
|
-
if (h < 0) {
|
|
16306
|
-
h += 1;
|
|
16307
|
-
} else if (h > 1) {
|
|
16308
|
-
h -= 1;
|
|
16309
|
-
}
|
|
16310
|
-
}
|
|
16311
|
-
return [
|
|
16312
|
-
h * 360,
|
|
16313
|
-
s * 100,
|
|
16314
|
-
v * 100
|
|
16315
|
-
];
|
|
16316
|
-
};
|
|
16317
|
-
convert.rgb.hwb = function(rgb) {
|
|
16318
|
-
const r = rgb[0];
|
|
16319
|
-
const g = rgb[1];
|
|
16320
|
-
let b = rgb[2];
|
|
16321
|
-
const h = convert.rgb.hsl(rgb)[0];
|
|
16322
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
16323
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
16324
|
-
return [h, w * 100, b * 100];
|
|
16325
|
-
};
|
|
16326
|
-
convert.rgb.cmyk = function(rgb) {
|
|
16327
|
-
const r = rgb[0] / 255;
|
|
16328
|
-
const g = rgb[1] / 255;
|
|
16329
|
-
const b = rgb[2] / 255;
|
|
16330
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
16331
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
|
16332
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
|
16333
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
|
16334
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
|
16335
|
-
};
|
|
16336
|
-
function comparativeDistance(x, y) {
|
|
16337
|
-
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
16338
|
-
}
|
|
16339
|
-
convert.rgb.keyword = function(rgb) {
|
|
16340
|
-
const reversed = reverseKeywords[rgb];
|
|
16341
|
-
if (reversed) {
|
|
16342
|
-
return reversed;
|
|
16343
|
-
}
|
|
16344
|
-
let currentClosestDistance = Infinity;
|
|
16345
|
-
let currentClosestKeyword;
|
|
16346
|
-
for (const keyword of Object.keys(cssKeywords)) {
|
|
16347
|
-
const value = cssKeywords[keyword];
|
|
16348
|
-
const distance = comparativeDistance(rgb, value);
|
|
16349
|
-
if (distance < currentClosestDistance) {
|
|
16350
|
-
currentClosestDistance = distance;
|
|
16351
|
-
currentClosestKeyword = keyword;
|
|
16352
|
-
}
|
|
16353
|
-
}
|
|
16354
|
-
return currentClosestKeyword;
|
|
16355
|
-
};
|
|
16356
|
-
convert.keyword.rgb = function(keyword) {
|
|
16357
|
-
return cssKeywords[keyword];
|
|
16358
|
-
};
|
|
16359
|
-
convert.rgb.xyz = function(rgb) {
|
|
16360
|
-
let r = rgb[0] / 255;
|
|
16361
|
-
let g = rgb[1] / 255;
|
|
16362
|
-
let b = rgb[2] / 255;
|
|
16363
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
16364
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
16365
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
16366
|
-
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
16367
|
-
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
16368
|
-
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
16369
|
-
return [x * 100, y * 100, z * 100];
|
|
16370
|
-
};
|
|
16371
|
-
convert.rgb.lab = function(rgb) {
|
|
16372
|
-
const xyz = convert.rgb.xyz(rgb);
|
|
16373
|
-
let x = xyz[0];
|
|
16374
|
-
let y = xyz[1];
|
|
16375
|
-
let z = xyz[2];
|
|
16376
|
-
x /= 95.047;
|
|
16377
|
-
y /= 100;
|
|
16378
|
-
z /= 108.883;
|
|
16379
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
16380
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
16381
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
16382
|
-
const l = 116 * y - 16;
|
|
16383
|
-
const a = 500 * (x - y);
|
|
16384
|
-
const b = 200 * (y - z);
|
|
16385
|
-
return [l, a, b];
|
|
16386
|
-
};
|
|
16387
|
-
convert.hsl.rgb = function(hsl) {
|
|
16388
|
-
const h = hsl[0] / 360;
|
|
16389
|
-
const s = hsl[1] / 100;
|
|
16390
|
-
const l = hsl[2] / 100;
|
|
16391
|
-
let t2;
|
|
16392
|
-
let t3;
|
|
16393
|
-
let val;
|
|
16394
|
-
if (s === 0) {
|
|
16395
|
-
val = l * 255;
|
|
16396
|
-
return [val, val, val];
|
|
16397
|
-
}
|
|
16398
|
-
if (l < 0.5) {
|
|
16399
|
-
t2 = l * (1 + s);
|
|
16400
|
-
} else {
|
|
16401
|
-
t2 = l + s - l * s;
|
|
16402
|
-
}
|
|
16403
|
-
const t1 = 2 * l - t2;
|
|
16404
|
-
const rgb = [0, 0, 0];
|
|
16405
|
-
for (let i = 0; i < 3; i++) {
|
|
16406
|
-
t3 = h + 1 / 3 * -(i - 1);
|
|
16407
|
-
if (t3 < 0) {
|
|
16408
|
-
t3++;
|
|
16409
|
-
}
|
|
16410
|
-
if (t3 > 1) {
|
|
16411
|
-
t3--;
|
|
16412
|
-
}
|
|
16413
|
-
if (6 * t3 < 1) {
|
|
16414
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
|
16415
|
-
} else if (2 * t3 < 1) {
|
|
16416
|
-
val = t2;
|
|
16417
|
-
} else if (3 * t3 < 2) {
|
|
16418
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
16419
|
-
} else {
|
|
16420
|
-
val = t1;
|
|
16421
|
-
}
|
|
16422
|
-
rgb[i] = val * 255;
|
|
16423
|
-
}
|
|
16424
|
-
return rgb;
|
|
16425
|
-
};
|
|
16426
|
-
convert.hsl.hsv = function(hsl) {
|
|
16427
|
-
const h = hsl[0];
|
|
16428
|
-
let s = hsl[1] / 100;
|
|
16429
|
-
let l = hsl[2] / 100;
|
|
16430
|
-
let smin = s;
|
|
16431
|
-
const lmin = Math.max(l, 0.01);
|
|
16432
|
-
l *= 2;
|
|
16433
|
-
s *= l <= 1 ? l : 2 - l;
|
|
16434
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
16435
|
-
const v = (l + s) / 2;
|
|
16436
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
16437
|
-
return [h, sv * 100, v * 100];
|
|
16438
|
-
};
|
|
16439
|
-
convert.hsv.rgb = function(hsv) {
|
|
16440
|
-
const h = hsv[0] / 60;
|
|
16441
|
-
const s = hsv[1] / 100;
|
|
16442
|
-
let v = hsv[2] / 100;
|
|
16443
|
-
const hi = Math.floor(h) % 6;
|
|
16444
|
-
const f = h - Math.floor(h);
|
|
16445
|
-
const p2 = 255 * v * (1 - s);
|
|
16446
|
-
const q = 255 * v * (1 - s * f);
|
|
16447
|
-
const t = 255 * v * (1 - s * (1 - f));
|
|
16448
|
-
v *= 255;
|
|
16449
|
-
switch (hi) {
|
|
16450
|
-
case 0:
|
|
16451
|
-
return [v, t, p2];
|
|
16452
|
-
case 1:
|
|
16453
|
-
return [q, v, p2];
|
|
16454
|
-
case 2:
|
|
16455
|
-
return [p2, v, t];
|
|
16456
|
-
case 3:
|
|
16457
|
-
return [p2, q, v];
|
|
16458
|
-
case 4:
|
|
16459
|
-
return [t, p2, v];
|
|
16460
|
-
case 5:
|
|
16461
|
-
return [v, p2, q];
|
|
16462
|
-
}
|
|
16463
|
-
};
|
|
16464
|
-
convert.hsv.hsl = function(hsv) {
|
|
16465
|
-
const h = hsv[0];
|
|
16466
|
-
const s = hsv[1] / 100;
|
|
16467
|
-
const v = hsv[2] / 100;
|
|
16468
|
-
const vmin = Math.max(v, 0.01);
|
|
16469
|
-
let sl;
|
|
16470
|
-
let l;
|
|
16471
|
-
l = (2 - s) * v;
|
|
16472
|
-
const lmin = (2 - s) * vmin;
|
|
16473
|
-
sl = s * vmin;
|
|
16474
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
16475
|
-
sl = sl || 0;
|
|
16476
|
-
l /= 2;
|
|
16477
|
-
return [h, sl * 100, l * 100];
|
|
16478
|
-
};
|
|
16479
|
-
convert.hwb.rgb = function(hwb) {
|
|
16480
|
-
const h = hwb[0] / 360;
|
|
16481
|
-
let wh = hwb[1] / 100;
|
|
16482
|
-
let bl = hwb[2] / 100;
|
|
16483
|
-
const ratio = wh + bl;
|
|
16484
|
-
let f;
|
|
16485
|
-
if (ratio > 1) {
|
|
16486
|
-
wh /= ratio;
|
|
16487
|
-
bl /= ratio;
|
|
16488
|
-
}
|
|
16489
|
-
const i = Math.floor(6 * h);
|
|
16490
|
-
const v = 1 - bl;
|
|
16491
|
-
f = 6 * h - i;
|
|
16492
|
-
if ((i & 1) !== 0) {
|
|
16493
|
-
f = 1 - f;
|
|
16494
|
-
}
|
|
16495
|
-
const n = wh + f * (v - wh);
|
|
16496
|
-
let r;
|
|
16497
|
-
let g;
|
|
16498
|
-
let b;
|
|
16499
|
-
switch (i) {
|
|
16500
|
-
default:
|
|
16501
|
-
case 6:
|
|
16502
|
-
case 0:
|
|
16503
|
-
r = v;
|
|
16504
|
-
g = n;
|
|
16505
|
-
b = wh;
|
|
16506
|
-
break;
|
|
16507
|
-
case 1:
|
|
16508
|
-
r = n;
|
|
16509
|
-
g = v;
|
|
16510
|
-
b = wh;
|
|
16511
|
-
break;
|
|
16512
|
-
case 2:
|
|
16513
|
-
r = wh;
|
|
16514
|
-
g = v;
|
|
16515
|
-
b = n;
|
|
16516
|
-
break;
|
|
16517
|
-
case 3:
|
|
16518
|
-
r = wh;
|
|
16519
|
-
g = n;
|
|
16520
|
-
b = v;
|
|
16521
|
-
break;
|
|
16522
|
-
case 4:
|
|
16523
|
-
r = n;
|
|
16524
|
-
g = wh;
|
|
16525
|
-
b = v;
|
|
16526
|
-
break;
|
|
16527
|
-
case 5:
|
|
16528
|
-
r = v;
|
|
16529
|
-
g = wh;
|
|
16530
|
-
b = n;
|
|
16531
|
-
break;
|
|
16532
|
-
}
|
|
16533
|
-
return [r * 255, g * 255, b * 255];
|
|
16534
|
-
};
|
|
16535
|
-
convert.cmyk.rgb = function(cmyk) {
|
|
16536
|
-
const c = cmyk[0] / 100;
|
|
16537
|
-
const m = cmyk[1] / 100;
|
|
16538
|
-
const y = cmyk[2] / 100;
|
|
16539
|
-
const k = cmyk[3] / 100;
|
|
16540
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
16541
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
16542
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
16543
|
-
return [r * 255, g * 255, b * 255];
|
|
16544
|
-
};
|
|
16545
|
-
convert.xyz.rgb = function(xyz) {
|
|
16546
|
-
const x = xyz[0] / 100;
|
|
16547
|
-
const y = xyz[1] / 100;
|
|
16548
|
-
const z = xyz[2] / 100;
|
|
16549
|
-
let r;
|
|
16550
|
-
let g;
|
|
16551
|
-
let b;
|
|
16552
|
-
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
16553
|
-
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
16554
|
-
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
16555
|
-
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
16556
|
-
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
16557
|
-
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
16558
|
-
r = Math.min(Math.max(0, r), 1);
|
|
16559
|
-
g = Math.min(Math.max(0, g), 1);
|
|
16560
|
-
b = Math.min(Math.max(0, b), 1);
|
|
16561
|
-
return [r * 255, g * 255, b * 255];
|
|
16562
|
-
};
|
|
16563
|
-
convert.xyz.lab = function(xyz) {
|
|
16564
|
-
let x = xyz[0];
|
|
16565
|
-
let y = xyz[1];
|
|
16566
|
-
let z = xyz[2];
|
|
16567
|
-
x /= 95.047;
|
|
16568
|
-
y /= 100;
|
|
16569
|
-
z /= 108.883;
|
|
16570
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
16571
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
16572
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
16573
|
-
const l = 116 * y - 16;
|
|
16574
|
-
const a = 500 * (x - y);
|
|
16575
|
-
const b = 200 * (y - z);
|
|
16576
|
-
return [l, a, b];
|
|
16577
|
-
};
|
|
16578
|
-
convert.lab.xyz = function(lab) {
|
|
16579
|
-
const l = lab[0];
|
|
16580
|
-
const a = lab[1];
|
|
16581
|
-
const b = lab[2];
|
|
16582
|
-
let x;
|
|
16583
|
-
let y;
|
|
16584
|
-
let z;
|
|
16585
|
-
y = (l + 16) / 116;
|
|
16586
|
-
x = a / 500 + y;
|
|
16587
|
-
z = y - b / 200;
|
|
16588
|
-
const y2 = y ** 3;
|
|
16589
|
-
const x2 = x ** 3;
|
|
16590
|
-
const z2 = z ** 3;
|
|
16591
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
16592
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
16593
|
-
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
16594
|
-
x *= 95.047;
|
|
16595
|
-
y *= 100;
|
|
16596
|
-
z *= 108.883;
|
|
16597
|
-
return [x, y, z];
|
|
16598
|
-
};
|
|
16599
|
-
convert.lab.lch = function(lab) {
|
|
16600
|
-
const l = lab[0];
|
|
16601
|
-
const a = lab[1];
|
|
16602
|
-
const b = lab[2];
|
|
16603
|
-
let h;
|
|
16604
|
-
const hr = Math.atan2(b, a);
|
|
16605
|
-
h = hr * 360 / 2 / Math.PI;
|
|
16606
|
-
if (h < 0) {
|
|
16607
|
-
h += 360;
|
|
16608
|
-
}
|
|
16609
|
-
const c = Math.sqrt(a * a + b * b);
|
|
16610
|
-
return [l, c, h];
|
|
16611
|
-
};
|
|
16612
|
-
convert.lch.lab = function(lch) {
|
|
16613
|
-
const l = lch[0];
|
|
16614
|
-
const c = lch[1];
|
|
16615
|
-
const h = lch[2];
|
|
16616
|
-
const hr = h / 360 * 2 * Math.PI;
|
|
16617
|
-
const a = c * Math.cos(hr);
|
|
16618
|
-
const b = c * Math.sin(hr);
|
|
16619
|
-
return [l, a, b];
|
|
16620
|
-
};
|
|
16621
|
-
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
16622
|
-
const [r, g, b] = args;
|
|
16623
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
16624
|
-
value = Math.round(value / 50);
|
|
16625
|
-
if (value === 0) {
|
|
16626
|
-
return 30;
|
|
16627
|
-
}
|
|
16628
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
16629
|
-
if (value === 2) {
|
|
16630
|
-
ansi += 60;
|
|
16631
|
-
}
|
|
16632
|
-
return ansi;
|
|
16633
|
-
};
|
|
16634
|
-
convert.hsv.ansi16 = function(args) {
|
|
16635
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
16636
|
-
};
|
|
16637
|
-
convert.rgb.ansi256 = function(args) {
|
|
16638
|
-
const r = args[0];
|
|
16639
|
-
const g = args[1];
|
|
16640
|
-
const b = args[2];
|
|
16641
|
-
if (r === g && g === b) {
|
|
16642
|
-
if (r < 8) {
|
|
16643
|
-
return 16;
|
|
16644
|
-
}
|
|
16645
|
-
if (r > 248) {
|
|
16646
|
-
return 231;
|
|
16647
|
-
}
|
|
16648
|
-
return Math.round((r - 8) / 247 * 24) + 232;
|
|
16649
|
-
}
|
|
16650
|
-
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
16651
|
-
return ansi;
|
|
16652
|
-
};
|
|
16653
|
-
convert.ansi16.rgb = function(args) {
|
|
16654
|
-
let color = args % 10;
|
|
16655
|
-
if (color === 0 || color === 7) {
|
|
16656
|
-
if (args > 50) {
|
|
16657
|
-
color += 3.5;
|
|
16658
|
-
}
|
|
16659
|
-
color = color / 10.5 * 255;
|
|
16660
|
-
return [color, color, color];
|
|
16661
|
-
}
|
|
16662
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
|
16663
|
-
const r = (color & 1) * mult * 255;
|
|
16664
|
-
const g = (color >> 1 & 1) * mult * 255;
|
|
16665
|
-
const b = (color >> 2 & 1) * mult * 255;
|
|
16666
|
-
return [r, g, b];
|
|
16667
|
-
};
|
|
16668
|
-
convert.ansi256.rgb = function(args) {
|
|
16669
|
-
if (args >= 232) {
|
|
16670
|
-
const c = (args - 232) * 10 + 8;
|
|
16671
|
-
return [c, c, c];
|
|
16672
|
-
}
|
|
16673
|
-
args -= 16;
|
|
16674
|
-
let rem;
|
|
16675
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
|
16676
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
16677
|
-
const b = rem % 6 / 5 * 255;
|
|
16678
|
-
return [r, g, b];
|
|
16679
|
-
};
|
|
16680
|
-
convert.rgb.hex = function(args) {
|
|
16681
|
-
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
16682
|
-
const string = integer.toString(16).toUpperCase();
|
|
16683
|
-
return "000000".substring(string.length) + string;
|
|
16684
|
-
};
|
|
16685
|
-
convert.hex.rgb = function(args) {
|
|
16686
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
16687
|
-
if (!match) {
|
|
16688
|
-
return [0, 0, 0];
|
|
16689
|
-
}
|
|
16690
|
-
let colorString = match[0];
|
|
16691
|
-
if (match[0].length === 3) {
|
|
16692
|
-
colorString = colorString.split("").map((char) => {
|
|
16693
|
-
return char + char;
|
|
16694
|
-
}).join("");
|
|
16695
|
-
}
|
|
16696
|
-
const integer = parseInt(colorString, 16);
|
|
16697
|
-
const r = integer >> 16 & 255;
|
|
16698
|
-
const g = integer >> 8 & 255;
|
|
16699
|
-
const b = integer & 255;
|
|
16700
|
-
return [r, g, b];
|
|
16701
|
-
};
|
|
16702
|
-
convert.rgb.hcg = function(rgb) {
|
|
16703
|
-
const r = rgb[0] / 255;
|
|
16704
|
-
const g = rgb[1] / 255;
|
|
16705
|
-
const b = rgb[2] / 255;
|
|
16706
|
-
const max = Math.max(Math.max(r, g), b);
|
|
16707
|
-
const min = Math.min(Math.min(r, g), b);
|
|
16708
|
-
const chroma = max - min;
|
|
16709
|
-
let grayscale;
|
|
16710
|
-
let hue;
|
|
16711
|
-
if (chroma < 1) {
|
|
16712
|
-
grayscale = min / (1 - chroma);
|
|
16713
|
-
} else {
|
|
16714
|
-
grayscale = 0;
|
|
16715
|
-
}
|
|
16716
|
-
if (chroma <= 0) {
|
|
16717
|
-
hue = 0;
|
|
16718
|
-
} else if (max === r) {
|
|
16719
|
-
hue = (g - b) / chroma % 6;
|
|
16720
|
-
} else if (max === g) {
|
|
16721
|
-
hue = 2 + (b - r) / chroma;
|
|
16722
|
-
} else {
|
|
16723
|
-
hue = 4 + (r - g) / chroma;
|
|
16724
|
-
}
|
|
16725
|
-
hue /= 6;
|
|
16726
|
-
hue %= 1;
|
|
16727
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
|
16728
|
-
};
|
|
16729
|
-
convert.hsl.hcg = function(hsl) {
|
|
16730
|
-
const s = hsl[1] / 100;
|
|
16731
|
-
const l = hsl[2] / 100;
|
|
16732
|
-
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
16733
|
-
let f = 0;
|
|
16734
|
-
if (c < 1) {
|
|
16735
|
-
f = (l - 0.5 * c) / (1 - c);
|
|
16736
|
-
}
|
|
16737
|
-
return [hsl[0], c * 100, f * 100];
|
|
16738
|
-
};
|
|
16739
|
-
convert.hsv.hcg = function(hsv) {
|
|
16740
|
-
const s = hsv[1] / 100;
|
|
16741
|
-
const v = hsv[2] / 100;
|
|
16742
|
-
const c = s * v;
|
|
16743
|
-
let f = 0;
|
|
16744
|
-
if (c < 1) {
|
|
16745
|
-
f = (v - c) / (1 - c);
|
|
16746
|
-
}
|
|
16747
|
-
return [hsv[0], c * 100, f * 100];
|
|
16748
|
-
};
|
|
16749
|
-
convert.hcg.rgb = function(hcg) {
|
|
16750
|
-
const h = hcg[0] / 360;
|
|
16751
|
-
const c = hcg[1] / 100;
|
|
16752
|
-
const g = hcg[2] / 100;
|
|
16753
|
-
if (c === 0) {
|
|
16754
|
-
return [g * 255, g * 255, g * 255];
|
|
16755
|
-
}
|
|
16756
|
-
const pure = [0, 0, 0];
|
|
16757
|
-
const hi = h % 1 * 6;
|
|
16758
|
-
const v = hi % 1;
|
|
16759
|
-
const w = 1 - v;
|
|
16760
|
-
let mg = 0;
|
|
16761
|
-
switch (Math.floor(hi)) {
|
|
16762
|
-
case 0:
|
|
16763
|
-
pure[0] = 1;
|
|
16764
|
-
pure[1] = v;
|
|
16765
|
-
pure[2] = 0;
|
|
16766
|
-
break;
|
|
16767
|
-
case 1:
|
|
16768
|
-
pure[0] = w;
|
|
16769
|
-
pure[1] = 1;
|
|
16770
|
-
pure[2] = 0;
|
|
16771
|
-
break;
|
|
16772
|
-
case 2:
|
|
16773
|
-
pure[0] = 0;
|
|
16774
|
-
pure[1] = 1;
|
|
16775
|
-
pure[2] = v;
|
|
16776
|
-
break;
|
|
16777
|
-
case 3:
|
|
16778
|
-
pure[0] = 0;
|
|
16779
|
-
pure[1] = w;
|
|
16780
|
-
pure[2] = 1;
|
|
16781
|
-
break;
|
|
16782
|
-
case 4:
|
|
16783
|
-
pure[0] = v;
|
|
16784
|
-
pure[1] = 0;
|
|
16785
|
-
pure[2] = 1;
|
|
16786
|
-
break;
|
|
16787
|
-
default:
|
|
16788
|
-
pure[0] = 1;
|
|
16789
|
-
pure[1] = 0;
|
|
16790
|
-
pure[2] = w;
|
|
16791
|
-
}
|
|
16792
|
-
mg = (1 - c) * g;
|
|
16793
|
-
return [
|
|
16794
|
-
(c * pure[0] + mg) * 255,
|
|
16795
|
-
(c * pure[1] + mg) * 255,
|
|
16796
|
-
(c * pure[2] + mg) * 255
|
|
16797
|
-
];
|
|
16798
|
-
};
|
|
16799
|
-
convert.hcg.hsv = function(hcg) {
|
|
16800
|
-
const c = hcg[1] / 100;
|
|
16801
|
-
const g = hcg[2] / 100;
|
|
16802
|
-
const v = c + g * (1 - c);
|
|
16803
|
-
let f = 0;
|
|
16804
|
-
if (v > 0) {
|
|
16805
|
-
f = c / v;
|
|
16806
|
-
}
|
|
16807
|
-
return [hcg[0], f * 100, v * 100];
|
|
16808
|
-
};
|
|
16809
|
-
convert.hcg.hsl = function(hcg) {
|
|
16810
|
-
const c = hcg[1] / 100;
|
|
16811
|
-
const g = hcg[2] / 100;
|
|
16812
|
-
const l = g * (1 - c) + 0.5 * c;
|
|
16813
|
-
let s = 0;
|
|
16814
|
-
if (l > 0 && l < 0.5) {
|
|
16815
|
-
s = c / (2 * l);
|
|
16816
|
-
} else if (l >= 0.5 && l < 1) {
|
|
16817
|
-
s = c / (2 * (1 - l));
|
|
16818
|
-
}
|
|
16819
|
-
return [hcg[0], s * 100, l * 100];
|
|
16820
|
-
};
|
|
16821
|
-
convert.hcg.hwb = function(hcg) {
|
|
16822
|
-
const c = hcg[1] / 100;
|
|
16823
|
-
const g = hcg[2] / 100;
|
|
16824
|
-
const v = c + g * (1 - c);
|
|
16825
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
16826
|
-
};
|
|
16827
|
-
convert.hwb.hcg = function(hwb) {
|
|
16828
|
-
const w = hwb[1] / 100;
|
|
16829
|
-
const b = hwb[2] / 100;
|
|
16830
|
-
const v = 1 - b;
|
|
16831
|
-
const c = v - w;
|
|
16832
|
-
let g = 0;
|
|
16833
|
-
if (c < 1) {
|
|
16834
|
-
g = (v - c) / (1 - c);
|
|
16835
|
-
}
|
|
16836
|
-
return [hwb[0], c * 100, g * 100];
|
|
16837
|
-
};
|
|
16838
|
-
convert.apple.rgb = function(apple) {
|
|
16839
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
16840
|
-
};
|
|
16841
|
-
convert.rgb.apple = function(rgb) {
|
|
16842
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
16843
|
-
};
|
|
16844
|
-
convert.gray.rgb = function(args) {
|
|
16845
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
16846
|
-
};
|
|
16847
|
-
convert.gray.hsl = function(args) {
|
|
16848
|
-
return [0, 0, args[0]];
|
|
16849
|
-
};
|
|
16850
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
16851
|
-
convert.gray.hwb = function(gray) {
|
|
16852
|
-
return [0, 100, gray[0]];
|
|
16853
|
-
};
|
|
16854
|
-
convert.gray.cmyk = function(gray) {
|
|
16855
|
-
return [0, 0, 0, gray[0]];
|
|
16856
|
-
};
|
|
16857
|
-
convert.gray.lab = function(gray) {
|
|
16858
|
-
return [gray[0], 0, 0];
|
|
16859
|
-
};
|
|
16860
|
-
convert.gray.hex = function(gray) {
|
|
16861
|
-
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
16862
|
-
const integer = (val << 16) + (val << 8) + val;
|
|
16863
|
-
const string = integer.toString(16).toUpperCase();
|
|
16864
|
-
return "000000".substring(string.length) + string;
|
|
16865
|
-
};
|
|
16866
|
-
convert.rgb.gray = function(rgb) {
|
|
16867
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
16868
|
-
return [val / 255 * 100];
|
|
16869
|
-
};
|
|
16870
|
-
}
|
|
16871
|
-
});
|
|
16872
|
-
|
|
16873
|
-
// node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/route.js
|
|
16874
|
-
var require_route = __commonJS({
|
|
16875
|
-
"node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/route.js"(exports, module2) {
|
|
16876
|
-
var conversions = require_conversions();
|
|
16877
|
-
function buildGraph() {
|
|
16878
|
-
const graph = {};
|
|
16879
|
-
const models = Object.keys(conversions);
|
|
16880
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
16881
|
-
graph[models[i]] = {
|
|
16882
|
-
// http://jsperf.com/1-vs-infinity
|
|
16883
|
-
// micro-opt, but this is simple.
|
|
16884
|
-
distance: -1,
|
|
16885
|
-
parent: null
|
|
16886
|
-
};
|
|
16887
|
-
}
|
|
16888
|
-
return graph;
|
|
16889
|
-
}
|
|
16890
|
-
function deriveBFS(fromModel) {
|
|
16891
|
-
const graph = buildGraph();
|
|
16892
|
-
const queue = [fromModel];
|
|
16893
|
-
graph[fromModel].distance = 0;
|
|
16894
|
-
while (queue.length) {
|
|
16895
|
-
const current = queue.pop();
|
|
16896
|
-
const adjacents = Object.keys(conversions[current]);
|
|
16897
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
16898
|
-
const adjacent = adjacents[i];
|
|
16899
|
-
const node = graph[adjacent];
|
|
16900
|
-
if (node.distance === -1) {
|
|
16901
|
-
node.distance = graph[current].distance + 1;
|
|
16902
|
-
node.parent = current;
|
|
16903
|
-
queue.unshift(adjacent);
|
|
16904
|
-
}
|
|
16905
|
-
}
|
|
16906
|
-
}
|
|
16907
|
-
return graph;
|
|
16908
|
-
}
|
|
16909
|
-
function link(from, to) {
|
|
16910
|
-
return function(args) {
|
|
16911
|
-
return to(from(args));
|
|
16912
|
-
};
|
|
16913
|
-
}
|
|
16914
|
-
function wrapConversion(toModel, graph) {
|
|
16915
|
-
const path2 = [graph[toModel].parent, toModel];
|
|
16916
|
-
let fn = conversions[graph[toModel].parent][toModel];
|
|
16917
|
-
let cur = graph[toModel].parent;
|
|
16918
|
-
while (graph[cur].parent) {
|
|
16919
|
-
path2.unshift(graph[cur].parent);
|
|
16920
|
-
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
16921
|
-
cur = graph[cur].parent;
|
|
16922
|
-
}
|
|
16923
|
-
fn.conversion = path2;
|
|
16924
|
-
return fn;
|
|
16925
|
-
}
|
|
16926
|
-
module2.exports = function(fromModel) {
|
|
16927
|
-
const graph = deriveBFS(fromModel);
|
|
16928
|
-
const conversion = {};
|
|
16929
|
-
const models = Object.keys(graph);
|
|
16930
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
16931
|
-
const toModel = models[i];
|
|
16932
|
-
const node = graph[toModel];
|
|
16933
|
-
if (node.parent === null) {
|
|
16934
|
-
continue;
|
|
16935
|
-
}
|
|
16936
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
16937
|
-
}
|
|
16938
|
-
return conversion;
|
|
16939
|
-
};
|
|
16940
|
-
}
|
|
16941
|
-
});
|
|
16942
|
-
|
|
16943
|
-
// node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/index.js
|
|
16944
|
-
var require_color_convert = __commonJS({
|
|
16945
|
-
"node_modules/.aspect_rules_js/color-convert@2.0.1/node_modules/color-convert/index.js"(exports, module2) {
|
|
16946
|
-
var conversions = require_conversions();
|
|
16947
|
-
var route = require_route();
|
|
16948
|
-
var convert = {};
|
|
16949
|
-
var models = Object.keys(conversions);
|
|
16950
|
-
function wrapRaw(fn) {
|
|
16951
|
-
const wrappedFn = function(...args) {
|
|
16952
|
-
const arg0 = args[0];
|
|
16953
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
16954
|
-
return arg0;
|
|
16955
|
-
}
|
|
16956
|
-
if (arg0.length > 1) {
|
|
16957
|
-
args = arg0;
|
|
16958
|
-
}
|
|
16959
|
-
return fn(args);
|
|
16960
|
-
};
|
|
16961
|
-
if ("conversion" in fn) {
|
|
16962
|
-
wrappedFn.conversion = fn.conversion;
|
|
16963
|
-
}
|
|
16964
|
-
return wrappedFn;
|
|
16965
|
-
}
|
|
16966
|
-
function wrapRounded(fn) {
|
|
16967
|
-
const wrappedFn = function(...args) {
|
|
16968
|
-
const arg0 = args[0];
|
|
16969
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
16970
|
-
return arg0;
|
|
16971
|
-
}
|
|
16972
|
-
if (arg0.length > 1) {
|
|
16973
|
-
args = arg0;
|
|
16974
|
-
}
|
|
16975
|
-
const result = fn(args);
|
|
16976
|
-
if (typeof result === "object") {
|
|
16977
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
|
16978
|
-
result[i] = Math.round(result[i]);
|
|
16979
|
-
}
|
|
16980
|
-
}
|
|
16981
|
-
return result;
|
|
16982
|
-
};
|
|
16983
|
-
if ("conversion" in fn) {
|
|
16984
|
-
wrappedFn.conversion = fn.conversion;
|
|
16985
|
-
}
|
|
16986
|
-
return wrappedFn;
|
|
16987
|
-
}
|
|
16988
|
-
models.forEach((fromModel) => {
|
|
16989
|
-
convert[fromModel] = {};
|
|
16990
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
16991
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
16992
|
-
const routes = route(fromModel);
|
|
16993
|
-
const routeModels = Object.keys(routes);
|
|
16994
|
-
routeModels.forEach((toModel) => {
|
|
16995
|
-
const fn = routes[toModel];
|
|
16996
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
|
16997
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
16998
|
-
});
|
|
16999
|
-
});
|
|
17000
|
-
module2.exports = convert;
|
|
17001
|
-
}
|
|
17002
|
-
});
|
|
17003
|
-
|
|
17004
|
-
// node_modules/.aspect_rules_js/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
|
|
17005
|
-
var require_ansi_styles = __commonJS({
|
|
17006
|
-
"node_modules/.aspect_rules_js/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module2) {
|
|
17007
|
-
"use strict";
|
|
17008
|
-
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
17009
|
-
const code = fn(...args);
|
|
17010
|
-
return `\x1B[${code + offset}m`;
|
|
17011
|
-
};
|
|
17012
|
-
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
17013
|
-
const code = fn(...args);
|
|
17014
|
-
return `\x1B[${38 + offset};5;${code}m`;
|
|
17015
|
-
};
|
|
17016
|
-
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
17017
|
-
const rgb = fn(...args);
|
|
17018
|
-
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
17019
|
-
};
|
|
17020
|
-
var ansi2ansi = (n) => n;
|
|
17021
|
-
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
17022
|
-
var setLazyProperty = (object, property, get) => {
|
|
17023
|
-
Object.defineProperty(object, property, {
|
|
17024
|
-
get: () => {
|
|
17025
|
-
const value = get();
|
|
17026
|
-
Object.defineProperty(object, property, {
|
|
17027
|
-
value,
|
|
17028
|
-
enumerable: true,
|
|
17029
|
-
configurable: true
|
|
17030
|
-
});
|
|
17031
|
-
return value;
|
|
17032
|
-
},
|
|
17033
|
-
enumerable: true,
|
|
17034
|
-
configurable: true
|
|
17035
|
-
});
|
|
17036
|
-
};
|
|
17037
|
-
var colorConvert;
|
|
17038
|
-
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
17039
|
-
if (colorConvert === void 0) {
|
|
17040
|
-
colorConvert = require_color_convert();
|
|
17041
|
-
}
|
|
17042
|
-
const offset = isBackground ? 10 : 0;
|
|
17043
|
-
const styles = {};
|
|
17044
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
17045
|
-
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
17046
|
-
if (sourceSpace === targetSpace) {
|
|
17047
|
-
styles[name] = wrap(identity, offset);
|
|
17048
|
-
} else if (typeof suite === "object") {
|
|
17049
|
-
styles[name] = wrap(suite[targetSpace], offset);
|
|
17050
|
-
}
|
|
17051
|
-
}
|
|
17052
|
-
return styles;
|
|
17053
|
-
};
|
|
17054
|
-
function assembleStyles() {
|
|
17055
|
-
const codes = /* @__PURE__ */ new Map();
|
|
17056
|
-
const styles = {
|
|
17057
|
-
modifier: {
|
|
17058
|
-
reset: [0, 0],
|
|
17059
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
17060
|
-
bold: [1, 22],
|
|
17061
|
-
dim: [2, 22],
|
|
17062
|
-
italic: [3, 23],
|
|
17063
|
-
underline: [4, 24],
|
|
17064
|
-
inverse: [7, 27],
|
|
17065
|
-
hidden: [8, 28],
|
|
17066
|
-
strikethrough: [9, 29]
|
|
17067
|
-
},
|
|
17068
|
-
color: {
|
|
17069
|
-
black: [30, 39],
|
|
17070
|
-
red: [31, 39],
|
|
17071
|
-
green: [32, 39],
|
|
17072
|
-
yellow: [33, 39],
|
|
17073
|
-
blue: [34, 39],
|
|
17074
|
-
magenta: [35, 39],
|
|
17075
|
-
cyan: [36, 39],
|
|
17076
|
-
white: [37, 39],
|
|
17077
|
-
// Bright color
|
|
17078
|
-
blackBright: [90, 39],
|
|
17079
|
-
redBright: [91, 39],
|
|
17080
|
-
greenBright: [92, 39],
|
|
17081
|
-
yellowBright: [93, 39],
|
|
17082
|
-
blueBright: [94, 39],
|
|
17083
|
-
magentaBright: [95, 39],
|
|
17084
|
-
cyanBright: [96, 39],
|
|
17085
|
-
whiteBright: [97, 39]
|
|
17086
|
-
},
|
|
17087
|
-
bgColor: {
|
|
17088
|
-
bgBlack: [40, 49],
|
|
17089
|
-
bgRed: [41, 49],
|
|
17090
|
-
bgGreen: [42, 49],
|
|
17091
|
-
bgYellow: [43, 49],
|
|
17092
|
-
bgBlue: [44, 49],
|
|
17093
|
-
bgMagenta: [45, 49],
|
|
17094
|
-
bgCyan: [46, 49],
|
|
17095
|
-
bgWhite: [47, 49],
|
|
17096
|
-
// Bright color
|
|
17097
|
-
bgBlackBright: [100, 49],
|
|
17098
|
-
bgRedBright: [101, 49],
|
|
17099
|
-
bgGreenBright: [102, 49],
|
|
17100
|
-
bgYellowBright: [103, 49],
|
|
17101
|
-
bgBlueBright: [104, 49],
|
|
17102
|
-
bgMagentaBright: [105, 49],
|
|
17103
|
-
bgCyanBright: [106, 49],
|
|
17104
|
-
bgWhiteBright: [107, 49]
|
|
17105
|
-
}
|
|
17106
|
-
};
|
|
17107
|
-
styles.color.gray = styles.color.blackBright;
|
|
17108
|
-
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
17109
|
-
styles.color.grey = styles.color.blackBright;
|
|
17110
|
-
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
17111
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
17112
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
17113
|
-
styles[styleName] = {
|
|
17114
|
-
open: `\x1B[${style[0]}m`,
|
|
17115
|
-
close: `\x1B[${style[1]}m`
|
|
17116
|
-
};
|
|
17117
|
-
group[styleName] = styles[styleName];
|
|
17118
|
-
codes.set(style[0], style[1]);
|
|
17119
|
-
}
|
|
17120
|
-
Object.defineProperty(styles, groupName, {
|
|
17121
|
-
value: group,
|
|
17122
|
-
enumerable: false
|
|
17123
|
-
});
|
|
17124
|
-
}
|
|
17125
|
-
Object.defineProperty(styles, "codes", {
|
|
17126
|
-
value: codes,
|
|
17127
|
-
enumerable: false
|
|
17128
|
-
});
|
|
17129
|
-
styles.color.close = "\x1B[39m";
|
|
17130
|
-
styles.bgColor.close = "\x1B[49m";
|
|
17131
|
-
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
17132
|
-
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
17133
|
-
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
17134
|
-
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
17135
|
-
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
17136
|
-
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
17137
|
-
return styles;
|
|
17138
|
-
}
|
|
17139
|
-
Object.defineProperty(module2, "exports", {
|
|
17140
|
-
enumerable: true,
|
|
17141
|
-
get: assembleStyles
|
|
17142
|
-
});
|
|
17143
|
-
}
|
|
17144
|
-
});
|
|
17145
|
-
|
|
17146
|
-
// node_modules/.aspect_rules_js/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
17147
|
-
var require_has_flag = __commonJS({
|
|
17148
|
-
"node_modules/.aspect_rules_js/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
|
|
17149
|
-
"use strict";
|
|
17150
|
-
module2.exports = (flag, argv = process.argv) => {
|
|
17151
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
17152
|
-
const position = argv.indexOf(prefix + flag);
|
|
17153
|
-
const terminatorPosition = argv.indexOf("--");
|
|
17154
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
17155
|
-
};
|
|
17156
|
-
}
|
|
17157
|
-
});
|
|
17158
|
-
|
|
17159
|
-
// node_modules/.aspect_rules_js/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
17160
|
-
var require_supports_color = __commonJS({
|
|
17161
|
-
"node_modules/.aspect_rules_js/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
|
|
17162
|
-
"use strict";
|
|
17163
|
-
var os = require("os");
|
|
17164
|
-
var tty = require("tty");
|
|
17165
|
-
var hasFlag = require_has_flag();
|
|
17166
|
-
var { env } = process;
|
|
17167
|
-
var forceColor;
|
|
17168
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
17169
|
-
forceColor = 0;
|
|
17170
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
17171
|
-
forceColor = 1;
|
|
17172
|
-
}
|
|
17173
|
-
if ("FORCE_COLOR" in env) {
|
|
17174
|
-
if (env.FORCE_COLOR === "true") {
|
|
17175
|
-
forceColor = 1;
|
|
17176
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
17177
|
-
forceColor = 0;
|
|
17178
|
-
} else {
|
|
17179
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
17180
|
-
}
|
|
17181
|
-
}
|
|
17182
|
-
function translateLevel(level) {
|
|
17183
|
-
if (level === 0) {
|
|
17184
|
-
return false;
|
|
17185
|
-
}
|
|
17186
|
-
return {
|
|
17187
|
-
level,
|
|
17188
|
-
hasBasic: true,
|
|
17189
|
-
has256: level >= 2,
|
|
17190
|
-
has16m: level >= 3
|
|
17191
|
-
};
|
|
17192
|
-
}
|
|
17193
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
17194
|
-
if (forceColor === 0) {
|
|
17195
|
-
return 0;
|
|
17196
|
-
}
|
|
17197
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
17198
|
-
return 3;
|
|
17199
|
-
}
|
|
17200
|
-
if (hasFlag("color=256")) {
|
|
17201
|
-
return 2;
|
|
17202
|
-
}
|
|
17203
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
17204
|
-
return 0;
|
|
17205
|
-
}
|
|
17206
|
-
const min = forceColor || 0;
|
|
17207
|
-
if (env.TERM === "dumb") {
|
|
17208
|
-
return min;
|
|
17209
|
-
}
|
|
17210
|
-
if (process.platform === "win32") {
|
|
17211
|
-
const osRelease = os.release().split(".");
|
|
17212
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
17213
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
17214
|
-
}
|
|
17215
|
-
return 1;
|
|
17216
|
-
}
|
|
17217
|
-
if ("CI" in env) {
|
|
17218
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
17219
|
-
return 1;
|
|
17220
|
-
}
|
|
17221
|
-
return min;
|
|
17222
|
-
}
|
|
17223
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
17224
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
17225
|
-
}
|
|
17226
|
-
if (env.COLORTERM === "truecolor") {
|
|
17227
|
-
return 3;
|
|
17228
|
-
}
|
|
17229
|
-
if ("TERM_PROGRAM" in env) {
|
|
17230
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
17231
|
-
switch (env.TERM_PROGRAM) {
|
|
17232
|
-
case "iTerm.app":
|
|
17233
|
-
return version >= 3 ? 3 : 2;
|
|
17234
|
-
case "Apple_Terminal":
|
|
17235
|
-
return 2;
|
|
17236
|
-
}
|
|
17237
|
-
}
|
|
17238
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
17239
|
-
return 2;
|
|
17240
|
-
}
|
|
17241
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
17242
|
-
return 1;
|
|
17243
|
-
}
|
|
17244
|
-
if ("COLORTERM" in env) {
|
|
17245
|
-
return 1;
|
|
17246
|
-
}
|
|
17247
|
-
return min;
|
|
17248
|
-
}
|
|
17249
|
-
function getSupportLevel(stream) {
|
|
17250
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
17251
|
-
return translateLevel(level);
|
|
17252
|
-
}
|
|
17253
|
-
module2.exports = {
|
|
17254
|
-
supportsColor: getSupportLevel,
|
|
17255
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
17256
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
17257
|
-
};
|
|
17258
|
-
}
|
|
17259
|
-
});
|
|
17260
|
-
|
|
17261
|
-
// node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/util.js
|
|
17262
|
-
var require_util = __commonJS({
|
|
17263
|
-
"node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/util.js"(exports, module2) {
|
|
17264
|
-
"use strict";
|
|
17265
|
-
var stringReplaceAll = (string, substring, replacer) => {
|
|
17266
|
-
let index = string.indexOf(substring);
|
|
17267
|
-
if (index === -1) {
|
|
17268
|
-
return string;
|
|
17269
|
-
}
|
|
17270
|
-
const substringLength = substring.length;
|
|
17271
|
-
let endIndex = 0;
|
|
17272
|
-
let returnValue = "";
|
|
17273
|
-
do {
|
|
17274
|
-
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
17275
|
-
endIndex = index + substringLength;
|
|
17276
|
-
index = string.indexOf(substring, endIndex);
|
|
17277
|
-
} while (index !== -1);
|
|
17278
|
-
returnValue += string.substr(endIndex);
|
|
17279
|
-
return returnValue;
|
|
17280
|
-
};
|
|
17281
|
-
var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
17282
|
-
let endIndex = 0;
|
|
17283
|
-
let returnValue = "";
|
|
17284
|
-
do {
|
|
17285
|
-
const gotCR = string[index - 1] === "\r";
|
|
17286
|
-
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
17287
|
-
endIndex = index + 1;
|
|
17288
|
-
index = string.indexOf("\n", endIndex);
|
|
17289
|
-
} while (index !== -1);
|
|
17290
|
-
returnValue += string.substr(endIndex);
|
|
17291
|
-
return returnValue;
|
|
17292
|
-
};
|
|
17293
|
-
module2.exports = {
|
|
17294
|
-
stringReplaceAll,
|
|
17295
|
-
stringEncaseCRLFWithFirstIndex
|
|
17296
|
-
};
|
|
17297
|
-
}
|
|
17298
|
-
});
|
|
17299
|
-
|
|
17300
|
-
// node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/templates.js
|
|
17301
|
-
var require_templates = __commonJS({
|
|
17302
|
-
"node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/templates.js"(exports, module2) {
|
|
17303
|
-
"use strict";
|
|
17304
|
-
var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
17305
|
-
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
17306
|
-
var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
17307
|
-
var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
17308
|
-
var ESCAPES = /* @__PURE__ */ new Map([
|
|
17309
|
-
["n", "\n"],
|
|
17310
|
-
["r", "\r"],
|
|
17311
|
-
["t", " "],
|
|
17312
|
-
["b", "\b"],
|
|
17313
|
-
["f", "\f"],
|
|
17314
|
-
["v", "\v"],
|
|
17315
|
-
["0", "\0"],
|
|
17316
|
-
["\\", "\\"],
|
|
17317
|
-
["e", "\x1B"],
|
|
17318
|
-
["a", "\x07"]
|
|
17319
|
-
]);
|
|
17320
|
-
function unescape(c) {
|
|
17321
|
-
const u = c[0] === "u";
|
|
17322
|
-
const bracket = c[1] === "{";
|
|
17323
|
-
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
17324
|
-
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
17325
|
-
}
|
|
17326
|
-
if (u && bracket) {
|
|
17327
|
-
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
17328
|
-
}
|
|
17329
|
-
return ESCAPES.get(c) || c;
|
|
17330
|
-
}
|
|
17331
|
-
function parseArguments(name, arguments_) {
|
|
17332
|
-
const results = [];
|
|
17333
|
-
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
17334
|
-
let matches;
|
|
17335
|
-
for (const chunk of chunks) {
|
|
17336
|
-
const number = Number(chunk);
|
|
17337
|
-
if (!Number.isNaN(number)) {
|
|
17338
|
-
results.push(number);
|
|
17339
|
-
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
17340
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
17341
|
-
} else {
|
|
17342
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
17343
|
-
}
|
|
17344
|
-
}
|
|
17345
|
-
return results;
|
|
17346
|
-
}
|
|
17347
|
-
function parseStyle(style) {
|
|
17348
|
-
STYLE_REGEX.lastIndex = 0;
|
|
17349
|
-
const results = [];
|
|
17350
|
-
let matches;
|
|
17351
|
-
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
17352
|
-
const name = matches[1];
|
|
17353
|
-
if (matches[2]) {
|
|
17354
|
-
const args = parseArguments(name, matches[2]);
|
|
17355
|
-
results.push([name].concat(args));
|
|
17356
|
-
} else {
|
|
17357
|
-
results.push([name]);
|
|
17358
|
-
}
|
|
17359
|
-
}
|
|
17360
|
-
return results;
|
|
17361
|
-
}
|
|
17362
|
-
function buildStyle(chalk3, styles) {
|
|
17363
|
-
const enabled = {};
|
|
17364
|
-
for (const layer of styles) {
|
|
17365
|
-
for (const style of layer.styles) {
|
|
17366
|
-
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
17367
|
-
}
|
|
17368
|
-
}
|
|
17369
|
-
let current = chalk3;
|
|
17370
|
-
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
17371
|
-
if (!Array.isArray(styles2)) {
|
|
17372
|
-
continue;
|
|
17373
|
-
}
|
|
17374
|
-
if (!(styleName in current)) {
|
|
17375
|
-
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
17376
|
-
}
|
|
17377
|
-
current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
|
|
17378
|
-
}
|
|
17379
|
-
return current;
|
|
17380
|
-
}
|
|
17381
|
-
module2.exports = (chalk3, temporary) => {
|
|
17382
|
-
const styles = [];
|
|
17383
|
-
const chunks = [];
|
|
17384
|
-
let chunk = [];
|
|
17385
|
-
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
17386
|
-
if (escapeCharacter) {
|
|
17387
|
-
chunk.push(unescape(escapeCharacter));
|
|
17388
|
-
} else if (style) {
|
|
17389
|
-
const string = chunk.join("");
|
|
17390
|
-
chunk = [];
|
|
17391
|
-
chunks.push(styles.length === 0 ? string : buildStyle(chalk3, styles)(string));
|
|
17392
|
-
styles.push({ inverse, styles: parseStyle(style) });
|
|
17393
|
-
} else if (close) {
|
|
17394
|
-
if (styles.length === 0) {
|
|
17395
|
-
throw new Error("Found extraneous } in Chalk template literal");
|
|
17396
|
-
}
|
|
17397
|
-
chunks.push(buildStyle(chalk3, styles)(chunk.join("")));
|
|
17398
|
-
chunk = [];
|
|
17399
|
-
styles.pop();
|
|
17400
|
-
} else {
|
|
17401
|
-
chunk.push(character);
|
|
17402
|
-
}
|
|
17403
|
-
});
|
|
17404
|
-
chunks.push(chunk.join(""));
|
|
17405
|
-
if (styles.length > 0) {
|
|
17406
|
-
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
17407
|
-
throw new Error(errMessage);
|
|
17408
|
-
}
|
|
17409
|
-
return chunks.join("");
|
|
17410
|
-
};
|
|
17411
|
-
}
|
|
17412
|
-
});
|
|
17413
|
-
|
|
17414
|
-
// node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/index.js
|
|
17415
|
-
var require_source = __commonJS({
|
|
17416
|
-
"node_modules/.aspect_rules_js/chalk@4.1.2/node_modules/chalk/source/index.js"(exports, module2) {
|
|
17417
|
-
"use strict";
|
|
17418
|
-
var ansiStyles = require_ansi_styles();
|
|
17419
|
-
var { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
|
|
17420
|
-
var {
|
|
17421
|
-
stringReplaceAll,
|
|
17422
|
-
stringEncaseCRLFWithFirstIndex
|
|
17423
|
-
} = require_util();
|
|
17424
|
-
var { isArray } = Array;
|
|
17425
|
-
var levelMapping = [
|
|
17426
|
-
"ansi",
|
|
17427
|
-
"ansi",
|
|
17428
|
-
"ansi256",
|
|
17429
|
-
"ansi16m"
|
|
17430
|
-
];
|
|
17431
|
-
var styles = /* @__PURE__ */ Object.create(null);
|
|
17432
|
-
var applyOptions = (object, options = {}) => {
|
|
17433
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
17434
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
17435
|
-
}
|
|
17436
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
17437
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
17438
|
-
};
|
|
17439
|
-
var ChalkClass = class {
|
|
17440
|
-
constructor(options) {
|
|
17441
|
-
return chalkFactory(options);
|
|
17442
|
-
}
|
|
17443
|
-
};
|
|
17444
|
-
var chalkFactory = (options) => {
|
|
17445
|
-
const chalk4 = {};
|
|
17446
|
-
applyOptions(chalk4, options);
|
|
17447
|
-
chalk4.template = (...arguments_) => chalkTag(chalk4.template, ...arguments_);
|
|
17448
|
-
Object.setPrototypeOf(chalk4, Chalk.prototype);
|
|
17449
|
-
Object.setPrototypeOf(chalk4.template, chalk4);
|
|
17450
|
-
chalk4.template.constructor = () => {
|
|
17451
|
-
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
17452
|
-
};
|
|
17453
|
-
chalk4.template.Instance = ChalkClass;
|
|
17454
|
-
return chalk4.template;
|
|
17455
|
-
};
|
|
17456
|
-
function Chalk(options) {
|
|
17457
|
-
return chalkFactory(options);
|
|
17458
|
-
}
|
|
17459
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
17460
|
-
styles[styleName] = {
|
|
17461
|
-
get() {
|
|
17462
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
17463
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
17464
|
-
return builder;
|
|
17465
|
-
}
|
|
17466
|
-
};
|
|
17467
|
-
}
|
|
17468
|
-
styles.visible = {
|
|
17469
|
-
get() {
|
|
17470
|
-
const builder = createBuilder(this, this._styler, true);
|
|
17471
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
17472
|
-
return builder;
|
|
17473
|
-
}
|
|
17474
|
-
};
|
|
17475
|
-
var usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
17476
|
-
for (const model of usedModels) {
|
|
17477
|
-
styles[model] = {
|
|
17478
|
-
get() {
|
|
17479
|
-
const { level } = this;
|
|
17480
|
-
return function(...arguments_) {
|
|
17481
|
-
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
17482
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
17483
|
-
};
|
|
17484
|
-
}
|
|
17485
|
-
};
|
|
17486
|
-
}
|
|
17487
|
-
for (const model of usedModels) {
|
|
17488
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
17489
|
-
styles[bgModel] = {
|
|
17490
|
-
get() {
|
|
17491
|
-
const { level } = this;
|
|
17492
|
-
return function(...arguments_) {
|
|
17493
|
-
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
17494
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
17495
|
-
};
|
|
17496
|
-
}
|
|
17497
|
-
};
|
|
17498
|
-
}
|
|
17499
|
-
var proto = Object.defineProperties(() => {
|
|
17500
|
-
}, {
|
|
17501
|
-
...styles,
|
|
17502
|
-
level: {
|
|
17503
|
-
enumerable: true,
|
|
17504
|
-
get() {
|
|
17505
|
-
return this._generator.level;
|
|
17506
|
-
},
|
|
17507
|
-
set(level) {
|
|
17508
|
-
this._generator.level = level;
|
|
17509
|
-
}
|
|
17510
|
-
}
|
|
17511
|
-
});
|
|
17512
|
-
var createStyler = (open, close, parent) => {
|
|
17513
|
-
let openAll;
|
|
17514
|
-
let closeAll;
|
|
17515
|
-
if (parent === void 0) {
|
|
17516
|
-
openAll = open;
|
|
17517
|
-
closeAll = close;
|
|
17518
|
-
} else {
|
|
17519
|
-
openAll = parent.openAll + open;
|
|
17520
|
-
closeAll = close + parent.closeAll;
|
|
17521
|
-
}
|
|
17522
|
-
return {
|
|
17523
|
-
open,
|
|
17524
|
-
close,
|
|
17525
|
-
openAll,
|
|
17526
|
-
closeAll,
|
|
17527
|
-
parent
|
|
17528
|
-
};
|
|
17529
|
-
};
|
|
17530
|
-
var createBuilder = (self, _styler, _isEmpty) => {
|
|
17531
|
-
const builder = (...arguments_) => {
|
|
17532
|
-
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
17533
|
-
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
17534
|
-
}
|
|
17535
|
-
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
17536
|
-
};
|
|
17537
|
-
Object.setPrototypeOf(builder, proto);
|
|
17538
|
-
builder._generator = self;
|
|
17539
|
-
builder._styler = _styler;
|
|
17540
|
-
builder._isEmpty = _isEmpty;
|
|
17541
|
-
return builder;
|
|
17542
|
-
};
|
|
17543
|
-
var applyStyle = (self, string) => {
|
|
17544
|
-
if (self.level <= 0 || !string) {
|
|
17545
|
-
return self._isEmpty ? "" : string;
|
|
17546
|
-
}
|
|
17547
|
-
let styler = self._styler;
|
|
17548
|
-
if (styler === void 0) {
|
|
17549
|
-
return string;
|
|
17550
|
-
}
|
|
17551
|
-
const { openAll, closeAll } = styler;
|
|
17552
|
-
if (string.indexOf("\x1B") !== -1) {
|
|
17553
|
-
while (styler !== void 0) {
|
|
17554
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
17555
|
-
styler = styler.parent;
|
|
17556
|
-
}
|
|
17557
|
-
}
|
|
17558
|
-
const lfIndex = string.indexOf("\n");
|
|
17559
|
-
if (lfIndex !== -1) {
|
|
17560
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
17561
|
-
}
|
|
17562
|
-
return openAll + string + closeAll;
|
|
17563
|
-
};
|
|
17564
|
-
var template;
|
|
17565
|
-
var chalkTag = (chalk4, ...strings) => {
|
|
17566
|
-
const [firstString] = strings;
|
|
17567
|
-
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
17568
|
-
return strings.join(" ");
|
|
17569
|
-
}
|
|
17570
|
-
const arguments_ = strings.slice(1);
|
|
17571
|
-
const parts = [firstString.raw[0]];
|
|
17572
|
-
for (let i = 1; i < firstString.length; i++) {
|
|
17573
|
-
parts.push(
|
|
17574
|
-
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
17575
|
-
String(firstString.raw[i])
|
|
17576
|
-
);
|
|
17577
|
-
}
|
|
17578
|
-
if (template === void 0) {
|
|
17579
|
-
template = require_templates();
|
|
17580
|
-
}
|
|
17581
|
-
return template(chalk4, parts.join(""));
|
|
17582
|
-
};
|
|
17583
|
-
Object.defineProperties(Chalk.prototype, styles);
|
|
17584
|
-
var chalk3 = Chalk();
|
|
17585
|
-
chalk3.supportsColor = stdoutColor;
|
|
17586
|
-
chalk3.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
17587
|
-
chalk3.stderr.supportsColor = stderrColor;
|
|
17588
|
-
module2.exports = chalk3;
|
|
17589
|
-
}
|
|
17590
|
-
});
|
|
17591
|
-
|
|
17592
16045
|
// packages/cli-lib/src/console_utils.ts
|
|
17593
16046
|
async function clearLine(terminal) {
|
|
17594
|
-
|
|
16047
|
+
var _a;
|
|
16048
|
+
if (!((_a = terminal.hasColors) == null ? void 0 : _a.call(terminal))) {
|
|
17595
16049
|
if (terminal.isTTY) {
|
|
17596
16050
|
if (terminal.columns > 0) {
|
|
17597
16051
|
await writeStderr(`\r${" ".repeat(terminal.columns - 1)}`);
|
|
@@ -17604,7 +16058,8 @@ async function clearLine(terminal) {
|
|
|
17604
16058
|
}
|
|
17605
16059
|
}
|
|
17606
16060
|
function label(level, message) {
|
|
17607
|
-
return `[@formatjs/cli] [${
|
|
16061
|
+
return `[@formatjs/cli] [${(0, import_node_util.styleText)(
|
|
16062
|
+
LEVEL_COLORS[level],
|
|
17608
16063
|
level.toUpperCase()
|
|
17609
16064
|
)}] ${message}`;
|
|
17610
16065
|
}
|
|
@@ -17613,12 +16068,12 @@ async function debug(message, ...args) {
|
|
|
17613
16068
|
return;
|
|
17614
16069
|
}
|
|
17615
16070
|
await clearLine(process.stderr);
|
|
17616
|
-
await writeStderr((0,
|
|
16071
|
+
await writeStderr((0, import_node_util.format)(label("debug", message), ...args));
|
|
17617
16072
|
await writeStderr("\n");
|
|
17618
16073
|
}
|
|
17619
16074
|
async function warn(message, ...args) {
|
|
17620
16075
|
await clearLine(process.stderr);
|
|
17621
|
-
await writeStderr((0,
|
|
16076
|
+
await writeStderr((0, import_node_util.format)(label("warn", message), ...args));
|
|
17622
16077
|
await writeStderr("\n");
|
|
17623
16078
|
}
|
|
17624
16079
|
function getStdinAsString() {
|
|
@@ -17636,20 +16091,18 @@ function getStdinAsString() {
|
|
|
17636
16091
|
});
|
|
17637
16092
|
});
|
|
17638
16093
|
}
|
|
17639
|
-
var
|
|
16094
|
+
var import_readline, import_node_util, CLEAR_WHOLE_LINE, writeStderr, writeStdout, LEVEL_COLORS;
|
|
17640
16095
|
var init_console_utils = __esm({
|
|
17641
16096
|
"packages/cli-lib/src/console_utils.ts"() {
|
|
17642
|
-
chalkNs = __toESM(require_source());
|
|
17643
16097
|
import_readline = require("readline");
|
|
17644
|
-
|
|
17645
|
-
chalk = chalkNs.default ?? chalkNs;
|
|
16098
|
+
import_node_util = require("node:util");
|
|
17646
16099
|
CLEAR_WHOLE_LINE = 0;
|
|
17647
|
-
writeStderr = (0,
|
|
17648
|
-
writeStdout = (0,
|
|
16100
|
+
writeStderr = (0, import_node_util.promisify)(process.stderr.write).bind(process.stderr);
|
|
16101
|
+
writeStdout = (0, import_node_util.promisify)(process.stdout.write).bind(process.stdout);
|
|
17649
16102
|
LEVEL_COLORS = {
|
|
17650
|
-
debug:
|
|
17651
|
-
warn:
|
|
17652
|
-
error:
|
|
16103
|
+
debug: "green",
|
|
16104
|
+
warn: "yellow",
|
|
16105
|
+
error: "red"
|
|
17653
16106
|
};
|
|
17654
16107
|
}
|
|
17655
16108
|
});
|
|
@@ -229128,25 +227581,23 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
229128
227581
|
|
|
229129
227582
|
// node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/console_utils.js
|
|
229130
227583
|
function label2(level, message) {
|
|
229131
|
-
return `[@formatjs/ts-transformer] [${LEVEL_COLORS2[level]
|
|
227584
|
+
return `[@formatjs/ts-transformer] [${(0, import_node_util2.styleText)(LEVEL_COLORS2[level], level.toUpperCase())}] ${message}`;
|
|
229132
227585
|
}
|
|
229133
227586
|
async function debug2(message, ...args) {
|
|
229134
227587
|
if (process.env.LOG_LEVEL !== "debug") {
|
|
229135
227588
|
return;
|
|
229136
227589
|
}
|
|
229137
|
-
console.error((0,
|
|
227590
|
+
console.error((0, import_node_util2.format)(label2("debug", message), ...args));
|
|
229138
227591
|
console.error("\n");
|
|
229139
227592
|
}
|
|
229140
|
-
var
|
|
227593
|
+
var import_node_util2, LEVEL_COLORS2;
|
|
229141
227594
|
var init_console_utils2 = __esm({
|
|
229142
227595
|
"node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/console_utils.js"() {
|
|
229143
|
-
|
|
229144
|
-
import_util2 = require("util");
|
|
229145
|
-
chalk2 = chalkNs2.default ?? chalkNs2;
|
|
227596
|
+
import_node_util2 = require("node:util");
|
|
229146
227597
|
LEVEL_COLORS2 = {
|
|
229147
|
-
debug:
|
|
229148
|
-
warn:
|
|
229149
|
-
error:
|
|
227598
|
+
debug: "green",
|
|
227599
|
+
warn: "yellow",
|
|
227600
|
+
error: "red"
|
|
229150
227601
|
};
|
|
229151
227602
|
}
|
|
229152
227603
|
});
|
|
@@ -229318,7 +227769,18 @@ function evaluateStringConcat(ts2, node) {
|
|
|
229318
227769
|
}
|
|
229319
227770
|
return ["", false];
|
|
229320
227771
|
}
|
|
229321
|
-
function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocation, preserveWhitespace, flatten: flatten2 }, sf) {
|
|
227772
|
+
function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocation, preserveWhitespace, flatten: flatten2, throws = true, onMsgError }, sf) {
|
|
227773
|
+
let extractionError = null;
|
|
227774
|
+
function handleError(errorMsg) {
|
|
227775
|
+
const error2 = new Error(errorMsg);
|
|
227776
|
+
if (throws) {
|
|
227777
|
+
throw error2;
|
|
227778
|
+
}
|
|
227779
|
+
extractionError = error2;
|
|
227780
|
+
if (onMsgError) {
|
|
227781
|
+
onMsgError(sf.fileName, error2);
|
|
227782
|
+
}
|
|
227783
|
+
}
|
|
229322
227784
|
let properties = void 0;
|
|
229323
227785
|
if (ts2.isObjectLiteralExpression(node)) {
|
|
229324
227786
|
properties = node.properties;
|
|
@@ -229364,7 +227826,8 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
|
|
|
229364
227826
|
}
|
|
229365
227827
|
const { template } = initializer;
|
|
229366
227828
|
if (!ts2.isNoSubstitutionTemplateLiteral(template)) {
|
|
229367
|
-
|
|
227829
|
+
handleError("[FormatJS] Tagged template expression must be no substitution");
|
|
227830
|
+
return;
|
|
229368
227831
|
}
|
|
229369
227832
|
switch (name.text) {
|
|
229370
227833
|
case "id":
|
|
@@ -229412,7 +227875,8 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
|
|
|
229412
227875
|
}
|
|
229413
227876
|
const { expression: { template } } = initializer;
|
|
229414
227877
|
if (!ts2.isNoSubstitutionTemplateLiteral(template)) {
|
|
229415
|
-
|
|
227878
|
+
handleError("[FormatJS] Tagged template expression must be no substitution");
|
|
227879
|
+
return;
|
|
229416
227880
|
}
|
|
229417
227881
|
switch (name.text) {
|
|
229418
227882
|
case "id":
|
|
@@ -229441,10 +227905,12 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
|
|
|
229441
227905
|
break;
|
|
229442
227906
|
}
|
|
229443
227907
|
} else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
|
|
229444
|
-
|
|
227908
|
+
handleError(`[FormatJS] \`${name.text}\` must be a string literal or statically evaluable expression to be extracted.`);
|
|
227909
|
+
return;
|
|
229445
227910
|
}
|
|
229446
227911
|
} else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
|
|
229447
|
-
|
|
227912
|
+
handleError(`[FormatJS] \`${name.text}\` must be a string literal to be extracted.`);
|
|
227913
|
+
return;
|
|
229448
227914
|
}
|
|
229449
227915
|
} else if (ts2.isBinaryExpression(initializer)) {
|
|
229450
227916
|
const [result, isStatic] = evaluateStringConcat(ts2, initializer);
|
|
@@ -229461,15 +227927,20 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
|
|
|
229461
227927
|
break;
|
|
229462
227928
|
}
|
|
229463
227929
|
} else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
|
|
229464
|
-
|
|
227930
|
+
handleError(`[FormatJS] \`${name.text}\` must be a string literal or statically evaluable expression to be extracted.`);
|
|
227931
|
+
return;
|
|
229465
227932
|
}
|
|
229466
227933
|
} else if (ts2.isObjectLiteralExpression(initializer) && name.text === "description") {
|
|
229467
227934
|
msg.description = objectLiteralExpressionToObj(ts2, initializer);
|
|
229468
227935
|
} else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
|
|
229469
|
-
|
|
227936
|
+
handleError(`[FormatJS] \`${name.text}\` must be a string literal to be extracted.`);
|
|
227937
|
+
return;
|
|
229470
227938
|
}
|
|
229471
227939
|
}
|
|
229472
227940
|
});
|
|
227941
|
+
if (extractionError) {
|
|
227942
|
+
return;
|
|
227943
|
+
}
|
|
229473
227944
|
if (!msg.defaultMessage && !msg.id) {
|
|
229474
227945
|
return;
|
|
229475
227946
|
}
|
|
@@ -230442,6 +228913,12 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
|
|
|
230442
228913
|
}
|
|
230443
228914
|
async function extract(files, extractOpts) {
|
|
230444
228915
|
const { throws, readFromStdin, ...opts } = extractOpts;
|
|
228916
|
+
const shouldThrow = throws === true;
|
|
228917
|
+
const optsWithThrows = {
|
|
228918
|
+
...opts,
|
|
228919
|
+
throws: shouldThrow,
|
|
228920
|
+
onMsgError: !shouldThrow ? (_, e) => warn(e.message) : void 0
|
|
228921
|
+
};
|
|
230445
228922
|
let rawResults = [];
|
|
230446
228923
|
try {
|
|
230447
228924
|
if (readFromStdin) {
|
|
@@ -230450,14 +228927,14 @@ async function extract(files, extractOpts) {
|
|
|
230450
228927
|
warn("Reading source file from TTY.");
|
|
230451
228928
|
}
|
|
230452
228929
|
const stdinSource = await getStdinAsString();
|
|
230453
|
-
rawResults = [await processFile(stdinSource, "dummy",
|
|
228930
|
+
rawResults = [await processFile(stdinSource, "dummy", optsWithThrows)];
|
|
230454
228931
|
} else {
|
|
230455
|
-
if (
|
|
228932
|
+
if (!shouldThrow) {
|
|
230456
228933
|
const settledResults = await Promise.allSettled(
|
|
230457
228934
|
files.map(async (fn) => {
|
|
230458
228935
|
debug("Extracting file:", fn);
|
|
230459
228936
|
const source = await (0, import_promises.readFile)(fn, "utf8");
|
|
230460
|
-
return processFile(source, fn,
|
|
228937
|
+
return processFile(source, fn, optsWithThrows);
|
|
230461
228938
|
})
|
|
230462
228939
|
);
|
|
230463
228940
|
rawResults = settledResults.map((result) => {
|
|
@@ -230473,13 +228950,13 @@ async function extract(files, extractOpts) {
|
|
|
230473
228950
|
files.map(async (fn) => {
|
|
230474
228951
|
debug("Extracting file:", fn);
|
|
230475
228952
|
const source = await (0, import_promises.readFile)(fn, "utf8");
|
|
230476
|
-
return processFile(source, fn,
|
|
228953
|
+
return processFile(source, fn, optsWithThrows);
|
|
230477
228954
|
})
|
|
230478
228955
|
);
|
|
230479
228956
|
}
|
|
230480
228957
|
}
|
|
230481
228958
|
} catch (e) {
|
|
230482
|
-
if (
|
|
228959
|
+
if (shouldThrow) {
|
|
230483
228960
|
throw e;
|
|
230484
228961
|
} else {
|
|
230485
228962
|
warn(String(e));
|