@stryke/capnp 0.12.67 → 0.12.69
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/capnpc.cjs +531 -12
- package/bin/capnpc.mjs +531 -12
- package/bin/capnpc.mjs.map +1 -1
- package/dist/{compile-DiTc51Q-.cjs → compile-B3XqBhBE.cjs} +1 -1
- package/dist/{compile-DBdcp5DD.mjs → compile-CwHohn4j.mjs} +2 -2
- package/dist/{compile-DBdcp5DD.mjs.map → compile-CwHohn4j.mjs.map} +1 -1
- package/dist/compile.cjs +2 -2
- package/dist/compile.mjs +2 -2
- package/dist/{helpers-DwX18sWU.cjs → helpers-DjSYmEPx.cjs} +527 -8
- package/dist/{helpers-DdetET6R.mjs → helpers-DoFLy1C-.mjs} +528 -9
- package/dist/helpers-DoFLy1C-.mjs.map +1 -0
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/rpc-helpers.cjs +1 -1
- package/package.json +9 -9
- package/dist/helpers-DdetET6R.mjs.map +0 -1
package/dist/compile.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('./helpers-
|
|
2
|
-
const require_compile = require('./compile-
|
|
1
|
+
require('./helpers-DjSYmEPx.cjs');
|
|
2
|
+
const require_compile = require('./compile-B3XqBhBE.cjs');
|
|
3
3
|
|
|
4
4
|
exports.capnpc = require_compile.capnpc;
|
|
5
5
|
exports.compile = require_compile.compile;
|
package/dist/compile.mjs
CHANGED
|
@@ -33,7 +33,7 @@ let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
|
33
33
|
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
34
34
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
35
35
|
|
|
36
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
36
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-DJB7XLHA.js
|
|
37
37
|
var DEFAULT_COLOR_CONFIG = {
|
|
38
38
|
light: {
|
|
39
39
|
background: "#fafafa",
|
|
@@ -2210,7 +2210,7 @@ var require_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2210
2210
|
}));
|
|
2211
2211
|
|
|
2212
2212
|
//#endregion
|
|
2213
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2213
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-HVVJHTFS.js
|
|
2214
2214
|
var import_source = /* @__PURE__ */ __toESM(require_source(), 1);
|
|
2215
2215
|
var chalkDefault = {
|
|
2216
2216
|
hex: (_) => (message) => message,
|
|
@@ -2242,14 +2242,14 @@ var getChalk = () => {
|
|
|
2242
2242
|
};
|
|
2243
2243
|
|
|
2244
2244
|
//#endregion
|
|
2245
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2245
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-G2MK47WL.js
|
|
2246
2246
|
function isUnicodeSupported() {
|
|
2247
2247
|
if (process.platform !== "win32") return process.env.TERM !== "linux";
|
|
2248
2248
|
return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2249
2249
|
}
|
|
2250
2250
|
|
|
2251
2251
|
//#endregion
|
|
2252
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2252
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.js
|
|
2253
2253
|
var LogLevel = {
|
|
2254
2254
|
SILENT: 0,
|
|
2255
2255
|
FATAL: 10,
|
|
@@ -2274,7 +2274,7 @@ var LogLevelLabel = {
|
|
|
2274
2274
|
};
|
|
2275
2275
|
|
|
2276
2276
|
//#endregion
|
|
2277
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2277
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-AITAR5W5.js
|
|
2278
2278
|
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
2279
2279
|
var CONSOLE_ICONS = {
|
|
2280
2280
|
[LogLevelLabel.ERROR]: useIcon("✘", "×"),
|
|
@@ -2288,13 +2288,13 @@ var CONSOLE_ICONS = {
|
|
|
2288
2288
|
};
|
|
2289
2289
|
|
|
2290
2290
|
//#endregion
|
|
2291
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2291
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-CZ4IE2QN.js
|
|
2292
2292
|
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
2293
2293
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
2294
2294
|
};
|
|
2295
2295
|
|
|
2296
2296
|
//#endregion
|
|
2297
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2297
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-K4CDYUQR.js
|
|
2298
2298
|
var getLogLevel = (label) => {
|
|
2299
2299
|
switch (label) {
|
|
2300
2300
|
case "all": return LogLevel.ALL;
|
|
@@ -2310,7 +2310,526 @@ var getLogLevel = (label) => {
|
|
|
2310
2310
|
};
|
|
2311
2311
|
|
|
2312
2312
|
//#endregion
|
|
2313
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2313
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.11/node_modules/@storm-software/config-tools/dist/chunk-SPHE3YEH.js
|
|
2314
|
+
var daysInYear = 365.2425;
|
|
2315
|
+
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
2316
|
+
var secondsInDay = 3600 * 24;
|
|
2317
|
+
secondsInDay * 7;
|
|
2318
|
+
secondsInDay * daysInYear / 12 * 3;
|
|
2319
|
+
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
2320
|
+
var formatDistanceLocale = {
|
|
2321
|
+
lessThanXSeconds: {
|
|
2322
|
+
one: "less than a second",
|
|
2323
|
+
other: "less than {{count}} seconds"
|
|
2324
|
+
},
|
|
2325
|
+
xSeconds: {
|
|
2326
|
+
one: "1 second",
|
|
2327
|
+
other: "{{count}} seconds"
|
|
2328
|
+
},
|
|
2329
|
+
halfAMinute: "half a minute",
|
|
2330
|
+
lessThanXMinutes: {
|
|
2331
|
+
one: "less than a minute",
|
|
2332
|
+
other: "less than {{count}} minutes"
|
|
2333
|
+
},
|
|
2334
|
+
xMinutes: {
|
|
2335
|
+
one: "1 minute",
|
|
2336
|
+
other: "{{count}} minutes"
|
|
2337
|
+
},
|
|
2338
|
+
aboutXHours: {
|
|
2339
|
+
one: "about 1 hour",
|
|
2340
|
+
other: "about {{count}} hours"
|
|
2341
|
+
},
|
|
2342
|
+
xHours: {
|
|
2343
|
+
one: "1 hour",
|
|
2344
|
+
other: "{{count}} hours"
|
|
2345
|
+
},
|
|
2346
|
+
xDays: {
|
|
2347
|
+
one: "1 day",
|
|
2348
|
+
other: "{{count}} days"
|
|
2349
|
+
},
|
|
2350
|
+
aboutXWeeks: {
|
|
2351
|
+
one: "about 1 week",
|
|
2352
|
+
other: "about {{count}} weeks"
|
|
2353
|
+
},
|
|
2354
|
+
xWeeks: {
|
|
2355
|
+
one: "1 week",
|
|
2356
|
+
other: "{{count}} weeks"
|
|
2357
|
+
},
|
|
2358
|
+
aboutXMonths: {
|
|
2359
|
+
one: "about 1 month",
|
|
2360
|
+
other: "about {{count}} months"
|
|
2361
|
+
},
|
|
2362
|
+
xMonths: {
|
|
2363
|
+
one: "1 month",
|
|
2364
|
+
other: "{{count}} months"
|
|
2365
|
+
},
|
|
2366
|
+
aboutXYears: {
|
|
2367
|
+
one: "about 1 year",
|
|
2368
|
+
other: "about {{count}} years"
|
|
2369
|
+
},
|
|
2370
|
+
xYears: {
|
|
2371
|
+
one: "1 year",
|
|
2372
|
+
other: "{{count}} years"
|
|
2373
|
+
},
|
|
2374
|
+
overXYears: {
|
|
2375
|
+
one: "over 1 year",
|
|
2376
|
+
other: "over {{count}} years"
|
|
2377
|
+
},
|
|
2378
|
+
almostXYears: {
|
|
2379
|
+
one: "almost 1 year",
|
|
2380
|
+
other: "almost {{count}} years"
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
var formatDistance = (token, count, options) => {
|
|
2384
|
+
let result;
|
|
2385
|
+
const tokenValue = formatDistanceLocale[token];
|
|
2386
|
+
if (typeof tokenValue === "string") result = tokenValue;
|
|
2387
|
+
else if (count === 1) result = tokenValue.one;
|
|
2388
|
+
else result = tokenValue.other.replace("{{count}}", count.toString());
|
|
2389
|
+
if (options?.addSuffix) if (options.comparison && options.comparison > 0) return "in " + result;
|
|
2390
|
+
else return result + " ago";
|
|
2391
|
+
return result;
|
|
2392
|
+
};
|
|
2393
|
+
function buildFormatLongFn(args) {
|
|
2394
|
+
return (options = {}) => {
|
|
2395
|
+
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
2396
|
+
return args.formats[width] || args.formats[args.defaultWidth];
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
var formatLong = {
|
|
2400
|
+
date: buildFormatLongFn({
|
|
2401
|
+
formats: {
|
|
2402
|
+
full: "EEEE, MMMM do, y",
|
|
2403
|
+
long: "MMMM do, y",
|
|
2404
|
+
medium: "MMM d, y",
|
|
2405
|
+
short: "MM/dd/yyyy"
|
|
2406
|
+
},
|
|
2407
|
+
defaultWidth: "full"
|
|
2408
|
+
}),
|
|
2409
|
+
time: buildFormatLongFn({
|
|
2410
|
+
formats: {
|
|
2411
|
+
full: "h:mm:ss a zzzz",
|
|
2412
|
+
long: "h:mm:ss a z",
|
|
2413
|
+
medium: "h:mm:ss a",
|
|
2414
|
+
short: "h:mm a"
|
|
2415
|
+
},
|
|
2416
|
+
defaultWidth: "full"
|
|
2417
|
+
}),
|
|
2418
|
+
dateTime: buildFormatLongFn({
|
|
2419
|
+
formats: {
|
|
2420
|
+
full: "{{date}} 'at' {{time}}",
|
|
2421
|
+
long: "{{date}} 'at' {{time}}",
|
|
2422
|
+
medium: "{{date}}, {{time}}",
|
|
2423
|
+
short: "{{date}}, {{time}}"
|
|
2424
|
+
},
|
|
2425
|
+
defaultWidth: "full"
|
|
2426
|
+
})
|
|
2427
|
+
};
|
|
2428
|
+
var formatRelativeLocale = {
|
|
2429
|
+
lastWeek: "'last' eeee 'at' p",
|
|
2430
|
+
yesterday: "'yesterday at' p",
|
|
2431
|
+
today: "'today at' p",
|
|
2432
|
+
tomorrow: "'tomorrow at' p",
|
|
2433
|
+
nextWeek: "eeee 'at' p",
|
|
2434
|
+
other: "P"
|
|
2435
|
+
};
|
|
2436
|
+
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
2437
|
+
function buildLocalizeFn(args) {
|
|
2438
|
+
return (value, options) => {
|
|
2439
|
+
const context = options?.context ? String(options.context) : "standalone";
|
|
2440
|
+
let valuesArray;
|
|
2441
|
+
if (context === "formatting" && args.formattingValues) {
|
|
2442
|
+
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
2443
|
+
const width = options?.width ? String(options.width) : defaultWidth;
|
|
2444
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
2445
|
+
} else {
|
|
2446
|
+
const defaultWidth = args.defaultWidth;
|
|
2447
|
+
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
2448
|
+
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
2449
|
+
}
|
|
2450
|
+
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
2451
|
+
return valuesArray[index];
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
var eraValues = {
|
|
2455
|
+
narrow: ["B", "A"],
|
|
2456
|
+
abbreviated: ["BC", "AD"],
|
|
2457
|
+
wide: ["Before Christ", "Anno Domini"]
|
|
2458
|
+
};
|
|
2459
|
+
var quarterValues = {
|
|
2460
|
+
narrow: [
|
|
2461
|
+
"1",
|
|
2462
|
+
"2",
|
|
2463
|
+
"3",
|
|
2464
|
+
"4"
|
|
2465
|
+
],
|
|
2466
|
+
abbreviated: [
|
|
2467
|
+
"Q1",
|
|
2468
|
+
"Q2",
|
|
2469
|
+
"Q3",
|
|
2470
|
+
"Q4"
|
|
2471
|
+
],
|
|
2472
|
+
wide: [
|
|
2473
|
+
"1st quarter",
|
|
2474
|
+
"2nd quarter",
|
|
2475
|
+
"3rd quarter",
|
|
2476
|
+
"4th quarter"
|
|
2477
|
+
]
|
|
2478
|
+
};
|
|
2479
|
+
var monthValues = {
|
|
2480
|
+
narrow: [
|
|
2481
|
+
"J",
|
|
2482
|
+
"F",
|
|
2483
|
+
"M",
|
|
2484
|
+
"A",
|
|
2485
|
+
"M",
|
|
2486
|
+
"J",
|
|
2487
|
+
"J",
|
|
2488
|
+
"A",
|
|
2489
|
+
"S",
|
|
2490
|
+
"O",
|
|
2491
|
+
"N",
|
|
2492
|
+
"D"
|
|
2493
|
+
],
|
|
2494
|
+
abbreviated: [
|
|
2495
|
+
"Jan",
|
|
2496
|
+
"Feb",
|
|
2497
|
+
"Mar",
|
|
2498
|
+
"Apr",
|
|
2499
|
+
"May",
|
|
2500
|
+
"Jun",
|
|
2501
|
+
"Jul",
|
|
2502
|
+
"Aug",
|
|
2503
|
+
"Sep",
|
|
2504
|
+
"Oct",
|
|
2505
|
+
"Nov",
|
|
2506
|
+
"Dec"
|
|
2507
|
+
],
|
|
2508
|
+
wide: [
|
|
2509
|
+
"January",
|
|
2510
|
+
"February",
|
|
2511
|
+
"March",
|
|
2512
|
+
"April",
|
|
2513
|
+
"May",
|
|
2514
|
+
"June",
|
|
2515
|
+
"July",
|
|
2516
|
+
"August",
|
|
2517
|
+
"September",
|
|
2518
|
+
"October",
|
|
2519
|
+
"November",
|
|
2520
|
+
"December"
|
|
2521
|
+
]
|
|
2522
|
+
};
|
|
2523
|
+
var dayValues = {
|
|
2524
|
+
narrow: [
|
|
2525
|
+
"S",
|
|
2526
|
+
"M",
|
|
2527
|
+
"T",
|
|
2528
|
+
"W",
|
|
2529
|
+
"T",
|
|
2530
|
+
"F",
|
|
2531
|
+
"S"
|
|
2532
|
+
],
|
|
2533
|
+
short: [
|
|
2534
|
+
"Su",
|
|
2535
|
+
"Mo",
|
|
2536
|
+
"Tu",
|
|
2537
|
+
"We",
|
|
2538
|
+
"Th",
|
|
2539
|
+
"Fr",
|
|
2540
|
+
"Sa"
|
|
2541
|
+
],
|
|
2542
|
+
abbreviated: [
|
|
2543
|
+
"Sun",
|
|
2544
|
+
"Mon",
|
|
2545
|
+
"Tue",
|
|
2546
|
+
"Wed",
|
|
2547
|
+
"Thu",
|
|
2548
|
+
"Fri",
|
|
2549
|
+
"Sat"
|
|
2550
|
+
],
|
|
2551
|
+
wide: [
|
|
2552
|
+
"Sunday",
|
|
2553
|
+
"Monday",
|
|
2554
|
+
"Tuesday",
|
|
2555
|
+
"Wednesday",
|
|
2556
|
+
"Thursday",
|
|
2557
|
+
"Friday",
|
|
2558
|
+
"Saturday"
|
|
2559
|
+
]
|
|
2560
|
+
};
|
|
2561
|
+
var dayPeriodValues = {
|
|
2562
|
+
narrow: {
|
|
2563
|
+
am: "a",
|
|
2564
|
+
pm: "p",
|
|
2565
|
+
midnight: "mi",
|
|
2566
|
+
noon: "n",
|
|
2567
|
+
morning: "morning",
|
|
2568
|
+
afternoon: "afternoon",
|
|
2569
|
+
evening: "evening",
|
|
2570
|
+
night: "night"
|
|
2571
|
+
},
|
|
2572
|
+
abbreviated: {
|
|
2573
|
+
am: "AM",
|
|
2574
|
+
pm: "PM",
|
|
2575
|
+
midnight: "midnight",
|
|
2576
|
+
noon: "noon",
|
|
2577
|
+
morning: "morning",
|
|
2578
|
+
afternoon: "afternoon",
|
|
2579
|
+
evening: "evening",
|
|
2580
|
+
night: "night"
|
|
2581
|
+
},
|
|
2582
|
+
wide: {
|
|
2583
|
+
am: "a.m.",
|
|
2584
|
+
pm: "p.m.",
|
|
2585
|
+
midnight: "midnight",
|
|
2586
|
+
noon: "noon",
|
|
2587
|
+
morning: "morning",
|
|
2588
|
+
afternoon: "afternoon",
|
|
2589
|
+
evening: "evening",
|
|
2590
|
+
night: "night"
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
var formattingDayPeriodValues = {
|
|
2594
|
+
narrow: {
|
|
2595
|
+
am: "a",
|
|
2596
|
+
pm: "p",
|
|
2597
|
+
midnight: "mi",
|
|
2598
|
+
noon: "n",
|
|
2599
|
+
morning: "in the morning",
|
|
2600
|
+
afternoon: "in the afternoon",
|
|
2601
|
+
evening: "in the evening",
|
|
2602
|
+
night: "at night"
|
|
2603
|
+
},
|
|
2604
|
+
abbreviated: {
|
|
2605
|
+
am: "AM",
|
|
2606
|
+
pm: "PM",
|
|
2607
|
+
midnight: "midnight",
|
|
2608
|
+
noon: "noon",
|
|
2609
|
+
morning: "in the morning",
|
|
2610
|
+
afternoon: "in the afternoon",
|
|
2611
|
+
evening: "in the evening",
|
|
2612
|
+
night: "at night"
|
|
2613
|
+
},
|
|
2614
|
+
wide: {
|
|
2615
|
+
am: "a.m.",
|
|
2616
|
+
pm: "p.m.",
|
|
2617
|
+
midnight: "midnight",
|
|
2618
|
+
noon: "noon",
|
|
2619
|
+
morning: "in the morning",
|
|
2620
|
+
afternoon: "in the afternoon",
|
|
2621
|
+
evening: "in the evening",
|
|
2622
|
+
night: "at night"
|
|
2623
|
+
}
|
|
2624
|
+
};
|
|
2625
|
+
var ordinalNumber = (dirtyNumber, _options) => {
|
|
2626
|
+
const number = Number(dirtyNumber);
|
|
2627
|
+
const rem100 = number % 100;
|
|
2628
|
+
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
2629
|
+
case 1: return number + "st";
|
|
2630
|
+
case 2: return number + "nd";
|
|
2631
|
+
case 3: return number + "rd";
|
|
2632
|
+
}
|
|
2633
|
+
return number + "th";
|
|
2634
|
+
};
|
|
2635
|
+
var localize = {
|
|
2636
|
+
ordinalNumber,
|
|
2637
|
+
era: buildLocalizeFn({
|
|
2638
|
+
values: eraValues,
|
|
2639
|
+
defaultWidth: "wide"
|
|
2640
|
+
}),
|
|
2641
|
+
quarter: buildLocalizeFn({
|
|
2642
|
+
values: quarterValues,
|
|
2643
|
+
defaultWidth: "wide",
|
|
2644
|
+
argumentCallback: (quarter) => quarter - 1
|
|
2645
|
+
}),
|
|
2646
|
+
month: buildLocalizeFn({
|
|
2647
|
+
values: monthValues,
|
|
2648
|
+
defaultWidth: "wide"
|
|
2649
|
+
}),
|
|
2650
|
+
day: buildLocalizeFn({
|
|
2651
|
+
values: dayValues,
|
|
2652
|
+
defaultWidth: "wide"
|
|
2653
|
+
}),
|
|
2654
|
+
dayPeriod: buildLocalizeFn({
|
|
2655
|
+
values: dayPeriodValues,
|
|
2656
|
+
defaultWidth: "wide",
|
|
2657
|
+
formattingValues: formattingDayPeriodValues,
|
|
2658
|
+
defaultFormattingWidth: "wide"
|
|
2659
|
+
})
|
|
2660
|
+
};
|
|
2661
|
+
function buildMatchFn(args) {
|
|
2662
|
+
return (string, options = {}) => {
|
|
2663
|
+
const width = options.width;
|
|
2664
|
+
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
2665
|
+
const matchResult = string.match(matchPattern);
|
|
2666
|
+
if (!matchResult) return null;
|
|
2667
|
+
const matchedString = matchResult[0];
|
|
2668
|
+
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
2669
|
+
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
|
2670
|
+
let value;
|
|
2671
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
2672
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
2673
|
+
const rest = string.slice(matchedString.length);
|
|
2674
|
+
return {
|
|
2675
|
+
value,
|
|
2676
|
+
rest
|
|
2677
|
+
};
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
function findKey(object, predicate) {
|
|
2681
|
+
for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) return key;
|
|
2682
|
+
}
|
|
2683
|
+
function findIndex(array, predicate) {
|
|
2684
|
+
for (let key = 0; key < array.length; key++) if (predicate(array[key])) return key;
|
|
2685
|
+
}
|
|
2686
|
+
function buildMatchPatternFn(args) {
|
|
2687
|
+
return (string, options = {}) => {
|
|
2688
|
+
const matchResult = string.match(args.matchPattern);
|
|
2689
|
+
if (!matchResult) return null;
|
|
2690
|
+
const matchedString = matchResult[0];
|
|
2691
|
+
const parseResult = string.match(args.parsePattern);
|
|
2692
|
+
if (!parseResult) return null;
|
|
2693
|
+
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
2694
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
2695
|
+
const rest = string.slice(matchedString.length);
|
|
2696
|
+
return {
|
|
2697
|
+
value,
|
|
2698
|
+
rest
|
|
2699
|
+
};
|
|
2700
|
+
};
|
|
2701
|
+
}
|
|
2702
|
+
var enUS = {
|
|
2703
|
+
code: "en-US",
|
|
2704
|
+
formatDistance,
|
|
2705
|
+
formatLong,
|
|
2706
|
+
formatRelative,
|
|
2707
|
+
localize,
|
|
2708
|
+
match: {
|
|
2709
|
+
ordinalNumber: buildMatchPatternFn({
|
|
2710
|
+
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
2711
|
+
parsePattern: /\d+/i,
|
|
2712
|
+
valueCallback: (value) => parseInt(value, 10)
|
|
2713
|
+
}),
|
|
2714
|
+
era: buildMatchFn({
|
|
2715
|
+
matchPatterns: {
|
|
2716
|
+
narrow: /^(b|a)/i,
|
|
2717
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
2718
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
2719
|
+
},
|
|
2720
|
+
defaultMatchWidth: "wide",
|
|
2721
|
+
parsePatterns: { any: [/^b/i, /^(a|c)/i] },
|
|
2722
|
+
defaultParseWidth: "any"
|
|
2723
|
+
}),
|
|
2724
|
+
quarter: buildMatchFn({
|
|
2725
|
+
matchPatterns: {
|
|
2726
|
+
narrow: /^[1234]/i,
|
|
2727
|
+
abbreviated: /^q[1234]/i,
|
|
2728
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
2729
|
+
},
|
|
2730
|
+
defaultMatchWidth: "wide",
|
|
2731
|
+
parsePatterns: { any: [
|
|
2732
|
+
/1/i,
|
|
2733
|
+
/2/i,
|
|
2734
|
+
/3/i,
|
|
2735
|
+
/4/i
|
|
2736
|
+
] },
|
|
2737
|
+
defaultParseWidth: "any",
|
|
2738
|
+
valueCallback: (index) => index + 1
|
|
2739
|
+
}),
|
|
2740
|
+
month: buildMatchFn({
|
|
2741
|
+
matchPatterns: {
|
|
2742
|
+
narrow: /^[jfmasond]/i,
|
|
2743
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
2744
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
2745
|
+
},
|
|
2746
|
+
defaultMatchWidth: "wide",
|
|
2747
|
+
parsePatterns: {
|
|
2748
|
+
narrow: [
|
|
2749
|
+
/^j/i,
|
|
2750
|
+
/^f/i,
|
|
2751
|
+
/^m/i,
|
|
2752
|
+
/^a/i,
|
|
2753
|
+
/^m/i,
|
|
2754
|
+
/^j/i,
|
|
2755
|
+
/^j/i,
|
|
2756
|
+
/^a/i,
|
|
2757
|
+
/^s/i,
|
|
2758
|
+
/^o/i,
|
|
2759
|
+
/^n/i,
|
|
2760
|
+
/^d/i
|
|
2761
|
+
],
|
|
2762
|
+
any: [
|
|
2763
|
+
/^ja/i,
|
|
2764
|
+
/^f/i,
|
|
2765
|
+
/^mar/i,
|
|
2766
|
+
/^ap/i,
|
|
2767
|
+
/^may/i,
|
|
2768
|
+
/^jun/i,
|
|
2769
|
+
/^jul/i,
|
|
2770
|
+
/^au/i,
|
|
2771
|
+
/^s/i,
|
|
2772
|
+
/^o/i,
|
|
2773
|
+
/^n/i,
|
|
2774
|
+
/^d/i
|
|
2775
|
+
]
|
|
2776
|
+
},
|
|
2777
|
+
defaultParseWidth: "any"
|
|
2778
|
+
}),
|
|
2779
|
+
day: buildMatchFn({
|
|
2780
|
+
matchPatterns: {
|
|
2781
|
+
narrow: /^[smtwf]/i,
|
|
2782
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
2783
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
2784
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
2785
|
+
},
|
|
2786
|
+
defaultMatchWidth: "wide",
|
|
2787
|
+
parsePatterns: {
|
|
2788
|
+
narrow: [
|
|
2789
|
+
/^s/i,
|
|
2790
|
+
/^m/i,
|
|
2791
|
+
/^t/i,
|
|
2792
|
+
/^w/i,
|
|
2793
|
+
/^t/i,
|
|
2794
|
+
/^f/i,
|
|
2795
|
+
/^s/i
|
|
2796
|
+
],
|
|
2797
|
+
any: [
|
|
2798
|
+
/^su/i,
|
|
2799
|
+
/^m/i,
|
|
2800
|
+
/^tu/i,
|
|
2801
|
+
/^w/i,
|
|
2802
|
+
/^th/i,
|
|
2803
|
+
/^f/i,
|
|
2804
|
+
/^sa/i
|
|
2805
|
+
]
|
|
2806
|
+
},
|
|
2807
|
+
defaultParseWidth: "any"
|
|
2808
|
+
}),
|
|
2809
|
+
dayPeriod: buildMatchFn({
|
|
2810
|
+
matchPatterns: {
|
|
2811
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
2812
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
2813
|
+
},
|
|
2814
|
+
defaultMatchWidth: "any",
|
|
2815
|
+
parsePatterns: { any: {
|
|
2816
|
+
am: /^a/i,
|
|
2817
|
+
pm: /^p/i,
|
|
2818
|
+
midnight: /^mi/i,
|
|
2819
|
+
noon: /^no/i,
|
|
2820
|
+
morning: /morning/i,
|
|
2821
|
+
afternoon: /afternoon/i,
|
|
2822
|
+
evening: /evening/i,
|
|
2823
|
+
night: /night/i
|
|
2824
|
+
} },
|
|
2825
|
+
defaultParseWidth: "any"
|
|
2826
|
+
})
|
|
2827
|
+
},
|
|
2828
|
+
options: {
|
|
2829
|
+
weekStartsOn: 0,
|
|
2830
|
+
firstWeekContainsDate: 1
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2314
2833
|
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
2315
2834
|
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
2316
2835
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|