mantine-reduce-css 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2129 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/getimport.ts
4
+ import { readdirSync, readFileSync } from "fs";
5
+ import { join } from "path";
6
+ function extractMantineImports(props) {
7
+ const allResults = /* @__PURE__ */ new Set();
8
+ if (props.code_highlight) {
9
+ allResults.add("@mantine/code-highlight");
10
+ }
11
+ if (props.notification) {
12
+ allResults.add("@mantine/notifications");
13
+ }
14
+ if (props.spotlight) {
15
+ allResults.add("@mantine/spotlight");
16
+ }
17
+ if (props.carousel) {
18
+ allResults.add("@mantine/carousel");
19
+ }
20
+ if (props.dropzone) {
21
+ allResults.add("@mantine/dropzone");
22
+ }
23
+ if (props.nprogress) {
24
+ allResults.add("@mantine/nprogress");
25
+ }
26
+ if (props.tiptap) {
27
+ allResults.add("@mantine/tiptap");
28
+ }
29
+ function processDirectory(dir, allResults2) {
30
+ const entries = readdirSync(dir, { withFileTypes: true });
31
+ for (const entry of entries) {
32
+ const fullPath = join(dir, entry.name);
33
+ if (entry.isDirectory()) {
34
+ processDirectory(fullPath, allResults2);
35
+ } else if (entry.isFile() && props.extensions.some((ext) => entry.name.endsWith(ext))) {
36
+ processFile(fullPath, allResults2);
37
+ }
38
+ }
39
+ }
40
+ function processFile(filePath, allResults2) {
41
+ try {
42
+ const content = readFileSync(filePath, "utf8");
43
+ if (props.core) {
44
+ const corePackage = /import\s*\{([^}]*)\}\s*from\s*["']@mantine\/core["']/;
45
+ let m;
46
+ if ((m = content.match(corePackage)) !== null) {
47
+ const imports = m[1];
48
+ imports.split(",").forEach((item) => {
49
+ const comp = item.trim().split(" as ")[0];
50
+ if (/^[A-Z][a-zA-Z0-9]+$/.test(comp)) {
51
+ allResults2.add(comp);
52
+ }
53
+ });
54
+ }
55
+ }
56
+ if (props.dates) {
57
+ const corePackage = /import\s*\{([^}]*)\}\s*from\s*["']@mantine\/dates["']/;
58
+ let m;
59
+ if ((m = content.match(corePackage)) !== null) {
60
+ const imports = m[1];
61
+ imports.split(",").forEach((item) => {
62
+ const comp = item.trim().split(" as ")[0];
63
+ if (/^[A-Z][a-zA-Z0-9]+$/.test(comp)) {
64
+ allResults2.add(comp);
65
+ }
66
+ });
67
+ }
68
+ }
69
+ if (props.charts) {
70
+ const corePackage = /import\s*\{([^}]*)\}\s*from\s*["']@mantine\/charts["']/;
71
+ let m;
72
+ if ((m = content.match(corePackage)) !== null) {
73
+ const imports = m[1];
74
+ imports.split(",").forEach((item) => {
75
+ const comp = item.trim().split(" as ")[0];
76
+ if (/^[A-Z][a-zA-Z0-9]+$/.test(comp)) {
77
+ allResults2.add(comp);
78
+ }
79
+ });
80
+ }
81
+ }
82
+ } catch (error) {
83
+ console.error(`Error reading file ${filePath}:`, error);
84
+ }
85
+ }
86
+ processDirectory(props.directory, allResults);
87
+ return allResults;
88
+ }
89
+
90
+ // node_modules/cac/dist/index.mjs
91
+ import { EventEmitter } from "events";
92
+ function toArr(any) {
93
+ return any == null ? [] : Array.isArray(any) ? any : [any];
94
+ }
95
+ function toVal(out, key, val, opts) {
96
+ var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
97
+ out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
98
+ }
99
+ function mri2(args, opts) {
100
+ args = args || [];
101
+ opts = opts || {};
102
+ var k, arr, arg, name, val, out = { _: [] };
103
+ var i = 0, j = 0, idx = 0, len = args.length;
104
+ const alibi = opts.alias !== void 0;
105
+ const strict = opts.unknown !== void 0;
106
+ const defaults = opts.default !== void 0;
107
+ opts.alias = opts.alias || {};
108
+ opts.string = toArr(opts.string);
109
+ opts.boolean = toArr(opts.boolean);
110
+ if (alibi) {
111
+ for (k in opts.alias) {
112
+ arr = opts.alias[k] = toArr(opts.alias[k]);
113
+ for (i = 0; i < arr.length; i++) {
114
+ (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
115
+ }
116
+ }
117
+ }
118
+ for (i = opts.boolean.length; i-- > 0; ) {
119
+ arr = opts.alias[opts.boolean[i]] || [];
120
+ for (j = arr.length; j-- > 0; ) opts.boolean.push(arr[j]);
121
+ }
122
+ for (i = opts.string.length; i-- > 0; ) {
123
+ arr = opts.alias[opts.string[i]] || [];
124
+ for (j = arr.length; j-- > 0; ) opts.string.push(arr[j]);
125
+ }
126
+ if (defaults) {
127
+ for (k in opts.default) {
128
+ name = typeof opts.default[k];
129
+ arr = opts.alias[k] = opts.alias[k] || [];
130
+ if (opts[name] !== void 0) {
131
+ opts[name].push(k);
132
+ for (i = 0; i < arr.length; i++) {
133
+ opts[name].push(arr[i]);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ const keys = strict ? Object.keys(opts.alias) : [];
139
+ for (i = 0; i < len; i++) {
140
+ arg = args[i];
141
+ if (arg === "--") {
142
+ out._ = out._.concat(args.slice(++i));
143
+ break;
144
+ }
145
+ for (j = 0; j < arg.length; j++) {
146
+ if (arg.charCodeAt(j) !== 45) break;
147
+ }
148
+ if (j === 0) {
149
+ out._.push(arg);
150
+ } else if (arg.substring(j, j + 3) === "no-") {
151
+ name = arg.substring(j + 3);
152
+ if (strict && !~keys.indexOf(name)) {
153
+ return opts.unknown(arg);
154
+ }
155
+ out[name] = false;
156
+ } else {
157
+ for (idx = j + 1; idx < arg.length; idx++) {
158
+ if (arg.charCodeAt(idx) === 61) break;
159
+ }
160
+ name = arg.substring(j, idx);
161
+ val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
162
+ arr = j === 2 ? [name] : name;
163
+ for (idx = 0; idx < arr.length; idx++) {
164
+ name = arr[idx];
165
+ if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
166
+ toVal(out, name, idx + 1 < arr.length || val, opts);
167
+ }
168
+ }
169
+ }
170
+ if (defaults) {
171
+ for (k in opts.default) {
172
+ if (out[k] === void 0) {
173
+ out[k] = opts.default[k];
174
+ }
175
+ }
176
+ }
177
+ if (alibi) {
178
+ for (k in out) {
179
+ arr = opts.alias[k] || [];
180
+ while (arr.length > 0) {
181
+ out[arr.shift()] = out[k];
182
+ }
183
+ }
184
+ }
185
+ return out;
186
+ }
187
+ var removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
188
+ var findAllBrackets = (v) => {
189
+ const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
190
+ const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
191
+ const res = [];
192
+ const parse = (match) => {
193
+ let variadic = false;
194
+ let value = match[1];
195
+ if (value.startsWith("...")) {
196
+ value = value.slice(3);
197
+ variadic = true;
198
+ }
199
+ return {
200
+ required: match[0].startsWith("<"),
201
+ value,
202
+ variadic
203
+ };
204
+ };
205
+ let angledMatch;
206
+ while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
207
+ res.push(parse(angledMatch));
208
+ }
209
+ let squareMatch;
210
+ while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
211
+ res.push(parse(squareMatch));
212
+ }
213
+ return res;
214
+ };
215
+ var getMriOptions = (options) => {
216
+ const result = { alias: {}, boolean: [] };
217
+ for (const [index, option] of options.entries()) {
218
+ if (option.names.length > 1) {
219
+ result.alias[option.names[0]] = option.names.slice(1);
220
+ }
221
+ if (option.isBoolean) {
222
+ if (option.negated) {
223
+ const hasStringTypeOption = options.some((o, i) => {
224
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
225
+ });
226
+ if (!hasStringTypeOption) {
227
+ result.boolean.push(option.names[0]);
228
+ }
229
+ } else {
230
+ result.boolean.push(option.names[0]);
231
+ }
232
+ }
233
+ }
234
+ return result;
235
+ };
236
+ var findLongest = (arr) => {
237
+ return arr.sort((a, b) => {
238
+ return a.length > b.length ? -1 : 1;
239
+ })[0];
240
+ };
241
+ var padRight = (str, length) => {
242
+ return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
243
+ };
244
+ var camelcase = (input) => {
245
+ return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
246
+ return p1 + p2.toUpperCase();
247
+ });
248
+ };
249
+ var setDotProp = (obj, keys, val) => {
250
+ let i = 0;
251
+ let length = keys.length;
252
+ let t = obj;
253
+ let x;
254
+ for (; i < length; ++i) {
255
+ x = t[keys[i]];
256
+ t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
257
+ }
258
+ };
259
+ var setByType = (obj, transforms) => {
260
+ for (const key of Object.keys(transforms)) {
261
+ const transform = transforms[key];
262
+ if (transform.shouldTransform) {
263
+ obj[key] = Array.prototype.concat.call([], obj[key]);
264
+ if (typeof transform.transformFunction === "function") {
265
+ obj[key] = obj[key].map(transform.transformFunction);
266
+ }
267
+ }
268
+ }
269
+ };
270
+ var getFileName = (input) => {
271
+ const m = /([^\\\/]+)$/.exec(input);
272
+ return m ? m[1] : "";
273
+ };
274
+ var camelcaseOptionName = (name) => {
275
+ return name.split(".").map((v, i) => {
276
+ return i === 0 ? camelcase(v) : v;
277
+ }).join(".");
278
+ };
279
+ var CACError = class extends Error {
280
+ constructor(message) {
281
+ super(message);
282
+ this.name = this.constructor.name;
283
+ if (typeof Error.captureStackTrace === "function") {
284
+ Error.captureStackTrace(this, this.constructor);
285
+ } else {
286
+ this.stack = new Error(message).stack;
287
+ }
288
+ }
289
+ };
290
+ var Option = class {
291
+ constructor(rawName, description, config) {
292
+ this.rawName = rawName;
293
+ this.description = description;
294
+ this.config = Object.assign({}, config);
295
+ rawName = rawName.replace(/\.\*/g, "");
296
+ this.negated = false;
297
+ this.names = removeBrackets(rawName).split(",").map((v) => {
298
+ let name = v.trim().replace(/^-{1,2}/, "");
299
+ if (name.startsWith("no-")) {
300
+ this.negated = true;
301
+ name = name.replace(/^no-/, "");
302
+ }
303
+ return camelcaseOptionName(name);
304
+ }).sort((a, b) => a.length > b.length ? 1 : -1);
305
+ this.name = this.names[this.names.length - 1];
306
+ if (this.negated && this.config.default == null) {
307
+ this.config.default = true;
308
+ }
309
+ if (rawName.includes("<")) {
310
+ this.required = true;
311
+ } else if (rawName.includes("[")) {
312
+ this.required = false;
313
+ } else {
314
+ this.isBoolean = true;
315
+ }
316
+ }
317
+ };
318
+ var processArgs = process.argv;
319
+ var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
320
+ var Command = class {
321
+ constructor(rawName, description, config = {}, cli2) {
322
+ this.rawName = rawName;
323
+ this.description = description;
324
+ this.config = config;
325
+ this.cli = cli2;
326
+ this.options = [];
327
+ this.aliasNames = [];
328
+ this.name = removeBrackets(rawName);
329
+ this.args = findAllBrackets(rawName);
330
+ this.examples = [];
331
+ }
332
+ usage(text) {
333
+ this.usageText = text;
334
+ return this;
335
+ }
336
+ allowUnknownOptions() {
337
+ this.config.allowUnknownOptions = true;
338
+ return this;
339
+ }
340
+ ignoreOptionDefaultValue() {
341
+ this.config.ignoreOptionDefaultValue = true;
342
+ return this;
343
+ }
344
+ version(version, customFlags = "-v, --version") {
345
+ this.versionNumber = version;
346
+ this.option(customFlags, "Display version number");
347
+ return this;
348
+ }
349
+ example(example) {
350
+ this.examples.push(example);
351
+ return this;
352
+ }
353
+ option(rawName, description, config) {
354
+ const option = new Option(rawName, description, config);
355
+ this.options.push(option);
356
+ return this;
357
+ }
358
+ alias(name) {
359
+ this.aliasNames.push(name);
360
+ return this;
361
+ }
362
+ action(callback) {
363
+ this.commandAction = callback;
364
+ return this;
365
+ }
366
+ isMatched(name) {
367
+ return this.name === name || this.aliasNames.includes(name);
368
+ }
369
+ get isDefaultCommand() {
370
+ return this.name === "" || this.aliasNames.includes("!");
371
+ }
372
+ get isGlobalCommand() {
373
+ return this instanceof GlobalCommand;
374
+ }
375
+ hasOption(name) {
376
+ name = name.split(".")[0];
377
+ return this.options.find((option) => {
378
+ return option.names.includes(name);
379
+ });
380
+ }
381
+ outputHelp() {
382
+ const { name, commands } = this.cli;
383
+ const {
384
+ versionNumber,
385
+ options: globalOptions,
386
+ helpCallback
387
+ } = this.cli.globalCommand;
388
+ let sections = [
389
+ {
390
+ body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
391
+ }
392
+ ];
393
+ sections.push({
394
+ title: "Usage",
395
+ body: ` $ ${name} ${this.usageText || this.rawName}`
396
+ });
397
+ const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
398
+ if (showCommands) {
399
+ const longestCommandName = findLongest(commands.map((command) => command.rawName));
400
+ sections.push({
401
+ title: "Commands",
402
+ body: commands.map((command) => {
403
+ return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
404
+ }).join("\n")
405
+ });
406
+ sections.push({
407
+ title: `For more info, run any command with the \`--help\` flag`,
408
+ body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
409
+ });
410
+ }
411
+ let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
412
+ if (!this.isGlobalCommand && !this.isDefaultCommand) {
413
+ options = options.filter((option) => option.name !== "version");
414
+ }
415
+ if (options.length > 0) {
416
+ const longestOptionName = findLongest(options.map((option) => option.rawName));
417
+ sections.push({
418
+ title: "Options",
419
+ body: options.map((option) => {
420
+ return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
421
+ }).join("\n")
422
+ });
423
+ }
424
+ if (this.examples.length > 0) {
425
+ sections.push({
426
+ title: "Examples",
427
+ body: this.examples.map((example) => {
428
+ if (typeof example === "function") {
429
+ return example(name);
430
+ }
431
+ return example;
432
+ }).join("\n")
433
+ });
434
+ }
435
+ if (helpCallback) {
436
+ sections = helpCallback(sections) || sections;
437
+ }
438
+ console.log(sections.map((section) => {
439
+ return section.title ? `${section.title}:
440
+ ${section.body}` : section.body;
441
+ }).join("\n\n"));
442
+ }
443
+ outputVersion() {
444
+ const { name } = this.cli;
445
+ const { versionNumber } = this.cli.globalCommand;
446
+ if (versionNumber) {
447
+ console.log(`${name}/${versionNumber} ${platformInfo}`);
448
+ }
449
+ }
450
+ checkRequiredArgs() {
451
+ const minimalArgsCount = this.args.filter((arg) => arg.required).length;
452
+ if (this.cli.args.length < minimalArgsCount) {
453
+ throw new CACError(`missing required args for command \`${this.rawName}\``);
454
+ }
455
+ }
456
+ checkUnknownOptions() {
457
+ const { options, globalCommand } = this.cli;
458
+ if (!this.config.allowUnknownOptions) {
459
+ for (const name of Object.keys(options)) {
460
+ if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
461
+ throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
462
+ }
463
+ }
464
+ }
465
+ }
466
+ checkOptionValue() {
467
+ const { options: parsedOptions, globalCommand } = this.cli;
468
+ const options = [...globalCommand.options, ...this.options];
469
+ for (const option of options) {
470
+ const value = parsedOptions[option.name.split(".")[0]];
471
+ if (option.required) {
472
+ const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
473
+ if (value === true || value === false && !hasNegated) {
474
+ throw new CACError(`option \`${option.rawName}\` value is missing`);
475
+ }
476
+ }
477
+ }
478
+ }
479
+ };
480
+ var GlobalCommand = class extends Command {
481
+ constructor(cli2) {
482
+ super("@@global@@", "", {}, cli2);
483
+ }
484
+ };
485
+ var __assign = Object.assign;
486
+ var CAC = class extends EventEmitter {
487
+ constructor(name = "") {
488
+ super();
489
+ this.name = name;
490
+ this.commands = [];
491
+ this.rawArgs = [];
492
+ this.args = [];
493
+ this.options = {};
494
+ this.globalCommand = new GlobalCommand(this);
495
+ this.globalCommand.usage("<command> [options]");
496
+ }
497
+ usage(text) {
498
+ this.globalCommand.usage(text);
499
+ return this;
500
+ }
501
+ command(rawName, description, config) {
502
+ const command = new Command(rawName, description || "", config, this);
503
+ command.globalCommand = this.globalCommand;
504
+ this.commands.push(command);
505
+ return command;
506
+ }
507
+ option(rawName, description, config) {
508
+ this.globalCommand.option(rawName, description, config);
509
+ return this;
510
+ }
511
+ help(callback) {
512
+ this.globalCommand.option("-h, --help", "Display this message");
513
+ this.globalCommand.helpCallback = callback;
514
+ this.showHelpOnExit = true;
515
+ return this;
516
+ }
517
+ version(version, customFlags = "-v, --version") {
518
+ this.globalCommand.version(version, customFlags);
519
+ this.showVersionOnExit = true;
520
+ return this;
521
+ }
522
+ example(example) {
523
+ this.globalCommand.example(example);
524
+ return this;
525
+ }
526
+ outputHelp() {
527
+ if (this.matchedCommand) {
528
+ this.matchedCommand.outputHelp();
529
+ } else {
530
+ this.globalCommand.outputHelp();
531
+ }
532
+ }
533
+ outputVersion() {
534
+ this.globalCommand.outputVersion();
535
+ }
536
+ setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
537
+ this.args = args;
538
+ this.options = options;
539
+ if (matchedCommand) {
540
+ this.matchedCommand = matchedCommand;
541
+ }
542
+ if (matchedCommandName) {
543
+ this.matchedCommandName = matchedCommandName;
544
+ }
545
+ return this;
546
+ }
547
+ unsetMatchedCommand() {
548
+ this.matchedCommand = void 0;
549
+ this.matchedCommandName = void 0;
550
+ }
551
+ parse(argv = processArgs, {
552
+ run = true
553
+ } = {}) {
554
+ this.rawArgs = argv;
555
+ if (!this.name) {
556
+ this.name = argv[1] ? getFileName(argv[1]) : "cli";
557
+ }
558
+ let shouldParse = true;
559
+ for (const command of this.commands) {
560
+ const parsed = this.mri(argv.slice(2), command);
561
+ const commandName = parsed.args[0];
562
+ if (command.isMatched(commandName)) {
563
+ shouldParse = false;
564
+ const parsedInfo = __assign(__assign({}, parsed), {
565
+ args: parsed.args.slice(1)
566
+ });
567
+ this.setParsedInfo(parsedInfo, command, commandName);
568
+ this.emit(`command:${commandName}`, command);
569
+ }
570
+ }
571
+ if (shouldParse) {
572
+ for (const command of this.commands) {
573
+ if (command.name === "") {
574
+ shouldParse = false;
575
+ const parsed = this.mri(argv.slice(2), command);
576
+ this.setParsedInfo(parsed, command);
577
+ this.emit(`command:!`, command);
578
+ }
579
+ }
580
+ }
581
+ if (shouldParse) {
582
+ const parsed = this.mri(argv.slice(2));
583
+ this.setParsedInfo(parsed);
584
+ }
585
+ if (this.options.help && this.showHelpOnExit) {
586
+ this.outputHelp();
587
+ run = false;
588
+ this.unsetMatchedCommand();
589
+ }
590
+ if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
591
+ this.outputVersion();
592
+ run = false;
593
+ this.unsetMatchedCommand();
594
+ }
595
+ const parsedArgv = { args: this.args, options: this.options };
596
+ if (run) {
597
+ this.runMatchedCommand();
598
+ }
599
+ if (!this.matchedCommand && this.args[0]) {
600
+ this.emit("command:*");
601
+ }
602
+ return parsedArgv;
603
+ }
604
+ mri(argv, command) {
605
+ const cliOptions = [
606
+ ...this.globalCommand.options,
607
+ ...command ? command.options : []
608
+ ];
609
+ const mriOptions = getMriOptions(cliOptions);
610
+ let argsAfterDoubleDashes = [];
611
+ const doubleDashesIndex = argv.indexOf("--");
612
+ if (doubleDashesIndex > -1) {
613
+ argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
614
+ argv = argv.slice(0, doubleDashesIndex);
615
+ }
616
+ let parsed = mri2(argv, mriOptions);
617
+ parsed = Object.keys(parsed).reduce((res, name) => {
618
+ return __assign(__assign({}, res), {
619
+ [camelcaseOptionName(name)]: parsed[name]
620
+ });
621
+ }, { _: [] });
622
+ const args = parsed._;
623
+ const options = {
624
+ "--": argsAfterDoubleDashes
625
+ };
626
+ const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
627
+ let transforms = /* @__PURE__ */ Object.create(null);
628
+ for (const cliOption of cliOptions) {
629
+ if (!ignoreDefault && cliOption.config.default !== void 0) {
630
+ for (const name of cliOption.names) {
631
+ options[name] = cliOption.config.default;
632
+ }
633
+ }
634
+ if (Array.isArray(cliOption.config.type)) {
635
+ if (transforms[cliOption.name] === void 0) {
636
+ transforms[cliOption.name] = /* @__PURE__ */ Object.create(null);
637
+ transforms[cliOption.name]["shouldTransform"] = true;
638
+ transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
639
+ }
640
+ }
641
+ }
642
+ for (const key of Object.keys(parsed)) {
643
+ if (key !== "_") {
644
+ const keys = key.split(".");
645
+ setDotProp(options, keys, parsed[key]);
646
+ setByType(options, transforms);
647
+ }
648
+ }
649
+ return {
650
+ args,
651
+ options
652
+ };
653
+ }
654
+ runMatchedCommand() {
655
+ const { args, options, matchedCommand: command } = this;
656
+ if (!command || !command.commandAction)
657
+ return;
658
+ command.checkUnknownOptions();
659
+ command.checkOptionValue();
660
+ command.checkRequiredArgs();
661
+ const actionArgs = [];
662
+ command.args.forEach((arg, index) => {
663
+ if (arg.variadic) {
664
+ actionArgs.push(args.slice(index));
665
+ } else {
666
+ actionArgs.push(args[index]);
667
+ }
668
+ });
669
+ actionArgs.push(options);
670
+ return command.commandAction.apply(this, actionArgs);
671
+ }
672
+ };
673
+ var cac = (name = "") => new CAC(name);
674
+
675
+ // src/generate.ts
676
+ import { writeFileSync } from "fs";
677
+
678
+ // src/data.json
679
+ var data_default = [
680
+ {
681
+ name: "Accordion",
682
+ module: "@mantine/core",
683
+ css_name: "@mantine/core/styles/Accordion.css",
684
+ dependency: [
685
+ "Collapse",
686
+ "UnstyledButton"
687
+ ]
688
+ },
689
+ {
690
+ name: "ActionIcon",
691
+ module: "@mantine/core",
692
+ css_name: "@mantine/core/styles/ActionIcon.css",
693
+ dependency: [
694
+ "UnstyledButton",
695
+ "Transition",
696
+ "Loader"
697
+ ]
698
+ },
699
+ {
700
+ name: "Affix",
701
+ module: "@mantine/core",
702
+ css_name: "@mantine/core/styles/Affix.css",
703
+ dependency: [
704
+ "Portal"
705
+ ]
706
+ },
707
+ {
708
+ name: "Alert",
709
+ module: "@mantine/core",
710
+ css_name: "@mantine/core/styles/Alert.css",
711
+ dependency: [
712
+ "CloseButton"
713
+ ]
714
+ },
715
+ {
716
+ name: "Anchor",
717
+ module: "@mantine/core",
718
+ css_name: "@mantine/core/styles/Anchor.css",
719
+ dependency: [
720
+ "Text"
721
+ ]
722
+ },
723
+ {
724
+ name: "AngleSlider",
725
+ module: "@mantine/core",
726
+ css_name: "@mantine/core/styles/AngleSlider.css",
727
+ dependency: []
728
+ },
729
+ {
730
+ name: "AppShell",
731
+ module: "@mantine/core",
732
+ css_name: "@mantine/core/styles/AppShell.css",
733
+ dependency: []
734
+ },
735
+ {
736
+ name: "AspectRatio",
737
+ module: "@mantine/core",
738
+ css_name: "@mantine/core/styles/AspectRatio.css",
739
+ dependency: []
740
+ },
741
+ {
742
+ name: "Autocomplete",
743
+ module: "@mantine/core",
744
+ css_name: "",
745
+ dependency: [
746
+ "Combobox",
747
+ "ScrollArea",
748
+ "Input",
749
+ "InputBase"
750
+ ]
751
+ },
752
+ {
753
+ name: "Avatar",
754
+ module: "@mantine/core",
755
+ css_name: "@mantine/core/styles/Avatar.css",
756
+ dependency: []
757
+ },
758
+ {
759
+ name: "BackgroundImage",
760
+ module: "@mantine/core",
761
+ css_name: "@mantine/core/styles/BackgroundImage.css",
762
+ dependency: []
763
+ },
764
+ {
765
+ name: "Badge",
766
+ module: "@mantine/core",
767
+ css_name: "@mantine/core/styles/Badge.css",
768
+ dependency: []
769
+ },
770
+ {
771
+ name: "Blockquote",
772
+ module: "@mantine/core",
773
+ css_name: "@mantine/core/styles/Blockquote.css",
774
+ dependency: []
775
+ },
776
+ {
777
+ name: "Breadcrumbs",
778
+ module: "@mantine/core",
779
+ css_name: "@mantine/core/styles/Breadcrumbs.css",
780
+ dependency: []
781
+ },
782
+ {
783
+ name: "Burger",
784
+ module: "@mantine/core",
785
+ css_name: "@mantine/core/styles/Burger.css",
786
+ dependency: [
787
+ "UnstyledButton"
788
+ ]
789
+ },
790
+ {
791
+ name: "Button",
792
+ module: "@mantine/core",
793
+ css_name: "@mantine/core/styles/Button.css",
794
+ dependency: [
795
+ "UnstyledButton",
796
+ "Transition",
797
+ "Loader"
798
+ ]
799
+ },
800
+ {
801
+ name: "Card",
802
+ module: "@mantine/core",
803
+ css_name: "@mantine/core/styles/Card.css",
804
+ dependency: [
805
+ "Paper"
806
+ ]
807
+ },
808
+ {
809
+ name: "Center",
810
+ module: "@mantine/core",
811
+ css_name: "@mantine/core/styles/Center.css",
812
+ dependency: []
813
+ },
814
+ {
815
+ name: "Checkbox",
816
+ module: "@mantine/core",
817
+ css_name: "@mantine/core/styles/Checkbox.css",
818
+ dependency: [
819
+ "InlineInput",
820
+ "InputsGroupFieldset",
821
+ "UnstyledButton",
822
+ "Input"
823
+ ]
824
+ },
825
+ {
826
+ name: "Chip",
827
+ module: "@mantine/core",
828
+ css_name: "@mantine/core/styles/Chip.css",
829
+ dependency: [
830
+ "Checkbox"
831
+ ]
832
+ },
833
+ {
834
+ name: "CloseButton",
835
+ module: "@mantine/core",
836
+ css_name: "@mantine/core/styles/CloseButton.css",
837
+ dependency: [
838
+ "UnstyledButton"
839
+ ]
840
+ },
841
+ {
842
+ name: "Code",
843
+ module: "@mantine/core",
844
+ css_name: "@mantine/core/styles/Code.css",
845
+ dependency: []
846
+ },
847
+ {
848
+ name: "Collapse",
849
+ module: "@mantine/core",
850
+ css_name: "",
851
+ dependency: []
852
+ },
853
+ {
854
+ name: "ColorInput",
855
+ module: "@mantine/core",
856
+ css_name: "@mantine/core/styles/ColorInput.css",
857
+ dependency: [
858
+ "ActionIcon",
859
+ "Popover",
860
+ "InputBase",
861
+ "Input",
862
+ "ColorSwatch",
863
+ "ColorPicker"
864
+ ]
865
+ },
866
+ {
867
+ name: "ColorPicker",
868
+ module: "@mantine/core",
869
+ css_name: "@mantine/core/styles/ColorPicker.css",
870
+ dependency: [
871
+ "ColorSwatch"
872
+ ]
873
+ },
874
+ {
875
+ name: "ColorSwatch",
876
+ module: "@mantine/core",
877
+ css_name: "@mantine/core/styles/ColorSwatch.css",
878
+ dependency: []
879
+ },
880
+ {
881
+ name: "Combobox",
882
+ module: "@mantine/core",
883
+ css_name: "@mantine/core/styles/Combobox.css",
884
+ dependency: [
885
+ "Popover",
886
+ "Input",
887
+ "Checkbox"
888
+ ]
889
+ },
890
+ {
891
+ name: "Container",
892
+ module: "@mantine/core",
893
+ css_name: "@mantine/core/styles/Container.css",
894
+ dependency: []
895
+ },
896
+ {
897
+ name: "CopyButton",
898
+ module: "@mantine/core",
899
+ css_name: "",
900
+ dependency: []
901
+ },
902
+ {
903
+ name: "Dialog",
904
+ module: "@mantine/core",
905
+ css_name: "@mantine/core/styles/Dialog.css",
906
+ dependency: [
907
+ "CloseButton",
908
+ "Paper",
909
+ "Transition",
910
+ "Affix"
911
+ ]
912
+ },
913
+ {
914
+ name: "Divider",
915
+ module: "@mantine/core",
916
+ css_name: "@mantine/core/styles/Divider.css",
917
+ dependency: []
918
+ },
919
+ {
920
+ name: "Drawer",
921
+ module: "@mantine/core",
922
+ css_name: "@mantine/core/styles/Drawer.css",
923
+ dependency: [
924
+ "ModalBase"
925
+ ]
926
+ },
927
+ {
928
+ name: "Fieldset",
929
+ module: "@mantine/core",
930
+ css_name: "@mantine/core/styles/Fieldset.css",
931
+ dependency: []
932
+ },
933
+ {
934
+ name: "FileButton",
935
+ module: "@mantine/core",
936
+ css_name: "",
937
+ dependency: []
938
+ },
939
+ {
940
+ name: "FileInput",
941
+ module: "@mantine/core",
942
+ css_name: "",
943
+ dependency: [
944
+ "Input",
945
+ "FileButton",
946
+ "CloseButton"
947
+ ]
948
+ },
949
+ {
950
+ name: "Flex",
951
+ module: "@mantine/core",
952
+ css_name: "@mantine/core/styles/Flex.css",
953
+ dependency: []
954
+ },
955
+ {
956
+ name: "FloatingIndicator",
957
+ module: "@mantine/core",
958
+ css_name: "@mantine/core/styles/FloatingIndicator.css",
959
+ dependency: []
960
+ },
961
+ {
962
+ name: "FocusTrap",
963
+ module: "@mantine/core",
964
+ css_name: "",
965
+ dependency: [
966
+ "VisuallyHidden"
967
+ ]
968
+ },
969
+ {
970
+ name: "Grid",
971
+ module: "@mantine/core",
972
+ css_name: "@mantine/core/styles/Grid.css",
973
+ dependency: []
974
+ },
975
+ {
976
+ name: "Group",
977
+ module: "@mantine/core",
978
+ css_name: "@mantine/core/styles/Group.css",
979
+ dependency: []
980
+ },
981
+ {
982
+ name: "Highlight",
983
+ module: "@mantine/core",
984
+ css_name: "",
985
+ dependency: [
986
+ "Text",
987
+ "Mark"
988
+ ]
989
+ },
990
+ {
991
+ name: "HoverCard",
992
+ module: "@mantine/core",
993
+ css_name: "",
994
+ dependency: [
995
+ "Popover",
996
+ "Floating"
997
+ ]
998
+ },
999
+ {
1000
+ name: "Image",
1001
+ module: "@mantine/core",
1002
+ css_name: "@mantine/core/styles/Image.css",
1003
+ dependency: []
1004
+ },
1005
+ {
1006
+ name: "Indicator",
1007
+ module: "@mantine/core",
1008
+ css_name: "@mantine/core/styles/Indicator.css",
1009
+ dependency: []
1010
+ },
1011
+ {
1012
+ name: "InlineInput",
1013
+ module: "@mantine/core",
1014
+ css_name: "@mantine/core/styles/InlineInput.css",
1015
+ dependency: [
1016
+ "Input"
1017
+ ]
1018
+ },
1019
+ {
1020
+ name: "Input",
1021
+ module: "@mantine/core",
1022
+ css_name: "@mantine/core/styles/Input.css",
1023
+ dependency: [
1024
+ "CloseButton"
1025
+ ]
1026
+ },
1027
+ {
1028
+ name: "InputBase",
1029
+ module: "@mantine/core",
1030
+ css_name: "",
1031
+ dependency: [
1032
+ "Input"
1033
+ ]
1034
+ },
1035
+ {
1036
+ name: "InputsGroupFieldset",
1037
+ module: "@mantine/core",
1038
+ css_name: "",
1039
+ dependency: [
1040
+ "Input"
1041
+ ]
1042
+ },
1043
+ {
1044
+ name: "JsonInput",
1045
+ module: "@mantine/core",
1046
+ css_name: "",
1047
+ dependency: [
1048
+ "Input",
1049
+ "Textarea",
1050
+ "InputBase"
1051
+ ]
1052
+ },
1053
+ {
1054
+ name: "Kbd",
1055
+ module: "@mantine/core",
1056
+ css_name: "@mantine/core/styles/Kbd.css",
1057
+ dependency: []
1058
+ },
1059
+ {
1060
+ name: "List",
1061
+ module: "@mantine/core",
1062
+ css_name: "@mantine/core/styles/List.css",
1063
+ dependency: []
1064
+ },
1065
+ {
1066
+ name: "Loader",
1067
+ module: "@mantine/core",
1068
+ css_name: "@mantine/core/styles/Loader.css",
1069
+ dependency: []
1070
+ },
1071
+ {
1072
+ name: "LoadingOverlay",
1073
+ module: "@mantine/core",
1074
+ css_name: "@mantine/core/styles/LoadingOverlay.css",
1075
+ dependency: [
1076
+ "Overlay",
1077
+ "Transition",
1078
+ "Loader"
1079
+ ]
1080
+ },
1081
+ {
1082
+ name: "Mark",
1083
+ module: "@mantine/core",
1084
+ css_name: "@mantine/core/styles/Mark.css",
1085
+ dependency: []
1086
+ },
1087
+ {
1088
+ name: "Menu",
1089
+ module: "@mantine/core",
1090
+ css_name: "@mantine/core/styles/Menu.css",
1091
+ dependency: [
1092
+ "Floating",
1093
+ "Transition",
1094
+ "Popover",
1095
+ "Accordion",
1096
+ "UnstyledButton"
1097
+ ]
1098
+ },
1099
+ {
1100
+ name: "Modal",
1101
+ module: "@mantine/core",
1102
+ css_name: "@mantine/core/styles/Modal.css",
1103
+ dependency: [
1104
+ "ModalBase"
1105
+ ]
1106
+ },
1107
+ {
1108
+ name: "ModalBase",
1109
+ module: "@mantine/core",
1110
+ css_name: "@mantine/core/styles/ModalBase.css",
1111
+ dependency: [
1112
+ "Portal",
1113
+ "Transition"
1114
+ ]
1115
+ },
1116
+ {
1117
+ name: "MultiSelect",
1118
+ module: "@mantine/core",
1119
+ css_name: "",
1120
+ dependency: [
1121
+ "Combobox",
1122
+ "ScrollArea",
1123
+ "Pill",
1124
+ "PillsInput",
1125
+ "InputBase",
1126
+ "Input"
1127
+ ]
1128
+ },
1129
+ {
1130
+ name: "NativeSelect",
1131
+ module: "@mantine/core",
1132
+ css_name: "",
1133
+ dependency: [
1134
+ "Combobox",
1135
+ "Input",
1136
+ "InputBase"
1137
+ ]
1138
+ },
1139
+ {
1140
+ name: "NavLink",
1141
+ module: "@mantine/core",
1142
+ css_name: "@mantine/core/styles/NavLink.css",
1143
+ dependency: [
1144
+ "Accordion",
1145
+ "Collapse",
1146
+ "UnstyledButton"
1147
+ ]
1148
+ },
1149
+ {
1150
+ name: "Notification",
1151
+ module: "@mantine/core",
1152
+ css_name: "@mantine/core/styles/Notification.css",
1153
+ dependency: [
1154
+ "CloseButton",
1155
+ "Loader"
1156
+ ]
1157
+ },
1158
+ {
1159
+ name: "NumberFormatter",
1160
+ module: "@mantine/core",
1161
+ css_name: "",
1162
+ dependency: []
1163
+ },
1164
+ {
1165
+ name: "NumberInput",
1166
+ module: "@mantine/core",
1167
+ css_name: "@mantine/core/styles/NumberInput.css",
1168
+ dependency: [
1169
+ "UnstyledButton",
1170
+ "Input",
1171
+ "InputBase"
1172
+ ]
1173
+ },
1174
+ {
1175
+ name: "Overlay",
1176
+ module: "@mantine/core",
1177
+ css_name: "@mantine/core/styles/Overlay.css",
1178
+ dependency: []
1179
+ },
1180
+ {
1181
+ name: "Pagination",
1182
+ module: "@mantine/core",
1183
+ css_name: "@mantine/core/styles/Pagination.css",
1184
+ dependency: [
1185
+ "UnstyledButton"
1186
+ ]
1187
+ },
1188
+ {
1189
+ name: "Paper",
1190
+ module: "@mantine/core",
1191
+ css_name: "@mantine/core/styles/Paper.css",
1192
+ dependency: []
1193
+ },
1194
+ {
1195
+ name: "PasswordInput",
1196
+ module: "@mantine/core",
1197
+ css_name: "@mantine/core/styles/PasswordInput.css",
1198
+ dependency: [
1199
+ "ActionIcon",
1200
+ "Input",
1201
+ "InputBase"
1202
+ ]
1203
+ },
1204
+ {
1205
+ name: "Pill",
1206
+ module: "@mantine/core",
1207
+ css_name: "@mantine/core/styles/Pill.css",
1208
+ dependency: [
1209
+ "CloseButton"
1210
+ ]
1211
+ },
1212
+ {
1213
+ name: "PillsInput",
1214
+ module: "@mantine/core",
1215
+ css_name: "@mantine/core/styles/PillsInput.css",
1216
+ dependency: [
1217
+ "Input",
1218
+ "InputBase"
1219
+ ]
1220
+ },
1221
+ {
1222
+ name: "PinInput",
1223
+ module: "@mantine/core",
1224
+ css_name: "@mantine/core/styles/PinInput.css",
1225
+ dependency: [
1226
+ "Input",
1227
+ "InputBase",
1228
+ "Group"
1229
+ ]
1230
+ },
1231
+ {
1232
+ name: "Popover",
1233
+ module: "@mantine/core",
1234
+ css_name: "@mantine/core/styles/Popover.css",
1235
+ dependency: [
1236
+ "Portal",
1237
+ "Floating",
1238
+ "Transition",
1239
+ "Overlay",
1240
+ "FocusTrap"
1241
+ ]
1242
+ },
1243
+ {
1244
+ name: "Portal",
1245
+ module: "@mantine/core",
1246
+ css_name: "",
1247
+ dependency: []
1248
+ },
1249
+ {
1250
+ name: "Progress",
1251
+ module: "@mantine/core",
1252
+ css_name: "@mantine/core/styles/Progress.css",
1253
+ dependency: []
1254
+ },
1255
+ {
1256
+ name: "Radio",
1257
+ module: "@mantine/core",
1258
+ css_name: "@mantine/core/styles/Radio.css",
1259
+ dependency: [
1260
+ "InlineInput",
1261
+ "InputsGroupFieldset",
1262
+ "UnstyledButton",
1263
+ "Input"
1264
+ ]
1265
+ },
1266
+ {
1267
+ name: "Rating",
1268
+ module: "@mantine/core",
1269
+ css_name: "@mantine/core/styles/Rating.css",
1270
+ dependency: []
1271
+ },
1272
+ {
1273
+ name: "RingProgress",
1274
+ module: "@mantine/core",
1275
+ css_name: "@mantine/core/styles/RingProgress.css",
1276
+ dependency: [
1277
+ "Tooltip"
1278
+ ]
1279
+ },
1280
+ {
1281
+ name: "ScrollArea",
1282
+ module: "@mantine/core",
1283
+ css_name: "@mantine/core/styles/ScrollArea.css",
1284
+ dependency: []
1285
+ },
1286
+ {
1287
+ name: "SegmentedControl",
1288
+ module: "@mantine/core",
1289
+ css_name: "@mantine/core/styles/SegmentedControl.css",
1290
+ dependency: [
1291
+ "FloatingIndicator"
1292
+ ]
1293
+ },
1294
+ {
1295
+ name: "Select",
1296
+ module: "@mantine/core",
1297
+ css_name: "",
1298
+ dependency: [
1299
+ "Combobox",
1300
+ "ScrollArea",
1301
+ "Input",
1302
+ "InputBase"
1303
+ ]
1304
+ },
1305
+ {
1306
+ name: "SemiCircleProgress",
1307
+ module: "@mantine/core",
1308
+ css_name: "@mantine/core/styles/SemiCircleProgress.css",
1309
+ dependency: []
1310
+ },
1311
+ {
1312
+ name: "SimpleGrid",
1313
+ module: "@mantine/core",
1314
+ css_name: "@mantine/core/styles/SimpleGrid.css",
1315
+ dependency: []
1316
+ },
1317
+ {
1318
+ name: "Skeleton",
1319
+ module: "@mantine/core",
1320
+ css_name: "@mantine/core/styles/Skeleton.css",
1321
+ dependency: []
1322
+ },
1323
+ {
1324
+ name: "Space",
1325
+ module: "@mantine/core",
1326
+ css_name: "",
1327
+ dependency: []
1328
+ },
1329
+ {
1330
+ name: "Spoiler",
1331
+ module: "@mantine/core",
1332
+ css_name: "@mantine/core/styles/Spoiler.css",
1333
+ dependency: [
1334
+ "Anchor"
1335
+ ]
1336
+ },
1337
+ {
1338
+ name: "Stack",
1339
+ module: "@mantine/core",
1340
+ css_name: "@mantine/core/styles/Stack.css",
1341
+ dependency: []
1342
+ },
1343
+ {
1344
+ name: "Stepper",
1345
+ module: "@mantine/core",
1346
+ css_name: "@mantine/core/styles/Stepper.css",
1347
+ dependency: [
1348
+ "UnstyledButton",
1349
+ "Checkbox",
1350
+ "Transition",
1351
+ "Loader"
1352
+ ]
1353
+ },
1354
+ {
1355
+ name: "Switch",
1356
+ module: "@mantine/core",
1357
+ css_name: "@mantine/core/styles/Switch.css",
1358
+ dependency: [
1359
+ "InlineInput",
1360
+ "InputsGroupFieldset",
1361
+ "Input"
1362
+ ]
1363
+ },
1364
+ {
1365
+ name: "Table",
1366
+ module: "@mantine/core",
1367
+ css_name: "@mantine/core/styles/Table.css",
1368
+ dependency: []
1369
+ },
1370
+ {
1371
+ name: "TableOfContents",
1372
+ module: "@mantine/core",
1373
+ css_name: "@mantine/core/styles/TableOfContents.css",
1374
+ dependency: [
1375
+ "UnstyledButton"
1376
+ ]
1377
+ },
1378
+ {
1379
+ name: "Tabs",
1380
+ module: "@mantine/core",
1381
+ css_name: "@mantine/core/styles/Tabs.css",
1382
+ dependency: [
1383
+ "UnstyledButton"
1384
+ ]
1385
+ },
1386
+ {
1387
+ name: "TagsInput",
1388
+ module: "@mantine/core",
1389
+ css_name: "",
1390
+ dependency: [
1391
+ "Combobox",
1392
+ "ScrollArea",
1393
+ "Pill",
1394
+ "PillsInput",
1395
+ "InputBase",
1396
+ "Input"
1397
+ ]
1398
+ },
1399
+ {
1400
+ name: "Text",
1401
+ module: "@mantine/core",
1402
+ css_name: "@mantine/core/styles/Text.css",
1403
+ dependency: []
1404
+ },
1405
+ {
1406
+ name: "Textarea",
1407
+ module: "@mantine/core",
1408
+ css_name: "",
1409
+ dependency: [
1410
+ "Input",
1411
+ "InputBase"
1412
+ ]
1413
+ },
1414
+ {
1415
+ name: "TextInput",
1416
+ module: "@mantine/core",
1417
+ css_name: "",
1418
+ dependency: [
1419
+ "Input",
1420
+ "InputBase"
1421
+ ]
1422
+ },
1423
+ {
1424
+ name: "ThemeIcon",
1425
+ module: "@mantine/core",
1426
+ css_name: "@mantine/core/styles/ThemeIcon.css",
1427
+ dependency: []
1428
+ },
1429
+ {
1430
+ name: "Timeline",
1431
+ module: "@mantine/core",
1432
+ css_name: "@mantine/core/styles/Timeline.css",
1433
+ dependency: []
1434
+ },
1435
+ {
1436
+ name: "Title",
1437
+ module: "@mantine/core",
1438
+ css_name: "@mantine/core/styles/Title.css",
1439
+ dependency: []
1440
+ },
1441
+ {
1442
+ name: "Tooltip",
1443
+ module: "@mantine/core",
1444
+ css_name: "@mantine/core/styles/Tooltip.css",
1445
+ dependency: [
1446
+ "Portal",
1447
+ "Floating",
1448
+ "Transition"
1449
+ ]
1450
+ },
1451
+ {
1452
+ name: "Transition",
1453
+ module: "@mantine/core",
1454
+ css_name: "",
1455
+ dependency: []
1456
+ },
1457
+ {
1458
+ name: "Tree",
1459
+ module: "@mantine/core",
1460
+ css_name: "@mantine/core/styles/Tree.css",
1461
+ dependency: []
1462
+ },
1463
+ {
1464
+ name: "TypographyStylesProvider",
1465
+ module: "@mantine/core",
1466
+ css_name: "@mantine/core/styles/TypographyStylesProvider.css",
1467
+ dependency: []
1468
+ },
1469
+ {
1470
+ name: "UnstyledButton",
1471
+ module: "@mantine/core",
1472
+ css_name: "@mantine/core/styles/UnstyledButton.css",
1473
+ dependency: []
1474
+ },
1475
+ {
1476
+ name: "VisuallyHidden",
1477
+ module: "@mantine/core",
1478
+ css_name: "@mantine/core/styles/VisuallyHidden.css",
1479
+ dependency: []
1480
+ },
1481
+ {
1482
+ name: "Calendar",
1483
+ module: "@mantine/dates",
1484
+ css_name: "@mantine/dates/styles.css",
1485
+ dependency: []
1486
+ },
1487
+ {
1488
+ name: "CalendarHeader",
1489
+ module: "@mantine/dates",
1490
+ css_name: "@mantine/dates/styles.css",
1491
+ dependency: [
1492
+ "UnstyledButton"
1493
+ ]
1494
+ },
1495
+ {
1496
+ name: "DateInput",
1497
+ module: "@mantine/dates",
1498
+ css_name: "@mantine/dates/styles.css",
1499
+ dependency: [
1500
+ "Input",
1501
+ "Popover",
1502
+ "CloseButton"
1503
+ ]
1504
+ },
1505
+ {
1506
+ name: "DateInputMask",
1507
+ module: "@mantine/dates",
1508
+ css_name: "@mantine/dates/styles.css",
1509
+ dependency: [
1510
+ "Popover",
1511
+ "InputBase"
1512
+ ]
1513
+ },
1514
+ {
1515
+ name: "DatePicker",
1516
+ module: "@mantine/dates",
1517
+ css_name: "@mantine/dates/styles.css",
1518
+ dependency: [
1519
+ "UnstyledButton"
1520
+ ]
1521
+ },
1522
+ {
1523
+ name: "DatePickerInput",
1524
+ module: "@mantine/dates",
1525
+ css_name: "@mantine/dates/styles.css",
1526
+ dependency: []
1527
+ },
1528
+ {
1529
+ name: "DatesProvider",
1530
+ module: "@mantine/dates",
1531
+ css_name: "@mantine/dates/styles.css",
1532
+ dependency: []
1533
+ },
1534
+ {
1535
+ name: "DateTimePicker",
1536
+ module: "@mantine/dates",
1537
+ css_name: "@mantine/dates/styles.css",
1538
+ dependency: [
1539
+ "ActionIcon"
1540
+ ]
1541
+ },
1542
+ {
1543
+ name: "Day",
1544
+ module: "@mantine/dates",
1545
+ css_name: "@mantine/dates/styles.css",
1546
+ dependency: [
1547
+ "UnstyledButton"
1548
+ ]
1549
+ },
1550
+ {
1551
+ name: "DecadeLevel",
1552
+ module: "@mantine/dates",
1553
+ css_name: "@mantine/dates/styles.css",
1554
+ dependency: []
1555
+ },
1556
+ {
1557
+ name: "DecadeLevelGroup",
1558
+ module: "@mantine/dates",
1559
+ css_name: "@mantine/dates/styles.css",
1560
+ dependency: []
1561
+ },
1562
+ {
1563
+ name: "HiddenDatesInput",
1564
+ module: "@mantine/dates",
1565
+ css_name: "@mantine/dates/styles.css",
1566
+ dependency: []
1567
+ },
1568
+ {
1569
+ name: "LevelsGroup",
1570
+ module: "@mantine/dates",
1571
+ css_name: "@mantine/dates/styles.css",
1572
+ dependency: []
1573
+ },
1574
+ {
1575
+ name: "Month",
1576
+ module: "@mantine/dates",
1577
+ css_name: "@mantine/dates/styles.css",
1578
+ dependency: []
1579
+ },
1580
+ {
1581
+ name: "MonthLevel",
1582
+ module: "@mantine/dates",
1583
+ css_name: "@mantine/dates/styles.css",
1584
+ dependency: []
1585
+ },
1586
+ {
1587
+ name: "MonthLevelGroup",
1588
+ module: "@mantine/dates",
1589
+ css_name: "@mantine/dates/styles.css",
1590
+ dependency: []
1591
+ },
1592
+ {
1593
+ name: "MonthPicker",
1594
+ module: "@mantine/dates",
1595
+ css_name: "@mantine/dates/styles.css",
1596
+ dependency: []
1597
+ },
1598
+ {
1599
+ name: "MonthPickerInput",
1600
+ module: "@mantine/dates",
1601
+ css_name: "@mantine/dates/styles.css",
1602
+ dependency: []
1603
+ },
1604
+ {
1605
+ name: "MonthsList",
1606
+ module: "@mantine/dates",
1607
+ css_name: "@mantine/dates/styles.css",
1608
+ dependency: []
1609
+ },
1610
+ {
1611
+ name: "PickerControl",
1612
+ module: "@mantine/dates",
1613
+ css_name: "@mantine/dates/styles.css",
1614
+ dependency: [
1615
+ "UnstyledButton"
1616
+ ]
1617
+ },
1618
+ {
1619
+ name: "PickerInputBase",
1620
+ module: "@mantine/dates",
1621
+ css_name: "@mantine/dates/styles.css",
1622
+ dependency: [
1623
+ "Popover",
1624
+ "Input",
1625
+ "Modal"
1626
+ ]
1627
+ },
1628
+ {
1629
+ name: "SpinInput",
1630
+ module: "@mantine/dates",
1631
+ css_name: "@mantine/dates/styles.css",
1632
+ dependency: []
1633
+ },
1634
+ {
1635
+ name: "TimeGrid",
1636
+ module: "@mantine/dates",
1637
+ css_name: "@mantine/dates/styles.css",
1638
+ dependency: [
1639
+ "SimpleGrid"
1640
+ ]
1641
+ },
1642
+ {
1643
+ name: "TimeInput",
1644
+ module: "@mantine/dates",
1645
+ css_name: "@mantine/dates/styles.css",
1646
+ dependency: [
1647
+ "InputBase"
1648
+ ]
1649
+ },
1650
+ {
1651
+ name: "TimePicker",
1652
+ module: "@mantine/dates",
1653
+ css_name: "@mantine/dates/styles.css",
1654
+ dependency: [
1655
+ "SimpleGrid",
1656
+ "ScrollArea",
1657
+ "Popover",
1658
+ "CloseButton",
1659
+ "InputBase"
1660
+ ]
1661
+ },
1662
+ {
1663
+ name: "TimeValue",
1664
+ module: "@mantine/dates",
1665
+ css_name: "@mantine/dates/styles.css",
1666
+ dependency: []
1667
+ },
1668
+ {
1669
+ name: "WeekdaysRow",
1670
+ module: "@mantine/dates",
1671
+ css_name: "@mantine/dates/styles.css",
1672
+ dependency: []
1673
+ },
1674
+ {
1675
+ name: "YearLevel",
1676
+ module: "@mantine/dates",
1677
+ css_name: "@mantine/dates/styles.css",
1678
+ dependency: []
1679
+ },
1680
+ {
1681
+ name: "YearLevelGroup",
1682
+ module: "@mantine/dates",
1683
+ css_name: "@mantine/dates/styles.css",
1684
+ dependency: []
1685
+ },
1686
+ {
1687
+ name: "YearPicker",
1688
+ module: "@mantine/dates",
1689
+ css_name: "@mantine/dates/styles.css",
1690
+ dependency: []
1691
+ },
1692
+ {
1693
+ name: "YearPickerInput",
1694
+ module: "@mantine/dates",
1695
+ css_name: "@mantine/dates/styles.css",
1696
+ dependency: []
1697
+ },
1698
+ {
1699
+ name: "YearsList",
1700
+ module: "@mantine/dates",
1701
+ css_name: "@mantine/dates/styles.css",
1702
+ dependency: []
1703
+ },
1704
+ {
1705
+ name: "AreaChart",
1706
+ module: "@mantine/charts",
1707
+ css_name: "@mantine/charts/styles.css",
1708
+ dependency: []
1709
+ },
1710
+ {
1711
+ name: "BarChart",
1712
+ module: "@mantine/charts",
1713
+ css_name: "@mantine/charts/styles.css",
1714
+ dependency: []
1715
+ },
1716
+ {
1717
+ name: "BubbleChart",
1718
+ module: "@mantine/charts",
1719
+ css_name: "@mantine/charts/styles.css",
1720
+ dependency: [
1721
+ "Text",
1722
+ "Group"
1723
+ ]
1724
+ },
1725
+ {
1726
+ name: "ChartLegend",
1727
+ module: "@mantine/charts",
1728
+ css_name: "@mantine/charts/styles.css",
1729
+ dependency: [
1730
+ "ColorSwatch"
1731
+ ]
1732
+ },
1733
+ {
1734
+ name: "ChartTooltip",
1735
+ module: "@mantine/charts",
1736
+ css_name: "@mantine/charts/styles.css",
1737
+ dependency: []
1738
+ },
1739
+ {
1740
+ name: "CompositeChart",
1741
+ module: "@mantine/charts",
1742
+ css_name: "@mantine/charts/styles.css",
1743
+ dependency: []
1744
+ },
1745
+ {
1746
+ name: "DonutChart",
1747
+ module: "@mantine/charts",
1748
+ css_name: "@mantine/charts/styles.css",
1749
+ dependency: []
1750
+ },
1751
+ {
1752
+ name: "FunnelChart",
1753
+ module: "@mantine/charts",
1754
+ css_name: "@mantine/charts/styles.css",
1755
+ dependency: []
1756
+ },
1757
+ {
1758
+ name: "Heatmap",
1759
+ module: "@mantine/charts",
1760
+ css_name: "@mantine/charts/styles.css",
1761
+ dependency: [
1762
+ "Tooltip"
1763
+ ]
1764
+ },
1765
+ {
1766
+ name: "LineChart",
1767
+ module: "@mantine/charts",
1768
+ css_name: "@mantine/charts/styles.css",
1769
+ dependency: []
1770
+ },
1771
+ {
1772
+ name: "PieChart",
1773
+ module: "@mantine/charts",
1774
+ css_name: "@mantine/charts/styles.css",
1775
+ dependency: []
1776
+ },
1777
+ {
1778
+ name: "PointLabel",
1779
+ module: "@mantine/charts",
1780
+ css_name: "@mantine/charts/styles.css",
1781
+ dependency: []
1782
+ },
1783
+ {
1784
+ name: "RadarChart",
1785
+ module: "@mantine/charts",
1786
+ css_name: "@mantine/charts/styles.css",
1787
+ dependency: []
1788
+ },
1789
+ {
1790
+ name: "RadialBarChart",
1791
+ module: "@mantine/charts",
1792
+ css_name: "@mantine/charts/styles.css",
1793
+ dependency: [
1794
+ "Paper",
1795
+ "ColorSwatch",
1796
+ "Group"
1797
+ ]
1798
+ },
1799
+ {
1800
+ name: "ScatterChart",
1801
+ module: "@mantine/charts",
1802
+ css_name: "@mantine/charts/styles.css",
1803
+ dependency: []
1804
+ },
1805
+ {
1806
+ name: "Sparkline",
1807
+ module: "@mantine/charts",
1808
+ css_name: "@mantine/charts/styles.css",
1809
+ dependency: []
1810
+ },
1811
+ {
1812
+ name: "@mantine/tiptap",
1813
+ module: "@mantine/tiptap",
1814
+ css_name: "@mantine/tiptap/styles.css",
1815
+ dependency: [
1816
+ "UnstyledButton",
1817
+ "TypographyStylesProvider"
1818
+ ]
1819
+ },
1820
+ {
1821
+ name: "@mantine/notifications",
1822
+ module: "@mantine/notifications",
1823
+ css_name: "@mantine/notifications/styles.css",
1824
+ dependency: [
1825
+ "Notification"
1826
+ ]
1827
+ },
1828
+ {
1829
+ name: "@mantine/spotlight",
1830
+ module: "@mantine/spotlight",
1831
+ css_name: "@mantine/spotlight/styles.css",
1832
+ dependency: [
1833
+ "Highlight",
1834
+ "Input",
1835
+ "ScrollArea",
1836
+ "Modal",
1837
+ "UnstyledButton"
1838
+ ]
1839
+ },
1840
+ {
1841
+ name: "@mantine/carousel",
1842
+ module: "@mantine/carousel",
1843
+ css_name: "@mantine/carousel/styles.css",
1844
+ dependency: [
1845
+ "UnstyledButton"
1846
+ ]
1847
+ },
1848
+ {
1849
+ name: "@mantine/dropzone",
1850
+ module: "@mantine/dropzone",
1851
+ css_name: "@mantine/dropzone/styles.css",
1852
+ dependency: [
1853
+ "LoadingOverlay"
1854
+ ]
1855
+ },
1856
+ {
1857
+ name: "@mantine/nprogress",
1858
+ module: "@mantine/nprogress",
1859
+ css_name: "@mantine/nprogress/styles.css",
1860
+ dependency: [
1861
+ "Progress"
1862
+ ]
1863
+ }
1864
+ ];
1865
+
1866
+ // src/hierarchy.json
1867
+ var hierarchy_default = [
1868
+ "AngleSlider",
1869
+ "AppShell",
1870
+ "AspectRatio",
1871
+ "Avatar",
1872
+ "BackgroundImage",
1873
+ "Badge",
1874
+ "Blockquote",
1875
+ "Breadcrumbs",
1876
+ "Center",
1877
+ "Code",
1878
+ "Collapse",
1879
+ "ColorSwatch",
1880
+ "Container",
1881
+ "CopyButton",
1882
+ "Divider",
1883
+ "Fieldset",
1884
+ "FileButton",
1885
+ "Flex",
1886
+ "FloatingIndicator",
1887
+ "Grid",
1888
+ "Group",
1889
+ "Image",
1890
+ "Indicator",
1891
+ "Kbd",
1892
+ "List",
1893
+ "Loader",
1894
+ "Mark",
1895
+ "NumberFormatter",
1896
+ "Overlay",
1897
+ "Paper",
1898
+ "Portal",
1899
+ "Progress",
1900
+ "Rating",
1901
+ "ScrollArea",
1902
+ "SemiCircleProgress",
1903
+ "SimpleGrid",
1904
+ "Skeleton",
1905
+ "Space",
1906
+ "Stack",
1907
+ "Table",
1908
+ "Text",
1909
+ "ThemeIcon",
1910
+ "Timeline",
1911
+ "Title",
1912
+ "Transition",
1913
+ "Tree",
1914
+ "TypographyStylesProvider",
1915
+ "UnstyledButton",
1916
+ "VisuallyHidden",
1917
+ "Calendar",
1918
+ "DatePickerInput",
1919
+ "DatesProvider",
1920
+ "DecadeLevel",
1921
+ "DecadeLevelGroup",
1922
+ "HiddenDatesInput",
1923
+ "LevelsGroup",
1924
+ "Month",
1925
+ "MonthLevel",
1926
+ "MonthLevelGroup",
1927
+ "MonthPicker",
1928
+ "MonthPickerInput",
1929
+ "MonthsList",
1930
+ "SpinInput",
1931
+ "TimeValue",
1932
+ "WeekdaysRow",
1933
+ "YearLevel",
1934
+ "YearLevelGroup",
1935
+ "YearPicker",
1936
+ "YearPickerInput",
1937
+ "YearsList",
1938
+ "AreaChart",
1939
+ "BarChart",
1940
+ "ChartTooltip",
1941
+ "CompositeChart",
1942
+ "DonutChart",
1943
+ "FunnelChart",
1944
+ "LineChart",
1945
+ "PieChart",
1946
+ "PointLabel",
1947
+ "RadarChart",
1948
+ "ScatterChart",
1949
+ "Sparkline",
1950
+ "ChartLegend",
1951
+ "ColorPicker",
1952
+ "SegmentedControl",
1953
+ "Card",
1954
+ "RadialBarChart",
1955
+ "Affix",
1956
+ "@mantine/nprogress",
1957
+ "TimeGrid",
1958
+ "Anchor",
1959
+ "BubbleChart",
1960
+ "Highlight",
1961
+ "ModalBase",
1962
+ "Tooltip",
1963
+ "LoadingOverlay",
1964
+ "PickerControl",
1965
+ "Burger",
1966
+ "Tabs",
1967
+ "Day",
1968
+ "CalendarHeader",
1969
+ "Accordion",
1970
+ "Pagination",
1971
+ "TableOfContents",
1972
+ "Button",
1973
+ "DatePicker",
1974
+ "ActionIcon",
1975
+ "CloseButton",
1976
+ "@mantine/carousel",
1977
+ "@mantine/tiptap",
1978
+ "FocusTrap",
1979
+ "Spoiler",
1980
+ "Drawer",
1981
+ "Modal",
1982
+ "RingProgress",
1983
+ "Heatmap",
1984
+ "@mantine/dropzone",
1985
+ "NavLink",
1986
+ "DateTimePicker",
1987
+ "Notification",
1988
+ "Alert",
1989
+ "Pill",
1990
+ "Input",
1991
+ "Dialog",
1992
+ "Popover",
1993
+ "@mantine/notifications",
1994
+ "@mantine/spotlight",
1995
+ "InputBase",
1996
+ "FileInput",
1997
+ "InputsGroupFieldset",
1998
+ "InlineInput",
1999
+ "PickerInputBase",
2000
+ "Menu",
2001
+ "HoverCard",
2002
+ "DateInput",
2003
+ "DateInputMask",
2004
+ "PasswordInput",
2005
+ "ColorInput",
2006
+ "PinInput",
2007
+ "TimeInput",
2008
+ "TimePicker",
2009
+ "PillsInput",
2010
+ "Textarea",
2011
+ "TextInput",
2012
+ "NumberInput",
2013
+ "Switch",
2014
+ "Radio",
2015
+ "Checkbox",
2016
+ "JsonInput",
2017
+ "Combobox",
2018
+ "Stepper",
2019
+ "Chip",
2020
+ "Select",
2021
+ "MultiSelect",
2022
+ "Autocomplete",
2023
+ "NativeSelect",
2024
+ "TagsInput"
2025
+ ];
2026
+
2027
+ // src/generate.ts
2028
+ var mantine_top = "@import '@mantine/core/styles/baseline.css';\n@import '@mantine/core/styles/default-css-variables.css';\n@import '@mantine/core/styles/global.css';\n";
2029
+ function generateCssFiles(data, outfile, base) {
2030
+ const mData = data_default;
2031
+ const hierarchyData = hierarchy_default;
2032
+ const componentMap = /* @__PURE__ */ new Map();
2033
+ mData.forEach((item) => {
2034
+ componentMap.set(item.name, item);
2035
+ });
2036
+ const hierarchyMap = /* @__PURE__ */ new Map();
2037
+ hierarchyData.forEach((item, index) => {
2038
+ hierarchyMap.set(item, index);
2039
+ });
2040
+ const allComponents = /* @__PURE__ */ new Set();
2041
+ function addComponentAndDependencies(componentName) {
2042
+ if (allComponents.has(componentName)) return;
2043
+ const component = componentMap.get(componentName);
2044
+ if (component) {
2045
+ allComponents.add(componentName);
2046
+ component.dependency.forEach((dep) => {
2047
+ addComponentAndDependencies(dep);
2048
+ });
2049
+ }
2050
+ }
2051
+ data.forEach((componentName) => {
2052
+ addComponentAndDependencies(componentName);
2053
+ });
2054
+ const sortedComponents = Array.from(allComponents).sort((a, b) => {
2055
+ const aHierarchy = hierarchyMap.get(a) ?? Number.MAX_SAFE_INTEGER;
2056
+ const bHierarchy = hierarchyMap.get(b) ?? Number.MAX_SAFE_INTEGER;
2057
+ return aHierarchy - bHierarchy;
2058
+ });
2059
+ const cssImports = sortedComponents.map((componentName) => {
2060
+ const component = componentMap.get(componentName);
2061
+ return component && component.css_name ? `@import "${component.css_name}";` : null;
2062
+ }).filter(Boolean);
2063
+ const cssContent = cssImports.join("\n");
2064
+ if (base) {
2065
+ const finalCssContent = mantine_top + cssContent;
2066
+ writeFileSync(outfile, finalCssContent);
2067
+ } else {
2068
+ writeFileSync(outfile, cssContent);
2069
+ }
2070
+ return cssContent;
2071
+ }
2072
+
2073
+ // src/index.ts
2074
+ var cli = cac("mantine-reduce-css");
2075
+ cli.command("run", "Run Mantine CSS reduction").option("--in <dir>", "Directory to scan for Mantine imports", {
2076
+ default: "./src"
2077
+ }).option("--out <file>", "Output file to save the result", {
2078
+ default: "mantine.css"
2079
+ }).option("--core", "Scan <dir> for @mantine/core packages", {
2080
+ default: true
2081
+ }).option("--dates", "Scan <dir> for @mantine/dates packages", {
2082
+ default: false
2083
+ }).option("--charts", "Scan <dir> for @mantine/charts packages", {
2084
+ default: false
2085
+ }).option("--base", "Include Mantine global CSS in the output file", {
2086
+ default: true
2087
+ }).option(
2088
+ "--code_highlight",
2089
+ "Include @mantine/code-highlight CSS in the output file",
2090
+ {
2091
+ default: false
2092
+ }
2093
+ ).option(
2094
+ "--notification",
2095
+ "Include @mantine/notifications CSS in the output file",
2096
+ {
2097
+ default: false
2098
+ }
2099
+ ).option("--spotlight", "Include @mantine/spotlight CSS in the output file", {
2100
+ default: false
2101
+ }).option("--carousel", "Include @mantine/carousel CSS in the output file", {
2102
+ default: false
2103
+ }).option("--dropzone", "Include @mantine/dropzone CSS in the output file", {
2104
+ default: false
2105
+ }).option("--nprogress", "Include @mantine/nprogress CSS in the output file", {
2106
+ default: false
2107
+ }).option("--tiptap", "Include @mantine/tiptap CSS in the output file", {
2108
+ default: false
2109
+ }).option("--ext <extension>", "File extension to scan for Mantine imports", {
2110
+ default: ["tsx", "jsx"]
2111
+ }).action((options) => {
2112
+ const data = extractMantineImports({
2113
+ directory: options.in,
2114
+ code_highlight: options.code_highlight,
2115
+ notification: options.notification,
2116
+ spotlight: options.spotlight,
2117
+ carousel: options.carousel,
2118
+ dropzone: options.dropzone,
2119
+ nprogress: options.nprogress,
2120
+ dates: options.dates,
2121
+ charts: options.charts,
2122
+ core: options.core,
2123
+ tiptap: options.tiptap,
2124
+ extensions: options.ext
2125
+ });
2126
+ generateCssFiles(data, options.out, options.base);
2127
+ });
2128
+ cli.help();
2129
+ cli.parse();