@pandacss/node 0.40.1 → 0.42.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.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@8.0.2_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.2_@swc+core@1.4.0_postcss@8.4.39_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.2_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.2_@swc+core@1.4.0_postcss@8.4.39_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -402,49 +402,53 @@ init_esm_shims();
402
402
  import { logger } from "@pandacss/logger";
403
403
  import { filesize } from "filesize";
404
404
  import { writeFile } from "fs/promises";
405
+ import path from "node:path";
405
406
  import zlib from "zlib";
406
407
 
408
+ // package.json
409
+ var version = "0.42.0";
410
+
407
411
  // src/classify.ts
408
412
  init_esm_shims();
409
413
  import { box } from "@pandacss/extractor";
410
414
  var createReportMaps = () => {
411
- const byInstanceOfKind = /* @__PURE__ */ new Map();
415
+ const byComponentOfKind = /* @__PURE__ */ new Map();
412
416
  const byPropertyName = /* @__PURE__ */ new Map();
413
- const byCategory = /* @__PURE__ */ new Map();
417
+ const byTokenType = /* @__PURE__ */ new Map();
414
418
  const byConditionName = /* @__PURE__ */ new Map();
415
419
  const byShorthand = /* @__PURE__ */ new Map();
416
420
  const byTokenName = /* @__PURE__ */ new Map();
417
421
  const byPropertyPath = /* @__PURE__ */ new Map();
418
422
  const fromKind = /* @__PURE__ */ new Map();
419
423
  const byType = /* @__PURE__ */ new Map();
420
- const byInstanceName = /* @__PURE__ */ new Map();
424
+ const byComponentName = /* @__PURE__ */ new Map();
421
425
  const colorsUsed = /* @__PURE__ */ new Map();
422
426
  return {
423
- byInstanceOfKind,
427
+ byComponentOfKind,
424
428
  byPropertyName,
425
- byCategory,
429
+ byTokenType,
426
430
  byConditionName,
427
431
  byShorthand,
428
432
  byTokenName,
429
433
  byPropertyPath,
430
434
  fromKind,
431
435
  byType,
432
- byInstanceName,
436
+ byComponentName,
433
437
  colorsUsed
434
438
  };
435
439
  };
436
- var colorPropNames = /* @__PURE__ */ new Set(["background", "outline", "border"]);
437
440
  var classifyTokens = (ctx, parserResultByFilepath) => {
438
441
  const byId = /* @__PURE__ */ new Map();
439
- const byInstanceId = /* @__PURE__ */ new Map();
442
+ const byComponentIndex = /* @__PURE__ */ new Map();
440
443
  const byFilepath = /* @__PURE__ */ new Map();
441
- const byInstanceInFilepath = /* @__PURE__ */ new Map();
444
+ const byComponentInFilepath = /* @__PURE__ */ new Map();
442
445
  const globalMaps = createReportMaps();
443
446
  const byFilePathMaps = /* @__PURE__ */ new Map();
444
447
  const conditions = new Map(Object.entries(ctx.conditions.values));
445
- let id = 0, instanceId = 0;
446
- const isKnownUtility = (reportItem) => {
447
- const { propName, type, value, from } = reportItem;
448
+ const { groupByProp } = getPropertyGroupMap(ctx);
449
+ let id = 0, componentIndex = 0;
450
+ const isKnownUtility = (reportItem, componentReportItem) => {
451
+ const { propName, value } = reportItem;
448
452
  const utility = ctx.config.utilities?.[propName];
449
453
  if (utility) {
450
454
  if (!utility.shorthand) {
@@ -452,8 +456,8 @@ var classifyTokens = (ctx, parserResultByFilepath) => {
452
456
  }
453
457
  return Boolean(ctx.tokens.getByName(`${utility.values}.${value}`));
454
458
  }
455
- if (type === "pattern") {
456
- const pattern = ctx.patterns.getConfig(from.toLowerCase());
459
+ if (componentReportItem.reportItemType === "pattern") {
460
+ const pattern = ctx.patterns.getConfig(componentReportItem.componentName.toLowerCase());
457
461
  const patternProp = pattern?.properties?.[propName];
458
462
  if (!patternProp)
459
463
  return false;
@@ -482,75 +486,82 @@ var classifyTokens = (ctx, parserResultByFilepath) => {
482
486
  set.add(value);
483
487
  map.set(key, set);
484
488
  };
485
- const processMap = (map, current, reportInstanceItem) => {
486
- const { from, type, kind } = reportInstanceItem;
489
+ const processMap = (map, current, componentReportItem) => {
490
+ const { reportItemType: type, kind } = componentReportItem;
491
+ const name = componentReportItem.componentName;
487
492
  map.value.forEach((attrNode, attrName) => {
488
493
  if (box.isLiteral(attrNode) || box.isEmptyInitializer(attrNode)) {
489
494
  const value = box.isLiteral(attrNode) ? attrNode.value : true;
490
- const reportItem = {
491
- id: id++,
492
- instanceId,
493
- category: "unknown",
495
+ const propReportItem = {
496
+ index: String(id++),
497
+ componentIndex: String(componentReportItem.componentIndex),
498
+ componentName: name,
499
+ tokenType: void 0,
494
500
  propName: attrName,
495
- from,
496
- type,
501
+ reportItemKind: "utility",
502
+ reportItemType: type,
497
503
  kind,
498
504
  filepath,
499
505
  path: current.concat(attrName),
500
506
  value,
501
- box: attrNode,
502
- isKnown: false
507
+ isKnownValue: false,
508
+ range: map.getRange()
503
509
  };
504
- reportInstanceItem.contains.push(reportItem.id);
510
+ componentReportItem.contains.push(propReportItem.index);
505
511
  if (conditions.has(attrName)) {
506
- addTo(globalMaps.byConditionName, attrName, reportItem.id);
507
- addTo(localMaps.byConditionName, attrName, reportItem.id);
508
- reportItem.propName = current[0] ?? attrName;
509
- reportItem.isKnown = isKnownUtility(reportItem);
510
- reportItem.conditionName = attrName;
512
+ addTo(globalMaps.byConditionName, attrName, propReportItem.index);
513
+ addTo(localMaps.byConditionName, attrName, propReportItem.index);
514
+ propReportItem.propName = current[0] ?? attrName;
515
+ propReportItem.isKnownValue = isKnownUtility(propReportItem, componentReportItem);
516
+ propReportItem.conditionName = attrName;
511
517
  } else {
512
518
  if (current.length && conditions.has(current[0])) {
513
- reportItem.conditionName = current[0];
514
- addTo(globalMaps.byConditionName, current[0], reportItem.id);
515
- addTo(localMaps.byConditionName, current[0], reportItem.id);
519
+ propReportItem.conditionName = current[0];
520
+ addTo(globalMaps.byConditionName, current[0], propReportItem.index);
521
+ addTo(localMaps.byConditionName, current[0], propReportItem.index);
516
522
  }
517
523
  const propName = ctx.utility.shorthands.get(attrName) ?? attrName;
518
- reportItem.propName = propName;
524
+ propReportItem.propName = propName;
519
525
  const utility = ctx.config.utilities?.[propName];
520
- reportItem.isKnown = isKnownUtility(reportItem);
521
- const category = typeof utility?.values === "string" ? utility?.values : "unknown";
522
- reportItem.category = category;
523
- addTo(globalMaps.byPropertyName, propName, reportItem.id);
524
- addTo(localMaps.byPropertyName, propName, reportItem.id);
525
- addTo(globalMaps.byCategory, category, reportItem.id);
526
- addTo(localMaps.byCategory, category, reportItem.id);
527
- if (propName.toLowerCase().includes("color") || colorPropNames.has(propName)) {
528
- addTo(globalMaps.colorsUsed, value, reportItem.id);
529
- addTo(localMaps.colorsUsed, value, reportItem.id);
526
+ propReportItem.isKnownValue = isKnownUtility(propReportItem, componentReportItem);
527
+ const tokenType = typeof utility?.values === "string" ? utility?.values : void 0;
528
+ if (tokenType) {
529
+ propReportItem.reportItemKind = "token";
530
+ propReportItem.tokenType = tokenType;
531
+ }
532
+ addTo(globalMaps.byPropertyName, propName, propReportItem.index);
533
+ addTo(localMaps.byPropertyName, propName, propReportItem.index);
534
+ if (tokenType) {
535
+ addTo(globalMaps.byTokenType, tokenType, propReportItem.index);
536
+ addTo(localMaps.byTokenType, tokenType, propReportItem.index);
537
+ }
538
+ if (propName.toLowerCase().includes("color") || groupByProp.get(propName) === "Color" || tokenType === "colors") {
539
+ addTo(globalMaps.colorsUsed, value, propReportItem.index);
540
+ addTo(localMaps.colorsUsed, value, propReportItem.index);
530
541
  }
531
542
  if (ctx.utility.shorthands.has(attrName)) {
532
- addTo(globalMaps.byShorthand, attrName, reportItem.id);
533
- addTo(localMaps.byShorthand, attrName, reportItem.id);
543
+ addTo(globalMaps.byShorthand, attrName, propReportItem.index);
544
+ addTo(localMaps.byShorthand, attrName, propReportItem.index);
534
545
  }
535
546
  }
536
547
  if (current.length) {
537
- addTo(globalMaps.byPropertyPath, reportItem.path.join("."), reportItem.id);
538
- addTo(localMaps.byPropertyPath, reportItem.path.join("."), reportItem.id);
548
+ addTo(globalMaps.byPropertyPath, propReportItem.path.join("."), propReportItem.index);
549
+ addTo(localMaps.byPropertyPath, propReportItem.path.join("."), propReportItem.index);
539
550
  }
540
- addTo(globalMaps.byTokenName, String(value), reportItem.id);
541
- addTo(localMaps.byTokenName, String(value), reportItem.id);
542
- addTo(globalMaps.byType, type, reportItem.id);
543
- addTo(localMaps.byType, type, reportItem.id);
544
- addTo(globalMaps.byInstanceName, from, reportItem.id);
545
- addTo(localMaps.byInstanceName, from, reportItem.id);
546
- addTo(globalMaps.fromKind, kind, reportItem.id);
547
- addTo(localMaps.fromKind, kind, reportItem.id);
548
- addTo(byFilepath, filepath, reportItem.id);
549
- byId.set(reportItem.id, reportItem);
551
+ addTo(globalMaps.byTokenName, String(value), propReportItem.index);
552
+ addTo(localMaps.byTokenName, String(value), propReportItem.index);
553
+ addTo(globalMaps.byType, type, propReportItem.index);
554
+ addTo(localMaps.byType, type, propReportItem.index);
555
+ addTo(globalMaps.byComponentName, name, propReportItem.index);
556
+ addTo(localMaps.byComponentName, name, propReportItem.index);
557
+ addTo(globalMaps.fromKind, kind, propReportItem.index);
558
+ addTo(localMaps.fromKind, kind, propReportItem.index);
559
+ addTo(byFilepath, filepath, propReportItem.index);
560
+ byId.set(propReportItem.index, propReportItem);
550
561
  return;
551
562
  }
552
563
  if (box.isMap(attrNode) && attrNode.value.size) {
553
- return processMap(attrNode, current.concat(attrName), reportInstanceItem);
564
+ return processMap(attrNode, current.concat(attrName), componentReportItem);
554
565
  }
555
566
  });
556
567
  };
@@ -559,45 +570,44 @@ var classifyTokens = (ctx, parserResultByFilepath) => {
559
570
  return;
560
571
  }
561
572
  if (!item.data) {
573
+ console.log("no data", item);
562
574
  return;
563
575
  }
564
- const from = item.name;
565
- const type = item.type;
566
- const reportInstanceItem = {
567
- instanceId: instanceId++,
568
- from,
569
- type,
576
+ const componentReportItem = {
577
+ componentIndex: String(componentIndex++),
578
+ componentName: item.name,
579
+ reportItemType: item.type,
570
580
  kind,
571
581
  filepath,
572
582
  value: item.data,
573
- box: item.box,
583
+ range: item.box.getRange(),
574
584
  contains: []
575
585
  };
576
586
  if (box.isArray(item.box)) {
577
- addTo(byInstanceInFilepath, filepath, reportInstanceItem.instanceId);
578
- return reportInstanceItem;
587
+ addTo(byComponentInFilepath, filepath, componentReportItem.componentIndex);
588
+ return componentReportItem;
579
589
  }
580
590
  if (box.isMap(item.box) && item.box.value.size) {
581
- addTo(byInstanceInFilepath, filepath, reportInstanceItem.instanceId);
582
- processMap(item.box, [], reportInstanceItem);
583
- return reportInstanceItem;
591
+ addTo(byComponentInFilepath, filepath, componentReportItem.componentIndex);
592
+ processMap(item.box, [], componentReportItem);
593
+ return componentReportItem;
584
594
  }
585
595
  };
586
596
  const processComponentResultItem = (item) => {
587
- const reportInstanceItem = processResultItem(item, "component");
588
- if (!reportInstanceItem)
597
+ const componentReportItem = processResultItem(item, "component");
598
+ if (!componentReportItem)
589
599
  return;
590
- addTo(globalMaps.byInstanceOfKind, "component", reportInstanceItem.instanceId);
591
- addTo(localMaps.byInstanceOfKind, "component", reportInstanceItem.instanceId);
592
- byInstanceId.set(reportInstanceItem.instanceId, reportInstanceItem);
600
+ addTo(globalMaps.byComponentOfKind, "component", componentReportItem.componentIndex);
601
+ addTo(localMaps.byComponentOfKind, "component", componentReportItem.componentIndex);
602
+ byComponentIndex.set(componentReportItem.componentIndex, componentReportItem);
593
603
  };
594
604
  const processFunctionResultItem = (item) => {
595
- const reportInstanceItem = processResultItem(item, "function");
596
- if (!reportInstanceItem)
605
+ const componentReportItem = processResultItem(item, "function");
606
+ if (!componentReportItem)
597
607
  return;
598
- addTo(globalMaps.byInstanceOfKind, "function", reportInstanceItem.instanceId);
599
- addTo(localMaps.byInstanceOfKind, "function", reportInstanceItem.instanceId);
600
- byInstanceId.set(reportInstanceItem.instanceId, reportInstanceItem);
608
+ addTo(globalMaps.byComponentOfKind, "function", componentReportItem.componentIndex);
609
+ addTo(localMaps.byComponentOfKind, "function", componentReportItem.componentIndex);
610
+ byComponentIndex.set(componentReportItem.componentIndex, componentReportItem);
601
611
  };
602
612
  parserResult.jsx.forEach(processComponentResultItem);
603
613
  parserResult.css.forEach(processFunctionResultItem);
@@ -611,37 +621,33 @@ var classifyTokens = (ctx, parserResultByFilepath) => {
611
621
  byFilePathMaps.set(filepath, localMaps);
612
622
  });
613
623
  const pickCount = 10;
614
- const filesWithMostInstance = Object.fromEntries(
615
- Array.from(byInstanceInFilepath.entries()).map(([filepath, list]) => [filepath, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount)
616
- );
617
- const filesWithMostPropValueCombinations = Object.fromEntries(
618
- Array.from(byFilepath.entries()).map(([token, list]) => [token, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount)
624
+ const filesWithMostComponent = Object.fromEntries(
625
+ Array.from(byComponentInFilepath.entries()).map(([filepath, list]) => [filepath, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount)
619
626
  );
620
627
  return {
621
- counts: {
622
- filesWithTokens: byFilepath.size,
623
- propNameUsed: globalMaps.byPropertyName.size,
624
- tokenUsed: globalMaps.byTokenName.size,
625
- shorthandUsed: globalMaps.byShorthand.size,
626
- propertyPathUsed: globalMaps.byPropertyPath.size,
627
- typeUsed: globalMaps.byType.size,
628
- instanceNameUsed: globalMaps.byInstanceName.size,
629
- kindUsed: globalMaps.fromKind.size,
630
- instanceOfKindUsed: globalMaps.byInstanceOfKind.size,
631
- colorsUsed: globalMaps.colorsUsed.size
632
- },
633
- stats: {
634
- //
635
- filesWithMostInstance,
636
- filesWithMostPropValueCombinations,
637
- //
638
- mostUseds: getXMostUseds(globalMaps, 10)
639
- },
628
+ propById: byId,
629
+ componentById: byComponentIndex,
640
630
  details: {
641
- byId,
642
- byInstanceId,
631
+ counts: {
632
+ filesWithTokens: byFilepath.size,
633
+ propNameUsed: globalMaps.byPropertyName.size,
634
+ tokenUsed: globalMaps.byTokenName.size,
635
+ shorthandUsed: globalMaps.byShorthand.size,
636
+ propertyPathUsed: globalMaps.byPropertyPath.size,
637
+ typeUsed: globalMaps.byType.size,
638
+ componentNameUsed: globalMaps.byComponentName.size,
639
+ kindUsed: globalMaps.fromKind.size,
640
+ componentOfKindUsed: globalMaps.byComponentOfKind.size,
641
+ colorsUsed: globalMaps.colorsUsed.size
642
+ },
643
+ stats: {
644
+ filesWithMostComponent,
645
+ mostUseds: getXMostUseds(globalMaps, 10)
646
+ }
647
+ },
648
+ derived: {
643
649
  byFilepath,
644
- byInstanceInFilepath,
650
+ byComponentInFilepath,
645
651
  globalMaps,
646
652
  byFilePathMaps
647
653
  }
@@ -654,17 +660,78 @@ var getXMostUseds = (globalMaps, pickCount) => {
654
660
  shorthands: getMostUsedInMap(globalMaps.byShorthand, pickCount),
655
661
  conditions: getMostUsedInMap(globalMaps.byConditionName, pickCount),
656
662
  propertyPaths: getMostUsedInMap(globalMaps.byPropertyPath, pickCount),
657
- categories: getMostUsedInMap(globalMaps.byCategory, pickCount),
663
+ categories: getMostUsedInMap(globalMaps.byTokenType, pickCount),
658
664
  types: getMostUsedInMap(globalMaps.byType, pickCount),
659
- instanceNames: getMostUsedInMap(globalMaps.byInstanceName, pickCount),
665
+ componentNames: getMostUsedInMap(globalMaps.byComponentName, pickCount),
660
666
  fromKinds: getMostUsedInMap(globalMaps.fromKind, pickCount),
661
- instanceOfKinds: getMostUsedInMap(globalMaps.byInstanceOfKind, pickCount),
667
+ componentOfKinds: getMostUsedInMap(globalMaps.byComponentOfKind, pickCount),
662
668
  colors: getMostUsedInMap(globalMaps.colorsUsed, pickCount)
663
669
  };
664
670
  };
665
671
  var getMostUsedInMap = (map, pickCount) => {
666
672
  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 }));
667
673
  };
674
+ var defaultGroupNames = [
675
+ "System",
676
+ "Container",
677
+ "Display",
678
+ "Visibility",
679
+ "Position",
680
+ "Transform",
681
+ "Flex Layout",
682
+ "Grid Layout",
683
+ "Layout",
684
+ "Border",
685
+ "Border Radius",
686
+ "Width",
687
+ "Height",
688
+ "Margin",
689
+ "Padding",
690
+ "Color",
691
+ "Typography",
692
+ "Background",
693
+ "Shadow",
694
+ "Table",
695
+ "List",
696
+ "Scroll",
697
+ "Interactivity",
698
+ "Transition",
699
+ "Effect",
700
+ "Other"
701
+ ];
702
+ var getPropertyGroupMap = (context) => {
703
+ const groups = new Map(defaultGroupNames.map((name) => [name, /* @__PURE__ */ new Set()]));
704
+ const groupByProp = /* @__PURE__ */ new Map();
705
+ const systemGroup = groups.get("System");
706
+ systemGroup.add("base");
707
+ systemGroup.add("colorPalette");
708
+ const otherStyleProps = groups.get("Other");
709
+ Object.entries(context.utility.config).map(([key, value]) => {
710
+ const group = value?.group;
711
+ if (!group) {
712
+ otherStyleProps.add(key);
713
+ return;
714
+ }
715
+ if (!groups.has(group)) {
716
+ groups.set(group, /* @__PURE__ */ new Set());
717
+ }
718
+ const set = groups.get(group);
719
+ if (value.shorthand) {
720
+ if (Array.isArray(value.shorthand)) {
721
+ value.shorthand.forEach((shorthand) => {
722
+ set.add(shorthand);
723
+ groupByProp.set(shorthand, group);
724
+ });
725
+ } else {
726
+ set.add(value.shorthand);
727
+ groupByProp.set(value.shorthand, group);
728
+ }
729
+ }
730
+ set.add(key);
731
+ groupByProp.set(key, group);
732
+ });
733
+ return { groups, groupByProp };
734
+ };
668
735
 
669
736
  // src/analyze-tokens.ts
670
737
  var gzipSizeSync = (code) => zlib.gzipSync(code, { level: zlib.constants.Z_BEST_COMPRESSION }).length;
@@ -672,34 +739,66 @@ function analyzeTokens(ctx, options = {}) {
672
739
  const filesMap = /* @__PURE__ */ new Map();
673
740
  const timesMap = /* @__PURE__ */ new Map();
674
741
  const files = ctx.getFiles();
742
+ const sheet = ctx.createSheet();
743
+ ctx.appendLayerParams(sheet);
744
+ ctx.appendBaselineCss(sheet);
675
745
  files.forEach((file) => {
676
746
  const start2 = performance.now();
677
747
  const result = ctx.project.parseSourceFile(file);
678
748
  const extractMs = performance.now() - start2;
679
- timesMap.set(file, extractMs);
749
+ const relativePath = path.relative(ctx.config.cwd, file);
750
+ timesMap.set(relativePath, extractMs);
680
751
  logger.debug("analyze", `Parsed ${file} in ${extractMs}ms`);
681
752
  if (result) {
682
- filesMap.set(file, result);
753
+ filesMap.set(relativePath, result);
683
754
  options.onResult?.(file, result);
684
755
  }
685
756
  });
686
757
  const totalMs = Array.from(timesMap.values()).reduce((a, b) => a + b, 0);
687
758
  logger.debug("analyze", `Analyzed ${files.length} files in ${totalMs.toFixed(2)}ms`);
688
- const minify = ctx.config.minify;
689
- ctx.config.optimize = true;
759
+ ctx.appendParserCss(sheet);
760
+ const cssStart = performance.now();
690
761
  ctx.config.minify = false;
691
- const css = "";
692
- const minifiedCss = "";
693
- ctx.config.minify = minify;
762
+ const css = ctx.getCss(sheet);
763
+ const cssMs = performance.now() - cssStart;
764
+ const cssMinifyStart = performance.now();
765
+ ctx.config.minify = true;
766
+ const minifiedCss = ctx.getCss(sheet);
767
+ const cssMinifyMs = performance.now() - cssMinifyStart;
768
+ let lightningCss = "";
769
+ let lightningCssMs;
770
+ let lightningCssMinifiedCss = "";
771
+ let lightningCssMinifiedMs;
772
+ const isUsingLightningCss = ctx.config.lightningcss;
773
+ if (!isUsingLightningCss) {
774
+ sheet["context"].lightningcss = true;
775
+ ctx.config.minify = false;
776
+ const lightningcssStart = performance.now();
777
+ lightningCss = ctx.getCss(sheet);
778
+ lightningCssMs = performance.now() - lightningcssStart;
779
+ ctx.config.minify = true;
780
+ const lightningcssMinifyStart = performance.now();
781
+ lightningCssMinifiedCss = ctx.getCss(sheet);
782
+ lightningCssMinifiedMs = performance.now() - lightningcssMinifyStart;
783
+ }
694
784
  const start = performance.now();
695
785
  const analysis = classifyTokens(ctx, filesMap);
696
786
  const classifyMs = performance.now() - start;
697
- return Object.assign(
787
+ const details = Object.assign(
698
788
  {
699
789
  duration: {
700
- extractTimeByFiles: Object.fromEntries(timesMap.entries()),
790
+ classify: classifyMs,
791
+ //
792
+ cssMs,
793
+ cssMinifyMs,
794
+ //
795
+ ...!isUsingLightningCss ? {
796
+ lightningCssMs,
797
+ lightningCssMinifiedMs
798
+ } : {},
799
+ //
701
800
  extractTotal: totalMs,
702
- classify: classifyMs
801
+ extractTimeByFiles: Object.fromEntries(timesMap.entries())
703
802
  },
704
803
  fileSizes: {
705
804
  lineCount: css.split("\n").length,
@@ -708,11 +807,24 @@ function analyzeTokens(ctx, options = {}) {
708
807
  gzip: {
709
808
  normal: filesize(gzipSizeSync(css)),
710
809
  minified: filesize(gzipSizeSync(minifiedCss))
711
- }
810
+ },
811
+ lightningCss: !isUsingLightningCss ? {
812
+ normal: filesize(Buffer.byteLength(lightningCss, "utf-8")),
813
+ minified: filesize(Buffer.byteLength(lightningCssMinifiedCss, "utf-8"))
814
+ } : void 0
712
815
  }
713
816
  },
714
- analysis
817
+ analysis.details
715
818
  );
819
+ const { globalCss, ...config } = ctx.config;
820
+ return {
821
+ schemaVersion: version,
822
+ details,
823
+ propByIndex: analysis.propById,
824
+ componentByIndex: analysis.componentById,
825
+ derived: analysis.derived,
826
+ config
827
+ };
716
828
  }
717
829
  var analyzeResultSerializer = (_key, value) => {
718
830
  if (value instanceof Set) {
@@ -724,25 +836,9 @@ var analyzeResultSerializer = (_key, value) => {
724
836
  return value;
725
837
  };
726
838
  var writeAnalyzeJSON = (filePath, result, ctx) => {
727
- result.details.byInstanceId.forEach((item) => {
728
- item.box = item.box.toJSON();
729
- });
730
839
  const dirname2 = ctx.runtime.path.dirname(filePath);
731
840
  ctx.runtime.fs.ensureDirSync(dirname2);
732
- return writeFile(
733
- filePath,
734
- JSON.stringify(
735
- Object.assign(result, {
736
- cwd: ctx.config.cwd,
737
- theme: ctx.config.theme,
738
- utilities: ctx.config.utilities,
739
- conditions: ctx.config.conditions,
740
- shorthands: ctx.utility.shorthands
741
- }),
742
- analyzeResultSerializer,
743
- 2
744
- )
745
- );
841
+ return writeFile(filePath, JSON.stringify(result, analyzeResultSerializer, 2));
746
842
  };
747
843
 
748
844
  // src/build-info.ts
@@ -1271,10 +1367,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1271
1367
  return 3;
1272
1368
  }
1273
1369
  if ("TERM_PROGRAM" in env) {
1274
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1370
+ const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1275
1371
  switch (env.TERM_PROGRAM) {
1276
1372
  case "iTerm.app": {
1277
- return version >= 3 ? 3 : 2;
1373
+ return version2 >= 3 ? 3 : 2;
1278
1374
  }
1279
1375
  case "Apple_Terminal": {
1280
1376
  return 2;
@@ -2305,8 +2401,8 @@ var nodeRuntime = {
2305
2401
  readDirSync: fsExtra.readdirSync,
2306
2402
  rmDirSync: fsExtra.emptyDirSync,
2307
2403
  rmFileSync: fsExtra.removeSync,
2308
- ensureDirSync(path3) {
2309
- return fsExtra.ensureDirSync(path3);
2404
+ ensureDirSync(path4) {
2405
+ return fsExtra.ensureDirSync(path4);
2310
2406
  },
2311
2407
  watch(options) {
2312
2408
  const { include, exclude, cwd, poll } = options;
@@ -2751,7 +2847,7 @@ var Builder = class {
2751
2847
  init_esm_shims();
2752
2848
  import { logger as logger7 } from "@pandacss/logger";
2753
2849
  import fs from "node:fs";
2754
- import path from "node:path";
2850
+ import path2 from "node:path";
2755
2851
  import readline from "node:readline";
2756
2852
  var startProfiling = async (cwd, prefix, isWatching) => {
2757
2853
  const inspector = await import("node:inspector").then((r) => r.default);
@@ -2816,7 +2912,7 @@ var startProfiling = async (cwd, prefix, isWatching) => {
2816
2912
  const date = /* @__PURE__ */ new Date();
2817
2913
  const timestamp = date.toISOString().replace(/[-:.]/g, "");
2818
2914
  const title = `panda-${prefix}-${timestamp}`;
2819
- const outfile = path.join(cwd, `${title}.cpuprofile`);
2915
+ const outfile = path2.join(cwd, `${title}.cpuprofile`);
2820
2916
  fs.writeFileSync(outfile, JSON.stringify(params.profile));
2821
2917
  logger7.info("cpu-prof", outfile);
2822
2918
  cb?.();
@@ -2869,8 +2965,7 @@ async function debug(ctx, options) {
2869
2965
  const files = ctx.getFiles();
2870
2966
  const measureTotal = logger9.time.debug(`Done parsing ${files.length} files`);
2871
2967
  ctx.config.minify = false;
2872
- ctx.config.optimize = true;
2873
- const { fs: fs3, path: path3 } = ctx.runtime;
2968
+ const { fs: fs3, path: path4 } = ctx.runtime;
2874
2969
  const outdir = options.outdir;
2875
2970
  if (!options.dry && outdir) {
2876
2971
  fs3.ensureDirSync(outdir);
@@ -2900,14 +2995,14 @@ async function debug(ctx, options) {
2900
2995
  if (outdir) {
2901
2996
  filesWithCss.push(file);
2902
2997
  const parsedPath = parse(file);
2903
- const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
2904
- const astJsonPath = `${relative2}${path3.sep}${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
2905
- const cssPath = `${relative2}${path3.sep}${parsedPath.name}.css`.replaceAll(path3.sep, "__");
2998
+ const relative2 = path4.relative(ctx.config.cwd, parsedPath.dir);
2999
+ const astJsonPath = `${relative2}${path4.sep}${parsedPath.name}.ast.json`.replaceAll(path4.sep, "__");
3000
+ const cssPath = `${relative2}${path4.sep}${parsedPath.name}.css`.replaceAll(path4.sep, "__");
2906
3001
  logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
2907
3002
  logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
2908
3003
  return Promise.allSettled([
2909
- fs3.writeFile(`${outdir}${path3.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2910
- fs3.writeFile(`${outdir}${path3.sep}${cssPath}`, css)
3004
+ fs3.writeFile(`${outdir}${path4.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
3005
+ fs3.writeFile(`${outdir}${path4.sep}${cssPath}`, css)
2911
3006
  ]);
2912
3007
  }
2913
3008
  });
@@ -3006,12 +3101,12 @@ function setupGitIgnore(ctx) {
3006
3101
  init_esm_shims();
3007
3102
  import { logger as logger11 } from "@pandacss/logger";
3008
3103
  import fs2 from "node:fs";
3009
- import path2 from "node:path";
3104
+ import path3 from "node:path";
3010
3105
  var setLogStream = (options) => {
3011
3106
  const { cwd = process.cwd() } = options;
3012
3107
  let stream;
3013
3108
  if (options.logfile) {
3014
- const outPath = path2.resolve(cwd, options.logfile);
3109
+ const outPath = path3.resolve(cwd, options.logfile);
3015
3110
  ensure(outPath);
3016
3111
  logger11.info("logfile", outPath);
3017
3112
  stream = fs2.createWriteStream(outPath, { flags: "a" });
@@ -3032,7 +3127,7 @@ var setLogStream = (options) => {
3032
3127
  };
3033
3128
  };
3034
3129
  var ensure = (outPath) => {
3035
- const dirname2 = path2.dirname(outPath);
3130
+ const dirname2 = path3.dirname(outPath);
3036
3131
  fs2.mkdirSync(dirname2, { recursive: true });
3037
3132
  return outPath;
3038
3133
  };