@pandacss/node 0.18.3 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,9 +11,9 @@ var __esm = (fn, res) => function __init() {
11
11
  var __commonJS = (cb, mod) => function __require() {
12
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
13
  };
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
14
+ var __export = (target, all2) => {
15
+ for (var name in all2)
16
+ __defProp(target, name, { get: all2[name], enumerable: true });
17
17
  };
18
18
  var __copyProps = (to, from, except, desc) => {
19
19
  if (from && typeof from === "object" || typeof from === "function") {
@@ -404,12 +404,11 @@ var require_ansi_align = __commonJS({
404
404
  var src_exports = {};
405
405
  __export(src_exports, {
406
406
  Builder: () => Builder,
407
+ PandaContext: () => PandaContext,
407
408
  analyzeTokens: () => analyzeTokens,
408
409
  bundleCss: () => bundleCss,
409
410
  bundleMinimalFilesCss: () => bundleMinimalFilesCss,
410
- createContext: () => createContext,
411
411
  debugFiles: () => debugFiles,
412
- emitArtfifactsAndCssChunks: () => emitArtfifactsAndCssChunks,
413
412
  emitArtifacts: () => emitArtifacts,
414
413
  execCommand: () => execCommand,
415
414
  extractFile: () => extractFile,
@@ -720,7 +719,7 @@ function analyzeTokens(ctx, options = {}) {
720
719
  const chunkFiles = ctx.chunks.getFiles();
721
720
  ctx.config.optimize = true;
722
721
  ctx.config.minify = false;
723
- const css = ctx.getCss({ files: chunkFiles });
722
+ const css2 = ctx.getCss({ files: chunkFiles });
724
723
  ctx.config.minify = true;
725
724
  const minifiedCss = ctx.getCss({ files: chunkFiles });
726
725
  ctx.config.minify = minify;
@@ -735,11 +734,11 @@ function analyzeTokens(ctx, options = {}) {
735
734
  classify: classifyMs
736
735
  },
737
736
  fileSizes: {
738
- lineCount: css.split("\n").length,
739
- normal: (0, import_filesize.filesize)(Buffer.byteLength(css, "utf-8")),
737
+ lineCount: css2.split("\n").length,
738
+ normal: (0, import_filesize.filesize)(Buffer.byteLength(css2, "utf-8")),
740
739
  minified: (0, import_filesize.filesize)(Buffer.byteLength(minifiedCss, "utf-8")),
741
740
  gzip: {
742
- normal: (0, import_filesize.filesize)(gzipSizeSync(css)),
741
+ normal: (0, import_filesize.filesize)(gzipSizeSync(css2)),
743
742
  minified: (0, import_filesize.filesize)(gzipSizeSync(minifiedCss))
744
743
  }
745
744
  }
@@ -781,13 +780,11 @@ var writeAnalyzeJSON = (filePath, result, ctx) => {
781
780
 
782
781
  // src/builder.ts
783
782
  init_cjs_shims();
784
- var import_config2 = require("@pandacss/config");
785
783
  var import_core3 = require("@pandacss/core");
786
784
  var import_error = require("@pandacss/error");
787
- var import_logger5 = require("@pandacss/logger");
785
+ var import_logger6 = require("@pandacss/logger");
788
786
  var import_fs = require("fs");
789
787
  var import_fs_extra2 = __toESM(require("fs-extra"));
790
- var import_path2 = require("path");
791
788
 
792
789
  // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
793
790
  init_cjs_shims();
@@ -896,17 +893,20 @@ function pLimit(concurrency) {
896
893
  return generator;
897
894
  }
898
895
 
896
+ // src/builder.ts
897
+ var import_pathe2 = require("pathe");
898
+
899
899
  // src/config.ts
900
900
  init_cjs_shims();
901
- var import_config = require("@pandacss/config");
901
+ var import_config2 = require("@pandacss/config");
902
902
  var import_hookable = require("hookable");
903
903
  var import_look_it_up = require("look-it-up");
904
904
  var import_tsconfck = require("tsconfck");
905
905
 
906
906
  // src/create-context.ts
907
907
  init_cjs_shims();
908
- var import_generator = require("@pandacss/generator");
909
- var import_logger3 = require("@pandacss/logger");
908
+ var import_generator2 = require("@pandacss/generator");
909
+ var import_logger4 = require("@pandacss/logger");
910
910
  var import_parser = require("@pandacss/parser");
911
911
 
912
912
  // src/chunk-engine.ts
@@ -929,10 +929,11 @@ var getChunkEngine = ({
929
929
  format(file) {
930
930
  return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
931
931
  },
932
- getArtifact(file, css) {
932
+ getArtifact(file, css2) {
933
933
  const fileName = this.format(file);
934
- const newCss = (0, import_core.mergeCss)(this.readFile(file), css);
934
+ const newCss = (0, import_core.mergeCss)(this.readFile(file), css2);
935
935
  return {
936
+ id: fileName,
936
937
  dir: paths.chunk,
937
938
  files: [{ file: fileName, code: newCss }]
938
939
  };
@@ -1024,58 +1025,200 @@ process.on("uncaughtException", (reason) => {
1024
1025
 
1025
1026
  // src/output-engine.ts
1026
1027
  init_cjs_shims();
1027
- var getOutputEngine = ({
1028
- paths,
1029
- runtime: { path: path2, fs }
1030
- }) => ({
1028
+ var import_logger3 = require("@pandacss/logger");
1029
+ var PandaOutputEngine = class {
1030
+ paths;
1031
+ fs;
1032
+ path;
1033
+ constructor({ paths, runtime: { path: path2, fs } }) {
1034
+ this.paths = paths;
1035
+ this.fs = fs;
1036
+ this.path = path2;
1037
+ }
1031
1038
  empty() {
1032
- fs.rmDirSync(path2.join(...paths.root));
1033
- },
1039
+ this.fs.rmDirSync(this.path.join(...this.paths.root));
1040
+ }
1034
1041
  async write(output) {
1035
1042
  if (!output)
1036
1043
  return;
1037
- const { dir = paths.root, files } = output;
1038
- fs.ensureDirSync(path2.join(...dir));
1044
+ const { dir = this.paths.root, files } = output;
1045
+ this.fs.ensureDirSync(this.path.join(...dir));
1039
1046
  return Promise.allSettled(
1040
1047
  files.map(async (artifact) => {
1041
- if (!artifact)
1048
+ if (!artifact?.code)
1042
1049
  return;
1043
1050
  const { file, code } = artifact;
1044
- const absPath = path2.join(...dir, file);
1045
- if (!code)
1046
- return;
1047
- return fs.writeFile(absPath, code);
1051
+ const absPath = this.path.join(...dir, file);
1052
+ import_logger3.logger.debug("write:file", dir.slice(-1).concat(file).join("/"));
1053
+ return this.fs.writeFile(absPath, code);
1048
1054
  })
1049
1055
  );
1050
1056
  }
1051
- });
1057
+ };
1058
+
1059
+ // src/diff-engine.ts
1060
+ init_cjs_shims();
1061
+ var import_config = require("@pandacss/config");
1062
+ var import_generator = require("@pandacss/generator");
1063
+ var import_shared = require("@pandacss/shared");
1064
+ var import_microdiff = __toESM(require("microdiff"));
1065
+
1066
+ // src/matcher.ts
1067
+ init_cjs_shims();
1068
+ function createMatcher(id, patterns) {
1069
+ if (!patterns?.length)
1070
+ return () => void 0;
1071
+ const includePatterns = [];
1072
+ const excludePatterns = [];
1073
+ const deduped = new Set(patterns);
1074
+ deduped.forEach((pattern) => {
1075
+ const regexString = pattern.replace(/\*/g, ".*");
1076
+ if (pattern.startsWith("!")) {
1077
+ excludePatterns.push(regexString.slice(1));
1078
+ } else {
1079
+ includePatterns.push(regexString);
1080
+ }
1081
+ });
1082
+ const include = new RegExp(includePatterns.join("|"));
1083
+ const exclude = new RegExp(excludePatterns.join("|"));
1084
+ return (path2) => {
1085
+ if (excludePatterns.length && exclude.test(path2))
1086
+ return;
1087
+ return include.test(path2) ? id : void 0;
1088
+ };
1089
+ }
1090
+
1091
+ // src/diff-engine.ts
1092
+ var all = ["outdir", "forceConsistentTypeExtension", "outExtension"];
1093
+ var format = ["syntax", "hash", "prefix", "separator"];
1094
+ var tokens = ["utilities", "conditions", "theme.tokens", "theme.semanticTokens", "theme.breakpoints"];
1095
+ var jsx = ["jsxFramework", "jsxFactory", "jsxStyleProps", "syntax"];
1096
+ var css = ["layers", "optimize", "minify"];
1097
+ var common = tokens.concat(jsx, format);
1098
+ var artifactConfigDeps = {
1099
+ helpers: ["syntax", "jsxFramework"],
1100
+ keyframes: ["theme.keyframes", "layers"],
1101
+ "design-tokens": ["layers", "!utilities.*.className"].concat(tokens),
1102
+ types: ["!utilities.*.className"].concat(common),
1103
+ "css-fn": common,
1104
+ cva: ["syntax"],
1105
+ sva: ["syntax"],
1106
+ cx: [],
1107
+ "create-recipe": ["separator", "prefix", "hash"],
1108
+ "recipes-index": ["theme.recipes", "theme.slotRecipes"],
1109
+ recipes: ["theme.recipes", "theme.slotRecipes"],
1110
+ "patterns-index": ["syntax", "patterns"],
1111
+ patterns: ["syntax", "patterns"],
1112
+ "jsx-is-valid-prop": common,
1113
+ "jsx-factory": jsx,
1114
+ "jsx-helpers": jsx,
1115
+ "jsx-patterns": jsx.concat("patterns"),
1116
+ "jsx-patterns-index": jsx.concat("patterns"),
1117
+ "css-index": ["syntax"],
1118
+ "reset.css": ["preflight", "layers"],
1119
+ "global.css": ["globalCss"].concat(css),
1120
+ "static.css": ["staticCss", "theme.breakpoints"].concat(css),
1121
+ "styles.css": tokens.concat(format),
1122
+ "package.json": ["emitPackage"]
1123
+ };
1124
+ var configDeps = {
1125
+ artifacts: artifactConfigDeps
1126
+ };
1127
+ var matchers = {
1128
+ artifacts: Object.keys(configDeps.artifacts).map((key) => {
1129
+ const paths = configDeps.artifacts[key];
1130
+ if (!paths.length)
1131
+ return () => void 0;
1132
+ return createMatcher(key, paths.concat(all));
1133
+ })
1134
+ };
1135
+ var DiffEngine = class {
1136
+ constructor(ctx) {
1137
+ this.ctx = ctx;
1138
+ this.previousConfig = ctx.conf.deserialize();
1139
+ }
1140
+ previousConfig;
1141
+ /**
1142
+ * Reload config from disk and refresh the context
1143
+ */
1144
+ async reloadConfigAndRefreshContext(fn) {
1145
+ const conf = await (0, import_config.loadConfigFile)({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
1146
+ return this.refresh(conf, fn);
1147
+ }
1148
+ /**
1149
+ * Update the context from the refreshed config
1150
+ * then persist the changes on each affected engines
1151
+ * Returns the list of affected artifacts/engines
1152
+ */
1153
+ refresh(conf, fn) {
1154
+ const affected = {
1155
+ artifacts: /* @__PURE__ */ new Set(),
1156
+ hasConfigChanged: false,
1157
+ diffs: []
1158
+ };
1159
+ if (!this.previousConfig) {
1160
+ affected.hasConfigChanged = true;
1161
+ return affected;
1162
+ }
1163
+ const newConfig = conf.deserialize();
1164
+ const configDiff = (0, import_microdiff.default)(this.previousConfig, newConfig);
1165
+ if (!configDiff.length) {
1166
+ return affected;
1167
+ }
1168
+ affected.hasConfigChanged = true;
1169
+ affected.diffs = configDiff;
1170
+ this.previousConfig = newConfig;
1171
+ fn?.(conf);
1172
+ configDiff.forEach((change) => {
1173
+ const changePath = change.path.join(".");
1174
+ matchers.artifacts.forEach((matcher) => {
1175
+ const id = matcher(changePath);
1176
+ if (!id)
1177
+ return;
1178
+ if (id === "recipes") {
1179
+ const name = (0, import_shared.dashCase)(change.path.slice(1, 3).join("."));
1180
+ affected.artifacts.add(name);
1181
+ }
1182
+ if (id === "patterns") {
1183
+ const name = (0, import_shared.dashCase)(change.path.slice(0, 2).join("."));
1184
+ affected.artifacts.add(name);
1185
+ }
1186
+ affected.artifacts.add(id);
1187
+ });
1188
+ });
1189
+ return affected;
1190
+ }
1191
+ };
1052
1192
 
1053
1193
  // src/create-context.ts
1054
- var createContext = (conf) => {
1055
- const generator = (0, import_generator.createGenerator)(conf);
1056
- const config = conf.config;
1057
- const runtime = nodeRuntime;
1058
- config.cwd ||= runtime.cwd();
1059
- if (config.logLevel) {
1060
- import_logger3.logger.level = config.logLevel;
1061
- }
1062
- const { include, exclude, cwd } = config;
1063
- const getFiles = () => runtime.fs.glob({ include, exclude, cwd });
1064
- const ctx = {
1065
- ...conf,
1066
- ...generator,
1067
- runtime: nodeRuntime,
1068
- hooks: conf.hooks,
1069
- getFiles,
1070
- project: (0, import_parser.createProject)({
1194
+ var PandaContext = class extends import_generator2.Generator {
1195
+ runtime;
1196
+ project;
1197
+ getFiles;
1198
+ chunks;
1199
+ output;
1200
+ diff;
1201
+ constructor(conf) {
1202
+ super(conf);
1203
+ const config = conf.config;
1204
+ this.runtime = nodeRuntime;
1205
+ config.cwd ||= this.runtime.cwd();
1206
+ if (config.logLevel) {
1207
+ import_logger4.logger.level = config.logLevel;
1208
+ }
1209
+ const { include, exclude, cwd } = config;
1210
+ this.getFiles = () => this.runtime.fs.glob({ include, exclude, cwd });
1211
+ this.project = (0, import_parser.createProject)({
1071
1212
  ...conf.tsconfig,
1072
- getFiles,
1073
- readFile: runtime.fs.readFileSync,
1213
+ getFiles: this.getFiles.bind(this),
1214
+ readFile: this.runtime.fs.readFileSync.bind(this),
1074
1215
  hooks: conf.hooks,
1075
- parserOptions: { join: runtime.path.join, ...generator.parserOptions }
1076
- })
1077
- };
1078
- return Object.assign(ctx, { chunks: getChunkEngine(ctx), output: getOutputEngine(ctx) });
1216
+ parserOptions: { join: this.runtime.path.join, ...this.parserOptions }
1217
+ });
1218
+ this.chunks = getChunkEngine(this);
1219
+ this.output = new PandaOutputEngine(this);
1220
+ this.diff = new DiffEngine(this);
1221
+ }
1079
1222
  };
1080
1223
 
1081
1224
  // src/config.ts
@@ -1089,27 +1232,33 @@ function findConfig() {
1089
1232
  }
1090
1233
  }
1091
1234
  async function loadConfigAndCreateContext(options = {}) {
1092
- const hooks = (0, import_hookable.createHooks)();
1093
1235
  const { config, configPath } = options;
1094
1236
  const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
1095
- const conf = await (0, import_config.loadConfigFile)({ cwd, file: configPath });
1237
+ const conf = await (0, import_config2.loadConfigFile)({ cwd, file: configPath });
1096
1238
  if (config) {
1097
1239
  Object.assign(conf.config, config);
1098
1240
  }
1099
1241
  if (options.cwd) {
1100
1242
  conf.config.cwd = options.cwd;
1101
1243
  }
1102
- const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, { root: cwd, resolveWithEmptyIfConfigNotFound: true });
1244
+ const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, {
1245
+ root: cwd,
1246
+ resolveWithEmptyIfConfigNotFound: true
1247
+ });
1103
1248
  if (tsconfigResult) {
1104
1249
  conf.tsconfig = tsconfigResult.tsconfig;
1105
1250
  conf.tsconfigFile = tsconfigResult.tsconfigFile;
1106
1251
  const options2 = tsconfigResult.tsconfig?.compilerOptions;
1107
1252
  if (options2?.paths) {
1108
1253
  const baseUrl = options2.baseUrl;
1109
- conf.tsOptions = { baseUrl, pathMappings: (0, import_config.convertTsPathsToRegexes)(options2.paths, baseUrl ?? cwd) };
1254
+ conf.tsOptions = {
1255
+ baseUrl,
1256
+ pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2.paths, baseUrl ?? cwd)
1257
+ };
1110
1258
  }
1111
1259
  }
1112
1260
  conf.config.outdir ??= "styled-system";
1261
+ const hooks = (0, import_hookable.createHooks)();
1113
1262
  if (conf.config.hooks) {
1114
1263
  hooks.addHooks(conf.config.hooks);
1115
1264
  }
@@ -1117,13 +1266,13 @@ async function loadConfigAndCreateContext(options = {}) {
1117
1266
  if (conf.config.logLevel === "debug") {
1118
1267
  (0, import_hookable.createDebugger)(hooks, { tag: "panda" });
1119
1268
  }
1120
- return createContext({ ...conf, hooks });
1269
+ return new PandaContext({ ...conf, hooks });
1121
1270
  }
1122
1271
 
1123
1272
  // src/extract.ts
1124
1273
  init_cjs_shims();
1125
1274
  var import_core2 = require("@pandacss/core");
1126
- var import_logger4 = require("@pandacss/logger");
1275
+ var import_logger5 = require("@pandacss/logger");
1127
1276
  var import_parser2 = require("@pandacss/parser");
1128
1277
  var import_promises2 = require("fs/promises");
1129
1278
  var import_lil_fp = require("lil-fp");
@@ -2445,6 +2594,7 @@ var createBox = (options) => boxen(options.content, {
2445
2594
  async function bundleStyleChunksWithImports(ctx) {
2446
2595
  const files = ctx.chunks.getFiles();
2447
2596
  await ctx.output.write({
2597
+ id: "styles.css",
2448
2598
  dir: ctx.paths.root,
2449
2599
  files: [{ file: "styles.css", code: ctx.getCss({ files }) }]
2450
2600
  });
@@ -2452,11 +2602,11 @@ async function bundleStyleChunksWithImports(ctx) {
2452
2602
  }
2453
2603
  async function writeFileChunk(ctx, file) {
2454
2604
  const { path: path2 } = ctx.runtime;
2455
- import_logger4.logger.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2456
- const css = extractFile(ctx, file);
2457
- if (!css)
2605
+ import_logger5.logger.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2606
+ const css2 = extractFile(ctx, file);
2607
+ if (!css2)
2458
2608
  return;
2459
- const artifact = ctx.chunks.getArtifact(file, css);
2609
+ const artifact = ctx.chunks.getArtifact(file, css2);
2460
2610
  return ctx.output.write(artifact);
2461
2611
  }
2462
2612
  function extractFile(ctx, file) {
@@ -2466,16 +2616,16 @@ function extractFile(ctx, file) {
2466
2616
  } = ctx;
2467
2617
  return (0, import_lil_fp.pipe)(
2468
2618
  { file: path2.abs(cwd, file) },
2469
- (0, import_lil_fp.tap)(() => import_logger4.logger.debug("file:extract", file)),
2470
- import_lil_fp.Obj.bind("measure", () => import_logger4.logger.time.debug(`Extracted ${file}`)),
2619
+ (0, import_lil_fp.tap)(() => import_logger5.logger.debug("file:extract", file)),
2620
+ import_lil_fp.Obj.bind("measure", () => import_logger5.logger.time.debug(`Extracted ${file}`)),
2471
2621
  import_lil_fp.Obj.bind(
2472
2622
  "result",
2473
2623
  (0, import_lil_fp.tryCatch)(
2474
2624
  ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2475
- (error) => import_logger4.logger.error("file:parse", error)
2625
+ (error) => import_logger5.logger.error("file:parse", error)
2476
2626
  )
2477
2627
  ),
2478
- import_lil_fp.Obj.bind("measureCss", () => import_logger4.logger.time.debug(`Parsed ${file}`)),
2628
+ import_lil_fp.Obj.bind("measureCss", () => import_logger5.logger.time.debug(`Parsed ${file}`)),
2479
2629
  import_lil_fp.Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2480
2630
  (0, import_lil_fp.tap)(({ measure, measureCss }) => [measureCss(), measure()]),
2481
2631
  import_lil_fp.Obj.get("css")
@@ -2487,10 +2637,10 @@ function writeChunks(ctx) {
2487
2637
  var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
2488
2638
  var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
2489
2639
  var limit = pLimit(20);
2490
- async function emitArtifacts(ctx) {
2640
+ async function emitArtifacts(ctx, ids) {
2491
2641
  if (ctx.config.clean)
2492
2642
  ctx.output.empty();
2493
- const promises = ctx.getArtifacts().map((artifact) => limit(() => ctx.output.write(artifact)));
2643
+ const promises = ctx.getArtifacts(ids).map((artifact) => limit(() => ctx.output.write(artifact)));
2494
2644
  await Promise.allSettled(promises);
2495
2645
  void ctx.hooks.callHook("generator:done");
2496
2646
  return {
@@ -2501,13 +2651,6 @@ async function emitArtifacts(ctx) {
2501
2651
  msg: ctx.messages.artifactsGenerated()
2502
2652
  };
2503
2653
  }
2504
- async function emitArtfifactsAndCssChunks(ctx) {
2505
- await emitArtifacts(ctx);
2506
- if (ctx.config.emitTokensOnly) {
2507
- return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
2508
- }
2509
- return writeAndBundleCssChunks(ctx);
2510
- }
2511
2654
  async function writeAndBundleCssChunks(ctx) {
2512
2655
  await writeChunks(ctx);
2513
2656
  return bundleStyleChunksWithImports(ctx);
@@ -2524,7 +2667,7 @@ async function bundleMinimalFilesCss(ctx, outfile) {
2524
2667
  const filesWithCss = [];
2525
2668
  const collector = (0, import_parser2.createParserResult)();
2526
2669
  files.forEach((file) => {
2527
- const measure = import_logger4.logger.time.debug(`Parsed ${file}`);
2670
+ const measure = import_logger5.logger.time.debug(`Parsed ${file}`);
2528
2671
  const result = ctx.project.parseSourceFile(file);
2529
2672
  measure();
2530
2673
  if (!result)
@@ -2532,24 +2675,24 @@ async function bundleMinimalFilesCss(ctx, outfile) {
2532
2675
  collector.merge(result);
2533
2676
  filesWithCss.push(file);
2534
2677
  });
2535
- const css = ctx.getParserCss(collector);
2536
- if (!css)
2678
+ const css2 = ctx.getParserCss(collector);
2679
+ if (!css2)
2537
2680
  return { files, msg: ctx.messages.buildComplete(files.length) };
2538
2681
  const minify = ctx.config.minify;
2539
- await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css, { minify }));
2682
+ await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css2, { minify }));
2540
2683
  return { files, msg: ctx.messages.buildComplete(files.length) };
2541
2684
  }
2542
2685
  async function generateCssArtifactOfType(ctx, cssType, outfile) {
2543
2686
  let notFound = false;
2544
- const css = (0, import_ts_pattern.match)(cssType).with("preflight", () => ctx.getResetCss(ctx)).with("tokens", () => ctx.getTokenCss(ctx)).with("static", () => ctx.getStaticCss(ctx)).with("global", () => ctx.getGlobalCss(ctx)).with("keyframes", () => ctx.getKeyframeCss(ctx)).otherwise(() => {
2687
+ const css2 = (0, import_ts_pattern.match)(cssType).with("preflight", () => ctx.getResetCss()).with("tokens", () => ctx.getTokenCss()).with("static", () => ctx.getStaticCss()).with("global", () => ctx.getGlobalCss()).with("keyframes", () => ctx.getKeyframeCss()).otherwise(() => {
2545
2688
  notFound = true;
2546
2689
  });
2547
2690
  if (notFound)
2548
2691
  return { msg: `No css artifact of type <${cssType}> was found` };
2549
- if (!css)
2692
+ if (!css2)
2550
2693
  return { msg: `No css to generate for type <${cssType}>` };
2551
2694
  const minify = ctx.config.minify;
2552
- await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css, { minify }));
2695
+ await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css2, { minify }));
2553
2696
  return { msg: `Successfully generated ${cssType} css artifact \u2728` };
2554
2697
  }
2555
2698
 
@@ -2598,8 +2741,8 @@ function parseDependency(fileOrGlob) {
2598
2741
  }
2599
2742
 
2600
2743
  // src/builder.ts
2601
- var configCache = /* @__PURE__ */ new Map();
2602
- var contentFilesCache = /* @__PURE__ */ new WeakMap();
2744
+ var fileCssMap = /* @__PURE__ */ new Map();
2745
+ var fileModifiedMap = /* @__PURE__ */ new Map();
2603
2746
  var limit2 = pLimit(20);
2604
2747
  var Builder = class {
2605
2748
  /**
@@ -2607,34 +2750,8 @@ var Builder = class {
2607
2750
  */
2608
2751
  context;
2609
2752
  hasEmitted = false;
2610
- configDependencies = /* @__PURE__ */ new Set();
2611
- writeFileCss = (file, css) => {
2612
- const oldCss = this.fileCssMap?.get(file) ?? "";
2613
- const newCss = (0, import_core3.mergeCss)(oldCss, css);
2614
- this.fileCssMap?.set(file, newCss);
2615
- };
2616
- checkConfigDeps = (configPath, deps) => {
2617
- let modified = false;
2618
- const newModified = /* @__PURE__ */ new Map();
2619
- const prevModified = configCache.get(configPath)?.depsModifiedMap;
2620
- for (const file of deps) {
2621
- const stats = import_fs_extra2.default.statSync(file, { throwIfNoEntry: false });
2622
- if (!stats)
2623
- continue;
2624
- const time = stats.mtimeMs;
2625
- newModified.set(file, time);
2626
- if (prevModified && (!prevModified.has(file) || time > prevModified.get(file))) {
2627
- modified = true;
2628
- }
2629
- }
2630
- if (!modified) {
2631
- return { isModified: false, modifiedMap: prevModified || /* @__PURE__ */ new Map() };
2632
- }
2633
- for (const file of deps) {
2634
- delete require.cache[file];
2635
- }
2636
- return { isModified: true, modifiedMap: newModified };
2637
- };
2753
+ hasConfigChanged = false;
2754
+ affecteds;
2638
2755
  getConfigPath = () => {
2639
2756
  const configPath = findConfig();
2640
2757
  if (!configPath) {
@@ -2642,56 +2759,35 @@ var Builder = class {
2642
2759
  }
2643
2760
  return configPath;
2644
2761
  };
2645
- hasConfigChanged = false;
2646
2762
  setup = async (options = {}) => {
2647
- import_logger5.logger.debug("builder", "\u{1F6A7} Setup");
2763
+ import_logger6.logger.debug("builder", "\u{1F6A7} Setup");
2648
2764
  const configPath = options.configPath ?? this.getConfigPath();
2649
- const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2650
- const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
2651
- const { deps: foundDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions, compilerOptions);
2652
- const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2653
- const configDeps = /* @__PURE__ */ new Set([...foundDeps, ...(this.context?.dependencies ?? []).map((file) => (0, import_path2.resolve)(cwd, file))]);
2654
- this.configDependencies = configDeps;
2655
- const deps = this.checkConfigDeps(configPath, configDeps);
2656
- this.hasConfigChanged = deps.isModified;
2657
- if (deps.isModified) {
2658
- await this.setupContext({
2659
- configPath,
2660
- depsModifiedMap: deps.modifiedMap
2661
- });
2662
- const ctx = this.getContextOrThrow();
2663
- import_logger5.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
2664
- await ctx.hooks.callHook("config:change", ctx.config);
2765
+ if (!this.context) {
2766
+ return this.setupContext({ configPath });
2665
2767
  }
2666
- const cache = configCache.get(configPath);
2667
- if (cache) {
2668
- this.context = cache.context;
2669
- this.context.project.reloadSourceFiles();
2670
- } else {
2671
- await this.setupContext({
2672
- configPath,
2673
- depsModifiedMap: deps.modifiedMap
2674
- });
2768
+ const ctx = this.getContextOrThrow();
2769
+ this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2770
+ this.context = new PandaContext({ ...conf, hooks: ctx.hooks });
2771
+ });
2772
+ this.hasConfigChanged = this.affecteds.hasConfigChanged;
2773
+ if (this.affecteds.hasConfigChanged) {
2774
+ import_logger6.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
2775
+ await ctx.hooks.callHook("config:change", ctx.config);
2776
+ return;
2675
2777
  }
2778
+ ctx.project.reloadSourceFiles();
2676
2779
  };
2677
- emit() {
2678
- if (this.hasEmitted && this.hasConfigChanged) {
2679
- emitArtifacts(this.getContextOrThrow());
2780
+ async emit() {
2781
+ if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
2782
+ await emitArtifacts(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
2680
2783
  }
2681
2784
  this.hasEmitted = true;
2682
2785
  }
2683
2786
  setupContext = async (options) => {
2684
- const { configPath, depsModifiedMap } = options;
2685
- this.context = await loadConfigAndCreateContext({ configPath });
2686
- configCache.set(configPath, {
2687
- context: this.context,
2688
- deps: new Set(this.context.dependencies ?? []),
2689
- depsModifiedMap
2690
- });
2691
- contentFilesCache.set(this.context, {
2692
- fileCssMap: /* @__PURE__ */ new Map(),
2693
- fileModifiedMap: /* @__PURE__ */ new Map()
2694
- });
2787
+ const { configPath } = options;
2788
+ const ctx = await loadConfigAndCreateContext({ configPath });
2789
+ this.context = ctx;
2790
+ return ctx;
2695
2791
  };
2696
2792
  getContextOrThrow = () => {
2697
2793
  if (!this.context) {
@@ -2699,29 +2795,23 @@ var Builder = class {
2699
2795
  }
2700
2796
  return this.context;
2701
2797
  };
2702
- get fileModifiedMap() {
2703
- const ctx = this.getContextOrThrow();
2704
- return contentFilesCache.get(ctx).fileModifiedMap;
2705
- }
2706
- get fileCssMap() {
2707
- const ctx = this.getContextOrThrow();
2708
- return contentFilesCache.get(ctx).fileCssMap;
2709
- }
2710
2798
  extractFile = async (ctx, file) => {
2711
2799
  const mtime = (0, import_fs.existsSync)(file) ? import_fs_extra2.default.statSync(file).mtimeMs : -Infinity;
2712
- const isUnchanged = this.fileModifiedMap.has(file) && mtime === this.fileModifiedMap.get(file);
2713
- if (isUnchanged)
2800
+ const isUnchanged = fileModifiedMap.has(file) && mtime === fileModifiedMap.get(file);
2801
+ if (isUnchanged && !this.hasConfigChanged)
2714
2802
  return;
2715
- const css = extractFile(ctx, file);
2716
- if (!css)
2803
+ const css2 = extractFile(ctx, file);
2804
+ fileModifiedMap.set(file, mtime);
2805
+ if (!css2) {
2806
+ fileCssMap.delete(file);
2717
2807
  return;
2718
- this.fileModifiedMap.set(file, mtime);
2719
- this.writeFileCss(file, css);
2720
- return css;
2808
+ }
2809
+ fileCssMap.set(file, css2);
2810
+ return css2;
2721
2811
  };
2722
2812
  extract = async () => {
2723
2813
  const ctx = this.getContextOrThrow();
2724
- const done = import_logger5.logger.time.info("Extracted in");
2814
+ const done = import_logger6.logger.time.info("Extracted in");
2725
2815
  const promises = ctx.getFiles().map((file) => limit2(() => this.extractFile(ctx, file)));
2726
2816
  await Promise.allSettled(promises);
2727
2817
  done();
@@ -2729,7 +2819,7 @@ var Builder = class {
2729
2819
  toString = () => {
2730
2820
  const ctx = this.getContextOrThrow();
2731
2821
  return ctx.getCss({
2732
- files: Array.from(this.fileCssMap.values()),
2822
+ files: Array.from(fileCssMap.values()),
2733
2823
  resolve: true
2734
2824
  });
2735
2825
  };
@@ -2761,29 +2851,26 @@ var Builder = class {
2761
2851
  fn(dependency);
2762
2852
  }
2763
2853
  }
2764
- for (const file of ctx.dependencies) {
2765
- fn({ type: "dependency", file: (0, import_path2.resolve)(file) });
2766
- }
2767
- for (const file of this.configDependencies) {
2768
- fn({ type: "dependency", file: (0, import_path2.resolve)(file) });
2854
+ for (const file of ctx.conf.dependencies) {
2855
+ fn({ type: "dependency", file: (0, import_pathe2.resolve)(file) });
2769
2856
  }
2770
2857
  };
2771
2858
  };
2772
2859
 
2773
2860
  // src/debug-files.ts
2774
2861
  init_cjs_shims();
2775
- var import_logger6 = require("@pandacss/logger");
2862
+ var import_logger7 = require("@pandacss/logger");
2776
2863
  var nodePath = __toESM(require("path"));
2777
2864
  async function debugFiles(ctx, options) {
2778
2865
  const files = ctx.getFiles();
2779
- const measureTotal = import_logger6.logger.time.debug(`Done parsing ${files.length} files`);
2866
+ const measureTotal = import_logger7.logger.time.debug(`Done parsing ${files.length} files`);
2780
2867
  ctx.config.minify = false;
2781
2868
  ctx.config.optimize = true;
2782
2869
  const { fs, path: path2 } = ctx.runtime;
2783
2870
  const outdir = options.outdir;
2784
2871
  if (!options.dry && outdir) {
2785
2872
  fs.ensureDirSync(outdir);
2786
- import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/config.json`)}`);
2873
+ import_logger7.logger.info("cli", `Writing ${import_logger7.colors.bold(`${outdir}/config.json`)}`);
2787
2874
  await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2788
2875
  }
2789
2876
  if (options.onlyConfig) {
@@ -2793,16 +2880,16 @@ async function debugFiles(ctx, options) {
2793
2880
  const filesWithCss = [];
2794
2881
  await Promise.allSettled(
2795
2882
  files.map(async (file) => {
2796
- const measure = import_logger6.logger.time.debug(`Parsed ${file}`);
2883
+ const measure = import_logger7.logger.time.debug(`Parsed ${file}`);
2797
2884
  const result = ctx.project.parseSourceFile(file);
2798
2885
  measure();
2799
2886
  if (!result)
2800
2887
  return;
2801
- const css = ctx.getParserCss(result);
2802
- if (!css)
2888
+ const css2 = ctx.getParserCss(result);
2889
+ if (!css2)
2803
2890
  return;
2804
2891
  if (options.dry) {
2805
- console.log({ path: file, ast: result, code: css });
2892
+ console.log({ path: file, ast: result, code: css2 });
2806
2893
  return Promise.resolve();
2807
2894
  }
2808
2895
  if (outdir) {
@@ -2811,22 +2898,22 @@ async function debugFiles(ctx, options) {
2811
2898
  const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
2812
2899
  const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
2813
2900
  const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
2814
- import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/${astJsonPath}`)}`);
2815
- import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/${cssPath}`)}`);
2901
+ import_logger7.logger.info("cli", `Writing ${import_logger7.colors.bold(`${outdir}/${astJsonPath}`)}`);
2902
+ import_logger7.logger.info("cli", `Writing ${import_logger7.colors.bold(`${outdir}/${cssPath}`)}`);
2816
2903
  return Promise.allSettled([
2817
2904
  fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2818
- fs.writeFile(`${outdir}/${cssPath}`, css)
2905
+ fs.writeFile(`${outdir}/${cssPath}`, css2)
2819
2906
  ]);
2820
2907
  }
2821
2908
  })
2822
2909
  );
2823
- import_logger6.logger.info("cli", `Found ${import_logger6.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2910
+ import_logger7.logger.info("cli", `Found ${import_logger7.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2824
2911
  measureTotal();
2825
2912
  }
2826
2913
 
2827
2914
  // src/exec-command.ts
2828
2915
  init_cjs_shims();
2829
- var import_logger7 = require("@pandacss/logger");
2916
+ var import_logger8 = require("@pandacss/logger");
2830
2917
  var import_child_process = require("child_process");
2831
2918
  var import_preferred_pm = __toESM(require("preferred-pm"));
2832
2919
  async function execCommand(cmd, cwd) {
@@ -2838,66 +2925,56 @@ async function execCommand(cmd, cwd) {
2838
2925
  }
2839
2926
  const check = (0, import_child_process.spawnSync)(pm, args, { cwd, stdio: "pipe" });
2840
2927
  if (check.status !== 0) {
2841
- import_logger7.logger.error("exec", check.stderr.toString());
2928
+ import_logger8.logger.error("exec", check.stderr.toString());
2842
2929
  }
2843
2930
  }
2844
2931
 
2845
2932
  // src/generate.ts
2846
2933
  init_cjs_shims();
2847
- var import_logger8 = require("@pandacss/logger");
2934
+ var import_logger9 = require("@pandacss/logger");
2848
2935
  var import_ts_pattern2 = require("ts-pattern");
2849
-
2850
- // src/load-context.ts
2851
- init_cjs_shims();
2852
- var loadContext = async (config, configPath) => {
2853
- const ctxRef = { current: void 0 };
2854
- const load = async () => {
2855
- const ctx = await loadConfigAndCreateContext({ config, configPath });
2856
- ctxRef.current = ctx;
2857
- };
2858
- await load();
2859
- return [ctxRef, load];
2860
- };
2861
-
2862
- // src/generate.ts
2863
- async function build(ctx) {
2864
- const { msg } = await emitArtfifactsAndCssChunks(ctx);
2865
- import_logger8.logger.info("css:emit", msg);
2936
+ async function build(ctx, ids) {
2937
+ await emitArtifacts(ctx, ids);
2938
+ if (ctx.config.emitTokensOnly) {
2939
+ return import_logger9.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2940
+ }
2941
+ const { msg } = await writeAndBundleCssChunks(ctx);
2942
+ import_logger9.logger.info("css:emit", msg);
2866
2943
  }
2867
2944
  async function generate(config, configPath) {
2868
- const [ctxRef, loadCtx] = await loadContext(config, configPath);
2869
- const ctx = ctxRef.current;
2945
+ const ctx = await loadConfigAndCreateContext({ config, configPath });
2870
2946
  await build(ctx);
2871
2947
  const {
2872
2948
  runtime: { fs, path: path2 },
2873
- dependencies,
2874
2949
  config: { cwd }
2875
2950
  } = ctx;
2876
2951
  if (ctx.config.watch) {
2877
- const configWatcher = fs.watch({ include: dependencies });
2952
+ const configWatcher = fs.watch({ include: ctx.conf.dependencies });
2878
2953
  configWatcher.on("change", async () => {
2879
- import_logger8.logger.info("config:change", "Config changed, restarting...");
2880
- await loadCtx();
2881
- await ctxRef.current.hooks.callHook("config:change", ctxRef.current.config);
2882
- return build(ctxRef.current);
2954
+ const affecteds = await ctx.diff.reloadConfigAndRefreshContext();
2955
+ if (!affecteds.artifacts.size)
2956
+ return;
2957
+ import_logger9.logger.info("config:change", "Config changed, restarting...");
2958
+ await ctx.hooks.callHook("config:change", ctx.config);
2959
+ return build(ctx, Array.from(affecteds.artifacts));
2883
2960
  });
2884
2961
  const contentWatcher = fs.watch(ctx.config);
2885
2962
  contentWatcher.on("all", async (event, file) => {
2886
- import_logger8.logger.info(`file:${event}`, file);
2963
+ import_logger9.logger.info(`file:${event}`, file);
2887
2964
  (0, import_ts_pattern2.match)(event).with("unlink", () => {
2888
2965
  ctx.project.removeSourceFile(path2.abs(cwd, file));
2889
2966
  ctx.chunks.rm(file);
2890
2967
  }).with("change", async () => {
2891
2968
  ctx.project.reloadSourceFile(file);
2892
- await writeFileChunk(ctxRef.current, file);
2893
- return bundleStyleChunksWithImports(ctxRef.current);
2969
+ await writeFileChunk(ctx, file);
2970
+ return bundleStyleChunksWithImports(ctx);
2894
2971
  }).with("add", async () => {
2895
2972
  ctx.project.createSourceFile(file);
2896
- return bundleStyleChunksWithImports(ctxRef.current);
2973
+ return bundleStyleChunksWithImports(ctx);
2897
2974
  }).otherwise(() => {
2898
2975
  });
2899
2976
  });
2900
- import_logger8.logger.info("ctx:watch", ctx.messages.watch());
2977
+ import_logger9.logger.info("ctx:watch", ctx.messages.watch());
2901
2978
  }
2902
2979
  }
2903
2980
 
@@ -2928,12 +3005,12 @@ function setupGitIgnore(ctx) {
2928
3005
 
2929
3006
  // src/setup-config.ts
2930
3007
  init_cjs_shims();
2931
- var import_generator2 = require("@pandacss/generator");
2932
- var import_logger9 = require("@pandacss/logger");
3008
+ var import_generator3 = require("@pandacss/generator");
3009
+ var import_logger10 = require("@pandacss/logger");
2933
3010
  var import_fs_extra3 = __toESM(require("fs-extra"));
2934
3011
  var import_look_it_up3 = require("look-it-up");
2935
3012
  var import_outdent2 = require("outdent");
2936
- var import_path3 = require("path");
3013
+ var import_path2 = require("path");
2937
3014
  var import_preferred_pm2 = __toESM(require("preferred-pm"));
2938
3015
  var import_prettier = __toESM(require("prettier"));
2939
3016
  async function setupConfig(cwd, opts = {}) {
@@ -2944,9 +3021,9 @@ async function setupConfig(cwd, opts = {}) {
2944
3021
  const cmd = pm === "npm" ? "npm run" : pm;
2945
3022
  const isTs = (0, import_look_it_up3.lookItUpSync)("tsconfig.json", cwd);
2946
3023
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2947
- import_logger9.logger.info("init:config", `creating panda config file: ${(0, import_logger9.quote)(file)}`);
3024
+ import_logger10.logger.info("init:config", `creating panda config file: ${(0, import_logger10.quote)(file)}`);
2948
3025
  if (!force && configFile) {
2949
- import_logger9.logger.warn("init:config", import_generator2.messages.configExists(cmd));
3026
+ import_logger10.logger.warn("init:config", import_generator3.messages.configExists(cmd));
2950
3027
  } else {
2951
3028
  const content = import_outdent2.outdent`
2952
3029
  import { defineConfig } from "@pandacss/dev"
@@ -2978,12 +3055,12 @@ jsxFramework: '${jsxFramework}',` : ""}
2978
3055
  syntax: '${syntax}'` : ""}
2979
3056
  })
2980
3057
  `;
2981
- await import_fs_extra3.default.writeFile((0, import_path3.join)(cwd, file), import_prettier.default.format(content));
2982
- import_logger9.logger.log(import_generator2.messages.thankYou());
3058
+ await import_fs_extra3.default.writeFile((0, import_path2.join)(cwd, file), import_prettier.default.format(content));
3059
+ import_logger10.logger.log(import_generator3.messages.thankYou());
2983
3060
  }
2984
3061
  }
2985
3062
  async function setupPostcss(cwd) {
2986
- import_logger9.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger9.quote)("postcss.config.cjs")}`);
3063
+ import_logger10.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger10.quote)("postcss.config.cjs")}`);
2987
3064
  const content = import_outdent2.outdent`
2988
3065
  module.exports = {
2989
3066
  plugins: {
@@ -2991,12 +3068,12 @@ module.exports = {
2991
3068
  },
2992
3069
  }
2993
3070
  `;
2994
- await import_fs_extra3.default.writeFile((0, import_path3.join)(cwd, "postcss.config.cjs"), content);
3071
+ await import_fs_extra3.default.writeFile((0, import_path2.join)(cwd, "postcss.config.cjs"), content);
2995
3072
  }
2996
3073
 
2997
3074
  // src/ship-files.ts
2998
3075
  init_cjs_shims();
2999
- var import_logger10 = require("@pandacss/logger");
3076
+ var import_logger11 = require("@pandacss/logger");
3000
3077
  var import_parser3 = require("@pandacss/parser");
3001
3078
  var import_promises3 = require("fs/promises");
3002
3079
  var path = __toESM(require("path"));
@@ -3008,30 +3085,29 @@ async function shipFiles(ctx, outfile) {
3008
3085
  const result = ctx.project.parseSourceFile(file);
3009
3086
  if (!result || result.isEmpty())
3010
3087
  return;
3011
- const css = ctx.getParserCss(result);
3012
- if (!css)
3088
+ const css2 = ctx.getParserCss(result);
3089
+ if (!css2)
3013
3090
  return;
3014
3091
  extractResult.merge(result);
3015
3092
  filesWithCss.push(path.relative(ctx.config.cwd, file));
3016
3093
  });
3017
- import_logger10.logger.info("cli", `Found ${import_logger10.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
3094
+ import_logger11.logger.info("cli", `Found ${import_logger11.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
3018
3095
  const minify = ctx.config.minify;
3019
- import_logger10.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger10.colors.bold(outfile)}`);
3096
+ import_logger11.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger11.colors.bold(outfile)}`);
3020
3097
  const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
3021
3098
  const dirname2 = ctx.runtime.path.dirname(outfile);
3022
3099
  ctx.runtime.fs.ensureDirSync(dirname2);
3023
3100
  await (0, import_promises3.writeFile)(outfile, output);
3024
- import_logger10.logger.info("cli", "Done!");
3101
+ import_logger11.logger.info("cli", "Done!");
3025
3102
  }
3026
3103
  // Annotate the CommonJS export names for ESM import in node:
3027
3104
  0 && (module.exports = {
3028
3105
  Builder,
3106
+ PandaContext,
3029
3107
  analyzeTokens,
3030
3108
  bundleCss,
3031
3109
  bundleMinimalFilesCss,
3032
- createContext,
3033
3110
  debugFiles,
3034
- emitArtfifactsAndCssChunks,
3035
3111
  emitArtifacts,
3036
3112
  execCommand,
3037
3113
  extractFile,