@pandacss/node 0.0.0-dev-20230321103030 → 0.0.0-dev-20230323194924
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.d.ts +147 -4
- package/dist/index.js +550 -156
- package/dist/index.mjs +552 -160
- package/package.json +17 -14
package/dist/index.mjs
CHANGED
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@6.7.0_typescript@
|
|
30
|
+
// ../../node_modules/.pnpm/tsup@6.7.0_typescript@5.0.2/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
var init_esm_shims = __esm({
|
|
32
|
-
"../../node_modules/.pnpm/tsup@6.7.0_typescript@
|
|
32
|
+
"../../node_modules/.pnpm/tsup@6.7.0_typescript@5.0.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -396,11 +396,381 @@ var require_ansi_align = __commonJS({
|
|
|
396
396
|
init_esm_shims();
|
|
397
397
|
import { discardDuplicate as discardDuplicate2 } from "@pandacss/core";
|
|
398
398
|
|
|
399
|
+
// src/analyze-tokens.ts
|
|
400
|
+
init_esm_shims();
|
|
401
|
+
import { logger } from "@pandacss/logger";
|
|
402
|
+
import { writeFile } from "fs/promises";
|
|
403
|
+
import { Node } from "ts-morph";
|
|
404
|
+
|
|
405
|
+
// src/classify.ts
|
|
406
|
+
init_esm_shims();
|
|
407
|
+
var createReportMaps = () => {
|
|
408
|
+
const byInstanceOfKind = /* @__PURE__ */ new Map();
|
|
409
|
+
const byPropertyName = /* @__PURE__ */ new Map();
|
|
410
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
411
|
+
const byConditionName = /* @__PURE__ */ new Map();
|
|
412
|
+
const byShorthand = /* @__PURE__ */ new Map();
|
|
413
|
+
const byTokenName = /* @__PURE__ */ new Map();
|
|
414
|
+
const byPropertyPath = /* @__PURE__ */ new Map();
|
|
415
|
+
const fromKind = /* @__PURE__ */ new Map();
|
|
416
|
+
const byType = /* @__PURE__ */ new Map();
|
|
417
|
+
const byInstanceName = /* @__PURE__ */ new Map();
|
|
418
|
+
const colorsUsed = /* @__PURE__ */ new Map();
|
|
419
|
+
return {
|
|
420
|
+
byInstanceOfKind,
|
|
421
|
+
byPropertyName,
|
|
422
|
+
byCategory,
|
|
423
|
+
byConditionName,
|
|
424
|
+
byShorthand,
|
|
425
|
+
byTokenName,
|
|
426
|
+
byPropertyPath,
|
|
427
|
+
fromKind,
|
|
428
|
+
byType,
|
|
429
|
+
byInstanceName,
|
|
430
|
+
colorsUsed
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
var colorPropNames = /* @__PURE__ */ new Set(["background", "outline", "border"]);
|
|
434
|
+
var classifyTokens = (ctx, parserResultByFilepath) => {
|
|
435
|
+
const byId = /* @__PURE__ */ new Map();
|
|
436
|
+
const byInstanceId = /* @__PURE__ */ new Map();
|
|
437
|
+
const byFilepath = /* @__PURE__ */ new Map();
|
|
438
|
+
const byInstanceInFilepath = /* @__PURE__ */ new Map();
|
|
439
|
+
const globalMaps = createReportMaps();
|
|
440
|
+
const byFilePathMaps = /* @__PURE__ */ new Map();
|
|
441
|
+
const conditions = new Map(Object.entries(ctx.conditions.values));
|
|
442
|
+
let id = 0, instanceId = 0;
|
|
443
|
+
const isKnownUtility = (reportItem) => {
|
|
444
|
+
const { propName, type, value, from } = reportItem;
|
|
445
|
+
const utility = ctx.config.utilities?.[propName];
|
|
446
|
+
if (utility) {
|
|
447
|
+
if (!utility.shorthand) {
|
|
448
|
+
return Boolean(ctx.tokens.getByName(`${utility.values}.${value}`));
|
|
449
|
+
}
|
|
450
|
+
return Boolean(ctx.tokens.getByName(`${utility.values}.${value}`));
|
|
451
|
+
}
|
|
452
|
+
if (type === "pattern") {
|
|
453
|
+
const pattern = ctx.patterns.getConfig(from.toLowerCase());
|
|
454
|
+
const patternProp = pattern.properties[propName];
|
|
455
|
+
if (!patternProp)
|
|
456
|
+
return false;
|
|
457
|
+
if (patternProp.type === "boolean" || patternProp.type === "number") {
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
if (patternProp.type === "property") {
|
|
461
|
+
return Boolean(ctx.config.utilities?.[patternProp.value]);
|
|
462
|
+
}
|
|
463
|
+
if (patternProp.type === "enum") {
|
|
464
|
+
return Boolean(patternProp.value.includes(String(value)));
|
|
465
|
+
}
|
|
466
|
+
if (patternProp.type === "token") {
|
|
467
|
+
return Boolean(ctx.tokens.getByName(`${patternProp.value}.${value}`));
|
|
468
|
+
}
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
return false;
|
|
472
|
+
};
|
|
473
|
+
parserResultByFilepath.forEach((parserResult, filepath) => {
|
|
474
|
+
if (parserResult.isEmpty())
|
|
475
|
+
return;
|
|
476
|
+
const localMaps = createReportMaps();
|
|
477
|
+
const addTo = (map, key, value) => {
|
|
478
|
+
const set = map.get(key) ?? /* @__PURE__ */ new Set();
|
|
479
|
+
set.add(value);
|
|
480
|
+
map.set(key, set);
|
|
481
|
+
};
|
|
482
|
+
const processMap = (map, current, reportInstanceItem) => {
|
|
483
|
+
const { from, type, kind } = reportInstanceItem;
|
|
484
|
+
map.value.forEach((attrNode, attrName) => {
|
|
485
|
+
if (attrNode.isLiteral() || attrNode.isEmptyInitializer()) {
|
|
486
|
+
const value = attrNode.isLiteral() ? attrNode.value : true;
|
|
487
|
+
const reportItem = {
|
|
488
|
+
id: id++,
|
|
489
|
+
instanceId,
|
|
490
|
+
category: "unknown",
|
|
491
|
+
propName: attrName,
|
|
492
|
+
from,
|
|
493
|
+
type,
|
|
494
|
+
kind,
|
|
495
|
+
filepath,
|
|
496
|
+
path: current.concat(attrName),
|
|
497
|
+
value,
|
|
498
|
+
box: attrNode,
|
|
499
|
+
isKnown: false
|
|
500
|
+
};
|
|
501
|
+
reportInstanceItem.contains.push(reportItem.id);
|
|
502
|
+
if (conditions.has(attrName)) {
|
|
503
|
+
addTo(globalMaps.byConditionName, attrName, reportItem.id);
|
|
504
|
+
addTo(localMaps.byConditionName, attrName, reportItem.id);
|
|
505
|
+
reportItem.propName = current[0] ?? attrName;
|
|
506
|
+
reportItem.isKnown = isKnownUtility(reportItem);
|
|
507
|
+
reportItem.conditionName = attrName;
|
|
508
|
+
} else {
|
|
509
|
+
if (current.length && conditions.has(current[0])) {
|
|
510
|
+
reportItem.conditionName = current[0];
|
|
511
|
+
addTo(globalMaps.byConditionName, current[0], reportItem.id);
|
|
512
|
+
addTo(localMaps.byConditionName, current[0], reportItem.id);
|
|
513
|
+
}
|
|
514
|
+
const propName = ctx.utility.shorthands.get(attrName) ?? attrName;
|
|
515
|
+
reportItem.propName = propName;
|
|
516
|
+
const utility = ctx.config.utilities?.[propName];
|
|
517
|
+
reportItem.isKnown = isKnownUtility(reportItem);
|
|
518
|
+
const category = typeof utility?.values === "string" ? utility?.values : "unknown";
|
|
519
|
+
reportItem.category = category;
|
|
520
|
+
addTo(globalMaps.byPropertyName, propName, reportItem.id);
|
|
521
|
+
addTo(localMaps.byPropertyName, propName, reportItem.id);
|
|
522
|
+
addTo(globalMaps.byCategory, category, reportItem.id);
|
|
523
|
+
addTo(localMaps.byCategory, category, reportItem.id);
|
|
524
|
+
if (propName.toLowerCase().includes("color") || colorPropNames.has(propName)) {
|
|
525
|
+
addTo(globalMaps.colorsUsed, value, reportItem.id);
|
|
526
|
+
addTo(localMaps.colorsUsed, value, reportItem.id);
|
|
527
|
+
}
|
|
528
|
+
if (ctx.utility.shorthands.has(attrName)) {
|
|
529
|
+
addTo(globalMaps.byShorthand, attrName, reportItem.id);
|
|
530
|
+
addTo(localMaps.byShorthand, attrName, reportItem.id);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (current.length) {
|
|
534
|
+
addTo(globalMaps.byPropertyPath, reportItem.path.join("."), reportItem.id);
|
|
535
|
+
addTo(localMaps.byPropertyPath, reportItem.path.join("."), reportItem.id);
|
|
536
|
+
}
|
|
537
|
+
addTo(globalMaps.byTokenName, String(value), reportItem.id);
|
|
538
|
+
addTo(localMaps.byTokenName, String(value), reportItem.id);
|
|
539
|
+
addTo(globalMaps.byType, type, reportItem.id);
|
|
540
|
+
addTo(localMaps.byType, type, reportItem.id);
|
|
541
|
+
addTo(globalMaps.byInstanceName, from, reportItem.id);
|
|
542
|
+
addTo(localMaps.byInstanceName, from, reportItem.id);
|
|
543
|
+
addTo(globalMaps.fromKind, kind, reportItem.id);
|
|
544
|
+
addTo(localMaps.fromKind, kind, reportItem.id);
|
|
545
|
+
addTo(byFilepath, filepath, reportItem.id);
|
|
546
|
+
byId.set(reportItem.id, reportItem);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (attrNode.isMap() && attrNode.value.size) {
|
|
550
|
+
return processMap(attrNode, current.concat(attrName), reportInstanceItem);
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
};
|
|
554
|
+
const processResultItem = (item, kind) => {
|
|
555
|
+
if (!item.box || item.box.isUnresolvable()) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (!item.data) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const from = item.name;
|
|
562
|
+
const type = item.type;
|
|
563
|
+
const reportInstanceItem = {
|
|
564
|
+
instanceId: instanceId++,
|
|
565
|
+
from,
|
|
566
|
+
type,
|
|
567
|
+
kind,
|
|
568
|
+
filepath,
|
|
569
|
+
value: item.data,
|
|
570
|
+
box: item.box,
|
|
571
|
+
contains: []
|
|
572
|
+
};
|
|
573
|
+
if (item.box.isList()) {
|
|
574
|
+
addTo(byInstanceInFilepath, filepath, reportInstanceItem.instanceId);
|
|
575
|
+
return reportInstanceItem;
|
|
576
|
+
}
|
|
577
|
+
if (item.box.isMap() && item.box.value.size) {
|
|
578
|
+
addTo(byInstanceInFilepath, filepath, reportInstanceItem.instanceId);
|
|
579
|
+
processMap(item.box, [], reportInstanceItem);
|
|
580
|
+
return reportInstanceItem;
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
const processComponentResultItem = (item) => {
|
|
584
|
+
const reportInstanceItem = processResultItem(item, "component");
|
|
585
|
+
if (!reportInstanceItem)
|
|
586
|
+
return;
|
|
587
|
+
addTo(globalMaps.byInstanceOfKind, "component", reportInstanceItem.instanceId);
|
|
588
|
+
addTo(localMaps.byInstanceOfKind, "component", reportInstanceItem.instanceId);
|
|
589
|
+
byInstanceId.set(reportInstanceItem.instanceId, reportInstanceItem);
|
|
590
|
+
};
|
|
591
|
+
const processFunctionResultItem = (item) => {
|
|
592
|
+
const reportInstanceItem = processResultItem(item, "function");
|
|
593
|
+
if (!reportInstanceItem)
|
|
594
|
+
return;
|
|
595
|
+
addTo(globalMaps.byInstanceOfKind, "function", reportInstanceItem.instanceId);
|
|
596
|
+
addTo(localMaps.byInstanceOfKind, "function", reportInstanceItem.instanceId);
|
|
597
|
+
byInstanceId.set(reportInstanceItem.instanceId, reportInstanceItem);
|
|
598
|
+
};
|
|
599
|
+
parserResult.jsx.forEach(processComponentResultItem);
|
|
600
|
+
parserResult.css.forEach(processFunctionResultItem);
|
|
601
|
+
parserResult.cva.forEach(processFunctionResultItem);
|
|
602
|
+
parserResult.pattern.forEach((itemList) => {
|
|
603
|
+
itemList.forEach(processFunctionResultItem);
|
|
604
|
+
});
|
|
605
|
+
parserResult.recipe.forEach((itemList) => {
|
|
606
|
+
itemList.forEach(processFunctionResultItem);
|
|
607
|
+
});
|
|
608
|
+
byFilePathMaps.set(filepath, localMaps);
|
|
609
|
+
});
|
|
610
|
+
const pickCount = 10;
|
|
611
|
+
const filesWithMostInstance = Object.fromEntries(
|
|
612
|
+
Array.from(byInstanceInFilepath.entries()).map(([filepath, list]) => [filepath, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount)
|
|
613
|
+
);
|
|
614
|
+
const filesWithMostPropValueCombinations = Object.fromEntries(
|
|
615
|
+
Array.from(byFilepath.entries()).map(([token, list]) => [token, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount)
|
|
616
|
+
);
|
|
617
|
+
return {
|
|
618
|
+
counts: {
|
|
619
|
+
filesWithTokens: byFilepath.size,
|
|
620
|
+
propNameUsed: globalMaps.byPropertyName.size,
|
|
621
|
+
tokenUsed: globalMaps.byTokenName.size,
|
|
622
|
+
shorthandUsed: globalMaps.byShorthand.size,
|
|
623
|
+
propertyPathUsed: globalMaps.byPropertyPath.size,
|
|
624
|
+
typeUsed: globalMaps.byType.size,
|
|
625
|
+
instanceNameUsed: globalMaps.byInstanceName.size,
|
|
626
|
+
kindUsed: globalMaps.fromKind.size,
|
|
627
|
+
instanceOfKindUsed: globalMaps.byInstanceOfKind.size,
|
|
628
|
+
colorsUsed: globalMaps.colorsUsed.size
|
|
629
|
+
},
|
|
630
|
+
stats: {
|
|
631
|
+
//
|
|
632
|
+
filesWithMostInstance,
|
|
633
|
+
filesWithMostPropValueCombinations,
|
|
634
|
+
//
|
|
635
|
+
mostUseds: getXMostUseds(globalMaps, 10)
|
|
636
|
+
},
|
|
637
|
+
details: {
|
|
638
|
+
byId,
|
|
639
|
+
byInstanceId,
|
|
640
|
+
byFilepath,
|
|
641
|
+
byInstanceInFilepath,
|
|
642
|
+
globalMaps,
|
|
643
|
+
byFilePathMaps
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
var getXMostUseds = (globalMaps, pickCount) => {
|
|
648
|
+
return {
|
|
649
|
+
propNames: getMostUsedInMap(globalMaps.byPropertyName, pickCount),
|
|
650
|
+
tokens: getMostUsedInMap(globalMaps.byTokenName, pickCount),
|
|
651
|
+
shorthands: getMostUsedInMap(globalMaps.byShorthand, pickCount),
|
|
652
|
+
conditions: getMostUsedInMap(globalMaps.byConditionName, pickCount),
|
|
653
|
+
propertyPaths: getMostUsedInMap(globalMaps.byPropertyPath, pickCount),
|
|
654
|
+
categories: getMostUsedInMap(globalMaps.byCategory, pickCount),
|
|
655
|
+
types: getMostUsedInMap(globalMaps.byType, pickCount),
|
|
656
|
+
instanceNames: getMostUsedInMap(globalMaps.byInstanceName, pickCount),
|
|
657
|
+
fromKinds: getMostUsedInMap(globalMaps.fromKind, pickCount),
|
|
658
|
+
instanceOfKinds: getMostUsedInMap(globalMaps.byInstanceOfKind, pickCount),
|
|
659
|
+
colors: getMostUsedInMap(globalMaps.colorsUsed, pickCount)
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
var getMostUsedInMap = (map, pickCount) => {
|
|
663
|
+
return Array.from(map.entries()).map(([key, list]) => [key, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount).map(([key, count]) => ({ key, count }));
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
// src/get-node-range.ts
|
|
667
|
+
init_esm_shims();
|
|
668
|
+
var getNodeRange = (node) => {
|
|
669
|
+
const src = node.getSourceFile();
|
|
670
|
+
const [startPosition, endPosition] = [node.getStart(), node.getEnd()];
|
|
671
|
+
const startInfo = src.getLineAndColumnAtPos(startPosition);
|
|
672
|
+
const endInfo = src.getLineAndColumnAtPos(endPosition);
|
|
673
|
+
return {
|
|
674
|
+
startPosition,
|
|
675
|
+
startLineNumber: startInfo.line,
|
|
676
|
+
startColumn: startInfo.column,
|
|
677
|
+
endPosition,
|
|
678
|
+
endLineNumber: endInfo.line,
|
|
679
|
+
endColumn: endInfo.column
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
// src/analyze-tokens.ts
|
|
684
|
+
import gzipSize from "gzip-size";
|
|
685
|
+
import { filesize } from "filesize";
|
|
686
|
+
function analyzeTokens(ctx, options = {
|
|
687
|
+
mode: "box-extractor"
|
|
688
|
+
}) {
|
|
689
|
+
const parserResultByFilepath = /* @__PURE__ */ new Map();
|
|
690
|
+
const extractTimeByFilepath = /* @__PURE__ */ new Map();
|
|
691
|
+
ctx.getFiles().map((file) => {
|
|
692
|
+
const start2 = performance.now();
|
|
693
|
+
const result = ctx.project.parseSourceFile(file, ctx.properties, options.mode);
|
|
694
|
+
const extractMs = performance.now() - start2;
|
|
695
|
+
extractTimeByFilepath.set(file, extractMs);
|
|
696
|
+
logger.debug("analyze", `Extracted ${file} in ${extractMs}ms`);
|
|
697
|
+
if (result) {
|
|
698
|
+
parserResultByFilepath.set(file, result);
|
|
699
|
+
options.onResult?.(file, result);
|
|
700
|
+
}
|
|
701
|
+
return [file, result];
|
|
702
|
+
}).filter(([, result]) => result);
|
|
703
|
+
const totalMs = Array.from(extractTimeByFilepath.values()).reduce((a, b) => a + b, 0);
|
|
704
|
+
logger.debug("analyze", `Analyzed ${ctx.getFiles().length} files in ${totalMs.toFixed(2)}ms`);
|
|
705
|
+
const minify = ctx.config.minify;
|
|
706
|
+
const files = ctx.chunks.getFiles();
|
|
707
|
+
ctx.config.minify = false;
|
|
708
|
+
const css = ctx.getCss({ files });
|
|
709
|
+
ctx.config.minify = true;
|
|
710
|
+
const minifiedCss = ctx.getCss({ files });
|
|
711
|
+
ctx.config.minify = minify;
|
|
712
|
+
const start = performance.now();
|
|
713
|
+
const analysis = classifyTokens(ctx, parserResultByFilepath);
|
|
714
|
+
const classifyMs = performance.now() - start;
|
|
715
|
+
return Object.assign(
|
|
716
|
+
{
|
|
717
|
+
duration: {
|
|
718
|
+
extractTimeByFiles: Object.fromEntries(extractTimeByFilepath.entries()),
|
|
719
|
+
extractTotal: totalMs,
|
|
720
|
+
classify: classifyMs
|
|
721
|
+
},
|
|
722
|
+
fileSizes: {
|
|
723
|
+
lineCount: css.split("\n").length,
|
|
724
|
+
// rulesCount: css.split('{').length - 1, ?
|
|
725
|
+
normal: filesize(Buffer.byteLength(css, "utf-8")),
|
|
726
|
+
minified: filesize(Buffer.byteLength(minifiedCss, "utf-8")),
|
|
727
|
+
gzip: {
|
|
728
|
+
normal: filesize(gzipSize.sync(css)),
|
|
729
|
+
minified: filesize(gzipSize.sync(minifiedCss))
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
analysis
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
var analyzeResultSerializer = (_key, value) => {
|
|
737
|
+
if (value instanceof Set) {
|
|
738
|
+
return Array.from(value);
|
|
739
|
+
}
|
|
740
|
+
if (value instanceof Map) {
|
|
741
|
+
return Object.fromEntries(value);
|
|
742
|
+
}
|
|
743
|
+
if (Node.isNode(value)) {
|
|
744
|
+
return { kind: value.getKindName(), range: getNodeRange(value) };
|
|
745
|
+
}
|
|
746
|
+
return value;
|
|
747
|
+
};
|
|
748
|
+
var writeAnalyzeJSON = (fileName, result, ctx) => {
|
|
749
|
+
result.details.byInstanceId.forEach((item) => {
|
|
750
|
+
item.box = { type: item.box.type, node: item.box.getNode(), stack: item.box.getStack() };
|
|
751
|
+
});
|
|
752
|
+
return writeFile(
|
|
753
|
+
fileName,
|
|
754
|
+
JSON.stringify(
|
|
755
|
+
Object.assign(result, {
|
|
756
|
+
cwd: ctx.config.cwd,
|
|
757
|
+
theme: ctx.config.theme,
|
|
758
|
+
utilities: ctx.config.utilities,
|
|
759
|
+
conditions: ctx.config.conditions,
|
|
760
|
+
shorthands: ctx.utility.shorthands,
|
|
761
|
+
parserOptions: ctx.parserOptions
|
|
762
|
+
}),
|
|
763
|
+
analyzeResultSerializer,
|
|
764
|
+
2
|
|
765
|
+
)
|
|
766
|
+
);
|
|
767
|
+
};
|
|
768
|
+
|
|
399
769
|
// src/builder.ts
|
|
400
770
|
init_esm_shims();
|
|
401
771
|
import { discardDuplicate, mergeCss as mergeCss2 } from "@pandacss/core";
|
|
402
772
|
import { ConfigNotFoundError } from "@pandacss/error";
|
|
403
|
-
import { logger as
|
|
773
|
+
import { logger as logger4 } from "@pandacss/logger";
|
|
404
774
|
import { toHash } from "@pandacss/shared";
|
|
405
775
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
406
776
|
import { statSync } from "fs-extra";
|
|
@@ -454,7 +824,7 @@ var getChunkEngine = ({ paths, config, runtime: { path, fs } }) => ({
|
|
|
454
824
|
|
|
455
825
|
// src/node-runtime.ts
|
|
456
826
|
init_esm_shims();
|
|
457
|
-
import { logger } from "@pandacss/logger";
|
|
827
|
+
import { logger as logger2 } from "@pandacss/logger";
|
|
458
828
|
import chokidar from "chokidar";
|
|
459
829
|
import glob from "fast-glob";
|
|
460
830
|
import {
|
|
@@ -464,7 +834,7 @@ import {
|
|
|
464
834
|
readdirSync,
|
|
465
835
|
readFileSync,
|
|
466
836
|
removeSync,
|
|
467
|
-
writeFile,
|
|
837
|
+
writeFile as writeFile2,
|
|
468
838
|
writeFileSync
|
|
469
839
|
} from "fs-extra";
|
|
470
840
|
import { dirname, extname, isAbsolute, join, relative, sep } from "path";
|
|
@@ -496,7 +866,7 @@ var nodeRuntime = {
|
|
|
496
866
|
return [];
|
|
497
867
|
return glob.sync(opts.include, { cwd: opts.cwd, ignore: opts.exclude, absolute: true });
|
|
498
868
|
},
|
|
499
|
-
writeFile,
|
|
869
|
+
writeFile: writeFile2,
|
|
500
870
|
writeFileSync,
|
|
501
871
|
readDirSync: readdirSync,
|
|
502
872
|
rmDirSync: emptyDirSync,
|
|
@@ -515,7 +885,7 @@ var nodeRuntime = {
|
|
|
515
885
|
ignored: exclude,
|
|
516
886
|
awaitWriteFinish: coalesce ? { stabilityThreshold: 50, pollInterval: 10 } : false
|
|
517
887
|
});
|
|
518
|
-
|
|
888
|
+
logger2.debug("watch:file", `watching [${include}]`);
|
|
519
889
|
process.once("SIGINT", async () => {
|
|
520
890
|
await watcher.close();
|
|
521
891
|
});
|
|
@@ -525,10 +895,10 @@ var nodeRuntime = {
|
|
|
525
895
|
};
|
|
526
896
|
process.setMaxListeners(Infinity);
|
|
527
897
|
process.on("unhandledRejection", (reason) => {
|
|
528
|
-
|
|
898
|
+
logger2.error("unhandled-rejection", reason);
|
|
529
899
|
});
|
|
530
900
|
process.on("uncaughtException", (reason) => {
|
|
531
|
-
|
|
901
|
+
logger2.error("uncaught-exception", reason);
|
|
532
902
|
});
|
|
533
903
|
|
|
534
904
|
// src/output-engine.ts
|
|
@@ -592,18 +962,21 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
592
962
|
if (config) {
|
|
593
963
|
Object.assign(conf.config, config);
|
|
594
964
|
}
|
|
965
|
+
if (options.cwd) {
|
|
966
|
+
conf.config.cwd = options.cwd;
|
|
967
|
+
}
|
|
595
968
|
return createContext(conf);
|
|
596
969
|
}
|
|
597
970
|
|
|
598
971
|
// src/extract.ts
|
|
599
972
|
init_esm_shims();
|
|
600
|
-
import { logger as
|
|
973
|
+
import { logger as logger3 } from "@pandacss/logger";
|
|
601
974
|
import { Obj as Obj2, pipe as pipe2, tap as tap2, tryCatch } from "lil-fp";
|
|
602
975
|
|
|
603
976
|
// src/cli-box.ts
|
|
604
977
|
init_esm_shims();
|
|
605
978
|
|
|
606
|
-
// ../../node_modules/.pnpm/boxen@7.0.
|
|
979
|
+
// ../../node_modules/.pnpm/boxen@7.0.2/node_modules/boxen/index.js
|
|
607
980
|
init_esm_shims();
|
|
608
981
|
import process3 from "node:process";
|
|
609
982
|
|
|
@@ -673,102 +1046,110 @@ function stringWidth(string, options = {}) {
|
|
|
673
1046
|
return width;
|
|
674
1047
|
}
|
|
675
1048
|
|
|
676
|
-
// ../../node_modules/.pnpm/chalk@5.0
|
|
1049
|
+
// ../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
|
|
677
1050
|
init_esm_shims();
|
|
678
1051
|
|
|
679
|
-
// ../../node_modules/.pnpm/chalk@5.0
|
|
1052
|
+
// ../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
680
1053
|
init_esm_shims();
|
|
681
1054
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
682
1055
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
683
1056
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
684
1057
|
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1058
|
+
var styles = {
|
|
1059
|
+
modifier: {
|
|
1060
|
+
reset: [0, 0],
|
|
1061
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1062
|
+
bold: [1, 22],
|
|
1063
|
+
dim: [2, 22],
|
|
1064
|
+
italic: [3, 23],
|
|
1065
|
+
underline: [4, 24],
|
|
1066
|
+
overline: [53, 55],
|
|
1067
|
+
inverse: [7, 27],
|
|
1068
|
+
hidden: [8, 28],
|
|
1069
|
+
strikethrough: [9, 29]
|
|
1070
|
+
},
|
|
1071
|
+
color: {
|
|
1072
|
+
black: [30, 39],
|
|
1073
|
+
red: [31, 39],
|
|
1074
|
+
green: [32, 39],
|
|
1075
|
+
yellow: [33, 39],
|
|
1076
|
+
blue: [34, 39],
|
|
1077
|
+
magenta: [35, 39],
|
|
1078
|
+
cyan: [36, 39],
|
|
1079
|
+
white: [37, 39],
|
|
1080
|
+
// Bright color
|
|
1081
|
+
blackBright: [90, 39],
|
|
1082
|
+
gray: [90, 39],
|
|
1083
|
+
// Alias of `blackBright`
|
|
1084
|
+
grey: [90, 39],
|
|
1085
|
+
// Alias of `blackBright`
|
|
1086
|
+
redBright: [91, 39],
|
|
1087
|
+
greenBright: [92, 39],
|
|
1088
|
+
yellowBright: [93, 39],
|
|
1089
|
+
blueBright: [94, 39],
|
|
1090
|
+
magentaBright: [95, 39],
|
|
1091
|
+
cyanBright: [96, 39],
|
|
1092
|
+
whiteBright: [97, 39]
|
|
1093
|
+
},
|
|
1094
|
+
bgColor: {
|
|
1095
|
+
bgBlack: [40, 49],
|
|
1096
|
+
bgRed: [41, 49],
|
|
1097
|
+
bgGreen: [42, 49],
|
|
1098
|
+
bgYellow: [43, 49],
|
|
1099
|
+
bgBlue: [44, 49],
|
|
1100
|
+
bgMagenta: [45, 49],
|
|
1101
|
+
bgCyan: [46, 49],
|
|
1102
|
+
bgWhite: [47, 49],
|
|
1103
|
+
// Bright color
|
|
1104
|
+
bgBlackBright: [100, 49],
|
|
1105
|
+
bgGray: [100, 49],
|
|
1106
|
+
// Alias of `bgBlackBright`
|
|
1107
|
+
bgGrey: [100, 49],
|
|
1108
|
+
// Alias of `bgBlackBright`
|
|
1109
|
+
bgRedBright: [101, 49],
|
|
1110
|
+
bgGreenBright: [102, 49],
|
|
1111
|
+
bgYellowBright: [103, 49],
|
|
1112
|
+
bgBlueBright: [104, 49],
|
|
1113
|
+
bgMagentaBright: [105, 49],
|
|
1114
|
+
bgCyanBright: [106, 49],
|
|
1115
|
+
bgWhiteBright: [107, 49]
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
1119
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
1120
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
1121
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
685
1122
|
function assembleStyles() {
|
|
686
1123
|
const codes = /* @__PURE__ */ new Map();
|
|
687
|
-
const
|
|
688
|
-
modifier: {
|
|
689
|
-
reset: [0, 0],
|
|
690
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
691
|
-
bold: [1, 22],
|
|
692
|
-
dim: [2, 22],
|
|
693
|
-
italic: [3, 23],
|
|
694
|
-
underline: [4, 24],
|
|
695
|
-
overline: [53, 55],
|
|
696
|
-
inverse: [7, 27],
|
|
697
|
-
hidden: [8, 28],
|
|
698
|
-
strikethrough: [9, 29]
|
|
699
|
-
},
|
|
700
|
-
color: {
|
|
701
|
-
black: [30, 39],
|
|
702
|
-
red: [31, 39],
|
|
703
|
-
green: [32, 39],
|
|
704
|
-
yellow: [33, 39],
|
|
705
|
-
blue: [34, 39],
|
|
706
|
-
magenta: [35, 39],
|
|
707
|
-
cyan: [36, 39],
|
|
708
|
-
white: [37, 39],
|
|
709
|
-
// Bright color
|
|
710
|
-
blackBright: [90, 39],
|
|
711
|
-
redBright: [91, 39],
|
|
712
|
-
greenBright: [92, 39],
|
|
713
|
-
yellowBright: [93, 39],
|
|
714
|
-
blueBright: [94, 39],
|
|
715
|
-
magentaBright: [95, 39],
|
|
716
|
-
cyanBright: [96, 39],
|
|
717
|
-
whiteBright: [97, 39]
|
|
718
|
-
},
|
|
719
|
-
bgColor: {
|
|
720
|
-
bgBlack: [40, 49],
|
|
721
|
-
bgRed: [41, 49],
|
|
722
|
-
bgGreen: [42, 49],
|
|
723
|
-
bgYellow: [43, 49],
|
|
724
|
-
bgBlue: [44, 49],
|
|
725
|
-
bgMagenta: [45, 49],
|
|
726
|
-
bgCyan: [46, 49],
|
|
727
|
-
bgWhite: [47, 49],
|
|
728
|
-
// Bright color
|
|
729
|
-
bgBlackBright: [100, 49],
|
|
730
|
-
bgRedBright: [101, 49],
|
|
731
|
-
bgGreenBright: [102, 49],
|
|
732
|
-
bgYellowBright: [103, 49],
|
|
733
|
-
bgBlueBright: [104, 49],
|
|
734
|
-
bgMagentaBright: [105, 49],
|
|
735
|
-
bgCyanBright: [106, 49],
|
|
736
|
-
bgWhiteBright: [107, 49]
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
styles2.color.gray = styles2.color.blackBright;
|
|
740
|
-
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
741
|
-
styles2.color.grey = styles2.color.blackBright;
|
|
742
|
-
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
743
|
-
for (const [groupName, group] of Object.entries(styles2)) {
|
|
1124
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
744
1125
|
for (const [styleName, style] of Object.entries(group)) {
|
|
745
|
-
|
|
1126
|
+
styles[styleName] = {
|
|
746
1127
|
open: `\x1B[${style[0]}m`,
|
|
747
1128
|
close: `\x1B[${style[1]}m`
|
|
748
1129
|
};
|
|
749
|
-
group[styleName] =
|
|
1130
|
+
group[styleName] = styles[styleName];
|
|
750
1131
|
codes.set(style[0], style[1]);
|
|
751
1132
|
}
|
|
752
|
-
Object.defineProperty(
|
|
1133
|
+
Object.defineProperty(styles, groupName, {
|
|
753
1134
|
value: group,
|
|
754
1135
|
enumerable: false
|
|
755
1136
|
});
|
|
756
1137
|
}
|
|
757
|
-
Object.defineProperty(
|
|
1138
|
+
Object.defineProperty(styles, "codes", {
|
|
758
1139
|
value: codes,
|
|
759
1140
|
enumerable: false
|
|
760
1141
|
});
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
Object.defineProperties(
|
|
1142
|
+
styles.color.close = "\x1B[39m";
|
|
1143
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1144
|
+
styles.color.ansi = wrapAnsi16();
|
|
1145
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1146
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1147
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1148
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1149
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1150
|
+
Object.defineProperties(styles, {
|
|
770
1151
|
rgbToAnsi256: {
|
|
771
|
-
value
|
|
1152
|
+
value(red, green, blue) {
|
|
772
1153
|
if (red === green && green === blue) {
|
|
773
1154
|
if (red < 8) {
|
|
774
1155
|
return 16;
|
|
@@ -783,12 +1164,12 @@ function assembleStyles() {
|
|
|
783
1164
|
enumerable: false
|
|
784
1165
|
},
|
|
785
1166
|
hexToRgb: {
|
|
786
|
-
value
|
|
787
|
-
const matches = /
|
|
1167
|
+
value(hex) {
|
|
1168
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
788
1169
|
if (!matches) {
|
|
789
1170
|
return [0, 0, 0];
|
|
790
1171
|
}
|
|
791
|
-
let
|
|
1172
|
+
let [colorString] = matches;
|
|
792
1173
|
if (colorString.length === 3) {
|
|
793
1174
|
colorString = [...colorString].map((character) => character + character).join("");
|
|
794
1175
|
}
|
|
@@ -804,11 +1185,11 @@ function assembleStyles() {
|
|
|
804
1185
|
enumerable: false
|
|
805
1186
|
},
|
|
806
1187
|
hexToAnsi256: {
|
|
807
|
-
value: (hex) =>
|
|
1188
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
808
1189
|
enumerable: false
|
|
809
1190
|
},
|
|
810
1191
|
ansi256ToAnsi: {
|
|
811
|
-
value
|
|
1192
|
+
value(code) {
|
|
812
1193
|
if (code < 8) {
|
|
813
1194
|
return 30 + code;
|
|
814
1195
|
}
|
|
@@ -842,25 +1223,25 @@ function assembleStyles() {
|
|
|
842
1223
|
enumerable: false
|
|
843
1224
|
},
|
|
844
1225
|
rgbToAnsi: {
|
|
845
|
-
value: (red, green, blue) =>
|
|
1226
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
846
1227
|
enumerable: false
|
|
847
1228
|
},
|
|
848
1229
|
hexToAnsi: {
|
|
849
|
-
value: (hex) =>
|
|
1230
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
850
1231
|
enumerable: false
|
|
851
1232
|
}
|
|
852
1233
|
});
|
|
853
|
-
return
|
|
1234
|
+
return styles;
|
|
854
1235
|
}
|
|
855
1236
|
var ansiStyles = assembleStyles();
|
|
856
1237
|
var ansi_styles_default = ansiStyles;
|
|
857
1238
|
|
|
858
|
-
// ../../node_modules/.pnpm/chalk@5.0
|
|
1239
|
+
// ../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
859
1240
|
init_esm_shims();
|
|
860
1241
|
import process2 from "node:process";
|
|
861
1242
|
import os from "node:os";
|
|
862
1243
|
import tty from "node:tty";
|
|
863
|
-
function hasFlag(flag, argv = process2.argv) {
|
|
1244
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
864
1245
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
865
1246
|
const position = argv.indexOf(prefix + flag);
|
|
866
1247
|
const terminatorPosition = argv.indexOf("--");
|
|
@@ -912,6 +1293,9 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
912
1293
|
return 2;
|
|
913
1294
|
}
|
|
914
1295
|
}
|
|
1296
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
1297
|
+
return 1;
|
|
1298
|
+
}
|
|
915
1299
|
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
916
1300
|
return 0;
|
|
917
1301
|
}
|
|
@@ -927,7 +1311,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
927
1311
|
return 1;
|
|
928
1312
|
}
|
|
929
1313
|
if ("CI" in env) {
|
|
930
|
-
if (
|
|
1314
|
+
if ("GITHUB_ACTIONS" in env) {
|
|
1315
|
+
return 3;
|
|
1316
|
+
}
|
|
1317
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
931
1318
|
return 1;
|
|
932
1319
|
}
|
|
933
1320
|
return min;
|
|
@@ -935,19 +1322,21 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
935
1322
|
if ("TEAMCITY_VERSION" in env) {
|
|
936
1323
|
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
937
1324
|
}
|
|
938
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
939
|
-
return 1;
|
|
940
|
-
}
|
|
941
1325
|
if (env.COLORTERM === "truecolor") {
|
|
942
1326
|
return 3;
|
|
943
1327
|
}
|
|
1328
|
+
if (env.TERM === "xterm-kitty") {
|
|
1329
|
+
return 3;
|
|
1330
|
+
}
|
|
944
1331
|
if ("TERM_PROGRAM" in env) {
|
|
945
1332
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
946
1333
|
switch (env.TERM_PROGRAM) {
|
|
947
|
-
case "iTerm.app":
|
|
1334
|
+
case "iTerm.app": {
|
|
948
1335
|
return version >= 3 ? 3 : 2;
|
|
949
|
-
|
|
1336
|
+
}
|
|
1337
|
+
case "Apple_Terminal": {
|
|
950
1338
|
return 2;
|
|
1339
|
+
}
|
|
951
1340
|
}
|
|
952
1341
|
}
|
|
953
1342
|
if (/-256(color)?$/i.test(env.TERM)) {
|
|
@@ -974,7 +1363,7 @@ var supportsColor = {
|
|
|
974
1363
|
};
|
|
975
1364
|
var supports_color_default = supportsColor;
|
|
976
1365
|
|
|
977
|
-
// ../../node_modules/.pnpm/chalk@5.0
|
|
1366
|
+
// ../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
|
|
978
1367
|
init_esm_shims();
|
|
979
1368
|
function stringReplaceAll(string, substring, replacer) {
|
|
980
1369
|
let index = string.indexOf(substring);
|
|
@@ -985,7 +1374,7 @@ function stringReplaceAll(string, substring, replacer) {
|
|
|
985
1374
|
let endIndex = 0;
|
|
986
1375
|
let returnValue = "";
|
|
987
1376
|
do {
|
|
988
|
-
returnValue += string.
|
|
1377
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
989
1378
|
endIndex = index + substringLength;
|
|
990
1379
|
index = string.indexOf(substring, endIndex);
|
|
991
1380
|
} while (index !== -1);
|
|
@@ -997,7 +1386,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
997
1386
|
let returnValue = "";
|
|
998
1387
|
do {
|
|
999
1388
|
const gotCR = string[index - 1] === "\r";
|
|
1000
|
-
returnValue += string.
|
|
1389
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1001
1390
|
endIndex = index + 1;
|
|
1002
1391
|
index = string.indexOf("\n", endIndex);
|
|
1003
1392
|
} while (index !== -1);
|
|
@@ -1005,7 +1394,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
1005
1394
|
return returnValue;
|
|
1006
1395
|
}
|
|
1007
1396
|
|
|
1008
|
-
// ../../node_modules/.pnpm/chalk@5.0
|
|
1397
|
+
// ../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
|
|
1009
1398
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
1010
1399
|
var GENERATOR = Symbol("GENERATOR");
|
|
1011
1400
|
var STYLER = Symbol("STYLER");
|
|
@@ -1016,7 +1405,7 @@ var levelMapping = [
|
|
|
1016
1405
|
"ansi256",
|
|
1017
1406
|
"ansi16m"
|
|
1018
1407
|
];
|
|
1019
|
-
var
|
|
1408
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
1020
1409
|
var applyOptions = (object, options = {}) => {
|
|
1021
1410
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1022
1411
|
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
@@ -1035,7 +1424,7 @@ function createChalk(options) {
|
|
|
1035
1424
|
}
|
|
1036
1425
|
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
1037
1426
|
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
1038
|
-
|
|
1427
|
+
styles2[styleName] = {
|
|
1039
1428
|
get() {
|
|
1040
1429
|
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
1041
1430
|
Object.defineProperty(this, styleName, { value: builder });
|
|
@@ -1043,7 +1432,7 @@ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
|
1043
1432
|
}
|
|
1044
1433
|
};
|
|
1045
1434
|
}
|
|
1046
|
-
|
|
1435
|
+
styles2.visible = {
|
|
1047
1436
|
get() {
|
|
1048
1437
|
const builder = createBuilder(this, this[STYLER], true);
|
|
1049
1438
|
Object.defineProperty(this, "visible", { value: builder });
|
|
@@ -1067,7 +1456,7 @@ var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
|
1067
1456
|
};
|
|
1068
1457
|
var usedModels = ["rgb", "hex", "ansi256"];
|
|
1069
1458
|
for (const model of usedModels) {
|
|
1070
|
-
|
|
1459
|
+
styles2[model] = {
|
|
1071
1460
|
get() {
|
|
1072
1461
|
const { level } = this;
|
|
1073
1462
|
return function(...arguments_) {
|
|
@@ -1077,7 +1466,7 @@ for (const model of usedModels) {
|
|
|
1077
1466
|
}
|
|
1078
1467
|
};
|
|
1079
1468
|
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1080
|
-
|
|
1469
|
+
styles2[bgModel] = {
|
|
1081
1470
|
get() {
|
|
1082
1471
|
const { level } = this;
|
|
1083
1472
|
return function(...arguments_) {
|
|
@@ -1089,7 +1478,7 @@ for (const model of usedModels) {
|
|
|
1089
1478
|
}
|
|
1090
1479
|
var proto = Object.defineProperties(() => {
|
|
1091
1480
|
}, {
|
|
1092
|
-
...
|
|
1481
|
+
...styles2,
|
|
1093
1482
|
level: {
|
|
1094
1483
|
enumerable: true,
|
|
1095
1484
|
get() {
|
|
@@ -1147,7 +1536,7 @@ var applyStyle = (self, string) => {
|
|
|
1147
1536
|
}
|
|
1148
1537
|
return openAll + string + closeAll;
|
|
1149
1538
|
};
|
|
1150
|
-
Object.defineProperties(createChalk.prototype,
|
|
1539
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
1151
1540
|
var chalk = createChalk();
|
|
1152
1541
|
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1153
1542
|
var source_default = chalk;
|
|
@@ -1162,7 +1551,7 @@ function widestLine(string) {
|
|
|
1162
1551
|
return lineWidth;
|
|
1163
1552
|
}
|
|
1164
1553
|
|
|
1165
|
-
// ../../node_modules/.pnpm/boxen@7.0.
|
|
1554
|
+
// ../../node_modules/.pnpm/boxen@7.0.2/node_modules/boxen/index.js
|
|
1166
1555
|
var import_cli_boxes = __toESM(require_cli_boxes(), 1);
|
|
1167
1556
|
|
|
1168
1557
|
// ../../node_modules/.pnpm/camelcase@7.0.0/node_modules/camelcase/index.js
|
|
@@ -1246,7 +1635,7 @@ function camelCase(input, options) {
|
|
|
1246
1635
|
return postProcess(input, toUpperCase);
|
|
1247
1636
|
}
|
|
1248
1637
|
|
|
1249
|
-
// ../../node_modules/.pnpm/boxen@7.0.
|
|
1638
|
+
// ../../node_modules/.pnpm/boxen@7.0.2/node_modules/boxen/index.js
|
|
1250
1639
|
var import_ansi_align = __toESM(require_ansi_align(), 1);
|
|
1251
1640
|
|
|
1252
1641
|
// ../../node_modules/.pnpm/wrap-ansi@8.0.1/node_modules/wrap-ansi/index.js
|
|
@@ -1260,7 +1649,7 @@ var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
|
1260
1649
|
var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1261
1650
|
function assembleStyles2() {
|
|
1262
1651
|
const codes = /* @__PURE__ */ new Map();
|
|
1263
|
-
const
|
|
1652
|
+
const styles3 = {
|
|
1264
1653
|
modifier: {
|
|
1265
1654
|
reset: [0, 0],
|
|
1266
1655
|
// 21 isn't widely supported and 22 does the same thing
|
|
@@ -1312,37 +1701,37 @@ function assembleStyles2() {
|
|
|
1312
1701
|
bgWhiteBright: [107, 49]
|
|
1313
1702
|
}
|
|
1314
1703
|
};
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
for (const [groupName, group] of Object.entries(
|
|
1704
|
+
styles3.color.gray = styles3.color.blackBright;
|
|
1705
|
+
styles3.bgColor.bgGray = styles3.bgColor.bgBlackBright;
|
|
1706
|
+
styles3.color.grey = styles3.color.blackBright;
|
|
1707
|
+
styles3.bgColor.bgGrey = styles3.bgColor.bgBlackBright;
|
|
1708
|
+
for (const [groupName, group] of Object.entries(styles3)) {
|
|
1320
1709
|
for (const [styleName, style] of Object.entries(group)) {
|
|
1321
|
-
|
|
1710
|
+
styles3[styleName] = {
|
|
1322
1711
|
open: `\x1B[${style[0]}m`,
|
|
1323
1712
|
close: `\x1B[${style[1]}m`
|
|
1324
1713
|
};
|
|
1325
|
-
group[styleName] =
|
|
1714
|
+
group[styleName] = styles3[styleName];
|
|
1326
1715
|
codes.set(style[0], style[1]);
|
|
1327
1716
|
}
|
|
1328
|
-
Object.defineProperty(
|
|
1717
|
+
Object.defineProperty(styles3, groupName, {
|
|
1329
1718
|
value: group,
|
|
1330
1719
|
enumerable: false
|
|
1331
1720
|
});
|
|
1332
1721
|
}
|
|
1333
|
-
Object.defineProperty(
|
|
1722
|
+
Object.defineProperty(styles3, "codes", {
|
|
1334
1723
|
value: codes,
|
|
1335
1724
|
enumerable: false
|
|
1336
1725
|
});
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
Object.defineProperties(
|
|
1726
|
+
styles3.color.close = "\x1B[39m";
|
|
1727
|
+
styles3.bgColor.close = "\x1B[49m";
|
|
1728
|
+
styles3.color.ansi = wrapAnsi162();
|
|
1729
|
+
styles3.color.ansi256 = wrapAnsi2562();
|
|
1730
|
+
styles3.color.ansi16m = wrapAnsi16m2();
|
|
1731
|
+
styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
|
|
1732
|
+
styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
|
|
1733
|
+
styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
|
|
1734
|
+
Object.defineProperties(styles3, {
|
|
1346
1735
|
rgbToAnsi256: {
|
|
1347
1736
|
value: (red, green, blue) => {
|
|
1348
1737
|
if (red === green && green === blue) {
|
|
@@ -1380,7 +1769,7 @@ function assembleStyles2() {
|
|
|
1380
1769
|
enumerable: false
|
|
1381
1770
|
},
|
|
1382
1771
|
hexToAnsi256: {
|
|
1383
|
-
value: (hex) =>
|
|
1772
|
+
value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)),
|
|
1384
1773
|
enumerable: false
|
|
1385
1774
|
},
|
|
1386
1775
|
ansi256ToAnsi: {
|
|
@@ -1418,15 +1807,15 @@ function assembleStyles2() {
|
|
|
1418
1807
|
enumerable: false
|
|
1419
1808
|
},
|
|
1420
1809
|
rgbToAnsi: {
|
|
1421
|
-
value: (red, green, blue) =>
|
|
1810
|
+
value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
|
|
1422
1811
|
enumerable: false
|
|
1423
1812
|
},
|
|
1424
1813
|
hexToAnsi: {
|
|
1425
|
-
value: (hex) =>
|
|
1814
|
+
value: (hex) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex)),
|
|
1426
1815
|
enumerable: false
|
|
1427
1816
|
}
|
|
1428
1817
|
});
|
|
1429
|
-
return
|
|
1818
|
+
return styles3;
|
|
1430
1819
|
}
|
|
1431
1820
|
var ansiStyles2 = assembleStyles2();
|
|
1432
1821
|
var ansi_styles_default2 = ansiStyles2;
|
|
@@ -1582,7 +1971,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
1582
1971
|
return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
1583
1972
|
}
|
|
1584
1973
|
|
|
1585
|
-
// ../../node_modules/.pnpm/boxen@7.0.
|
|
1974
|
+
// ../../node_modules/.pnpm/boxen@7.0.2/node_modules/boxen/index.js
|
|
1586
1975
|
var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
|
|
1587
1976
|
var NEWLINE = "\n";
|
|
1588
1977
|
var PAD = " ";
|
|
@@ -1866,7 +2255,7 @@ async function bundleChunks(ctx) {
|
|
|
1866
2255
|
}
|
|
1867
2256
|
async function writeFileChunk(ctx, file) {
|
|
1868
2257
|
const { path } = ctx.runtime;
|
|
1869
|
-
|
|
2258
|
+
logger3.debug("chunk:write", `File: ${path.relative(ctx.config.cwd, file)}`);
|
|
1870
2259
|
const css = extractFile(ctx, file);
|
|
1871
2260
|
if (!css)
|
|
1872
2261
|
return;
|
|
@@ -1880,17 +2269,18 @@ function extractFile(ctx, file) {
|
|
|
1880
2269
|
} = ctx;
|
|
1881
2270
|
return pipe2(
|
|
1882
2271
|
{ file: path.abs(cwd, file) },
|
|
1883
|
-
tap2(() =>
|
|
1884
|
-
Obj2.bind("measure", () =>
|
|
2272
|
+
tap2(() => logger3.debug("file:extract", file)),
|
|
2273
|
+
Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
|
|
1885
2274
|
Obj2.bind(
|
|
1886
2275
|
"result",
|
|
1887
2276
|
tryCatch(
|
|
1888
|
-
({ file: file2 }) => ctx.project.parseSourceFile(file2),
|
|
1889
|
-
(error) =>
|
|
2277
|
+
({ file: file2 }) => ctx.project.parseSourceFile(file2, ctx.properties),
|
|
2278
|
+
(error) => logger3.error("file:parse", error)
|
|
1890
2279
|
)
|
|
1891
2280
|
),
|
|
2281
|
+
Obj2.bind("measureCss", () => logger3.time.debug(`Parsed ${file}`)),
|
|
1892
2282
|
Obj2.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
|
|
1893
|
-
tap2(({ measure }) => measure()),
|
|
2283
|
+
tap2(({ measure, measureCss }) => [measureCss(), measure()]),
|
|
1894
2284
|
Obj2.get("css")
|
|
1895
2285
|
);
|
|
1896
2286
|
}
|
|
@@ -2016,7 +2406,7 @@ var Builder = class {
|
|
|
2016
2406
|
}
|
|
2017
2407
|
async extract() {
|
|
2018
2408
|
const ctx = this.ensure();
|
|
2019
|
-
const done =
|
|
2409
|
+
const done = logger4.time.info("Extracted in");
|
|
2020
2410
|
await Promise.all(
|
|
2021
2411
|
ctx.getFiles().map(async (file) => {
|
|
2022
2412
|
const mtime = existsSync2(file) ? statSync(file).mtimeMs : -Infinity;
|
|
@@ -2077,7 +2467,7 @@ var Builder = class {
|
|
|
2077
2467
|
|
|
2078
2468
|
// src/exec-command.ts
|
|
2079
2469
|
init_esm_shims();
|
|
2080
|
-
import { logger as
|
|
2470
|
+
import { logger as logger5 } from "@pandacss/logger";
|
|
2081
2471
|
import { spawnSync } from "child_process";
|
|
2082
2472
|
import getPackageManager from "preferred-pm";
|
|
2083
2473
|
async function execCommand(cmd, cwd) {
|
|
@@ -2089,13 +2479,13 @@ async function execCommand(cmd, cwd) {
|
|
|
2089
2479
|
}
|
|
2090
2480
|
const check = spawnSync(pm, args, { cwd, stdio: "pipe" });
|
|
2091
2481
|
if (check.status !== 0) {
|
|
2092
|
-
|
|
2482
|
+
logger5.error("exec", check.stderr.toString());
|
|
2093
2483
|
}
|
|
2094
2484
|
}
|
|
2095
2485
|
|
|
2096
2486
|
// src/generate.ts
|
|
2097
2487
|
init_esm_shims();
|
|
2098
|
-
import { logger as
|
|
2488
|
+
import { logger as logger6 } from "@pandacss/logger";
|
|
2099
2489
|
import { match } from "ts-pattern";
|
|
2100
2490
|
|
|
2101
2491
|
// src/load-context.ts
|
|
@@ -2113,7 +2503,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2113
2503
|
// src/generate.ts
|
|
2114
2504
|
async function build(ctx) {
|
|
2115
2505
|
const msg = await emitAndExtract(ctx);
|
|
2116
|
-
|
|
2506
|
+
logger6.info("css:emit", msg);
|
|
2117
2507
|
}
|
|
2118
2508
|
async function generate(config, configPath) {
|
|
2119
2509
|
const [ctxRef, loadCtx] = await loadContext(config, configPath);
|
|
@@ -2127,13 +2517,13 @@ async function generate(config, configPath) {
|
|
|
2127
2517
|
if (ctx.config.watch) {
|
|
2128
2518
|
const configWatcher = fs.watch({ include: dependencies });
|
|
2129
2519
|
configWatcher.on("change", async () => {
|
|
2130
|
-
|
|
2520
|
+
logger6.info("config:change", "Config changed, restarting...");
|
|
2131
2521
|
await loadCtx();
|
|
2132
2522
|
return build(ctxRef.current);
|
|
2133
2523
|
});
|
|
2134
2524
|
const contentWatcher = fs.watch(ctx.config);
|
|
2135
2525
|
contentWatcher.on("all", async (event, file) => {
|
|
2136
|
-
|
|
2526
|
+
logger6.info(`file:${event}`, file);
|
|
2137
2527
|
match(event).with("unlink", () => {
|
|
2138
2528
|
ctx.project.removeSourceFile(path.abs(cwd, file));
|
|
2139
2529
|
ctx.chunks.rm(file);
|
|
@@ -2147,7 +2537,7 @@ async function generate(config, configPath) {
|
|
|
2147
2537
|
}).otherwise(() => {
|
|
2148
2538
|
});
|
|
2149
2539
|
});
|
|
2150
|
-
|
|
2540
|
+
logger6.info("ctx:watch", ctx.messages.watch());
|
|
2151
2541
|
}
|
|
2152
2542
|
}
|
|
2153
2543
|
|
|
@@ -2173,9 +2563,9 @@ function setupGitIgnore({ config: { outdir } }) {
|
|
|
2173
2563
|
|
|
2174
2564
|
// src/setup-config.ts
|
|
2175
2565
|
init_esm_shims();
|
|
2176
|
-
import { logger as
|
|
2566
|
+
import { logger as logger7, quote } from "@pandacss/logger";
|
|
2177
2567
|
import { messages } from "@pandacss/generator";
|
|
2178
|
-
import { writeFile as
|
|
2568
|
+
import { writeFile as writeFile3 } from "fs-extra";
|
|
2179
2569
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2180
2570
|
import { outdent as outdent2 } from "outdent";
|
|
2181
2571
|
import { join as join2 } from "path";
|
|
@@ -2187,9 +2577,9 @@ async function setupConfig(cwd, { force }) {
|
|
|
2187
2577
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2188
2578
|
const isTs = lookItUpSync3("tsconfig.json", cwd);
|
|
2189
2579
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2190
|
-
|
|
2580
|
+
logger7.info("init:config", `creating panda config file: ${quote(file)}`);
|
|
2191
2581
|
if (!force && configFile) {
|
|
2192
|
-
|
|
2582
|
+
logger7.warn("init:config", messages.configExists(cmd));
|
|
2193
2583
|
} else {
|
|
2194
2584
|
const content = outdent2`
|
|
2195
2585
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -2208,12 +2598,12 @@ async function setupConfig(cwd, { force }) {
|
|
|
2208
2598
|
outdir: "styled-system",
|
|
2209
2599
|
})
|
|
2210
2600
|
`;
|
|
2211
|
-
await
|
|
2212
|
-
|
|
2601
|
+
await writeFile3(join2(cwd, file), content);
|
|
2602
|
+
logger7.log(messages.thankYou());
|
|
2213
2603
|
}
|
|
2214
2604
|
}
|
|
2215
2605
|
async function setupPostcss(cwd) {
|
|
2216
|
-
|
|
2606
|
+
logger7.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
|
|
2217
2607
|
const content = outdent2`
|
|
2218
2608
|
module.exports = {
|
|
2219
2609
|
plugins: {
|
|
@@ -2221,10 +2611,11 @@ async function setupPostcss(cwd) {
|
|
|
2221
2611
|
},
|
|
2222
2612
|
}
|
|
2223
2613
|
`;
|
|
2224
|
-
await
|
|
2614
|
+
await writeFile3(join2(cwd, "postcss.config.cjs"), content);
|
|
2225
2615
|
}
|
|
2226
2616
|
export {
|
|
2227
2617
|
Builder,
|
|
2618
|
+
analyzeTokens,
|
|
2228
2619
|
createContext,
|
|
2229
2620
|
discardDuplicate2 as discardDuplicate,
|
|
2230
2621
|
emitAndExtract,
|
|
@@ -2235,5 +2626,6 @@ export {
|
|
|
2235
2626
|
loadConfigAndCreateContext,
|
|
2236
2627
|
setupConfig,
|
|
2237
2628
|
setupGitIgnore,
|
|
2238
|
-
setupPostcss
|
|
2629
|
+
setupPostcss,
|
|
2630
|
+
writeAnalyzeJSON
|
|
2239
2631
|
};
|