@bamboocss/node 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2557 -0
- package/dist/index.d.cts +191 -0
- package/dist/index.d.mts +191 -0
- package/dist/index.mjs +2349 -2781
- package/package.json +20 -20
- package/dist/index.js +0 -2984
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2557 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
//#endregion
|
|
25
|
+
let _bamboocss_reporter = require("@bamboocss/reporter");
|
|
26
|
+
let _bamboocss_logger = require("@bamboocss/logger");
|
|
27
|
+
let _bamboocss_config = require("@bamboocss/config");
|
|
28
|
+
let _bamboocss_shared = require("@bamboocss/shared");
|
|
29
|
+
let fs = require("fs");
|
|
30
|
+
let path = require("path");
|
|
31
|
+
let _bamboocss_plugin_lightningcss = require("@bamboocss/plugin-lightningcss");
|
|
32
|
+
let _bamboocss_plugin_svelte = require("@bamboocss/plugin-svelte");
|
|
33
|
+
let _bamboocss_plugin_vue = require("@bamboocss/plugin-vue");
|
|
34
|
+
let browserslist = require("browserslist");
|
|
35
|
+
browserslist = __toESM(browserslist);
|
|
36
|
+
let _bamboocss_generator = require("@bamboocss/generator");
|
|
37
|
+
let _bamboocss_parser = require("@bamboocss/parser");
|
|
38
|
+
let perfect_debounce = require("perfect-debounce");
|
|
39
|
+
let node_process = require("node:process");
|
|
40
|
+
node_process = __toESM(node_process, 1);
|
|
41
|
+
let node_os = require("node:os");
|
|
42
|
+
node_os = __toESM(node_os, 1);
|
|
43
|
+
let node_tty = require("node:tty");
|
|
44
|
+
node_tty = __toESM(node_tty, 1);
|
|
45
|
+
let chokidar = require("chokidar");
|
|
46
|
+
chokidar = __toESM(chokidar);
|
|
47
|
+
let fast_glob = require("fast-glob");
|
|
48
|
+
fast_glob = __toESM(fast_glob);
|
|
49
|
+
let fs_extra = require("fs-extra");
|
|
50
|
+
fs_extra = __toESM(fs_extra);
|
|
51
|
+
let picomatch = require("picomatch");
|
|
52
|
+
picomatch = __toESM(picomatch);
|
|
53
|
+
let node_path = require("node:path");
|
|
54
|
+
node_path = __toESM(node_path);
|
|
55
|
+
let node_fs = require("node:fs");
|
|
56
|
+
node_fs = __toESM(node_fs);
|
|
57
|
+
let is_glob = require("is-glob");
|
|
58
|
+
is_glob = __toESM(is_glob);
|
|
59
|
+
let glob_parent = require("glob-parent");
|
|
60
|
+
glob_parent = __toESM(glob_parent);
|
|
61
|
+
let node_readline = require("node:readline");
|
|
62
|
+
node_readline = __toESM(node_readline);
|
|
63
|
+
let look_it_up = require("look-it-up");
|
|
64
|
+
let outdent = require("outdent");
|
|
65
|
+
outdent = __toESM(outdent);
|
|
66
|
+
let _bamboocss_core = require("@bamboocss/core");
|
|
67
|
+
let child_process = require("child_process");
|
|
68
|
+
//#region src/analyze.ts
|
|
69
|
+
function analyze(ctx, options = {}) {
|
|
70
|
+
const reporter = new _bamboocss_reporter.Reporter(ctx, {
|
|
71
|
+
project: ctx.project,
|
|
72
|
+
getRelativePath: ctx.runtime.path.relative,
|
|
73
|
+
getFiles: ctx.getFiles,
|
|
74
|
+
...options
|
|
75
|
+
});
|
|
76
|
+
reporter.init();
|
|
77
|
+
return {
|
|
78
|
+
getRecipeReport(format = "table") {
|
|
79
|
+
const report = reporter.getRecipeReport();
|
|
80
|
+
return {
|
|
81
|
+
report,
|
|
82
|
+
formatted: (0, _bamboocss_reporter.formatRecipeReport)(report, format)
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
getTokenReport(format = "table") {
|
|
86
|
+
const report = reporter.getTokenReport();
|
|
87
|
+
return {
|
|
88
|
+
report,
|
|
89
|
+
formatted: (0, _bamboocss_reporter.formatTokenReport)(report.getSummary(), format)
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
writeReport(filePath) {
|
|
93
|
+
const dirname = ctx.runtime.path.dirname(filePath);
|
|
94
|
+
ctx.runtime.fs.ensureDirSync(dirname);
|
|
95
|
+
const str = JSON.stringify(reporter.report, replacer, 2);
|
|
96
|
+
return ctx.runtime.fs.writeFile(filePath, str);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function replacer(_, value) {
|
|
101
|
+
if (value instanceof Set) return Array.from(value);
|
|
102
|
+
if (value instanceof Map) return Object.fromEntries(value);
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/build-info.ts
|
|
107
|
+
async function buildInfo(ctx, outfile) {
|
|
108
|
+
const { filesWithCss, files } = ctx.parseFiles();
|
|
109
|
+
_bamboocss_logger.logger.info("cli", `Found ${_bamboocss_logger.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Bamboo`);
|
|
110
|
+
const { minify, staticCss } = ctx.config;
|
|
111
|
+
_bamboocss_logger.logger.info("cli", `Writing ${minify ? "[min] " : " "}${_bamboocss_logger.colors.bold(outfile)}`);
|
|
112
|
+
if (staticCss) {
|
|
113
|
+
_bamboocss_logger.logger.info("cli", "Adding staticCss definitions...");
|
|
114
|
+
ctx.staticCss.process(staticCss);
|
|
115
|
+
}
|
|
116
|
+
const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
|
|
117
|
+
ctx.output.ensure(outfile, process.cwd());
|
|
118
|
+
await ctx.runtime.fs.writeFile(outfile, output);
|
|
119
|
+
_bamboocss_logger.logger.info("cli", "Done!");
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/codegen.ts
|
|
123
|
+
async function codegen(ctx, ids) {
|
|
124
|
+
const { default: pLimit } = await import("p-limit");
|
|
125
|
+
const limit = pLimit(20);
|
|
126
|
+
if (ctx.config.clean) ctx.output.empty();
|
|
127
|
+
let artifacts = ctx.getArtifacts(ids);
|
|
128
|
+
if (ctx.hooks["codegen:prepare"]) {
|
|
129
|
+
const results = await ctx.hooks["codegen:prepare"]?.({
|
|
130
|
+
changed: ids,
|
|
131
|
+
artifacts
|
|
132
|
+
});
|
|
133
|
+
if (results) artifacts = results;
|
|
134
|
+
}
|
|
135
|
+
const promises = artifacts.map((artifact) => limit(() => ctx.output.write(artifact)));
|
|
136
|
+
await Promise.allSettled(promises);
|
|
137
|
+
await ctx.hooks["codegen:done"]?.({ changed: ids });
|
|
138
|
+
return {
|
|
139
|
+
box: ctx.initMessage(),
|
|
140
|
+
msg: ctx.messages.artifactsGenerated()
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
145
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
146
|
+
return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region ../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
|
|
150
|
+
const regex = ansiRegex();
|
|
151
|
+
function stripAnsi(string) {
|
|
152
|
+
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
153
|
+
return string.replace(regex, "");
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
|
|
157
|
+
function isAmbiguous(x) {
|
|
158
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
159
|
+
}
|
|
160
|
+
function isFullWidth(x) {
|
|
161
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
162
|
+
}
|
|
163
|
+
function isWide(x) {
|
|
164
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
|
|
168
|
+
function validate(codePoint) {
|
|
169
|
+
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
170
|
+
}
|
|
171
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
172
|
+
validate(codePoint);
|
|
173
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
174
|
+
return 1;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
178
|
+
var import_emoji_regex = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
179
|
+
module.exports = () => {
|
|
180
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
181
|
+
};
|
|
182
|
+
})))(), 1);
|
|
183
|
+
const segmenter = new Intl.Segmenter();
|
|
184
|
+
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
185
|
+
function stringWidth(string, options = {}) {
|
|
186
|
+
if (typeof string !== "string" || string.length === 0) return 0;
|
|
187
|
+
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
188
|
+
if (!countAnsiEscapeCodes) string = stripAnsi(string);
|
|
189
|
+
if (string.length === 0) return 0;
|
|
190
|
+
let width = 0;
|
|
191
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
192
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
193
|
+
const codePoint = character.codePointAt(0);
|
|
194
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
195
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
196
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
|
|
197
|
+
if (codePoint >= 55296 && codePoint <= 57343) continue;
|
|
198
|
+
if (codePoint >= 65024 && codePoint <= 65039) continue;
|
|
199
|
+
if (defaultIgnorableCodePointRegex.test(character)) continue;
|
|
200
|
+
if ((0, import_emoji_regex.default)().test(character)) {
|
|
201
|
+
width += 2;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
205
|
+
}
|
|
206
|
+
return width;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
210
|
+
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
211
|
+
const wrapAnsi16$1 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
212
|
+
const wrapAnsi256$1 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
213
|
+
const wrapAnsi16m$1 = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
214
|
+
const styles$2 = {
|
|
215
|
+
modifier: {
|
|
216
|
+
reset: [0, 0],
|
|
217
|
+
bold: [1, 22],
|
|
218
|
+
dim: [2, 22],
|
|
219
|
+
italic: [3, 23],
|
|
220
|
+
underline: [4, 24],
|
|
221
|
+
overline: [53, 55],
|
|
222
|
+
inverse: [7, 27],
|
|
223
|
+
hidden: [8, 28],
|
|
224
|
+
strikethrough: [9, 29]
|
|
225
|
+
},
|
|
226
|
+
color: {
|
|
227
|
+
black: [30, 39],
|
|
228
|
+
red: [31, 39],
|
|
229
|
+
green: [32, 39],
|
|
230
|
+
yellow: [33, 39],
|
|
231
|
+
blue: [34, 39],
|
|
232
|
+
magenta: [35, 39],
|
|
233
|
+
cyan: [36, 39],
|
|
234
|
+
white: [37, 39],
|
|
235
|
+
blackBright: [90, 39],
|
|
236
|
+
gray: [90, 39],
|
|
237
|
+
grey: [90, 39],
|
|
238
|
+
redBright: [91, 39],
|
|
239
|
+
greenBright: [92, 39],
|
|
240
|
+
yellowBright: [93, 39],
|
|
241
|
+
blueBright: [94, 39],
|
|
242
|
+
magentaBright: [95, 39],
|
|
243
|
+
cyanBright: [96, 39],
|
|
244
|
+
whiteBright: [97, 39]
|
|
245
|
+
},
|
|
246
|
+
bgColor: {
|
|
247
|
+
bgBlack: [40, 49],
|
|
248
|
+
bgRed: [41, 49],
|
|
249
|
+
bgGreen: [42, 49],
|
|
250
|
+
bgYellow: [43, 49],
|
|
251
|
+
bgBlue: [44, 49],
|
|
252
|
+
bgMagenta: [45, 49],
|
|
253
|
+
bgCyan: [46, 49],
|
|
254
|
+
bgWhite: [47, 49],
|
|
255
|
+
bgBlackBright: [100, 49],
|
|
256
|
+
bgGray: [100, 49],
|
|
257
|
+
bgGrey: [100, 49],
|
|
258
|
+
bgRedBright: [101, 49],
|
|
259
|
+
bgGreenBright: [102, 49],
|
|
260
|
+
bgYellowBright: [103, 49],
|
|
261
|
+
bgBlueBright: [104, 49],
|
|
262
|
+
bgMagentaBright: [105, 49],
|
|
263
|
+
bgCyanBright: [106, 49],
|
|
264
|
+
bgWhiteBright: [107, 49]
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
Object.keys(styles$2.modifier);
|
|
268
|
+
const foregroundColorNames$1 = Object.keys(styles$2.color);
|
|
269
|
+
const backgroundColorNames$1 = Object.keys(styles$2.bgColor);
|
|
270
|
+
[...foregroundColorNames$1, ...backgroundColorNames$1];
|
|
271
|
+
function assembleStyles$1() {
|
|
272
|
+
const codes = /* @__PURE__ */ new Map();
|
|
273
|
+
for (const [groupName, group] of Object.entries(styles$2)) {
|
|
274
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
275
|
+
styles$2[styleName] = {
|
|
276
|
+
open: `\u001B[${style[0]}m`,
|
|
277
|
+
close: `\u001B[${style[1]}m`
|
|
278
|
+
};
|
|
279
|
+
group[styleName] = styles$2[styleName];
|
|
280
|
+
codes.set(style[0], style[1]);
|
|
281
|
+
}
|
|
282
|
+
Object.defineProperty(styles$2, groupName, {
|
|
283
|
+
value: group,
|
|
284
|
+
enumerable: false
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
Object.defineProperty(styles$2, "codes", {
|
|
288
|
+
value: codes,
|
|
289
|
+
enumerable: false
|
|
290
|
+
});
|
|
291
|
+
styles$2.color.close = "\x1B[39m";
|
|
292
|
+
styles$2.bgColor.close = "\x1B[49m";
|
|
293
|
+
styles$2.color.ansi = wrapAnsi16$1();
|
|
294
|
+
styles$2.color.ansi256 = wrapAnsi256$1();
|
|
295
|
+
styles$2.color.ansi16m = wrapAnsi16m$1();
|
|
296
|
+
styles$2.bgColor.ansi = wrapAnsi16$1(ANSI_BACKGROUND_OFFSET$1);
|
|
297
|
+
styles$2.bgColor.ansi256 = wrapAnsi256$1(ANSI_BACKGROUND_OFFSET$1);
|
|
298
|
+
styles$2.bgColor.ansi16m = wrapAnsi16m$1(ANSI_BACKGROUND_OFFSET$1);
|
|
299
|
+
Object.defineProperties(styles$2, {
|
|
300
|
+
rgbToAnsi256: {
|
|
301
|
+
value(red, green, blue) {
|
|
302
|
+
if (red === green && green === blue) {
|
|
303
|
+
if (red < 8) return 16;
|
|
304
|
+
if (red > 248) return 231;
|
|
305
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
306
|
+
}
|
|
307
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
308
|
+
},
|
|
309
|
+
enumerable: false
|
|
310
|
+
},
|
|
311
|
+
hexToRgb: {
|
|
312
|
+
value(hex) {
|
|
313
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
314
|
+
if (!matches) return [
|
|
315
|
+
0,
|
|
316
|
+
0,
|
|
317
|
+
0
|
|
318
|
+
];
|
|
319
|
+
let [colorString] = matches;
|
|
320
|
+
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
321
|
+
const integer = Number.parseInt(colorString, 16);
|
|
322
|
+
return [
|
|
323
|
+
integer >> 16 & 255,
|
|
324
|
+
integer >> 8 & 255,
|
|
325
|
+
integer & 255
|
|
326
|
+
];
|
|
327
|
+
},
|
|
328
|
+
enumerable: false
|
|
329
|
+
},
|
|
330
|
+
hexToAnsi256: {
|
|
331
|
+
value: (hex) => styles$2.rgbToAnsi256(...styles$2.hexToRgb(hex)),
|
|
332
|
+
enumerable: false
|
|
333
|
+
},
|
|
334
|
+
ansi256ToAnsi: {
|
|
335
|
+
value(code) {
|
|
336
|
+
if (code < 8) return 30 + code;
|
|
337
|
+
if (code < 16) return 90 + (code - 8);
|
|
338
|
+
let red;
|
|
339
|
+
let green;
|
|
340
|
+
let blue;
|
|
341
|
+
if (code >= 232) {
|
|
342
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
343
|
+
green = red;
|
|
344
|
+
blue = red;
|
|
345
|
+
} else {
|
|
346
|
+
code -= 16;
|
|
347
|
+
const remainder = code % 36;
|
|
348
|
+
red = Math.floor(code / 36) / 5;
|
|
349
|
+
green = Math.floor(remainder / 6) / 5;
|
|
350
|
+
blue = remainder % 6 / 5;
|
|
351
|
+
}
|
|
352
|
+
const value = Math.max(red, green, blue) * 2;
|
|
353
|
+
if (value === 0) return 30;
|
|
354
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
355
|
+
if (value === 2) result += 60;
|
|
356
|
+
return result;
|
|
357
|
+
},
|
|
358
|
+
enumerable: false
|
|
359
|
+
},
|
|
360
|
+
rgbToAnsi: {
|
|
361
|
+
value: (red, green, blue) => styles$2.ansi256ToAnsi(styles$2.rgbToAnsi256(red, green, blue)),
|
|
362
|
+
enumerable: false
|
|
363
|
+
},
|
|
364
|
+
hexToAnsi: {
|
|
365
|
+
value: (hex) => styles$2.ansi256ToAnsi(styles$2.hexToAnsi256(hex)),
|
|
366
|
+
enumerable: false
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
return styles$2;
|
|
370
|
+
}
|
|
371
|
+
const ansiStyles$1 = assembleStyles$1();
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
374
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.default.argv) {
|
|
375
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
376
|
+
const position = argv.indexOf(prefix + flag);
|
|
377
|
+
const terminatorPosition = argv.indexOf("--");
|
|
378
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
379
|
+
}
|
|
380
|
+
const { env } = node_process.default;
|
|
381
|
+
let flagForceColor;
|
|
382
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
383
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
384
|
+
function envForceColor() {
|
|
385
|
+
if ("FORCE_COLOR" in env) {
|
|
386
|
+
if (env.FORCE_COLOR === "true") return 1;
|
|
387
|
+
if (env.FORCE_COLOR === "false") return 0;
|
|
388
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function translateLevel(level) {
|
|
392
|
+
if (level === 0) return false;
|
|
393
|
+
return {
|
|
394
|
+
level,
|
|
395
|
+
hasBasic: true,
|
|
396
|
+
has256: level >= 2,
|
|
397
|
+
has16m: level >= 3
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
401
|
+
const noFlagForceColor = envForceColor();
|
|
402
|
+
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
403
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
404
|
+
if (forceColor === 0) return 0;
|
|
405
|
+
if (sniffFlags) {
|
|
406
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
407
|
+
if (hasFlag("color=256")) return 2;
|
|
408
|
+
}
|
|
409
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
410
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
411
|
+
const min = forceColor || 0;
|
|
412
|
+
if (env.TERM === "dumb") return min;
|
|
413
|
+
if (node_process.default.platform === "win32") {
|
|
414
|
+
const osRelease = node_os.default.release().split(".");
|
|
415
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
416
|
+
return 1;
|
|
417
|
+
}
|
|
418
|
+
if ("CI" in env) {
|
|
419
|
+
if ([
|
|
420
|
+
"GITHUB_ACTIONS",
|
|
421
|
+
"GITEA_ACTIONS",
|
|
422
|
+
"CIRCLECI"
|
|
423
|
+
].some((key) => key in env)) return 3;
|
|
424
|
+
if ([
|
|
425
|
+
"TRAVIS",
|
|
426
|
+
"APPVEYOR",
|
|
427
|
+
"GITLAB_CI",
|
|
428
|
+
"BUILDKITE",
|
|
429
|
+
"DRONE"
|
|
430
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
431
|
+
return min;
|
|
432
|
+
}
|
|
433
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
434
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
435
|
+
if (env.TERM === "xterm-kitty") return 3;
|
|
436
|
+
if (env.TERM === "xterm-ghostty") return 3;
|
|
437
|
+
if (env.TERM === "wezterm") return 3;
|
|
438
|
+
if ("TERM_PROGRAM" in env) {
|
|
439
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
440
|
+
switch (env.TERM_PROGRAM) {
|
|
441
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
442
|
+
case "Apple_Terminal": return 2;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
446
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
447
|
+
if ("COLORTERM" in env) return 1;
|
|
448
|
+
return min;
|
|
449
|
+
}
|
|
450
|
+
function createSupportsColor(stream, options = {}) {
|
|
451
|
+
return translateLevel(_supportsColor(stream, {
|
|
452
|
+
streamIsTTY: stream && stream.isTTY,
|
|
453
|
+
...options
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
456
|
+
const supportsColor = {
|
|
457
|
+
stdout: createSupportsColor({ isTTY: node_tty.default.isatty(1) }),
|
|
458
|
+
stderr: createSupportsColor({ isTTY: node_tty.default.isatty(2) })
|
|
459
|
+
};
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
462
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
463
|
+
let index = string.indexOf(substring);
|
|
464
|
+
if (index === -1) return string;
|
|
465
|
+
const substringLength = substring.length;
|
|
466
|
+
let endIndex = 0;
|
|
467
|
+
let returnValue = "";
|
|
468
|
+
do {
|
|
469
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
470
|
+
endIndex = index + substringLength;
|
|
471
|
+
index = string.indexOf(substring, endIndex);
|
|
472
|
+
} while (index !== -1);
|
|
473
|
+
returnValue += string.slice(endIndex);
|
|
474
|
+
return returnValue;
|
|
475
|
+
}
|
|
476
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
477
|
+
let endIndex = 0;
|
|
478
|
+
let returnValue = "";
|
|
479
|
+
do {
|
|
480
|
+
const gotCR = string[index - 1] === "\r";
|
|
481
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
482
|
+
endIndex = index + 1;
|
|
483
|
+
index = string.indexOf("\n", endIndex);
|
|
484
|
+
} while (index !== -1);
|
|
485
|
+
returnValue += string.slice(endIndex);
|
|
486
|
+
return returnValue;
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
490
|
+
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
491
|
+
const GENERATOR = Symbol("GENERATOR");
|
|
492
|
+
const STYLER = Symbol("STYLER");
|
|
493
|
+
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
494
|
+
const levelMapping = [
|
|
495
|
+
"ansi",
|
|
496
|
+
"ansi",
|
|
497
|
+
"ansi256",
|
|
498
|
+
"ansi16m"
|
|
499
|
+
];
|
|
500
|
+
const styles$1 = Object.create(null);
|
|
501
|
+
const applyOptions = (object, options = {}) => {
|
|
502
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
|
|
503
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
504
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
505
|
+
};
|
|
506
|
+
const chalkFactory = (options) => {
|
|
507
|
+
const chalk = (...strings) => strings.join(" ");
|
|
508
|
+
applyOptions(chalk, options);
|
|
509
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
510
|
+
return chalk;
|
|
511
|
+
};
|
|
512
|
+
function createChalk(options) {
|
|
513
|
+
return chalkFactory(options);
|
|
514
|
+
}
|
|
515
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
516
|
+
for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
|
|
517
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
518
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
519
|
+
return builder;
|
|
520
|
+
} };
|
|
521
|
+
styles$1.visible = { get() {
|
|
522
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
523
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
524
|
+
return builder;
|
|
525
|
+
} };
|
|
526
|
+
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
527
|
+
if (model === "rgb") {
|
|
528
|
+
if (level === "ansi16m") return ansiStyles$1[type].ansi16m(...arguments_);
|
|
529
|
+
if (level === "ansi256") return ansiStyles$1[type].ansi256(ansiStyles$1.rgbToAnsi256(...arguments_));
|
|
530
|
+
return ansiStyles$1[type].ansi(ansiStyles$1.rgbToAnsi(...arguments_));
|
|
531
|
+
}
|
|
532
|
+
if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles$1.hexToRgb(...arguments_));
|
|
533
|
+
return ansiStyles$1[type][model](...arguments_);
|
|
534
|
+
};
|
|
535
|
+
for (const model of [
|
|
536
|
+
"rgb",
|
|
537
|
+
"hex",
|
|
538
|
+
"ansi256"
|
|
539
|
+
]) {
|
|
540
|
+
styles$1[model] = { get() {
|
|
541
|
+
const { level } = this;
|
|
542
|
+
return function(...arguments_) {
|
|
543
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles$1.color.close, this[STYLER]);
|
|
544
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
545
|
+
};
|
|
546
|
+
} };
|
|
547
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
548
|
+
styles$1[bgModel] = { get() {
|
|
549
|
+
const { level } = this;
|
|
550
|
+
return function(...arguments_) {
|
|
551
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles$1.bgColor.close, this[STYLER]);
|
|
552
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
553
|
+
};
|
|
554
|
+
} };
|
|
555
|
+
}
|
|
556
|
+
const proto = Object.defineProperties(() => {}, {
|
|
557
|
+
...styles$1,
|
|
558
|
+
level: {
|
|
559
|
+
enumerable: true,
|
|
560
|
+
get() {
|
|
561
|
+
return this[GENERATOR].level;
|
|
562
|
+
},
|
|
563
|
+
set(level) {
|
|
564
|
+
this[GENERATOR].level = level;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
const createStyler = (open, close, parent) => {
|
|
569
|
+
let openAll;
|
|
570
|
+
let closeAll;
|
|
571
|
+
if (parent === void 0) {
|
|
572
|
+
openAll = open;
|
|
573
|
+
closeAll = close;
|
|
574
|
+
} else {
|
|
575
|
+
openAll = parent.openAll + open;
|
|
576
|
+
closeAll = close + parent.closeAll;
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
open,
|
|
580
|
+
close,
|
|
581
|
+
openAll,
|
|
582
|
+
closeAll,
|
|
583
|
+
parent
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
587
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
588
|
+
Object.setPrototypeOf(builder, proto);
|
|
589
|
+
builder[GENERATOR] = self;
|
|
590
|
+
builder[STYLER] = _styler;
|
|
591
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
592
|
+
return builder;
|
|
593
|
+
};
|
|
594
|
+
const applyStyle = (self, string) => {
|
|
595
|
+
if (self.level <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
596
|
+
let styler = self[STYLER];
|
|
597
|
+
if (styler === void 0) return string;
|
|
598
|
+
const { openAll, closeAll } = styler;
|
|
599
|
+
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
600
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
601
|
+
styler = styler.parent;
|
|
602
|
+
}
|
|
603
|
+
const lfIndex = string.indexOf("\n");
|
|
604
|
+
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
605
|
+
return openAll + string + closeAll;
|
|
606
|
+
};
|
|
607
|
+
Object.defineProperties(createChalk.prototype, styles$1);
|
|
608
|
+
const chalk = createChalk();
|
|
609
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
|
|
612
|
+
function widestLine(string) {
|
|
613
|
+
let lineWidth = 0;
|
|
614
|
+
for (const line of string.split("\n")) lineWidth = Math.max(lineWidth, stringWidth(line));
|
|
615
|
+
return lineWidth;
|
|
616
|
+
}
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
|
|
619
|
+
var require_boxes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
620
|
+
module.exports = {
|
|
621
|
+
"single": {
|
|
622
|
+
"topLeft": "┌",
|
|
623
|
+
"top": "─",
|
|
624
|
+
"topRight": "┐",
|
|
625
|
+
"right": "│",
|
|
626
|
+
"bottomRight": "┘",
|
|
627
|
+
"bottom": "─",
|
|
628
|
+
"bottomLeft": "└",
|
|
629
|
+
"left": "│"
|
|
630
|
+
},
|
|
631
|
+
"double": {
|
|
632
|
+
"topLeft": "╔",
|
|
633
|
+
"top": "═",
|
|
634
|
+
"topRight": "╗",
|
|
635
|
+
"right": "║",
|
|
636
|
+
"bottomRight": "╝",
|
|
637
|
+
"bottom": "═",
|
|
638
|
+
"bottomLeft": "╚",
|
|
639
|
+
"left": "║"
|
|
640
|
+
},
|
|
641
|
+
"round": {
|
|
642
|
+
"topLeft": "╭",
|
|
643
|
+
"top": "─",
|
|
644
|
+
"topRight": "╮",
|
|
645
|
+
"right": "│",
|
|
646
|
+
"bottomRight": "╯",
|
|
647
|
+
"bottom": "─",
|
|
648
|
+
"bottomLeft": "╰",
|
|
649
|
+
"left": "│"
|
|
650
|
+
},
|
|
651
|
+
"bold": {
|
|
652
|
+
"topLeft": "┏",
|
|
653
|
+
"top": "━",
|
|
654
|
+
"topRight": "┓",
|
|
655
|
+
"right": "┃",
|
|
656
|
+
"bottomRight": "┛",
|
|
657
|
+
"bottom": "━",
|
|
658
|
+
"bottomLeft": "┗",
|
|
659
|
+
"left": "┃"
|
|
660
|
+
},
|
|
661
|
+
"singleDouble": {
|
|
662
|
+
"topLeft": "╓",
|
|
663
|
+
"top": "─",
|
|
664
|
+
"topRight": "╖",
|
|
665
|
+
"right": "║",
|
|
666
|
+
"bottomRight": "╜",
|
|
667
|
+
"bottom": "─",
|
|
668
|
+
"bottomLeft": "╙",
|
|
669
|
+
"left": "║"
|
|
670
|
+
},
|
|
671
|
+
"doubleSingle": {
|
|
672
|
+
"topLeft": "╒",
|
|
673
|
+
"top": "═",
|
|
674
|
+
"topRight": "╕",
|
|
675
|
+
"right": "│",
|
|
676
|
+
"bottomRight": "╛",
|
|
677
|
+
"bottom": "═",
|
|
678
|
+
"bottomLeft": "╘",
|
|
679
|
+
"left": "│"
|
|
680
|
+
},
|
|
681
|
+
"classic": {
|
|
682
|
+
"topLeft": "+",
|
|
683
|
+
"top": "-",
|
|
684
|
+
"topRight": "+",
|
|
685
|
+
"right": "|",
|
|
686
|
+
"bottomRight": "+",
|
|
687
|
+
"bottom": "-",
|
|
688
|
+
"bottomLeft": "+",
|
|
689
|
+
"left": "|"
|
|
690
|
+
},
|
|
691
|
+
"arrow": {
|
|
692
|
+
"topLeft": "↘",
|
|
693
|
+
"top": "↓",
|
|
694
|
+
"topRight": "↙",
|
|
695
|
+
"right": "←",
|
|
696
|
+
"bottomRight": "↖",
|
|
697
|
+
"bottom": "↑",
|
|
698
|
+
"bottomLeft": "↗",
|
|
699
|
+
"left": "→"
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
}));
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
705
|
+
var import_cli_boxes = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
706
|
+
const cliBoxes = require_boxes();
|
|
707
|
+
module.exports = cliBoxes;
|
|
708
|
+
module.exports.default = cliBoxes;
|
|
709
|
+
})))(), 1);
|
|
710
|
+
const UPPERCASE = /[\p{Lu}]/u;
|
|
711
|
+
const LOWERCASE = /[\p{Ll}]/u;
|
|
712
|
+
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
713
|
+
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
714
|
+
const SEPARATORS = /[_.\- ]+/;
|
|
715
|
+
const LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
716
|
+
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
717
|
+
const NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
718
|
+
const preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {
|
|
719
|
+
let isLastCharLower = false;
|
|
720
|
+
let isLastCharUpper = false;
|
|
721
|
+
let isLastLastCharUpper = false;
|
|
722
|
+
let isLastLastCharPreserved = false;
|
|
723
|
+
for (let index = 0; index < string.length; index++) {
|
|
724
|
+
const character = string[index];
|
|
725
|
+
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
726
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
727
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
728
|
+
isLastCharLower = false;
|
|
729
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
730
|
+
isLastCharUpper = true;
|
|
731
|
+
index++;
|
|
732
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {
|
|
733
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
734
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
735
|
+
isLastCharUpper = false;
|
|
736
|
+
isLastCharLower = true;
|
|
737
|
+
} else {
|
|
738
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
739
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
740
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return string;
|
|
744
|
+
};
|
|
745
|
+
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
746
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
747
|
+
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
748
|
+
};
|
|
749
|
+
const postProcess = (input, toUpperCase) => {
|
|
750
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
751
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
752
|
+
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
753
|
+
};
|
|
754
|
+
function camelCase(input, options) {
|
|
755
|
+
if (!(typeof input === "string" || Array.isArray(input))) throw new TypeError("Expected the input to be `string | string[]`");
|
|
756
|
+
options = {
|
|
757
|
+
pascalCase: false,
|
|
758
|
+
preserveConsecutiveUppercase: false,
|
|
759
|
+
...options
|
|
760
|
+
};
|
|
761
|
+
if (Array.isArray(input)) input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
762
|
+
else input = input.trim();
|
|
763
|
+
if (input.length === 0) return "";
|
|
764
|
+
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
765
|
+
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
766
|
+
if (input.length === 1) {
|
|
767
|
+
if (SEPARATORS.test(input)) return "";
|
|
768
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
769
|
+
}
|
|
770
|
+
if (input !== toLowerCase(input)) input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
771
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
772
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
773
|
+
if (options.pascalCase) input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
774
|
+
return postProcess(input, toUpperCase);
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region ../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
|
|
778
|
+
var require_ansi_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
779
|
+
module.exports = ({ onlyFirst = false } = {}) => {
|
|
780
|
+
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
781
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
782
|
+
};
|
|
783
|
+
}));
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region ../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
|
|
786
|
+
var require_strip_ansi = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
787
|
+
const ansiRegex = require_ansi_regex();
|
|
788
|
+
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
|
|
789
|
+
}));
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
792
|
+
var require_is_fullwidth_code_point = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
793
|
+
const isFullwidthCodePoint = (codePoint) => {
|
|
794
|
+
if (Number.isNaN(codePoint)) return false;
|
|
795
|
+
if (codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141)) return true;
|
|
796
|
+
return false;
|
|
797
|
+
};
|
|
798
|
+
module.exports = isFullwidthCodePoint;
|
|
799
|
+
module.exports.default = isFullwidthCodePoint;
|
|
800
|
+
}));
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region ../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
|
|
803
|
+
var require_emoji_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
804
|
+
module.exports = function() {
|
|
805
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
806
|
+
};
|
|
807
|
+
}));
|
|
808
|
+
//#endregion
|
|
809
|
+
//#region ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
|
|
810
|
+
var require_string_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
811
|
+
const stripAnsi = require_strip_ansi();
|
|
812
|
+
const isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
813
|
+
const emojiRegex = require_emoji_regex();
|
|
814
|
+
const stringWidth = (string) => {
|
|
815
|
+
if (typeof string !== "string" || string.length === 0) return 0;
|
|
816
|
+
string = stripAnsi(string);
|
|
817
|
+
if (string.length === 0) return 0;
|
|
818
|
+
string = string.replace(emojiRegex(), " ");
|
|
819
|
+
let width = 0;
|
|
820
|
+
for (let i = 0; i < string.length; i++) {
|
|
821
|
+
const code = string.codePointAt(i);
|
|
822
|
+
if (code <= 31 || code >= 127 && code <= 159) continue;
|
|
823
|
+
if (code >= 768 && code <= 879) continue;
|
|
824
|
+
if (code > 65535) i++;
|
|
825
|
+
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
826
|
+
}
|
|
827
|
+
return width;
|
|
828
|
+
};
|
|
829
|
+
module.exports = stringWidth;
|
|
830
|
+
module.exports.default = stringWidth;
|
|
831
|
+
}));
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region ../../node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
|
|
834
|
+
var import_ansi_align = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
835
|
+
const stringWidth = require_string_width();
|
|
836
|
+
function ansiAlign(text, opts) {
|
|
837
|
+
if (!text) return text;
|
|
838
|
+
opts = opts || {};
|
|
839
|
+
const align = opts.align || "center";
|
|
840
|
+
if (align === "left") return text;
|
|
841
|
+
const split = opts.split || "\n";
|
|
842
|
+
const pad = opts.pad || " ";
|
|
843
|
+
const widthDiffFn = align !== "right" ? halfDiff : fullDiff;
|
|
844
|
+
let returnString = false;
|
|
845
|
+
if (!Array.isArray(text)) {
|
|
846
|
+
returnString = true;
|
|
847
|
+
text = String(text).split(split);
|
|
848
|
+
}
|
|
849
|
+
let width;
|
|
850
|
+
let maxWidth = 0;
|
|
851
|
+
text = text.map(function(str) {
|
|
852
|
+
str = String(str);
|
|
853
|
+
width = stringWidth(str);
|
|
854
|
+
maxWidth = Math.max(width, maxWidth);
|
|
855
|
+
return {
|
|
856
|
+
str,
|
|
857
|
+
width
|
|
858
|
+
};
|
|
859
|
+
}).map(function(obj) {
|
|
860
|
+
return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str;
|
|
861
|
+
});
|
|
862
|
+
return returnString ? text.join(split) : text;
|
|
863
|
+
}
|
|
864
|
+
ansiAlign.left = function left(text) {
|
|
865
|
+
return ansiAlign(text, { align: "left" });
|
|
866
|
+
};
|
|
867
|
+
ansiAlign.center = function center(text) {
|
|
868
|
+
return ansiAlign(text, { align: "center" });
|
|
869
|
+
};
|
|
870
|
+
ansiAlign.right = function right(text) {
|
|
871
|
+
return ansiAlign(text, { align: "right" });
|
|
872
|
+
};
|
|
873
|
+
module.exports = ansiAlign;
|
|
874
|
+
function halfDiff(maxWidth, curWidth) {
|
|
875
|
+
return Math.floor((maxWidth - curWidth) / 2);
|
|
876
|
+
}
|
|
877
|
+
function fullDiff(maxWidth, curWidth) {
|
|
878
|
+
return maxWidth - curWidth;
|
|
879
|
+
}
|
|
880
|
+
})))(), 1);
|
|
881
|
+
const ANSI_BACKGROUND_OFFSET = 10;
|
|
882
|
+
const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
883
|
+
const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
884
|
+
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
885
|
+
const styles = {
|
|
886
|
+
modifier: {
|
|
887
|
+
reset: [0, 0],
|
|
888
|
+
bold: [1, 22],
|
|
889
|
+
dim: [2, 22],
|
|
890
|
+
italic: [3, 23],
|
|
891
|
+
underline: [4, 24],
|
|
892
|
+
overline: [53, 55],
|
|
893
|
+
inverse: [7, 27],
|
|
894
|
+
hidden: [8, 28],
|
|
895
|
+
strikethrough: [9, 29]
|
|
896
|
+
},
|
|
897
|
+
color: {
|
|
898
|
+
black: [30, 39],
|
|
899
|
+
red: [31, 39],
|
|
900
|
+
green: [32, 39],
|
|
901
|
+
yellow: [33, 39],
|
|
902
|
+
blue: [34, 39],
|
|
903
|
+
magenta: [35, 39],
|
|
904
|
+
cyan: [36, 39],
|
|
905
|
+
white: [37, 39],
|
|
906
|
+
blackBright: [90, 39],
|
|
907
|
+
gray: [90, 39],
|
|
908
|
+
grey: [90, 39],
|
|
909
|
+
redBright: [91, 39],
|
|
910
|
+
greenBright: [92, 39],
|
|
911
|
+
yellowBright: [93, 39],
|
|
912
|
+
blueBright: [94, 39],
|
|
913
|
+
magentaBright: [95, 39],
|
|
914
|
+
cyanBright: [96, 39],
|
|
915
|
+
whiteBright: [97, 39]
|
|
916
|
+
},
|
|
917
|
+
bgColor: {
|
|
918
|
+
bgBlack: [40, 49],
|
|
919
|
+
bgRed: [41, 49],
|
|
920
|
+
bgGreen: [42, 49],
|
|
921
|
+
bgYellow: [43, 49],
|
|
922
|
+
bgBlue: [44, 49],
|
|
923
|
+
bgMagenta: [45, 49],
|
|
924
|
+
bgCyan: [46, 49],
|
|
925
|
+
bgWhite: [47, 49],
|
|
926
|
+
bgBlackBright: [100, 49],
|
|
927
|
+
bgGray: [100, 49],
|
|
928
|
+
bgGrey: [100, 49],
|
|
929
|
+
bgRedBright: [101, 49],
|
|
930
|
+
bgGreenBright: [102, 49],
|
|
931
|
+
bgYellowBright: [103, 49],
|
|
932
|
+
bgBlueBright: [104, 49],
|
|
933
|
+
bgMagentaBright: [105, 49],
|
|
934
|
+
bgCyanBright: [106, 49],
|
|
935
|
+
bgWhiteBright: [107, 49]
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
Object.keys(styles.modifier);
|
|
939
|
+
const foregroundColorNames = Object.keys(styles.color);
|
|
940
|
+
const backgroundColorNames = Object.keys(styles.bgColor);
|
|
941
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
942
|
+
function assembleStyles() {
|
|
943
|
+
const codes = /* @__PURE__ */ new Map();
|
|
944
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
945
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
946
|
+
styles[styleName] = {
|
|
947
|
+
open: `\u001B[${style[0]}m`,
|
|
948
|
+
close: `\u001B[${style[1]}m`
|
|
949
|
+
};
|
|
950
|
+
group[styleName] = styles[styleName];
|
|
951
|
+
codes.set(style[0], style[1]);
|
|
952
|
+
}
|
|
953
|
+
Object.defineProperty(styles, groupName, {
|
|
954
|
+
value: group,
|
|
955
|
+
enumerable: false
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
Object.defineProperty(styles, "codes", {
|
|
959
|
+
value: codes,
|
|
960
|
+
enumerable: false
|
|
961
|
+
});
|
|
962
|
+
styles.color.close = "\x1B[39m";
|
|
963
|
+
styles.bgColor.close = "\x1B[49m";
|
|
964
|
+
styles.color.ansi = wrapAnsi16();
|
|
965
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
966
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
967
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
968
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
969
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
970
|
+
Object.defineProperties(styles, {
|
|
971
|
+
rgbToAnsi256: {
|
|
972
|
+
value(red, green, blue) {
|
|
973
|
+
if (red === green && green === blue) {
|
|
974
|
+
if (red < 8) return 16;
|
|
975
|
+
if (red > 248) return 231;
|
|
976
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
977
|
+
}
|
|
978
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
979
|
+
},
|
|
980
|
+
enumerable: false
|
|
981
|
+
},
|
|
982
|
+
hexToRgb: {
|
|
983
|
+
value(hex) {
|
|
984
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
985
|
+
if (!matches) return [
|
|
986
|
+
0,
|
|
987
|
+
0,
|
|
988
|
+
0
|
|
989
|
+
];
|
|
990
|
+
let [colorString] = matches;
|
|
991
|
+
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
992
|
+
const integer = Number.parseInt(colorString, 16);
|
|
993
|
+
return [
|
|
994
|
+
integer >> 16 & 255,
|
|
995
|
+
integer >> 8 & 255,
|
|
996
|
+
integer & 255
|
|
997
|
+
];
|
|
998
|
+
},
|
|
999
|
+
enumerable: false
|
|
1000
|
+
},
|
|
1001
|
+
hexToAnsi256: {
|
|
1002
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1003
|
+
enumerable: false
|
|
1004
|
+
},
|
|
1005
|
+
ansi256ToAnsi: {
|
|
1006
|
+
value(code) {
|
|
1007
|
+
if (code < 8) return 30 + code;
|
|
1008
|
+
if (code < 16) return 90 + (code - 8);
|
|
1009
|
+
let red;
|
|
1010
|
+
let green;
|
|
1011
|
+
let blue;
|
|
1012
|
+
if (code >= 232) {
|
|
1013
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
1014
|
+
green = red;
|
|
1015
|
+
blue = red;
|
|
1016
|
+
} else {
|
|
1017
|
+
code -= 16;
|
|
1018
|
+
const remainder = code % 36;
|
|
1019
|
+
red = Math.floor(code / 36) / 5;
|
|
1020
|
+
green = Math.floor(remainder / 6) / 5;
|
|
1021
|
+
blue = remainder % 6 / 5;
|
|
1022
|
+
}
|
|
1023
|
+
const value = Math.max(red, green, blue) * 2;
|
|
1024
|
+
if (value === 0) return 30;
|
|
1025
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1026
|
+
if (value === 2) result += 60;
|
|
1027
|
+
return result;
|
|
1028
|
+
},
|
|
1029
|
+
enumerable: false
|
|
1030
|
+
},
|
|
1031
|
+
rgbToAnsi: {
|
|
1032
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1033
|
+
enumerable: false
|
|
1034
|
+
},
|
|
1035
|
+
hexToAnsi: {
|
|
1036
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1037
|
+
enumerable: false
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
return styles;
|
|
1041
|
+
}
|
|
1042
|
+
const ansiStyles = assembleStyles();
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region ../../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
|
|
1045
|
+
const ESCAPES = new Set(["\x1B", ""]);
|
|
1046
|
+
const END_CODE = 39;
|
|
1047
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
1048
|
+
const ANSI_CSI = "[";
|
|
1049
|
+
const ANSI_OSC = "]";
|
|
1050
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
1051
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1052
|
+
const wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1053
|
+
const wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1054
|
+
const wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1055
|
+
const wrapWord = (rows, word, columns) => {
|
|
1056
|
+
const characters = [...word];
|
|
1057
|
+
let isInsideEscape = false;
|
|
1058
|
+
let isInsideLinkEscape = false;
|
|
1059
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
1060
|
+
for (const [index, character] of characters.entries()) {
|
|
1061
|
+
const characterLength = stringWidth(character);
|
|
1062
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
1063
|
+
else {
|
|
1064
|
+
rows.push(character);
|
|
1065
|
+
visible = 0;
|
|
1066
|
+
}
|
|
1067
|
+
if (ESCAPES.has(character)) {
|
|
1068
|
+
isInsideEscape = true;
|
|
1069
|
+
isInsideLinkEscape = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("") === ANSI_ESCAPE_LINK;
|
|
1070
|
+
}
|
|
1071
|
+
if (isInsideEscape) {
|
|
1072
|
+
if (isInsideLinkEscape) {
|
|
1073
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1074
|
+
isInsideEscape = false;
|
|
1075
|
+
isInsideLinkEscape = false;
|
|
1076
|
+
}
|
|
1077
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
1078
|
+
continue;
|
|
1079
|
+
}
|
|
1080
|
+
visible += characterLength;
|
|
1081
|
+
if (visible === columns && index < characters.length - 1) {
|
|
1082
|
+
rows.push("");
|
|
1083
|
+
visible = 0;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
1087
|
+
};
|
|
1088
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
1089
|
+
const words = string.split(" ");
|
|
1090
|
+
let last = words.length;
|
|
1091
|
+
while (last > 0) {
|
|
1092
|
+
if (stringWidth(words[last - 1]) > 0) break;
|
|
1093
|
+
last--;
|
|
1094
|
+
}
|
|
1095
|
+
if (last === words.length) return string;
|
|
1096
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1097
|
+
};
|
|
1098
|
+
const exec = (string, columns, options = {}) => {
|
|
1099
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
1100
|
+
let returnValue = "";
|
|
1101
|
+
let escapeCode;
|
|
1102
|
+
let escapeUrl;
|
|
1103
|
+
const lengths = wordLengths(string);
|
|
1104
|
+
let rows = [""];
|
|
1105
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
1106
|
+
if (options.trim !== false) rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
1107
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
1108
|
+
if (index !== 0) {
|
|
1109
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
1110
|
+
rows.push("");
|
|
1111
|
+
rowLength = 0;
|
|
1112
|
+
}
|
|
1113
|
+
if (rowLength > 0 || options.trim === false) {
|
|
1114
|
+
rows[rows.length - 1] += " ";
|
|
1115
|
+
rowLength++;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (options.hard && lengths[index] > columns) {
|
|
1119
|
+
const remainingColumns = columns - rowLength;
|
|
1120
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
1121
|
+
if (Math.floor((lengths[index] - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
1122
|
+
wrapWord(rows, word, columns);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
1126
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1127
|
+
wrapWord(rows, word, columns);
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
rows.push("");
|
|
1131
|
+
}
|
|
1132
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
1133
|
+
wrapWord(rows, word, columns);
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
rows[rows.length - 1] += word;
|
|
1137
|
+
}
|
|
1138
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1139
|
+
const preString = rows.join("\n");
|
|
1140
|
+
const pre = [...preString];
|
|
1141
|
+
let preStringIndex = 0;
|
|
1142
|
+
for (const [index, character] of pre.entries()) {
|
|
1143
|
+
returnValue += character;
|
|
1144
|
+
if (ESCAPES.has(character)) {
|
|
1145
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
1146
|
+
if (groups.code !== void 0) {
|
|
1147
|
+
const code = Number.parseFloat(groups.code);
|
|
1148
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
1149
|
+
} else if (groups.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
1150
|
+
}
|
|
1151
|
+
const code = ansiStyles.codes.get(Number(escapeCode));
|
|
1152
|
+
if (pre[index + 1] === "\n") {
|
|
1153
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
1154
|
+
if (escapeCode && code) returnValue += wrapAnsiCode(code);
|
|
1155
|
+
} else if (character === "\n") {
|
|
1156
|
+
if (escapeCode && code) returnValue += wrapAnsiCode(escapeCode);
|
|
1157
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1158
|
+
}
|
|
1159
|
+
preStringIndex += character.length;
|
|
1160
|
+
}
|
|
1161
|
+
return returnValue;
|
|
1162
|
+
};
|
|
1163
|
+
function wrapAnsi(string, columns, options) {
|
|
1164
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
1165
|
+
}
|
|
1166
|
+
//#endregion
|
|
1167
|
+
//#region ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1168
|
+
const NEWLINE = "\n";
|
|
1169
|
+
const PAD = " ";
|
|
1170
|
+
const NONE = "none";
|
|
1171
|
+
const terminalColumns = () => {
|
|
1172
|
+
const { env, stdout, stderr } = node_process.default;
|
|
1173
|
+
if (stdout?.columns) return stdout.columns;
|
|
1174
|
+
if (stderr?.columns) return stderr.columns;
|
|
1175
|
+
if (env.COLUMNS) return Number.parseInt(env.COLUMNS, 10);
|
|
1176
|
+
return 80;
|
|
1177
|
+
};
|
|
1178
|
+
const getObject = (detail) => typeof detail === "number" ? {
|
|
1179
|
+
top: detail,
|
|
1180
|
+
right: detail * 3,
|
|
1181
|
+
bottom: detail,
|
|
1182
|
+
left: detail * 3
|
|
1183
|
+
} : {
|
|
1184
|
+
top: 0,
|
|
1185
|
+
right: 0,
|
|
1186
|
+
bottom: 0,
|
|
1187
|
+
left: 0,
|
|
1188
|
+
...detail
|
|
1189
|
+
};
|
|
1190
|
+
const getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
|
|
1191
|
+
const getBorderChars = (borderStyle) => {
|
|
1192
|
+
const sides = [
|
|
1193
|
+
"topLeft",
|
|
1194
|
+
"topRight",
|
|
1195
|
+
"bottomRight",
|
|
1196
|
+
"bottomLeft",
|
|
1197
|
+
"left",
|
|
1198
|
+
"right",
|
|
1199
|
+
"top",
|
|
1200
|
+
"bottom"
|
|
1201
|
+
];
|
|
1202
|
+
let characters;
|
|
1203
|
+
if (borderStyle === NONE) {
|
|
1204
|
+
borderStyle = {};
|
|
1205
|
+
for (const side of sides) borderStyle[side] = "";
|
|
1206
|
+
}
|
|
1207
|
+
if (typeof borderStyle === "string") {
|
|
1208
|
+
characters = import_cli_boxes.default[borderStyle];
|
|
1209
|
+
if (!characters) throw new TypeError(`Invalid border style: ${borderStyle}`);
|
|
1210
|
+
} else {
|
|
1211
|
+
if (typeof borderStyle?.vertical === "string") {
|
|
1212
|
+
borderStyle.left = borderStyle.vertical;
|
|
1213
|
+
borderStyle.right = borderStyle.vertical;
|
|
1214
|
+
}
|
|
1215
|
+
if (typeof borderStyle?.horizontal === "string") {
|
|
1216
|
+
borderStyle.top = borderStyle.horizontal;
|
|
1217
|
+
borderStyle.bottom = borderStyle.horizontal;
|
|
1218
|
+
}
|
|
1219
|
+
for (const side of sides) if (borderStyle[side] === null || typeof borderStyle[side] !== "string") throw new TypeError(`Invalid border style: ${side}`);
|
|
1220
|
+
characters = borderStyle;
|
|
1221
|
+
}
|
|
1222
|
+
return characters;
|
|
1223
|
+
};
|
|
1224
|
+
const makeTitle = (text, horizontal, alignment) => {
|
|
1225
|
+
let title = "";
|
|
1226
|
+
const textWidth = stringWidth(text);
|
|
1227
|
+
switch (alignment) {
|
|
1228
|
+
case "left":
|
|
1229
|
+
title = text + horizontal.slice(textWidth);
|
|
1230
|
+
break;
|
|
1231
|
+
case "right":
|
|
1232
|
+
title = horizontal.slice(textWidth) + text;
|
|
1233
|
+
break;
|
|
1234
|
+
default:
|
|
1235
|
+
horizontal = horizontal.slice(textWidth);
|
|
1236
|
+
if (horizontal.length % 2 === 1) {
|
|
1237
|
+
horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
|
|
1238
|
+
title = horizontal.slice(1) + text + horizontal;
|
|
1239
|
+
} else {
|
|
1240
|
+
horizontal = horizontal.slice(horizontal.length / 2);
|
|
1241
|
+
title = horizontal + text + horizontal;
|
|
1242
|
+
}
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
return title;
|
|
1246
|
+
};
|
|
1247
|
+
const makeContentText = (text, { padding, width, textAlignment, height }) => {
|
|
1248
|
+
text = (0, import_ansi_align.default)(text, { align: textAlignment });
|
|
1249
|
+
let lines = text.split(NEWLINE);
|
|
1250
|
+
const textWidth = widestLine(text);
|
|
1251
|
+
const max = width - padding.left - padding.right;
|
|
1252
|
+
if (textWidth > max) {
|
|
1253
|
+
const newLines = [];
|
|
1254
|
+
for (const line of lines) {
|
|
1255
|
+
const alignedLinesArray = (0, import_ansi_align.default)(wrapAnsi(line, max, { hard: true }), { align: textAlignment }).split("\n");
|
|
1256
|
+
const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
|
|
1257
|
+
for (const alignedLine of alignedLinesArray) {
|
|
1258
|
+
let paddedLine;
|
|
1259
|
+
switch (textAlignment) {
|
|
1260
|
+
case "center":
|
|
1261
|
+
paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
|
|
1262
|
+
break;
|
|
1263
|
+
case "right":
|
|
1264
|
+
paddedLine = PAD.repeat(max - longestLength) + alignedLine;
|
|
1265
|
+
break;
|
|
1266
|
+
default:
|
|
1267
|
+
paddedLine = alignedLine;
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
newLines.push(paddedLine);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
lines = newLines;
|
|
1274
|
+
}
|
|
1275
|
+
if (textAlignment === "center" && textWidth < max) lines = lines.map((line) => PAD.repeat((max - textWidth) / 2) + line);
|
|
1276
|
+
else if (textAlignment === "right" && textWidth < max) lines = lines.map((line) => PAD.repeat(max - textWidth) + line);
|
|
1277
|
+
const paddingLeft = PAD.repeat(padding.left);
|
|
1278
|
+
const paddingRight = PAD.repeat(padding.right);
|
|
1279
|
+
lines = lines.map((line) => {
|
|
1280
|
+
const newLine = paddingLeft + line + paddingRight;
|
|
1281
|
+
return newLine + PAD.repeat(width - stringWidth(newLine));
|
|
1282
|
+
});
|
|
1283
|
+
if (padding.top > 0) lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
|
|
1284
|
+
if (padding.bottom > 0) lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
|
|
1285
|
+
if (height && lines.length > height) lines = lines.slice(0, height);
|
|
1286
|
+
else if (height && lines.length < height) lines = [...lines, ...Array.from({ length: height - lines.length }).fill(PAD.repeat(width))];
|
|
1287
|
+
return lines.join(NEWLINE);
|
|
1288
|
+
};
|
|
1289
|
+
const boxContent = (content, contentWidth, options) => {
|
|
1290
|
+
const colorizeBorder = (border) => {
|
|
1291
|
+
const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
|
|
1292
|
+
return options.dimBorder ? chalk.dim(newBorder) : newBorder;
|
|
1293
|
+
};
|
|
1294
|
+
const colorizeContent = (content) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content) : content;
|
|
1295
|
+
const chars = getBorderChars(options.borderStyle);
|
|
1296
|
+
const columns = terminalColumns();
|
|
1297
|
+
let marginLeft = PAD.repeat(options.margin.left);
|
|
1298
|
+
if (options.float === "center") {
|
|
1299
|
+
const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
|
|
1300
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
1301
|
+
} else if (options.float === "right") {
|
|
1302
|
+
const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
|
|
1303
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
1304
|
+
}
|
|
1305
|
+
let result = "";
|
|
1306
|
+
if (options.margin.top) result += NEWLINE.repeat(options.margin.top);
|
|
1307
|
+
if (options.borderStyle !== NONE || options.title) result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
|
|
1308
|
+
const lines = content.split(NEWLINE);
|
|
1309
|
+
result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
|
|
1310
|
+
if (options.borderStyle !== NONE) result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
|
|
1311
|
+
if (options.margin.bottom) result += NEWLINE.repeat(options.margin.bottom);
|
|
1312
|
+
return result;
|
|
1313
|
+
};
|
|
1314
|
+
const sanitizeOptions = (options) => {
|
|
1315
|
+
if (options.fullscreen && node_process.default?.stdout) {
|
|
1316
|
+
let newDimensions = [node_process.default.stdout.columns, node_process.default.stdout.rows];
|
|
1317
|
+
if (typeof options.fullscreen === "function") newDimensions = options.fullscreen(...newDimensions);
|
|
1318
|
+
options.width ||= newDimensions[0];
|
|
1319
|
+
options.height ||= newDimensions[1];
|
|
1320
|
+
}
|
|
1321
|
+
options.width &&= Math.max(1, options.width - getBorderWidth(options.borderStyle));
|
|
1322
|
+
options.height &&= Math.max(1, options.height - getBorderWidth(options.borderStyle));
|
|
1323
|
+
return options;
|
|
1324
|
+
};
|
|
1325
|
+
const formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
|
|
1326
|
+
const determineDimensions = (text, options) => {
|
|
1327
|
+
options = sanitizeOptions(options);
|
|
1328
|
+
const widthOverride = options.width !== void 0;
|
|
1329
|
+
const columns = terminalColumns();
|
|
1330
|
+
const borderWidth = getBorderWidth(options.borderStyle);
|
|
1331
|
+
const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
|
|
1332
|
+
const widest = widestLine(wrapAnsi(text, columns - borderWidth, {
|
|
1333
|
+
hard: true,
|
|
1334
|
+
trim: false
|
|
1335
|
+
})) + options.padding.left + options.padding.right;
|
|
1336
|
+
if (options.title && widthOverride) {
|
|
1337
|
+
options.title = options.title.slice(0, Math.max(0, options.width - 2));
|
|
1338
|
+
options.title &&= formatTitle(options.title, options.borderStyle);
|
|
1339
|
+
} else if (options.title) {
|
|
1340
|
+
options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
|
|
1341
|
+
if (options.title) {
|
|
1342
|
+
options.title = formatTitle(options.title, options.borderStyle);
|
|
1343
|
+
if (stringWidth(options.title) > widest) options.width = stringWidth(options.title);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
options.width ||= widest;
|
|
1347
|
+
if (!widthOverride) {
|
|
1348
|
+
if (options.margin.left && options.margin.right && options.width > maxWidth) {
|
|
1349
|
+
const multiplier = (columns - options.width - borderWidth) / (options.margin.left + options.margin.right);
|
|
1350
|
+
options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
|
|
1351
|
+
options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
|
|
1352
|
+
}
|
|
1353
|
+
options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
|
|
1354
|
+
}
|
|
1355
|
+
if (options.width - (options.padding.left + options.padding.right) <= 0) {
|
|
1356
|
+
options.padding.left = 0;
|
|
1357
|
+
options.padding.right = 0;
|
|
1358
|
+
}
|
|
1359
|
+
if (options.height && options.height - (options.padding.top + options.padding.bottom) <= 0) {
|
|
1360
|
+
options.padding.top = 0;
|
|
1361
|
+
options.padding.bottom = 0;
|
|
1362
|
+
}
|
|
1363
|
+
return options;
|
|
1364
|
+
};
|
|
1365
|
+
const isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
|
|
1366
|
+
const isColorValid = (color) => typeof color === "string" && (chalk[color] ?? isHex(color));
|
|
1367
|
+
const getColorFunction = (color) => isHex(color) ? chalk.hex(color) : chalk[color];
|
|
1368
|
+
const getBGColorFunction = (color) => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(["bg", color])];
|
|
1369
|
+
function boxen(text, options) {
|
|
1370
|
+
options = {
|
|
1371
|
+
padding: 0,
|
|
1372
|
+
borderStyle: "single",
|
|
1373
|
+
dimBorder: false,
|
|
1374
|
+
textAlignment: "left",
|
|
1375
|
+
float: "left",
|
|
1376
|
+
titleAlignment: "left",
|
|
1377
|
+
...options
|
|
1378
|
+
};
|
|
1379
|
+
if (options.align) options.textAlignment = options.align;
|
|
1380
|
+
if (options.borderColor && !isColorValid(options.borderColor)) throw new Error(`${options.borderColor} is not a valid borderColor`);
|
|
1381
|
+
if (options.backgroundColor && !isColorValid(options.backgroundColor)) throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
|
|
1382
|
+
options.padding = getObject(options.padding);
|
|
1383
|
+
options.margin = getObject(options.margin);
|
|
1384
|
+
options = determineDimensions(text, options);
|
|
1385
|
+
text = makeContentText(text, options);
|
|
1386
|
+
return boxContent(text, options.width, options);
|
|
1387
|
+
}
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/cli-box.ts
|
|
1390
|
+
const createBox = (options) => boxen(options.content, {
|
|
1391
|
+
padding: {
|
|
1392
|
+
left: 3,
|
|
1393
|
+
right: 3,
|
|
1394
|
+
top: 1,
|
|
1395
|
+
bottom: 1
|
|
1396
|
+
},
|
|
1397
|
+
borderColor: "magenta",
|
|
1398
|
+
borderStyle: "round",
|
|
1399
|
+
title: options.title,
|
|
1400
|
+
titleAlignment: "center"
|
|
1401
|
+
});
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/diff-engine.ts
|
|
1404
|
+
var DiffEngine = class {
|
|
1405
|
+
ctx;
|
|
1406
|
+
prevConfig;
|
|
1407
|
+
constructor(ctx) {
|
|
1408
|
+
this.ctx = ctx;
|
|
1409
|
+
this.prevConfig = ctx.conf.deserialize();
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Reload config from disk and refresh the context
|
|
1413
|
+
*/
|
|
1414
|
+
async reloadConfigAndRefreshContext(fn) {
|
|
1415
|
+
const conf = await (0, _bamboocss_config.loadConfig)({
|
|
1416
|
+
cwd: this.ctx.config.cwd,
|
|
1417
|
+
file: this.ctx.conf.path
|
|
1418
|
+
});
|
|
1419
|
+
const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
|
|
1420
|
+
Object.assign(conf, {
|
|
1421
|
+
tsconfig,
|
|
1422
|
+
tsconfigFile,
|
|
1423
|
+
tsOptions
|
|
1424
|
+
});
|
|
1425
|
+
return this.refresh(conf, fn);
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Update the context from the refreshed config
|
|
1429
|
+
* then persist the changes on each affected engines
|
|
1430
|
+
* Returns the list of affected artifacts/engines
|
|
1431
|
+
*/
|
|
1432
|
+
refresh(conf, fn) {
|
|
1433
|
+
const affected = (0, _bamboocss_config.diffConfigs)(() => conf.deserialize(), this.prevConfig);
|
|
1434
|
+
if (!affected.hasConfigChanged || !this.prevConfig) return affected;
|
|
1435
|
+
fn?.(conf);
|
|
1436
|
+
this.prevConfig = conf.deserialize();
|
|
1437
|
+
return affected;
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region src/glob-dirname.ts
|
|
1442
|
+
function globDirname(globs) {
|
|
1443
|
+
const rootDirs = /* @__PURE__ */ new Set();
|
|
1444
|
+
for (const glob of globs) {
|
|
1445
|
+
const scan = picomatch.default.scan(glob, { tokens: true });
|
|
1446
|
+
if (!scan.isGlob) {
|
|
1447
|
+
rootDirs.add(glob);
|
|
1448
|
+
continue;
|
|
1449
|
+
}
|
|
1450
|
+
const nonGlobTokens = scan.tokens?.filter((token) => !token.isPrefix && !token.isGlob);
|
|
1451
|
+
if (nonGlobTokens?.length) rootDirs.add((0, path.join)(...nonGlobTokens.map((token) => token.value)));
|
|
1452
|
+
}
|
|
1453
|
+
if (rootDirs.size === 0) return ["."];
|
|
1454
|
+
return Array.from(rootDirs);
|
|
1455
|
+
}
|
|
1456
|
+
//#endregion
|
|
1457
|
+
//#region src/node-runtime.ts
|
|
1458
|
+
const nodeRuntime = {
|
|
1459
|
+
cwd() {
|
|
1460
|
+
return process.cwd();
|
|
1461
|
+
},
|
|
1462
|
+
env(name) {
|
|
1463
|
+
return process.env[name];
|
|
1464
|
+
},
|
|
1465
|
+
path: {
|
|
1466
|
+
join: path.join,
|
|
1467
|
+
relative: path.relative,
|
|
1468
|
+
dirname: path.dirname,
|
|
1469
|
+
extname: path.extname,
|
|
1470
|
+
isAbsolute: path.isAbsolute,
|
|
1471
|
+
sep: path.sep,
|
|
1472
|
+
resolve: path.resolve,
|
|
1473
|
+
abs(cwd, str) {
|
|
1474
|
+
return (0, path.isAbsolute)(str) ? str : (0, path.join)(cwd, str);
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
fs: {
|
|
1478
|
+
existsSync: fs_extra.default.existsSync,
|
|
1479
|
+
readFileSync(filePath) {
|
|
1480
|
+
return fs_extra.default.readFileSync(filePath, "utf8");
|
|
1481
|
+
},
|
|
1482
|
+
glob(opts) {
|
|
1483
|
+
if (!opts.include) return [];
|
|
1484
|
+
const ignore = opts.exclude ?? [];
|
|
1485
|
+
if (!ignore.length) ignore.push("**/*.d.ts");
|
|
1486
|
+
return fast_glob.default.sync(opts.include, {
|
|
1487
|
+
cwd: opts.cwd,
|
|
1488
|
+
ignore,
|
|
1489
|
+
absolute: true
|
|
1490
|
+
});
|
|
1491
|
+
},
|
|
1492
|
+
writeFile: fs_extra.default.writeFile,
|
|
1493
|
+
writeFileSync: fs_extra.default.writeFileSync,
|
|
1494
|
+
readDirSync: fs_extra.default.readdirSync,
|
|
1495
|
+
rmDirSync: fs_extra.default.emptyDirSync,
|
|
1496
|
+
rmFileSync: fs_extra.default.removeSync,
|
|
1497
|
+
ensureDirSync(path$6) {
|
|
1498
|
+
return fs_extra.default.ensureDirSync(path$6);
|
|
1499
|
+
},
|
|
1500
|
+
watch(options) {
|
|
1501
|
+
const { include, exclude, cwd, poll } = options;
|
|
1502
|
+
const coalesce = poll || process.platform === "win32";
|
|
1503
|
+
const dirnames = globDirname(include);
|
|
1504
|
+
const isValidPath = (0, picomatch.default)(include, {
|
|
1505
|
+
cwd,
|
|
1506
|
+
ignore: exclude
|
|
1507
|
+
});
|
|
1508
|
+
const workingDir = cwd || process.cwd();
|
|
1509
|
+
const watcher = chokidar.default.watch(dirnames, {
|
|
1510
|
+
usePolling: poll,
|
|
1511
|
+
cwd,
|
|
1512
|
+
ignored(path$7, stats) {
|
|
1513
|
+
const relativePath = (0, path.relative)(workingDir, path$7);
|
|
1514
|
+
return !!stats?.isFile() && !isValidPath(relativePath);
|
|
1515
|
+
},
|
|
1516
|
+
ignoreInitial: true,
|
|
1517
|
+
ignorePermissionErrors: true,
|
|
1518
|
+
awaitWriteFinish: coalesce ? {
|
|
1519
|
+
stabilityThreshold: 50,
|
|
1520
|
+
pollInterval: 10
|
|
1521
|
+
} : false
|
|
1522
|
+
});
|
|
1523
|
+
_bamboocss_logger.logger.debug("watch:file", `Watching [ ${dirnames.join(", ")} ]`);
|
|
1524
|
+
process.once("SIGINT", async () => {
|
|
1525
|
+
await watcher.close();
|
|
1526
|
+
});
|
|
1527
|
+
return watcher;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
process.setMaxListeners(Infinity);
|
|
1532
|
+
process.on("unhandledRejection", (reason) => {
|
|
1533
|
+
_bamboocss_logger.logger.caughtError("process", "Unhandled rejection", reason);
|
|
1534
|
+
});
|
|
1535
|
+
process.on("uncaughtException", (error) => {
|
|
1536
|
+
_bamboocss_logger.logger.caughtError("process", "Uncaught exception", error);
|
|
1537
|
+
});
|
|
1538
|
+
//#endregion
|
|
1539
|
+
//#region src/output-engine.ts
|
|
1540
|
+
var OutputEngine = class {
|
|
1541
|
+
paths;
|
|
1542
|
+
fs;
|
|
1543
|
+
path;
|
|
1544
|
+
constructor(options) {
|
|
1545
|
+
const { paths, runtime } = options;
|
|
1546
|
+
this.paths = paths;
|
|
1547
|
+
this.fs = runtime.fs;
|
|
1548
|
+
this.path = runtime.path;
|
|
1549
|
+
}
|
|
1550
|
+
empty = () => {
|
|
1551
|
+
this.fs.rmDirSync(this.path.join(...this.paths.root));
|
|
1552
|
+
};
|
|
1553
|
+
ensure = (file, cwd) => {
|
|
1554
|
+
const outPath = this.path.resolve(cwd, file);
|
|
1555
|
+
const dirname = this.path.dirname(outPath);
|
|
1556
|
+
this.fs.ensureDirSync(dirname);
|
|
1557
|
+
return outPath;
|
|
1558
|
+
};
|
|
1559
|
+
write = (output) => {
|
|
1560
|
+
if (!output) return;
|
|
1561
|
+
const { dir = this.paths.root, files } = output;
|
|
1562
|
+
this.fs.ensureDirSync(this.path.join(...dir));
|
|
1563
|
+
return Promise.allSettled(files.map(async (artifact) => {
|
|
1564
|
+
if (!artifact?.code) return;
|
|
1565
|
+
const { file, code } = artifact;
|
|
1566
|
+
const absPath = this.path.join(...dir, file);
|
|
1567
|
+
_bamboocss_logger.logger.debug("write:file", dir.slice(-1).concat(file).join("/"));
|
|
1568
|
+
return this.fs.writeFile(absPath, code);
|
|
1569
|
+
}));
|
|
1570
|
+
};
|
|
1571
|
+
};
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region src/create-context.ts
|
|
1574
|
+
var BambooContext = class extends _bamboocss_generator.Generator {
|
|
1575
|
+
runtime;
|
|
1576
|
+
project;
|
|
1577
|
+
output;
|
|
1578
|
+
diff;
|
|
1579
|
+
explicitDeps = [];
|
|
1580
|
+
constructor(conf) {
|
|
1581
|
+
super(conf);
|
|
1582
|
+
const config = conf.config;
|
|
1583
|
+
this.runtime = nodeRuntime;
|
|
1584
|
+
config.cwd ||= this.runtime.cwd();
|
|
1585
|
+
if (config.logLevel) _bamboocss_logger.logger.level = config.logLevel;
|
|
1586
|
+
this.project = new _bamboocss_parser.Project({
|
|
1587
|
+
...conf.tsconfig,
|
|
1588
|
+
getFiles: this.getFiles.bind(this),
|
|
1589
|
+
readFile: this.runtime.fs.readFileSync.bind(this),
|
|
1590
|
+
hooks: conf.hooks,
|
|
1591
|
+
parserOptions: {
|
|
1592
|
+
...this.parserOptions,
|
|
1593
|
+
join: this.runtime.path.join || this.parserOptions.join
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
this.output = new OutputEngine(this);
|
|
1597
|
+
this.diff = new DiffEngine(this);
|
|
1598
|
+
this.explicitDeps = this.getExplicitDependencies();
|
|
1599
|
+
}
|
|
1600
|
+
getExplicitDependencies = () => {
|
|
1601
|
+
const { cwd, dependencies } = this.config;
|
|
1602
|
+
if (!dependencies) return [];
|
|
1603
|
+
return this.runtime.fs.glob({
|
|
1604
|
+
include: dependencies,
|
|
1605
|
+
cwd
|
|
1606
|
+
});
|
|
1607
|
+
};
|
|
1608
|
+
initMessage = () => {
|
|
1609
|
+
return createBox({
|
|
1610
|
+
content: this.messages.codegenComplete(),
|
|
1611
|
+
title: this.messages.exclamation()
|
|
1612
|
+
});
|
|
1613
|
+
};
|
|
1614
|
+
getFiles = () => {
|
|
1615
|
+
const { include, exclude, cwd } = this.config;
|
|
1616
|
+
return this.runtime.fs.glob({
|
|
1617
|
+
include,
|
|
1618
|
+
exclude,
|
|
1619
|
+
cwd
|
|
1620
|
+
});
|
|
1621
|
+
};
|
|
1622
|
+
parseFile = (filePath, styleEncoder) => {
|
|
1623
|
+
const file = this.runtime.path.abs(this.config.cwd, filePath);
|
|
1624
|
+
_bamboocss_logger.logger.debug("file:extract", file);
|
|
1625
|
+
const measure = _bamboocss_logger.logger.time.debug(`Parsed ${file}`);
|
|
1626
|
+
let result;
|
|
1627
|
+
try {
|
|
1628
|
+
const encoder = styleEncoder || this.parserOptions.encoder;
|
|
1629
|
+
result = this.project.parseSourceFile(file, encoder);
|
|
1630
|
+
} catch (error) {
|
|
1631
|
+
_bamboocss_logger.logger.caughtError("file:extract", `Failed to parse ${file}`, error);
|
|
1632
|
+
}
|
|
1633
|
+
measure();
|
|
1634
|
+
return result;
|
|
1635
|
+
};
|
|
1636
|
+
parseFiles = (styleEncoder) => {
|
|
1637
|
+
const encoder = styleEncoder || this.parserOptions.encoder;
|
|
1638
|
+
const files = this.getFiles();
|
|
1639
|
+
const filesWithCss = [];
|
|
1640
|
+
const results = [];
|
|
1641
|
+
files.forEach((file) => {
|
|
1642
|
+
const measure = _bamboocss_logger.logger.time.debug(`Parsed ${file}`);
|
|
1643
|
+
const result = this.project.parseSourceFile(file, encoder);
|
|
1644
|
+
measure();
|
|
1645
|
+
if (!result || result.isEmpty() || encoder.isEmpty()) return;
|
|
1646
|
+
filesWithCss.push(file);
|
|
1647
|
+
results.push(result);
|
|
1648
|
+
});
|
|
1649
|
+
return {
|
|
1650
|
+
filesWithCss,
|
|
1651
|
+
files,
|
|
1652
|
+
results
|
|
1653
|
+
};
|
|
1654
|
+
};
|
|
1655
|
+
writeCss = (sheet) => {
|
|
1656
|
+
_bamboocss_logger.logger.info("css", this.runtime.path.join(...this.paths.root, "styles.css"));
|
|
1657
|
+
return this.output.write({
|
|
1658
|
+
id: "styles.css",
|
|
1659
|
+
dir: this.paths.root,
|
|
1660
|
+
files: [{
|
|
1661
|
+
file: "styles.css",
|
|
1662
|
+
code: this.getCss(sheet)
|
|
1663
|
+
}]
|
|
1664
|
+
});
|
|
1665
|
+
};
|
|
1666
|
+
writeSplitCss = async (sheet) => {
|
|
1667
|
+
const { path: pathUtil, fs } = this.runtime;
|
|
1668
|
+
const rootDir = this.paths.root;
|
|
1669
|
+
const stylesDir = [...rootDir, "styles"];
|
|
1670
|
+
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
1671
|
+
const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
|
|
1672
|
+
fs.ensureDirSync(pathUtil.join(...stylesDir));
|
|
1673
|
+
subDirs.forEach((dir) => fs.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
1674
|
+
const styleFiles = [];
|
|
1675
|
+
for (const layer of artifacts.layers) {
|
|
1676
|
+
styleFiles.push({
|
|
1677
|
+
file: layer.file,
|
|
1678
|
+
code: layer.code
|
|
1679
|
+
});
|
|
1680
|
+
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, layer.file));
|
|
1681
|
+
}
|
|
1682
|
+
for (const recipe of artifacts.recipes) {
|
|
1683
|
+
styleFiles.push({
|
|
1684
|
+
file: `${recipe.dir}/${recipe.file}`,
|
|
1685
|
+
code: recipe.code
|
|
1686
|
+
});
|
|
1687
|
+
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, recipe.dir, recipe.file));
|
|
1688
|
+
}
|
|
1689
|
+
if (artifacts.recipes.length) {
|
|
1690
|
+
styleFiles.push({
|
|
1691
|
+
file: "recipes.css",
|
|
1692
|
+
code: artifacts.recipesIndex
|
|
1693
|
+
});
|
|
1694
|
+
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, "recipes.css"));
|
|
1695
|
+
}
|
|
1696
|
+
for (const theme of artifacts.themes) {
|
|
1697
|
+
styleFiles.push({
|
|
1698
|
+
file: `${theme.dir}/${theme.file}`,
|
|
1699
|
+
code: theme.code
|
|
1700
|
+
});
|
|
1701
|
+
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, theme.dir, theme.file));
|
|
1702
|
+
}
|
|
1703
|
+
await this.output.write({
|
|
1704
|
+
id: "styles",
|
|
1705
|
+
dir: stylesDir,
|
|
1706
|
+
files: styleFiles
|
|
1707
|
+
});
|
|
1708
|
+
_bamboocss_logger.logger.info("css", pathUtil.join(...rootDir, "styles.css"));
|
|
1709
|
+
await this.output.write({
|
|
1710
|
+
id: "styles.css",
|
|
1711
|
+
dir: rootDir,
|
|
1712
|
+
files: [{
|
|
1713
|
+
file: "styles.css",
|
|
1714
|
+
code: artifacts.index
|
|
1715
|
+
}]
|
|
1716
|
+
});
|
|
1717
|
+
};
|
|
1718
|
+
watchConfig = (cb, opts) => {
|
|
1719
|
+
const { cwd, poll, exclude } = opts ?? {};
|
|
1720
|
+
_bamboocss_logger.logger.info("ctx:watch", this.messages.configWatch());
|
|
1721
|
+
this.runtime.fs.watch({
|
|
1722
|
+
include: (0, _bamboocss_shared.uniq)([...this.explicitDeps, ...this.conf.dependencies]),
|
|
1723
|
+
exclude,
|
|
1724
|
+
cwd,
|
|
1725
|
+
poll
|
|
1726
|
+
}).on("change", (0, perfect_debounce.debounce)(async (file) => {
|
|
1727
|
+
_bamboocss_logger.logger.info("ctx:change", "config changed, rebuilding...");
|
|
1728
|
+
await cb(file);
|
|
1729
|
+
}));
|
|
1730
|
+
};
|
|
1731
|
+
watchFiles = (cb, opts) => {
|
|
1732
|
+
const { include, exclude, poll, cwd } = this.config;
|
|
1733
|
+
_bamboocss_logger.logger.info("ctx:watch", this.messages.watch());
|
|
1734
|
+
this.runtime.fs.watch({
|
|
1735
|
+
...opts,
|
|
1736
|
+
include,
|
|
1737
|
+
exclude,
|
|
1738
|
+
poll,
|
|
1739
|
+
cwd
|
|
1740
|
+
}).on("all", (0, perfect_debounce.debounce)(async (event, file) => {
|
|
1741
|
+
_bamboocss_logger.logger.info(`file:${event}`, file);
|
|
1742
|
+
await cb(event, file);
|
|
1743
|
+
}));
|
|
1744
|
+
};
|
|
1745
|
+
};
|
|
1746
|
+
//#endregion
|
|
1747
|
+
//#region src/tsconfig-utils.ts
|
|
1748
|
+
/**
|
|
1749
|
+
* If `filename` points to a `.json` file that exists as a regular file, return its absolute path.
|
|
1750
|
+
*/
|
|
1751
|
+
async function resolveDirectTsconfigJson(filename) {
|
|
1752
|
+
if (node_path.default.extname(filename) !== ".json") return null;
|
|
1753
|
+
const resolved = node_path.default.resolve(filename);
|
|
1754
|
+
try {
|
|
1755
|
+
const stat = await node_fs.promises.stat(resolved);
|
|
1756
|
+
if (stat.isFile() || stat.isFIFO()) return resolved;
|
|
1757
|
+
throw new Error(`${filename} exists but is not a regular file.`);
|
|
1758
|
+
} catch (e) {
|
|
1759
|
+
if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") return null;
|
|
1760
|
+
throw e;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Walk upward from `dirname(filename)` and return the first existing `configName`,
|
|
1765
|
+
* stopping at `root` (inclusive) or the filesystem root.
|
|
1766
|
+
*/
|
|
1767
|
+
async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
|
|
1768
|
+
const resolvedRoot = node_path.default.resolve(root);
|
|
1769
|
+
let dir = node_path.default.dirname(node_path.default.resolve(filename));
|
|
1770
|
+
for (;;) {
|
|
1771
|
+
const candidate = node_path.default.join(dir, configName);
|
|
1772
|
+
try {
|
|
1773
|
+
const stat = await node_fs.promises.stat(candidate);
|
|
1774
|
+
if (stat.isFile() || stat.isFIFO()) return candidate;
|
|
1775
|
+
} catch {}
|
|
1776
|
+
if (dir === resolvedRoot || node_path.default.dirname(dir) === dir) return null;
|
|
1777
|
+
dir = node_path.default.dirname(dir);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Resolve `compilerOptions.baseUrl` the same way TypeScript does: relative to the tsconfig file.
|
|
1782
|
+
* Falls back to `cwd` when `baseUrl` is omitted.
|
|
1783
|
+
*/
|
|
1784
|
+
function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
|
|
1785
|
+
if (baseUrl == null) return cwd;
|
|
1786
|
+
if (baseUrl.startsWith("${")) return baseUrl;
|
|
1787
|
+
if (node_path.default.isAbsolute(baseUrl)) return baseUrl;
|
|
1788
|
+
return node_path.default.resolve(node_path.default.dirname(tsconfigFile), baseUrl);
|
|
1789
|
+
}
|
|
1790
|
+
const SOURCE_EXTENSIONS = [
|
|
1791
|
+
".ts",
|
|
1792
|
+
".tsx",
|
|
1793
|
+
".mts",
|
|
1794
|
+
".cts"
|
|
1795
|
+
];
|
|
1796
|
+
function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
|
|
1797
|
+
const p = refPath.endsWith(".json") ? refPath : node_path.default.join(refPath, configName);
|
|
1798
|
+
return node_path.default.resolve(fromDir, p);
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* When a file belongs to a referenced project (TypeScript project references),
|
|
1802
|
+
* return that project's merged tsconfig for `compilerOptions`.
|
|
1803
|
+
*/
|
|
1804
|
+
async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
|
|
1805
|
+
const { parseTsconfig } = getTsconfigModule;
|
|
1806
|
+
if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) return {
|
|
1807
|
+
tsconfig: rootParsed,
|
|
1808
|
+
tsconfigFile: rootTsconfigPath
|
|
1809
|
+
};
|
|
1810
|
+
const refs = rootParsed.references;
|
|
1811
|
+
if (!refs?.length) return {
|
|
1812
|
+
tsconfig: rootParsed,
|
|
1813
|
+
tsconfigFile: rootTsconfigPath
|
|
1814
|
+
};
|
|
1815
|
+
if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) return {
|
|
1816
|
+
tsconfig: rootParsed,
|
|
1817
|
+
tsconfigFile: rootTsconfigPath
|
|
1818
|
+
};
|
|
1819
|
+
const rootDir = node_path.default.dirname(rootTsconfigPath);
|
|
1820
|
+
for (const ref of refs) {
|
|
1821
|
+
const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
|
|
1822
|
+
try {
|
|
1823
|
+
await node_fs.promises.access(refPath);
|
|
1824
|
+
} catch {
|
|
1825
|
+
continue;
|
|
1826
|
+
}
|
|
1827
|
+
const childParsed = parseTsconfig(refPath);
|
|
1828
|
+
if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) return {
|
|
1829
|
+
tsconfig: childParsed,
|
|
1830
|
+
tsconfigFile: refPath
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
return {
|
|
1834
|
+
tsconfig: rootParsed,
|
|
1835
|
+
tsconfigFile: rootTsconfigPath
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
const POSIX_SEP_RE = new RegExp("\\" + node_path.default.posix.sep, "g");
|
|
1839
|
+
const NATIVE_SEP_RE = new RegExp("\\" + node_path.default.sep, "g");
|
|
1840
|
+
const PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
1841
|
+
const GLOB_ALL_PATTERN = `**/*`;
|
|
1842
|
+
const TS_EXTENSIONS = [
|
|
1843
|
+
".ts",
|
|
1844
|
+
".tsx",
|
|
1845
|
+
".mts",
|
|
1846
|
+
".cts"
|
|
1847
|
+
];
|
|
1848
|
+
const TSJS_EXTENSIONS = TS_EXTENSIONS.concat([
|
|
1849
|
+
".js",
|
|
1850
|
+
".jsx",
|
|
1851
|
+
".mjs",
|
|
1852
|
+
".cjs"
|
|
1853
|
+
]);
|
|
1854
|
+
const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
1855
|
+
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
1856
|
+
const IS_POSIX = node_path.default.posix.sep === node_path.default.sep;
|
|
1857
|
+
const native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, node_path.default.posix.sep);
|
|
1858
|
+
const resolve2posix = IS_POSIX ? (dir, filename) => dir ? node_path.default.resolve(dir, filename) : node_path.default.resolve(filename) : (dir, filename) => {
|
|
1859
|
+
const posix2native = (f) => f.replace(POSIX_SEP_RE, node_path.default.sep);
|
|
1860
|
+
return native2posix(dir ? node_path.default.resolve(posix2native(dir), posix2native(filename)) : node_path.default.resolve(posix2native(filename)));
|
|
1861
|
+
};
|
|
1862
|
+
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
1863
|
+
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
1864
|
+
return patterns.some((patternArg) => {
|
|
1865
|
+
let pattern = patternArg;
|
|
1866
|
+
let lastWildcardIndex = pattern.length;
|
|
1867
|
+
let hasWildcard = false;
|
|
1868
|
+
let hasExtension = false;
|
|
1869
|
+
let hasSlash = false;
|
|
1870
|
+
let lastSlashIndex = -1;
|
|
1871
|
+
for (let i = pattern.length - 1; i > -1; i--) {
|
|
1872
|
+
const c = pattern[i];
|
|
1873
|
+
if (!hasWildcard) {
|
|
1874
|
+
if (c === "*" || c === "?") {
|
|
1875
|
+
lastWildcardIndex = i;
|
|
1876
|
+
hasWildcard = true;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
if (!hasSlash) {
|
|
1880
|
+
if (c === ".") hasExtension = true;
|
|
1881
|
+
else if (c === "/") {
|
|
1882
|
+
lastSlashIndex = i;
|
|
1883
|
+
hasSlash = true;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
if (hasWildcard && hasSlash) break;
|
|
1887
|
+
}
|
|
1888
|
+
if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
|
|
1889
|
+
pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
|
|
1890
|
+
lastWildcardIndex = pattern.length - 1;
|
|
1891
|
+
hasWildcard = true;
|
|
1892
|
+
}
|
|
1893
|
+
if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) return false;
|
|
1894
|
+
if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) return false;
|
|
1895
|
+
if (pattern === GLOB_ALL_PATTERN) return filename.startsWith(`${dir}/`);
|
|
1896
|
+
const resolvedPattern = resolve2posix(dir, pattern);
|
|
1897
|
+
let firstWildcardIndex = -1;
|
|
1898
|
+
for (let i = 0; i < resolvedPattern.length; i++) if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
|
|
1899
|
+
firstWildcardIndex = i;
|
|
1900
|
+
hasWildcard = true;
|
|
1901
|
+
break;
|
|
1902
|
+
}
|
|
1903
|
+
if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) return false;
|
|
1904
|
+
if (!hasWildcard) return filename === resolvedPattern;
|
|
1905
|
+
if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) return true;
|
|
1906
|
+
if (PATTERN_REGEX_CACHE.has(resolvedPattern)) return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
|
|
1907
|
+
const regex = pattern2regex(resolvedPattern, allowJs);
|
|
1908
|
+
PATTERN_REGEX_CACHE.set(resolvedPattern, regex);
|
|
1909
|
+
return regex.test(filename);
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
function pattern2regex(resolvedPattern, allowJs) {
|
|
1913
|
+
let regexStr = "^";
|
|
1914
|
+
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
1915
|
+
const char = resolvedPattern[i];
|
|
1916
|
+
if (char === "?") {
|
|
1917
|
+
regexStr += "[^\\/]";
|
|
1918
|
+
continue;
|
|
1919
|
+
}
|
|
1920
|
+
if (char === "*") {
|
|
1921
|
+
if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
|
|
1922
|
+
i += 2;
|
|
1923
|
+
regexStr += "(?:[^\\/]*\\/)*";
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1926
|
+
regexStr += "[^\\/]*";
|
|
1927
|
+
continue;
|
|
1928
|
+
}
|
|
1929
|
+
if ("/.+^${}()|[]\\".includes(char)) regexStr += "\\";
|
|
1930
|
+
regexStr += char;
|
|
1931
|
+
}
|
|
1932
|
+
if (resolvedPattern.endsWith("*")) regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
|
|
1933
|
+
regexStr += "$";
|
|
1934
|
+
return new RegExp(regexStr);
|
|
1935
|
+
}
|
|
1936
|
+
function isIncluded(filename, tsconfigFile, tsconfig) {
|
|
1937
|
+
const dir = native2posix(node_path.default.dirname(tsconfigFile));
|
|
1938
|
+
const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
1939
|
+
const absoluteFilename = resolve2posix(null, filename);
|
|
1940
|
+
if (files.includes(filename)) return true;
|
|
1941
|
+
const allowJs = tsconfig.compilerOptions?.allowJs;
|
|
1942
|
+
if (isGlobMatch(absoluteFilename, dir, tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]), allowJs)) return !isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
|
|
1943
|
+
return false;
|
|
1944
|
+
}
|
|
1945
|
+
/** Whether `absoluteFilename` is part of the compilation set defined by this tsconfig. */
|
|
1946
|
+
function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
|
|
1947
|
+
return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
|
|
1948
|
+
}
|
|
1949
|
+
//#endregion
|
|
1950
|
+
//#region src/load-tsconfig.ts
|
|
1951
|
+
async function loadTsConfig(conf, cwd) {
|
|
1952
|
+
const root = cwd;
|
|
1953
|
+
let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
|
|
1954
|
+
if (!tsconfigFile) tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
|
|
1955
|
+
if (!tsconfigFile) return {
|
|
1956
|
+
tsconfig: {},
|
|
1957
|
+
tsconfigFile: void 0
|
|
1958
|
+
};
|
|
1959
|
+
const gtc = await import("get-tsconfig");
|
|
1960
|
+
const rootParsed = gtc.parseTsconfig(tsconfigFile);
|
|
1961
|
+
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(node_path.default.resolve(conf.path), tsconfigFile, rootParsed, gtc);
|
|
1962
|
+
const compilerOptions = tsconfig?.compilerOptions;
|
|
1963
|
+
const result = {
|
|
1964
|
+
tsconfig,
|
|
1965
|
+
tsconfigFile: effectiveTsconfigPath
|
|
1966
|
+
};
|
|
1967
|
+
if (compilerOptions?.paths) {
|
|
1968
|
+
const baseUrl = compilerOptions.baseUrl;
|
|
1969
|
+
result.tsOptions = {
|
|
1970
|
+
baseUrl,
|
|
1971
|
+
pathMappings: (0, _bamboocss_config.convertTsPathsToRegexes)(compilerOptions.paths, resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd))
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
return result;
|
|
1975
|
+
}
|
|
1976
|
+
//#endregion
|
|
1977
|
+
//#region src/config.ts
|
|
1978
|
+
const RESOLVED_HOOKS_NAME = "__resolved__";
|
|
1979
|
+
/**
|
|
1980
|
+
* Built-in plugins that are auto-injected when using the CLI or PostCSS plugin.
|
|
1981
|
+
* These provide Vue/Svelte file support and LightningCSS optimization.
|
|
1982
|
+
*/
|
|
1983
|
+
function getAutoPlugins(config) {
|
|
1984
|
+
const plugins = [(0, _bamboocss_plugin_vue.pluginVue)(), (0, _bamboocss_plugin_svelte.pluginSvelte)()];
|
|
1985
|
+
if (config.lightningcss) plugins.push((0, _bamboocss_plugin_lightningcss.pluginLightningcss)());
|
|
1986
|
+
return plugins;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Load config and create context with auto-injected plugins.
|
|
1990
|
+
* Used by the CLI and PostCSS plugin.
|
|
1991
|
+
*/
|
|
1992
|
+
async function loadConfigAndCreateContext(options = {}) {
|
|
1993
|
+
const { config, configPath } = options;
|
|
1994
|
+
const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
|
|
1995
|
+
const conf = await (0, _bamboocss_config.loadConfig)({
|
|
1996
|
+
cwd,
|
|
1997
|
+
file: configPath
|
|
1998
|
+
});
|
|
1999
|
+
if (config) Object.assign(conf.config, config);
|
|
2000
|
+
if (options.cwd) conf.config.cwd = options.cwd;
|
|
2001
|
+
if (conf.config.lightningcss && !conf.config.browserslist) conf.config.browserslist ||= browserslist.default.findConfig(cwd)?.defaults;
|
|
2002
|
+
const autoPlugins = getAutoPlugins(conf.config);
|
|
2003
|
+
conf.hooks = (0, _bamboocss_config.mergeHooks)([...autoPlugins, {
|
|
2004
|
+
name: RESOLVED_HOOKS_NAME,
|
|
2005
|
+
hooks: conf.hooks
|
|
2006
|
+
}]);
|
|
2007
|
+
conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
|
|
2008
|
+
const tsConfResult = await loadTsConfig(conf, cwd);
|
|
2009
|
+
if (tsConfResult) Object.assign(conf, tsConfResult);
|
|
2010
|
+
return new BambooContext(conf);
|
|
2011
|
+
}
|
|
2012
|
+
//#endregion
|
|
2013
|
+
//#region src/parse-glob.ts
|
|
2014
|
+
function parseGlob(pattern) {
|
|
2015
|
+
let glob = pattern;
|
|
2016
|
+
const base = (0, glob_parent.default)(pattern);
|
|
2017
|
+
if (base !== ".") {
|
|
2018
|
+
glob = pattern.substring(base.length);
|
|
2019
|
+
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2020
|
+
}
|
|
2021
|
+
if (glob.substring(0, 2) === "./") glob = glob.substring(2);
|
|
2022
|
+
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2023
|
+
return {
|
|
2024
|
+
base,
|
|
2025
|
+
glob
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
//#endregion
|
|
2029
|
+
//#region src/parse-dependency.ts
|
|
2030
|
+
function parseDependency(fileOrGlob) {
|
|
2031
|
+
if (fileOrGlob.startsWith("!")) return null;
|
|
2032
|
+
let message = null;
|
|
2033
|
+
if ((0, is_glob.default)(fileOrGlob)) {
|
|
2034
|
+
const { base, glob } = parseGlob(fileOrGlob);
|
|
2035
|
+
message = {
|
|
2036
|
+
type: "dir-dependency",
|
|
2037
|
+
dir: (0, path.normalize)((0, path.resolve)(base)),
|
|
2038
|
+
glob
|
|
2039
|
+
};
|
|
2040
|
+
} else message = {
|
|
2041
|
+
type: "dependency",
|
|
2042
|
+
file: (0, path.normalize)((0, path.resolve)(fileOrGlob))
|
|
2043
|
+
};
|
|
2044
|
+
if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") message = {
|
|
2045
|
+
type: "dependency",
|
|
2046
|
+
file: (0, path.normalize)((0, path.resolve)(message.dir))
|
|
2047
|
+
};
|
|
2048
|
+
return message;
|
|
2049
|
+
}
|
|
2050
|
+
//#endregion
|
|
2051
|
+
//#region src/builder.ts
|
|
2052
|
+
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
2053
|
+
var Builder = class {
|
|
2054
|
+
/**
|
|
2055
|
+
* The current bamboo context
|
|
2056
|
+
*/
|
|
2057
|
+
context;
|
|
2058
|
+
hasEmitted = false;
|
|
2059
|
+
filesMeta;
|
|
2060
|
+
explicitDepsMeta;
|
|
2061
|
+
affecteds;
|
|
2062
|
+
configDependencies = /* @__PURE__ */ new Set();
|
|
2063
|
+
setConfigDependencies(options) {
|
|
2064
|
+
const tsOptions = this.context?.conf.tsOptions ?? {
|
|
2065
|
+
baseUrl: void 0,
|
|
2066
|
+
pathMappings: []
|
|
2067
|
+
};
|
|
2068
|
+
const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
|
|
2069
|
+
const { deps: foundDeps } = (0, _bamboocss_config.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
|
|
2070
|
+
const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
|
|
2071
|
+
const configDeps = new Set([...foundDeps, ...(this.context?.conf.dependencies ?? []).map((file) => (0, path.resolve)(cwd, file))]);
|
|
2072
|
+
configDeps.forEach((file) => {
|
|
2073
|
+
this.configDependencies.add(file);
|
|
2074
|
+
});
|
|
2075
|
+
_bamboocss_logger.logger.debug("builder", "Config dependencies");
|
|
2076
|
+
_bamboocss_logger.logger.debug("builder", configDeps);
|
|
2077
|
+
}
|
|
2078
|
+
setup = async (options = {}) => {
|
|
2079
|
+
_bamboocss_logger.logger.debug("builder", "🚧 Setup");
|
|
2080
|
+
const configPath = options.configPath ?? (0, _bamboocss_config.findConfig)({ cwd: options.cwd });
|
|
2081
|
+
this.setConfigDependencies({
|
|
2082
|
+
configPath,
|
|
2083
|
+
cwd: options.cwd
|
|
2084
|
+
});
|
|
2085
|
+
if (!this.context) return this.setupContext({
|
|
2086
|
+
configPath,
|
|
2087
|
+
cwd: options.cwd
|
|
2088
|
+
});
|
|
2089
|
+
const ctx = this.getContextOrThrow();
|
|
2090
|
+
this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
2091
|
+
this.context = new BambooContext(conf);
|
|
2092
|
+
});
|
|
2093
|
+
_bamboocss_logger.logger.debug("builder", this.affecteds);
|
|
2094
|
+
this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
|
|
2095
|
+
if (this.explicitDepsMeta.hasFilesChanged) {
|
|
2096
|
+
this.explicitDepsMeta.changes.forEach((meta, file) => {
|
|
2097
|
+
fileModifiedMap.set(file, meta.mtime);
|
|
2098
|
+
});
|
|
2099
|
+
_bamboocss_logger.logger.debug("builder", "⚙️ Explicit config dependencies changed");
|
|
2100
|
+
this.affecteds.hasConfigChanged = true;
|
|
2101
|
+
}
|
|
2102
|
+
if (this.affecteds.hasConfigChanged) {
|
|
2103
|
+
_bamboocss_logger.logger.debug("builder", "⚙️ Config changed, reloading");
|
|
2104
|
+
await ctx.hooks["config:change"]?.({
|
|
2105
|
+
config: ctx.config,
|
|
2106
|
+
changes: this.affecteds
|
|
2107
|
+
});
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
this.filesMeta = this.checkFilesChanged(ctx.getFiles());
|
|
2111
|
+
if (this.filesMeta.hasFilesChanged) {
|
|
2112
|
+
_bamboocss_logger.logger.debug("builder", "Files changed, invalidating them");
|
|
2113
|
+
ctx.project.reloadSourceFiles();
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
async emit() {
|
|
2117
|
+
if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
|
|
2118
|
+
_bamboocss_logger.logger.debug("builder", "Emit artifacts after config change");
|
|
2119
|
+
await codegen(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
|
|
2120
|
+
}
|
|
2121
|
+
this.hasEmitted = true;
|
|
2122
|
+
}
|
|
2123
|
+
setupContext = async (options) => {
|
|
2124
|
+
const { configPath, cwd } = options;
|
|
2125
|
+
const ctx = await loadConfigAndCreateContext({
|
|
2126
|
+
configPath,
|
|
2127
|
+
cwd
|
|
2128
|
+
});
|
|
2129
|
+
(0, _bamboocss_shared.uniq)([...ctx.conf.dependencies, ...ctx.explicitDeps]).forEach((file) => {
|
|
2130
|
+
this.configDependencies.add((0, path.resolve)(cwd || ctx.conf.config.cwd, file));
|
|
2131
|
+
});
|
|
2132
|
+
this.context = ctx;
|
|
2133
|
+
return ctx;
|
|
2134
|
+
};
|
|
2135
|
+
getContextOrThrow = () => {
|
|
2136
|
+
if (!this.context) throw new _bamboocss_shared.BambooError("NO_CONTEXT", "context not loaded");
|
|
2137
|
+
return this.context;
|
|
2138
|
+
};
|
|
2139
|
+
getFileMeta = (file) => {
|
|
2140
|
+
const mtime = (0, fs.existsSync)(file) ? (0, fs.statSync)(file).mtimeMs : -Infinity;
|
|
2141
|
+
return {
|
|
2142
|
+
mtime,
|
|
2143
|
+
isUnchanged: fileModifiedMap.has(file) && mtime === fileModifiedMap.get(file)
|
|
2144
|
+
};
|
|
2145
|
+
};
|
|
2146
|
+
checkFilesChanged(files) {
|
|
2147
|
+
const changes = /* @__PURE__ */ new Map();
|
|
2148
|
+
let hasFilesChanged = false;
|
|
2149
|
+
for (const file of files) {
|
|
2150
|
+
const meta = this.getFileMeta(file);
|
|
2151
|
+
changes.set(file, meta);
|
|
2152
|
+
if (!meta.isUnchanged) hasFilesChanged = true;
|
|
2153
|
+
}
|
|
2154
|
+
return {
|
|
2155
|
+
changes,
|
|
2156
|
+
hasFilesChanged
|
|
2157
|
+
};
|
|
2158
|
+
}
|
|
2159
|
+
extractFile = (ctx, file) => {
|
|
2160
|
+
const meta = this.filesMeta?.changes.get(file) ?? this.getFileMeta(file);
|
|
2161
|
+
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
|
|
2162
|
+
if (meta.isUnchanged && !hasConfigChanged) return;
|
|
2163
|
+
const parserResult = ctx.parseFile(file);
|
|
2164
|
+
fileModifiedMap.set(file, meta.mtime);
|
|
2165
|
+
return parserResult;
|
|
2166
|
+
};
|
|
2167
|
+
extract = () => {
|
|
2168
|
+
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
|
|
2169
|
+
if (!this.filesMeta && !hasConfigChanged) {
|
|
2170
|
+
_bamboocss_logger.logger.debug("builder", "No files or config changed, skipping extract");
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
const ctx = this.getContextOrThrow();
|
|
2174
|
+
const files = ctx.getFiles();
|
|
2175
|
+
const done = _bamboocss_logger.logger.time.info("Extracted in");
|
|
2176
|
+
files.map((file) => this.extractFile(ctx, file));
|
|
2177
|
+
done();
|
|
2178
|
+
};
|
|
2179
|
+
isValidRoot = (root) => {
|
|
2180
|
+
const ctx = this.getContextOrThrow();
|
|
2181
|
+
let valid = false;
|
|
2182
|
+
root.walkAtRules("layer", (rule) => {
|
|
2183
|
+
if (ctx.isValidLayerParams(rule.params)) valid = true;
|
|
2184
|
+
});
|
|
2185
|
+
return valid;
|
|
2186
|
+
};
|
|
2187
|
+
write = (root) => {
|
|
2188
|
+
const ctx = this.getContextOrThrow();
|
|
2189
|
+
const sheet = ctx.createSheet();
|
|
2190
|
+
ctx.appendBaselineCss(sheet);
|
|
2191
|
+
const css = ctx.getCss(sheet);
|
|
2192
|
+
root.append(css);
|
|
2193
|
+
};
|
|
2194
|
+
registerDependency = (fn) => {
|
|
2195
|
+
const ctx = this.getContextOrThrow();
|
|
2196
|
+
for (const fileOrGlob of ctx.config.include) {
|
|
2197
|
+
const dependency = parseDependency(fileOrGlob);
|
|
2198
|
+
if (dependency) fn(dependency);
|
|
2199
|
+
}
|
|
2200
|
+
for (const file of this.configDependencies) fn({
|
|
2201
|
+
type: "dependency",
|
|
2202
|
+
file: (0, path.normalize)((0, path.resolve)(file))
|
|
2203
|
+
});
|
|
2204
|
+
};
|
|
2205
|
+
};
|
|
2206
|
+
//#endregion
|
|
2207
|
+
//#region src/cpu-profile.ts
|
|
2208
|
+
const startProfiling = async (cwd, prefix, isWatching) => {
|
|
2209
|
+
const session = new (await (import("node:inspector").then((r) => r.default))).Session();
|
|
2210
|
+
session.connect();
|
|
2211
|
+
let state = "idle";
|
|
2212
|
+
const setState = (s) => {
|
|
2213
|
+
state = s;
|
|
2214
|
+
};
|
|
2215
|
+
await new Promise((resolve) => {
|
|
2216
|
+
session.post("Profiler.enable", () => {
|
|
2217
|
+
session.post("Profiler.start", () => {
|
|
2218
|
+
setState("profiling");
|
|
2219
|
+
resolve();
|
|
2220
|
+
});
|
|
2221
|
+
});
|
|
2222
|
+
});
|
|
2223
|
+
const toggleProfiler = () => {
|
|
2224
|
+
if (state === "idle") {
|
|
2225
|
+
console.log("Starting CPU profiling...");
|
|
2226
|
+
setState("starting");
|
|
2227
|
+
session.post("Profiler.start", () => {
|
|
2228
|
+
setState("profiling");
|
|
2229
|
+
console.log("Press 'p' to stop profiling...");
|
|
2230
|
+
});
|
|
2231
|
+
} else if (state === "profiling") {
|
|
2232
|
+
console.log("Stopping CPU profiling...");
|
|
2233
|
+
stopProfiling();
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
if (isWatching) {
|
|
2237
|
+
node_readline.default.emitKeypressEvents(process.stdin);
|
|
2238
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
2239
|
+
console.log("Press 'p' to stop profiling...");
|
|
2240
|
+
process.stdin.on("keypress", (str, key) => {
|
|
2241
|
+
if (key.name === "p") toggleProfiler();
|
|
2242
|
+
if (key.ctrl && key.name === "c") stopProfiling(() => process.exit());
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
const stopProfiling = (cb) => {
|
|
2246
|
+
if (state !== "profiling") {
|
|
2247
|
+
cb?.();
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
setState("stopping");
|
|
2251
|
+
session.post("Profiler.stop", (err, params) => {
|
|
2252
|
+
setState("idle");
|
|
2253
|
+
if (err) {
|
|
2254
|
+
_bamboocss_logger.logger.error("cpu-prof", err);
|
|
2255
|
+
cb?.();
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
if (!params?.profile) {
|
|
2259
|
+
cb?.();
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
const title = `bamboo-${prefix}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:.]/g, "")}`;
|
|
2263
|
+
const outfile = node_path.default.join(cwd, `${title}.cpuprofile`);
|
|
2264
|
+
node_fs.default.writeFileSync(outfile, JSON.stringify(params.profile));
|
|
2265
|
+
_bamboocss_logger.logger.info("cpu-prof", outfile);
|
|
2266
|
+
cb?.();
|
|
2267
|
+
});
|
|
2268
|
+
};
|
|
2269
|
+
return stopProfiling;
|
|
2270
|
+
};
|
|
2271
|
+
//#endregion
|
|
2272
|
+
//#region src/cssgen.ts
|
|
2273
|
+
const cssgen = async (ctx, options) => {
|
|
2274
|
+
const { outfile, type, minimal, splitting } = options;
|
|
2275
|
+
const sheet = ctx.createSheet();
|
|
2276
|
+
if (type) {
|
|
2277
|
+
const done = _bamboocss_logger.logger.time.info(ctx.messages.cssArtifactComplete(type));
|
|
2278
|
+
ctx.appendCssOfType(type, sheet);
|
|
2279
|
+
if (outfile) {
|
|
2280
|
+
const css = ctx.getCss(sheet);
|
|
2281
|
+
_bamboocss_logger.logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
2282
|
+
await ctx.runtime.fs.writeFile(outfile, css);
|
|
2283
|
+
} else await ctx.writeCss(sheet);
|
|
2284
|
+
done();
|
|
2285
|
+
} else {
|
|
2286
|
+
const { files } = ctx.parseFiles();
|
|
2287
|
+
const done = _bamboocss_logger.logger.time.info(ctx.messages.buildComplete(files.length));
|
|
2288
|
+
if (!minimal) {
|
|
2289
|
+
ctx.appendLayerParams(sheet);
|
|
2290
|
+
ctx.appendBaselineCss(sheet);
|
|
2291
|
+
}
|
|
2292
|
+
ctx.appendParserCss(sheet);
|
|
2293
|
+
if (splitting) await ctx.writeSplitCss(sheet);
|
|
2294
|
+
else if (outfile) {
|
|
2295
|
+
const css = ctx.getCss(sheet);
|
|
2296
|
+
_bamboocss_logger.logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
2297
|
+
await ctx.runtime.fs.writeFile(outfile, css);
|
|
2298
|
+
} else await ctx.writeCss(sheet);
|
|
2299
|
+
done();
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
//#endregion
|
|
2303
|
+
//#region src/debug.ts
|
|
2304
|
+
async function debug(ctx, options) {
|
|
2305
|
+
const files = ctx.getFiles();
|
|
2306
|
+
const measureTotal = _bamboocss_logger.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2307
|
+
ctx.config.minify = false;
|
|
2308
|
+
const { fs, path: path$5 } = ctx.runtime;
|
|
2309
|
+
const outdir = options.outdir;
|
|
2310
|
+
if (!options.dry && outdir) {
|
|
2311
|
+
fs.ensureDirSync(outdir);
|
|
2312
|
+
_bamboocss_logger.logger.info("cli", `Writing ${_bamboocss_logger.colors.bold(`${outdir}/config.json`)}`);
|
|
2313
|
+
await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2314
|
+
}
|
|
2315
|
+
if (options.onlyConfig) {
|
|
2316
|
+
measureTotal();
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
const filesWithCss = [];
|
|
2320
|
+
files.map((file) => {
|
|
2321
|
+
const measure = _bamboocss_logger.logger.time.debug(`Parsed ${file}`);
|
|
2322
|
+
const encoder = ctx.encoder.clone();
|
|
2323
|
+
const result = ctx.project.parseSourceFile(file, encoder);
|
|
2324
|
+
measure();
|
|
2325
|
+
if (!result || result.isEmpty() || encoder.isEmpty()) return;
|
|
2326
|
+
const styles = ctx.decoder.clone().collect(encoder);
|
|
2327
|
+
const css = ctx.getParserCss(styles);
|
|
2328
|
+
if (!css) return;
|
|
2329
|
+
if (options.dry) {
|
|
2330
|
+
console.log({
|
|
2331
|
+
path: file,
|
|
2332
|
+
ast: result,
|
|
2333
|
+
code: css
|
|
2334
|
+
});
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
if (outdir) {
|
|
2338
|
+
filesWithCss.push(file);
|
|
2339
|
+
const parsedPath = (0, path.parse)(file);
|
|
2340
|
+
const relative = path$5.relative(ctx.config.cwd, parsedPath.dir);
|
|
2341
|
+
const astJsonPath = `${relative}${path$5.sep}${parsedPath.name}.ast.json`.replaceAll(path$5.sep, "__");
|
|
2342
|
+
const cssPath = `${relative}${path$5.sep}${parsedPath.name}.css`.replaceAll(path$5.sep, "__");
|
|
2343
|
+
_bamboocss_logger.logger.info("cli", `Writing ${_bamboocss_logger.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2344
|
+
_bamboocss_logger.logger.info("cli", `Writing ${_bamboocss_logger.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2345
|
+
return Promise.allSettled([fs.writeFile(`${outdir}${path$5.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)), fs.writeFile(`${outdir}${path$5.sep}${cssPath}`, css)]);
|
|
2346
|
+
}
|
|
2347
|
+
});
|
|
2348
|
+
_bamboocss_logger.logger.info("cli", `Found ${_bamboocss_logger.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Bamboo`);
|
|
2349
|
+
measureTotal();
|
|
2350
|
+
}
|
|
2351
|
+
//#endregion
|
|
2352
|
+
//#region src/generate.ts
|
|
2353
|
+
async function build(ctx, artifactIds) {
|
|
2354
|
+
await codegen(ctx, artifactIds);
|
|
2355
|
+
if (ctx.config.emitTokensOnly) return _bamboocss_logger.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens ✨");
|
|
2356
|
+
const done = _bamboocss_logger.logger.time.info("");
|
|
2357
|
+
const sheet = ctx.createSheet();
|
|
2358
|
+
ctx.appendLayerParams(sheet);
|
|
2359
|
+
ctx.appendBaselineCss(sheet);
|
|
2360
|
+
const parsed = ctx.parseFiles();
|
|
2361
|
+
ctx.appendParserCss(sheet);
|
|
2362
|
+
await ctx.writeCss(sheet);
|
|
2363
|
+
done(ctx.messages.buildComplete(parsed.files.length));
|
|
2364
|
+
}
|
|
2365
|
+
async function generate(config, configPath) {
|
|
2366
|
+
let ctx = await loadConfigAndCreateContext({
|
|
2367
|
+
config,
|
|
2368
|
+
configPath
|
|
2369
|
+
});
|
|
2370
|
+
await build(ctx);
|
|
2371
|
+
const { cwd, watch, poll } = ctx.config;
|
|
2372
|
+
if (watch) {
|
|
2373
|
+
ctx.watchConfig(async () => {
|
|
2374
|
+
const affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
2375
|
+
ctx = new BambooContext(conf);
|
|
2376
|
+
});
|
|
2377
|
+
_bamboocss_logger.logger.info("ctx:updated", "config rebuilt ✅");
|
|
2378
|
+
await ctx.hooks["config:change"]?.({
|
|
2379
|
+
config: ctx.config,
|
|
2380
|
+
changes: affecteds
|
|
2381
|
+
});
|
|
2382
|
+
return build(ctx, Array.from(affecteds.artifacts));
|
|
2383
|
+
}, {
|
|
2384
|
+
cwd,
|
|
2385
|
+
poll
|
|
2386
|
+
});
|
|
2387
|
+
const bundleStyles = async (ctx, changedFilePath) => {
|
|
2388
|
+
const outfile = ctx.runtime.path.join(...ctx.paths.root, "styles.css");
|
|
2389
|
+
if (ctx.project.parseSourceFile(changedFilePath)) {
|
|
2390
|
+
const done = _bamboocss_logger.logger.time.info(ctx.messages.buildComplete(1));
|
|
2391
|
+
const sheet = ctx.createSheet();
|
|
2392
|
+
ctx.appendLayerParams(sheet);
|
|
2393
|
+
ctx.appendBaselineCss(sheet);
|
|
2394
|
+
ctx.appendParserCss(sheet);
|
|
2395
|
+
const css = ctx.getCss(sheet);
|
|
2396
|
+
await ctx.runtime.fs.writeFile(outfile, css);
|
|
2397
|
+
done();
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
ctx.watchFiles(async (event, file) => {
|
|
2401
|
+
const filePath = ctx.runtime.path.abs(cwd, file);
|
|
2402
|
+
if (event === "unlink") ctx.project.removeSourceFile(filePath);
|
|
2403
|
+
else if (event === "change") {
|
|
2404
|
+
ctx.project.reloadSourceFile(file);
|
|
2405
|
+
await bundleStyles(ctx, filePath);
|
|
2406
|
+
} else if (event === "add") {
|
|
2407
|
+
ctx.project.createSourceFile(file);
|
|
2408
|
+
await bundleStyles(ctx, filePath);
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
//#endregion
|
|
2414
|
+
//#region src/git-ignore.ts
|
|
2415
|
+
function setupGitIgnore(ctx) {
|
|
2416
|
+
const { outdir, gitignore } = ctx.config;
|
|
2417
|
+
if (!gitignore) return;
|
|
2418
|
+
const txt = outdent.default`
|
|
2419
|
+
|
|
2420
|
+
## Bamboo
|
|
2421
|
+
${outdir}
|
|
2422
|
+
${ctx.studio.outdir}
|
|
2423
|
+
`;
|
|
2424
|
+
const file = (0, look_it_up.lookItUpSync)(".gitignore");
|
|
2425
|
+
if (!file) return (0, fs.writeFileSync)(".gitignore", txt);
|
|
2426
|
+
if (!(0, fs.readFileSync)(file, "utf-8").includes(outdir)) (0, fs.appendFileSync)(file, txt);
|
|
2427
|
+
}
|
|
2428
|
+
//#endregion
|
|
2429
|
+
//#region src/logstream.ts
|
|
2430
|
+
const setLogStream = (options) => {
|
|
2431
|
+
const { cwd = process.cwd() } = options;
|
|
2432
|
+
let stream;
|
|
2433
|
+
if (options.logfile) {
|
|
2434
|
+
const outPath = node_path.default.resolve(cwd, options.logfile);
|
|
2435
|
+
ensure(outPath);
|
|
2436
|
+
_bamboocss_logger.logger.info("logfile", outPath);
|
|
2437
|
+
stream = node_fs.default.createWriteStream(outPath, { flags: "a" });
|
|
2438
|
+
_bamboocss_logger.logger.onLog = (entry) => {
|
|
2439
|
+
stream?.write(JSON.stringify(entry) + "\n");
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
process.once("SIGINT", () => {
|
|
2443
|
+
stream?.end();
|
|
2444
|
+
});
|
|
2445
|
+
return {
|
|
2446
|
+
end() {
|
|
2447
|
+
stream?.end();
|
|
2448
|
+
},
|
|
2449
|
+
[Symbol.dispose]: () => {
|
|
2450
|
+
stream?.end();
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
};
|
|
2454
|
+
const ensure = (outPath) => {
|
|
2455
|
+
const dirname = node_path.default.dirname(outPath);
|
|
2456
|
+
node_fs.default.mkdirSync(dirname, { recursive: true });
|
|
2457
|
+
return outPath;
|
|
2458
|
+
};
|
|
2459
|
+
//#endregion
|
|
2460
|
+
//#region src/setup-config.ts
|
|
2461
|
+
async function setupConfig(cwd, opts = {}) {
|
|
2462
|
+
const { force, outExtension, jsxFramework, syntax, outdir = "styled-system" } = opts;
|
|
2463
|
+
let configFile;
|
|
2464
|
+
try {
|
|
2465
|
+
configFile = (0, _bamboocss_config.findConfig)({ cwd });
|
|
2466
|
+
} catch (err) {
|
|
2467
|
+
if (!(err instanceof _bamboocss_shared.BambooError)) throw err;
|
|
2468
|
+
}
|
|
2469
|
+
const { detect } = await import("package-manager-detector");
|
|
2470
|
+
const pm = ((await detect({ cwd }))?.agent ?? "npm").split("@")[0];
|
|
2471
|
+
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2472
|
+
const file = (0, look_it_up.lookItUpSync)("tsconfig.json", cwd) ? "bamboo.config.ts" : "bamboo.config.mjs";
|
|
2473
|
+
_bamboocss_logger.logger.info("init:config", `creating bamboo config file: ${(0, _bamboocss_logger.quote)(file)}`);
|
|
2474
|
+
if (!force && configFile) _bamboocss_logger.logger.warn("init:config", _bamboocss_core.messages.configExists(cmd));
|
|
2475
|
+
else {
|
|
2476
|
+
const content = outdent.outdent`
|
|
2477
|
+
import { defineConfig } from "@bamboocss/dev"
|
|
2478
|
+
|
|
2479
|
+
export default defineConfig({
|
|
2480
|
+
// Whether to use css reset
|
|
2481
|
+
preflight: true,
|
|
2482
|
+
${outExtension ? `\n // The extension for the emitted JavaScript files\noutExtension: '${outExtension}',` : ""}
|
|
2483
|
+
// Where to look for your css declarations
|
|
2484
|
+
include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
|
|
2485
|
+
|
|
2486
|
+
// Files to exclude
|
|
2487
|
+
exclude: [],
|
|
2488
|
+
|
|
2489
|
+
// Useful for theme customization
|
|
2490
|
+
theme: {
|
|
2491
|
+
extend: {}
|
|
2492
|
+
},
|
|
2493
|
+
|
|
2494
|
+
// The output directory for your css system
|
|
2495
|
+
outdir: ${JSON.stringify(outdir)},
|
|
2496
|
+
${jsxFramework ? `\n // The JSX framework to use\njsxFramework: '${jsxFramework}',` : ""}
|
|
2497
|
+
${syntax ? `\n // The CSS Syntax to use to use\nsyntax: '${syntax}'` : ""}
|
|
2498
|
+
})
|
|
2499
|
+
`;
|
|
2500
|
+
const filePath = (0, path.join)(cwd, file);
|
|
2501
|
+
await fs_extra.default.writeFile(filePath, content);
|
|
2502
|
+
try {
|
|
2503
|
+
(0, child_process.execFileSync)("oxfmt", [filePath], { stdio: "ignore" });
|
|
2504
|
+
} catch {}
|
|
2505
|
+
_bamboocss_logger.logger.log(_bamboocss_core.messages.thankYou());
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
async function setupPostcss(cwd) {
|
|
2509
|
+
_bamboocss_logger.logger.info("init:postcss", `creating postcss config file: ${(0, _bamboocss_logger.quote)("postcss.config.cjs")}`);
|
|
2510
|
+
const content = outdent.outdent`
|
|
2511
|
+
module.exports = {
|
|
2512
|
+
plugins: {
|
|
2513
|
+
'@bamboocss/dev/postcss': {},
|
|
2514
|
+
},
|
|
2515
|
+
}
|
|
2516
|
+
`;
|
|
2517
|
+
await fs_extra.default.writeFile((0, path.join)(cwd, "postcss.config.cjs"), content);
|
|
2518
|
+
}
|
|
2519
|
+
//#endregion
|
|
2520
|
+
//#region src/spec.ts
|
|
2521
|
+
async function spec(ctx, options) {
|
|
2522
|
+
const { outdir } = options;
|
|
2523
|
+
const specs = ctx.getSpec();
|
|
2524
|
+
const specDir = outdir ? [ctx.config.cwd, outdir] : ctx.paths.specs;
|
|
2525
|
+
const specDirPath = ctx.runtime.path.join(...specDir);
|
|
2526
|
+
const writeSpec = async (spec) => {
|
|
2527
|
+
await ctx.output.write({
|
|
2528
|
+
id: `spec-${spec.type}`,
|
|
2529
|
+
dir: specDir,
|
|
2530
|
+
files: [{
|
|
2531
|
+
file: `${spec.type}.json`,
|
|
2532
|
+
code: JSON.stringify(spec, null, 2)
|
|
2533
|
+
}]
|
|
2534
|
+
});
|
|
2535
|
+
};
|
|
2536
|
+
await Promise.all(specs.map(writeSpec));
|
|
2537
|
+
const specTypes = specs.map((s) => s.type);
|
|
2538
|
+
_bamboocss_logger.logger.info("spec", `Generated ${specTypes.length} spec file(s) → ${specDirPath}`);
|
|
2539
|
+
return specs;
|
|
2540
|
+
}
|
|
2541
|
+
//#endregion
|
|
2542
|
+
exports.BambooContext = BambooContext;
|
|
2543
|
+
exports.Builder = Builder;
|
|
2544
|
+
exports.analyze = analyze;
|
|
2545
|
+
exports.buildInfo = buildInfo;
|
|
2546
|
+
exports.codegen = codegen;
|
|
2547
|
+
exports.cssgen = cssgen;
|
|
2548
|
+
exports.debug = debug;
|
|
2549
|
+
exports.generate = generate;
|
|
2550
|
+
exports.loadConfigAndCreateContext = loadConfigAndCreateContext;
|
|
2551
|
+
exports.parseDependency = parseDependency;
|
|
2552
|
+
exports.setLogStream = setLogStream;
|
|
2553
|
+
exports.setupConfig = setupConfig;
|
|
2554
|
+
exports.setupGitIgnore = setupGitIgnore;
|
|
2555
|
+
exports.setupPostcss = setupPostcss;
|
|
2556
|
+
exports.spec = spec;
|
|
2557
|
+
exports.startProfiling = startProfiling;
|