@pandacss/compiler 2.0.0-beta.7 → 2.0.0-beta.9

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.
@@ -91,8 +91,7 @@ var fallbackBuildInfo = new BuildInfo({
91
91
  var fallbackDesignSystem = new DesignSystem(
92
92
  {
93
93
  createManifest: (input) => ({ ...input, schemaVersion: -1 }),
94
- manifestSchemaVersion: () => -1,
95
- resolveChain: () => ({ status: "ordered", order: [] })
94
+ manifestSchemaVersion: () => -1
96
95
  },
97
96
  fallbackBuildInfo
98
97
  );
@@ -139,9 +138,6 @@ var FallbackCompiler = class _FallbackCompiler {
139
138
  designSystemManifestSchemaVersion() {
140
139
  return -1;
141
140
  }
142
- resolveDesignSystemChain() {
143
- return { status: "ordered", order: [] };
144
- }
145
141
  config() {
146
142
  return {};
147
143
  }
@@ -218,6 +214,17 @@ var FallbackCompiler = class _FallbackCompiler {
218
214
  inspectFileSource(_path, _source) {
219
215
  return { usages: [], diagnostics: [], calls: [], jsx: [], tokenRefs: [], componentEntries: [], styleEntries: [] };
220
216
  }
217
+ transformSource(input) {
218
+ return {
219
+ code: input.source,
220
+ map: null,
221
+ changed: false,
222
+ bailed: false,
223
+ diagnostics: [],
224
+ dependencies: [],
225
+ helper: { needsCx: false, needsCva: false, needsSva: false }
226
+ };
227
+ }
221
228
  inspectFile(input) {
222
229
  return { ...this.inspectFileSource(input.path, input.source), path: input.path };
223
230
  }
@@ -230,6 +237,9 @@ var FallbackCompiler = class _FallbackCompiler {
230
237
  suggestTokens() {
231
238
  return [];
232
239
  }
240
+ suggestSemanticTokens() {
241
+ return [];
242
+ }
233
243
  writeArtifacts(_options) {
234
244
  return [];
235
245
  }
@@ -299,6 +309,9 @@ var fallback = {
299
309
  },
300
310
  flushTracing() {
301
311
  },
312
+ takeTimingsJson() {
313
+ return void 0;
314
+ },
302
315
  shutdownTracing() {
303
316
  return false;
304
317
  },
@@ -453,98 +466,215 @@ import {
453
466
  compilePreset,
454
467
  defaultImportMap,
455
468
  diffConfig,
456
- loadConfig,
469
+ filterPublishableLibFiles,
470
+ loadConfig as loadConfig2,
457
471
  mergeExcludes,
458
472
  readPackageIdentity,
473
+ readPandaVersion as readPandaVersion2,
474
+ resolvePublishedPandaRange,
459
475
  resolveSmartInclude,
460
476
  syncExports,
461
477
  toPosixRelative,
462
478
  toRelativeKey
463
479
  } from "@pandacss/config";
464
480
 
481
+ // src/tooling/create-project.ts
482
+ import { defaultConfig } from "@pandacss/compiler-shared";
483
+ import { loadConfig } from "@pandacss/config";
484
+
465
485
  // src/design-system.ts
466
486
  import "@pandacss/compiler-shared";
467
487
  import { readPandaVersion } from "@pandacss/config";
468
488
  function hydrateDesignSystem(compiler, chain, consumerTokenPaths = []) {
469
- if (!chain || chain.length === 0) return [];
489
+ if (!chain || chain.length === 0) {
490
+ return [];
491
+ }
470
492
  const pandaVersion = readPandaVersion();
471
493
  const diagnostics = [];
472
- for (const ds of chain) diagnostics.push(...hydrateLevel(compiler, ds, pandaVersion, consumerTokenPaths));
494
+ for (const ds of chain) {
495
+ diagnostics.push(...hydrateLevel(compiler, ds, pandaVersion, consumerTokenPaths));
496
+ }
473
497
  return diagnostics;
474
498
  }
475
499
  function hydrateLevel(compiler, ds, pandaVersion, consumerTokenPaths) {
476
500
  const compat = compiler.designSystem.validate(ds.manifest, { pandaVersion });
477
- if (!compat.ok) throw incompatibleManifestError(compiler, ds, compat.reason, pandaVersion);
478
- const diagnostics = [];
501
+ if (!compat.ok) {
502
+ throw incompatibleManifestError(compiler, ds, compat.reason, pandaVersion);
503
+ }
504
+ const diagnostics = hydrateArtifacts(compiler, ds, pandaVersion);
505
+ diagnostics.push(...tokenConflictDiagnostics(ds, consumerTokenPaths));
506
+ return diagnostics;
507
+ }
508
+ function hydrateArtifacts(compiler, ds, pandaVersion) {
509
+ if (ds.optionMismatch && ds.optionMismatch.length > 0) {
510
+ const diagnostic = recoverFromSources(
511
+ compiler,
512
+ ds,
513
+ (sourceCount, severity) => optionMismatchDiagnostic(ds, sourceCount, severity)
514
+ );
515
+ return [diagnostic];
516
+ }
479
517
  let buildInfo;
480
518
  try {
481
519
  const content = compiler.fs.readFile(ds.buildInfoPath);
482
- if (content == null) throw new Error(`file not found`);
520
+ if (content == null) {
521
+ throw new Error("file not found");
522
+ }
483
523
  buildInfo = JSON.parse(content);
484
524
  } catch (error) {
485
- if (!tryStaleFallback(compiler, ds, diagnostics)) throw hydrateReadError(ds, error);
486
- }
487
- if (buildInfo) {
488
- const result = compiler.designSystem.load(ds.manifest, { buildInfo, pandaVersion });
489
- if (!result.ok && !tryStaleFallback(compiler, ds, diagnostics)) throw hydrateLoadError(ds, result.reason);
525
+ const issue = { kind: "read", detail: errorMessage(error) };
526
+ const diagnostic = recoverFromSources(
527
+ compiler,
528
+ ds,
529
+ (sourceCount, severity) => buildInfoDiagnostic(ds, issue, sourceCount, severity)
530
+ );
531
+ return [diagnostic];
532
+ }
533
+ const result = compiler.designSystem.load(ds.manifest, { buildInfo, pandaVersion });
534
+ if (!result.ok) {
535
+ const issue = result.reason === "schemaVersion" ? {
536
+ kind: "schemaVersion",
537
+ received: buildInfo.schemaVersion,
538
+ expected: compiler.buildInfo.schemaVersion
539
+ } : { kind: "corrupt" };
540
+ const diagnostic = recoverFromSources(
541
+ compiler,
542
+ ds,
543
+ (sourceCount, severity) => buildInfoDiagnostic(ds, issue, sourceCount, severity)
544
+ );
545
+ return [diagnostic];
490
546
  }
491
- diagnostics.push(...tokenConflictDiagnostics(ds, consumerTokenPaths));
492
- return diagnostics;
547
+ return [];
493
548
  }
494
- function tryStaleFallback(compiler, ds, diagnostics) {
495
- if (ds.files.length === 0) return false;
496
- const sources = compiler.scan({ include: ds.files, cwd: compiler.path.dirname(ds.manifestPath) });
497
- if (sources.length === 0) return false;
549
+ function recoverFromSources(compiler, ds, createDiagnostic) {
550
+ const sources = extractFallbackSources(compiler, ds);
551
+ const severity = sources.length === 0 ? "error" : "warning";
552
+ const diagnostic = createDiagnostic(sources.length, severity);
553
+ if (sources.length === 0) {
554
+ throw diagnosticError(diagnostic);
555
+ }
498
556
  compiler.parseFiles(sources);
499
- diagnostics.push({
557
+ return diagnostic;
558
+ }
559
+ function extractFallbackSources(compiler, ds) {
560
+ if (ds.files.length === 0) {
561
+ return [];
562
+ }
563
+ return compiler.scan({ include: ds.files, cwd: compiler.path.dirname(ds.manifestPath) });
564
+ }
565
+ function buildInfoDiagnostic(ds, issue, sourceCount, severity) {
566
+ const reason = buildInfoIssueMessage(issue);
567
+ const outcome = sourceCount > 0 ? ` Re-extracted ${sourceCount} source ${sourceCount === 1 ? "file" : "files"}.` : " No fallback source files were available.";
568
+ return {
500
569
  code: "design_system_buildinfo_stale",
501
- severity: "warning",
570
+ severity,
502
571
  category: "designSystem",
503
- message: `Re-extracting ${JSON.stringify(ds.name)} from source; rebuild it with \`panda lib\` to restore the fast path.`
504
- });
505
- return true;
572
+ file: ds.buildInfoPath,
573
+ message: `${JSON.stringify(ds.name)} build info ${reason}.${outcome}`,
574
+ help: [`Run \`panda lib\` in ${JSON.stringify(ds.name)} to rebuild panda.buildinfo.json.`]
575
+ };
576
+ }
577
+ function buildInfoIssueMessage(issue) {
578
+ if (issue.kind === "schemaVersion") {
579
+ return `uses schemaVersion ${formatValue(issue.received)}; expected ${issue.expected}`;
580
+ }
581
+ if (issue.kind === "read") {
582
+ return `could not be read: ${issue.detail}`;
583
+ }
584
+ return "is malformed or corrupt";
585
+ }
586
+ function optionMismatchDiagnostic(ds, sourceCount, severity) {
587
+ const options = ds.optionMismatch?.join(", ") ?? "class-name options";
588
+ const outcome = sourceCount > 0 ? ` Re-extracted ${sourceCount} source ${sourceCount === 1 ? "file" : "files"} with the consumer options.` : " No fallback source files were available, so the prebuilt class names cannot be used safely.";
589
+ return {
590
+ code: "design_system_option_mismatch",
591
+ severity,
592
+ category: "designSystem",
593
+ file: ds.manifestPath,
594
+ message: `${JSON.stringify(ds.name)} was built with different ${options}.${outcome}`,
595
+ help: [`Match ${options} with ${JSON.stringify(ds.name)}, or rebuild it with \`panda lib\`.`]
596
+ };
506
597
  }
507
598
  function tokenConflictDiagnostics(ds, consumerTokenPaths) {
508
- if (consumerTokenPaths.length === 0 || ds.tokenPaths.length === 0) return [];
599
+ if (consumerTokenPaths.length === 0 || ds.tokenPaths.length === 0) {
600
+ return [];
601
+ }
509
602
  const designSystemTokenPaths = new Set(ds.tokenPaths);
510
603
  const conflicts = [...new Set(consumerTokenPaths.filter((path) => designSystemTokenPaths.has(path)))].sort();
511
- return conflicts.map((path) => ({
512
- code: "design_system_token_conflict",
513
- severity: "warning",
514
- category: "designSystem",
515
- message: `Token ${JSON.stringify(path)} is defined by both ${JSON.stringify(ds.name)} and this config; the local value wins.`
516
- }));
604
+ if (conflicts.length === 0) {
605
+ return [];
606
+ }
607
+ const preview = conflicts.slice(0, 3).map((path) => JSON.stringify(path)).join(", ");
608
+ const remainder = conflicts.length > 3 ? ` and ${conflicts.length - 3} more` : "";
609
+ return [
610
+ {
611
+ code: "design_system_token_conflict",
612
+ severity: "info",
613
+ category: "designSystem",
614
+ file: ds.manifestPath,
615
+ message: `${conflicts.length} token ${conflicts.length === 1 ? "path is" : "paths are"} defined by both ${JSON.stringify(ds.name)} and this config (${preview}${remainder}); the local values win.`
616
+ }
617
+ ];
517
618
  }
518
619
  function incompatibleManifestError(compiler, ds, reason, pandaVersion) {
519
620
  if (reason === "schemaVersion") {
520
- return new Error(
521
- `Failed to hydrate designSystem ${JSON.stringify(ds.name)} from ${JSON.stringify(ds.manifestPath)}: manifest schemaVersion ${ds.manifest.schemaVersion} is incompatible with this compiler (expected ${compiler.designSystem.schemaVersion}).`
522
- );
621
+ return diagnosticError({
622
+ code: "design_system_version_mismatch",
623
+ severity: "error",
624
+ category: "designSystem",
625
+ file: ds.manifestPath,
626
+ message: `${JSON.stringify(ds.name)} panda.lib.json uses schemaVersion ${ds.manifest.schemaVersion}; expected ${compiler.designSystem.schemaVersion}.`,
627
+ help: [`Upgrade ${JSON.stringify(ds.name)}, or rebuild it with a compatible version of Panda.`]
628
+ });
523
629
  }
524
- const running = pandaVersion ? ` (you are on ${pandaVersion})` : "";
525
- return new Error(
526
- `Failed to hydrate designSystem ${JSON.stringify(ds.name)}: manifest requires Panda ${ds.manifest.panda}${running}.`
527
- );
630
+ const running = pandaVersion ? `; the consumer uses ${pandaVersion}` : "";
631
+ return diagnosticError({
632
+ code: "design_system_peer_range_unsatisfied",
633
+ severity: "error",
634
+ category: "designSystem",
635
+ file: ds.manifestPath,
636
+ message: `${JSON.stringify(ds.name)} requires Panda ${ds.manifest.panda}${running}.`,
637
+ help: [`Install a compatible Panda version or update ${JSON.stringify(ds.name)}.`]
638
+ });
528
639
  }
529
- function hydrateReadError(ds, error) {
530
- return new Error(
531
- `Failed to hydrate designSystem ${JSON.stringify(ds.name)} from ${JSON.stringify(ds.buildInfoPath)}: ${errorMessage(error)}`
532
- );
640
+ function diagnosticError(diagnostic) {
641
+ const error = new Error(diagnostic.message);
642
+ error.diagnostics = [diagnostic];
643
+ return error;
533
644
  }
534
- function hydrateLoadError(ds, reason) {
535
- return new Error(
536
- `Failed to hydrate designSystem ${JSON.stringify(ds.name)} from ${JSON.stringify(ds.buildInfoPath)}: incompatible buildInfo ${reason}.`
537
- );
645
+ function formatValue(value) {
646
+ return typeof value === "number" || typeof value === "string" ? JSON.stringify(value) : String(value);
538
647
  }
539
648
  function errorMessage(error) {
540
649
  return error instanceof Error ? error.message : String(error);
541
650
  }
542
651
 
652
+ // src/tooling/create-project.ts
653
+ function createProjectFromLoadedConfig(loaded) {
654
+ const compiler = createCompilerFromSnapshot({
655
+ config: loaded.config,
656
+ callbacks: loaded.callbacks,
657
+ hooks: loaded.hooks
658
+ });
659
+ const designSystemDiagnostics = hydrateDesignSystem(
660
+ compiler,
661
+ loaded.metadata?.designSystem,
662
+ loaded.metadata?.userTokenPaths ?? []
663
+ );
664
+ return {
665
+ compiler,
666
+ configPath: loaded.path,
667
+ dependencies: loaded.dependencies,
668
+ outdir: loaded.config.outdir ?? defaultConfig.outdir,
669
+ designSystemDiagnostics
670
+ };
671
+ }
672
+
543
673
  // src/driver.ts
544
674
  var DEFAULT_DESIGN_SYSTEM_LIB_OUTDIR = "dist";
545
675
  var DEFAULT_DESIGN_SYSTEM_LIB_FILES = ["./**/*.{js,mjs}"];
546
676
  async function createNodeDriver(options) {
547
- const loaded = await loadConfig({ cwd: options.cwd, file: options.configPath });
677
+ const loaded = await loadConfig2({ cwd: options.cwd, file: options.configPath });
548
678
  if (options.include?.length) applyIncludeOverride(loaded, options.cwd, options.include);
549
679
  return new NodeDriver(options, loaded);
550
680
  }
@@ -566,7 +696,7 @@ var NodeDriver = class extends BaseDriver {
566
696
  #designSystemArtifactSnapshot;
567
697
  #designSystemWatchTargets;
568
698
  constructor(options, loaded) {
569
- const built = buildFromConfig(loaded);
699
+ const built = createProjectFromLoadedConfig(loaded);
570
700
  super(built.compiler);
571
701
  this.#options = options;
572
702
  this.#loaded = loaded;
@@ -623,15 +753,29 @@ var NodeDriver = class extends BaseDriver {
623
753
  if (kind === "source") return this.applyChange(change);
624
754
  return false;
625
755
  }
756
+ syncDesignSystemSources() {
757
+ const changes = [];
758
+ const activeFiles = new Map(
759
+ this.compiler.fileManifest().map((file) => [this.compiler.path.realpath(file.path), file.path])
760
+ );
761
+ for (const target of this.designSystemWatchTargets()) {
762
+ for (const path of target.sourceFiles) {
763
+ const activePath = activeFiles.get(this.compiler.path.realpath(path));
764
+ if (!activePath) continue;
765
+ changes.push({ path: activePath, kind: this.compiler.fs.exists(path) ? "change" : "unlink" });
766
+ }
767
+ }
768
+ return this.applyChanges(changes);
769
+ }
626
770
  async reload() {
627
- const next = await loadConfig({ cwd: this.#options.cwd, file: this.#options.configPath });
771
+ const next = await loadConfig2({ cwd: this.#options.cwd, file: this.#options.configPath });
628
772
  if (this.#options.include?.length) applyIncludeOverride(next, this.#options.cwd, this.#options.include);
629
773
  const diff = diffConfig(this.#loaded, next);
630
774
  const nextDesignSystemArtifactSnapshot = designSystemArtifactSnapshot(this.compiler, next);
631
775
  const designSystemArtifactsChanged = this.#designSystemArtifactSnapshot !== nextDesignSystemArtifactSnapshot;
632
776
  if (diff.hasChanged || designSystemArtifactsChanged) {
633
777
  this.#loaded = next;
634
- const built = buildFromConfig(next);
778
+ const built = createProjectFromLoadedConfig(next);
635
779
  this.setCompiler(built.compiler);
636
780
  this.#designSystemDiagnostics = built.designSystemDiagnostics;
637
781
  this.#designSystemPreset = void 0;
@@ -688,6 +832,66 @@ var NodeDriver = class extends BaseDriver {
688
832
  }
689
833
  return files;
690
834
  }
835
+ cssgen(options) {
836
+ const output = super.cssgen(options);
837
+ this.runCssgenDone({
838
+ artifact: "styles.css",
839
+ content: output.css,
840
+ cwd: this.#options.cwd,
841
+ manifest: output.manifest,
842
+ layerRanges: output.layerRanges
843
+ });
844
+ return output;
845
+ }
846
+ writeCss(options) {
847
+ const result = super.writeCss(options);
848
+ this.runCssgenDone({
849
+ artifact: "styles.css",
850
+ content: result.css,
851
+ path: result.path,
852
+ outfile: options.outfile,
853
+ cwd: options.cwd ?? this.#options.cwd,
854
+ manifest: result.manifest,
855
+ layerRanges: result.layerRanges
856
+ });
857
+ return result;
858
+ }
859
+ writeLayerCss(options) {
860
+ const result = super.writeLayerCss(options);
861
+ this.runCssgenDone({
862
+ artifact: "styles.layer",
863
+ content: result.css,
864
+ path: result.path,
865
+ outfile: options.outfile,
866
+ cwd: options.cwd ?? this.#options.cwd,
867
+ manifest: result.manifest,
868
+ layerRanges: result.layerRanges
869
+ });
870
+ return result;
871
+ }
872
+ writeSplitCss(options) {
873
+ const result = super.writeSplitCss(options);
874
+ const cwd = options?.cwd ?? this.#options.cwd;
875
+ const outdir = result.root;
876
+ for (const file of result.files) {
877
+ const path = this.compiler.path.join([result.root, file.path]);
878
+ this.runCssgenDone({
879
+ artifact: "styles.split",
880
+ content: file.code,
881
+ path,
882
+ outdir,
883
+ cwd
884
+ });
885
+ }
886
+ return result;
887
+ }
888
+ runCssgenDone(args) {
889
+ const hooks = this.#loaded.hostHooks?.["cssgen:done"] ?? [];
890
+ for (const entry of hooks) {
891
+ const handler = resolveHookHandler(entry.value, "cssgen:done");
892
+ handler(args);
893
+ }
894
+ }
691
895
  codegenWithPrepareHooks(hooks, outdir, cwd, options) {
692
896
  let artifacts = this.compiler.generateArtifacts(toGenerateArtifactOptions(options));
693
897
  for (const entry of hooks) {
@@ -734,7 +938,7 @@ var NodeDriver = class extends BaseDriver {
734
938
  }
735
939
  writeDesignSystemLibArtifacts(options, preset, parsed) {
736
940
  const identity = readPackageIdentity(this.#options.cwd);
737
- const pandaRange = options.panda ?? identity.pandaPeer ?? "*";
941
+ const pandaRange = resolvePublishedPandaRange(options.panda ?? identity.pandaPeer, readPandaVersion2());
738
942
  const outdir = options.outdir ?? DEFAULT_DESIGN_SYSTEM_LIB_OUTDIR;
739
943
  const outRoot = this.compiler.path.resolve(outdir);
740
944
  const manifestPath = this.compiler.path.join([outRoot, "panda.lib.json"]);
@@ -744,6 +948,16 @@ var NodeDriver = class extends BaseDriver {
744
948
  const buildInfo = this.compiler.buildInfo.normalize(info, {
745
949
  mapModuleKey: (key) => toRelativeKey(key, this.#options.cwd)
746
950
  });
951
+ const { files: libFiles, diagnostics: filesDiagnostics } = resolveDesignSystemLibFiles({
952
+ explicit: options.files,
953
+ compiler: this.compiler,
954
+ cwd: this.#options.cwd,
955
+ outRoot,
956
+ buildInfo,
957
+ packageRoot: this.compiler.path.dirname(identity.packagePath),
958
+ publishFiles: identity.publishFiles,
959
+ packageName: identity.name
960
+ });
747
961
  const manifest = this.compiler.designSystem.create({
748
962
  name: identity.name,
749
963
  version: identity.version,
@@ -752,7 +966,7 @@ var NodeDriver = class extends BaseDriver {
752
966
  buildInfo: "./panda.buildinfo.json",
753
967
  importMap: defaultImportMap(identity.name),
754
968
  designSystem: typeof this.config.designSystem === "string" ? this.config.designSystem : void 0,
755
- files: options.files ?? inferDesignSystemLibFiles(this.compiler, this.#options.cwd, outRoot, buildInfo)
969
+ files: libFiles
756
970
  });
757
971
  this.compiler.writeArtifacts({
758
972
  outdir,
@@ -781,7 +995,7 @@ var NodeDriver = class extends BaseDriver {
781
995
  }
782
996
  ]
783
997
  });
784
- const exportsChanged = syncPackageExports(this.compiler, identity.packagePath, {
998
+ const { changed: exportsChanged, conflicts } = syncPackageExports(this.compiler, identity.packagePath, {
785
999
  manifestPath,
786
1000
  presetPath
787
1001
  });
@@ -791,10 +1005,52 @@ var NodeDriver = class extends BaseDriver {
791
1005
  presetPath,
792
1006
  exportsChanged,
793
1007
  parsedFileCount: parsed.parsedFileCount,
794
- diagnostics: parsed.diagnostics
1008
+ diagnostics: [...parsed.diagnostics, ...filesDiagnostics, ...exportConflictDiagnostics(identity.name, conflicts)]
795
1009
  };
796
1010
  }
797
1011
  };
1012
+ function resolveDesignSystemLibFiles(options) {
1013
+ if (options.explicit) {
1014
+ return { files: options.explicit, diagnostics: [] };
1015
+ }
1016
+ const inferred = inferDesignSystemLibFiles(options.compiler, options.cwd, options.outRoot, options.buildInfo);
1017
+ const { files, unpublished } = filterPublishableLibFiles({
1018
+ files: inferred,
1019
+ packageRoot: options.packageRoot,
1020
+ outRoot: options.outRoot,
1021
+ publishFiles: options.publishFiles
1022
+ });
1023
+ if (unpublished.length === 0) {
1024
+ return { files, diagnostics: [] };
1025
+ }
1026
+ return {
1027
+ files,
1028
+ diagnostics: [unpublishedLibFilesDiagnostic(options.packageName, unpublished)]
1029
+ };
1030
+ }
1031
+ function unpublishedLibFilesDiagnostic(name, unpublished) {
1032
+ const sample = unpublished.slice(0, 3).map((path) => JSON.stringify(path)).join(", ");
1033
+ const more = unpublished.length > 3 ? `, and ${unpublished.length - 3} more` : "";
1034
+ return {
1035
+ code: "design_system_files_not_publishable",
1036
+ severity: "warning",
1037
+ category: "designSystem",
1038
+ message: `\`panda lib\` omitted ${unpublished.length === 1 ? "a fallback file" : "fallback files"} from ${JSON.stringify(name)}'s manifest because package.json \`"files"\` would not publish ${sample}${more}. Happy-path consumers still hydrate build info. For dist-only recovery, re-run with \`panda lib --files './**/*.{js,mjs}'\` (or the globs you actually publish).`
1039
+ };
1040
+ }
1041
+ function exportConflictDiagnostics(name, conflicts) {
1042
+ if (conflicts.length === 0) return [];
1043
+ const paths = conflicts.map((path) => JSON.stringify(path)).join(", ");
1044
+ const plural = conflicts.length > 1;
1045
+ return [
1046
+ {
1047
+ code: "design_system_export_overwritten",
1048
+ severity: "warning",
1049
+ category: "designSystem",
1050
+ message: `\`panda lib\` overwrote the existing ${paths} export${plural ? "s" : ""} in ${JSON.stringify(name)}'s package.json. Restore or rename ${plural ? "them" : "it"} if you still need the previous target${plural ? "s" : ""}.`
1051
+ }
1052
+ ];
1053
+ }
798
1054
  function resolveHookHandler(value, name) {
799
1055
  if (typeof value === "function") return value;
800
1056
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -838,25 +1094,12 @@ function syncPackageExports(compiler, packagePath, paths) {
838
1094
  ]
839
1095
  });
840
1096
  }
841
- return result.changed;
1097
+ return { changed: result.changed, conflicts: result.conflicts };
842
1098
  }
843
1099
  function stabilizePath(cwd, file) {
844
1100
  const relativePath = toRelativeKey(file, cwd);
845
1101
  return relativePath && !relativePath.startsWith("..") ? relativePath : file;
846
1102
  }
847
- function buildFromConfig(loaded) {
848
- const compiler = createCompilerFromSnapshot({
849
- config: loaded.config,
850
- callbacks: loaded.callbacks,
851
- hooks: loaded.hooks
852
- });
853
- const designSystemDiagnostics = hydrateDesignSystem(
854
- compiler,
855
- loaded.metadata?.designSystem,
856
- loaded.metadata?.userTokenPaths ?? []
857
- );
858
- return { compiler, designSystemDiagnostics };
859
- }
860
1103
  function designSystemArtifactSnapshot(compiler, loaded) {
861
1104
  return JSON.stringify(
862
1105
  loaded.metadata?.designSystem?.map((ds) => ({
@@ -897,6 +1140,9 @@ function startTracing(options) {
897
1140
  function flushTracing() {
898
1141
  binding.flushTracing?.();
899
1142
  }
1143
+ function takeTimingsJson() {
1144
+ return binding.takeTimingsJson?.() ?? void 0;
1145
+ }
900
1146
  function shutdownTracing() {
901
1147
  return binding.shutdownTracing?.() ?? false;
902
1148
  }
@@ -996,8 +1242,7 @@ function attachInspection(compiler) {
996
1242
  function toDesignSystemBinding(compiler) {
997
1243
  return {
998
1244
  createManifest: (input) => compiler.createDesignSystemManifest(input),
999
- manifestSchemaVersion: () => compiler.designSystemManifestSchemaVersion(),
1000
- resolveChain: (manifests) => compiler.resolveDesignSystemChain(manifests)
1245
+ manifestSchemaVersion: () => compiler.designSystemManifestSchemaVersion()
1001
1246
  };
1002
1247
  }
1003
1248
  function toNativeOptions(options) {
@@ -1021,6 +1266,7 @@ export {
1021
1266
  compile,
1022
1267
  startTracing,
1023
1268
  flushTracing,
1269
+ takeTimingsJson,
1024
1270
  shutdownTracing,
1025
1271
  createCompiler,
1026
1272
  createCompilerFromSnapshot,