@pandacss/node 0.0.0-dev-20230418123438 → 0.0.0-dev-20230420112920

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -203,6 +203,11 @@ declare function loadConfigAndCreateContext(options?: {
203
203
  configPath?: string;
204
204
  }): Promise<PandaContext>;
205
205
 
206
+ declare function debugFiles(ctx: PandaContext, options: {
207
+ outdir: string;
208
+ dry: boolean;
209
+ }): Promise<void>;
210
+
206
211
  declare function execCommand(cmd: string, cwd: string): Promise<void>;
207
212
 
208
213
  declare function emitArtifacts(ctx: PandaContext): Promise<string>;
@@ -218,4 +223,4 @@ declare function setupConfig(cwd: string, { force }: {
218
223
  }): Promise<void>;
219
224
  declare function setupPostcss(cwd: string): Promise<void>;
220
225
 
221
- export { Builder, analyzeTokens, createContext, emitAndExtract, emitArtifacts, execCommand, extractCss, generate, loadConfigAndCreateContext, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
226
+ export { Builder, analyzeTokens, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, generate, loadConfigAndCreateContext, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
package/dist/index.js CHANGED
@@ -478,6 +478,7 @@ __export(src_exports, {
478
478
  Builder: () => Builder,
479
479
  analyzeTokens: () => analyzeTokens,
480
480
  createContext: () => createContext,
481
+ debugFiles: () => debugFiles,
481
482
  discardDuplicate: () => import_core3.discardDuplicate,
482
483
  emitAndExtract: () => emitAndExtract,
483
484
  emitArtifacts: () => emitArtifacts,
@@ -804,13 +805,13 @@ function analyzeTokens(ctx, options = {}) {
804
805
  const result = ctx.project.parseSourceFile(file);
805
806
  const extractMs = performance.now() - start2;
806
807
  extractTimeByFilepath.set(file, extractMs);
807
- import_logger.logger.debug("analyze", `Extracted ${file} in ${extractMs}ms`);
808
+ import_logger.logger.debug("analyze", `Parsed ${file} in ${extractMs}ms`);
808
809
  if (result) {
809
810
  parserResultByFilepath.set(file, result);
810
811
  options.onResult?.(file, result);
811
812
  }
812
813
  return [file, result];
813
- }).filter(([, result]) => result);
814
+ });
814
815
  const totalMs = Array.from(extractTimeByFilepath.values()).reduce((a, b) => a + b, 0);
815
816
  import_logger.logger.debug("analyze", `Analyzed ${ctx.getFiles().length} files in ${totalMs.toFixed(2)}ms`);
816
817
  const minify = ctx.config.minify;
@@ -901,18 +902,18 @@ var import_lil_fp = require("lil-fp");
901
902
  // src/chunk-engine.ts
902
903
  init_cjs_shims();
903
904
  var import_core = require("@pandacss/core");
904
- var getChunkEngine = ({ paths, config, runtime: { path, fs: fs2 } }) => ({
905
- dir: path.join(...paths.chunk),
905
+ var getChunkEngine = ({ paths, config, runtime: { path: path2, fs: fs2 } }) => ({
906
+ dir: path2.join(...paths.chunk),
906
907
  readFile(file) {
907
- const fileName = path.join(...paths.chunk, this.format(file));
908
+ const fileName = path2.join(...paths.chunk, this.format(file));
908
909
  return fs2.existsSync(fileName) ? fs2.readFileSync(fileName) : "";
909
910
  },
910
911
  getFiles() {
911
912
  const files = fs2.existsSync(this.dir) ? fs2.readDirSync(this.dir) : [];
912
- return files.map((file) => fs2.readFileSync(path.join(this.dir, file)));
913
+ return files.map((file) => fs2.readFileSync(path2.join(this.dir, file)));
913
914
  },
914
915
  format(file) {
915
- return path.relative(config.cwd, file).replaceAll(path.sep, "__").replace(path.extname(file), ".css");
916
+ return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
916
917
  },
917
918
  getArtifact(file, css) {
918
919
  const fileName = this.format(file);
@@ -923,7 +924,7 @@ var getChunkEngine = ({ paths, config, runtime: { path, fs: fs2 } }) => ({
923
924
  };
924
925
  },
925
926
  rm(file) {
926
- return fs2.rmFileSync(path.join(...paths.chunk, this.format(file)));
927
+ return fs2.rmFileSync(path2.join(...paths.chunk, this.format(file)));
927
928
  },
928
929
  empty() {
929
930
  return fs2.rmDirSync(this.dir);
@@ -973,8 +974,8 @@ var nodeRuntime = {
973
974
  readDirSync: import_fs_extra.readdirSync,
974
975
  rmDirSync: import_fs_extra.emptyDirSync,
975
976
  rmFileSync: import_fs_extra.removeSync,
976
- ensureDirSync(path) {
977
- return (0, import_fs_extra.ensureDirSync)(path);
977
+ ensureDirSync(path2) {
978
+ return (0, import_fs_extra.ensureDirSync)(path2);
978
979
  },
979
980
  watch(options) {
980
981
  const { include, exclude, cwd, poll } = options;
@@ -1005,18 +1006,18 @@ process.on("uncaughtException", (reason) => {
1005
1006
 
1006
1007
  // src/output-engine.ts
1007
1008
  init_cjs_shims();
1008
- var getOutputEngine = ({ paths, runtime: { path, fs: fs2 } }) => ({
1009
+ var getOutputEngine = ({ paths, runtime: { path: path2, fs: fs2 } }) => ({
1009
1010
  empty() {
1010
- fs2.rmDirSync(path.join(...paths.root));
1011
+ fs2.rmDirSync(path2.join(...paths.root));
1011
1012
  },
1012
1013
  async write(output) {
1013
1014
  if (!output)
1014
1015
  return;
1015
1016
  const { dir = paths.root, files } = output;
1016
- fs2.ensureDirSync(path.join(...dir));
1017
+ fs2.ensureDirSync(path2.join(...dir));
1017
1018
  return Promise.all(
1018
1019
  files.map(async ({ file, code }) => {
1019
- const absPath = path.join(...dir, file);
1020
+ const absPath = path2.join(...dir, file);
1020
1021
  if (code) {
1021
1022
  return fs2.writeFile(absPath, code);
1022
1023
  }
@@ -2356,8 +2357,8 @@ async function bundleChunks(ctx) {
2356
2357
  });
2357
2358
  }
2358
2359
  async function writeFileChunk(ctx, file) {
2359
- const { path } = ctx.runtime;
2360
- import_logger3.logger.debug("chunk:write", `File: ${path.relative(ctx.config.cwd, file)}`);
2360
+ const { path: path2 } = ctx.runtime;
2361
+ import_logger3.logger.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2361
2362
  const css = extractFile(ctx, file);
2362
2363
  if (!css)
2363
2364
  return;
@@ -2366,11 +2367,11 @@ async function writeFileChunk(ctx, file) {
2366
2367
  }
2367
2368
  function extractFile(ctx, file) {
2368
2369
  const {
2369
- runtime: { path },
2370
+ runtime: { path: path2 },
2370
2371
  config: { cwd }
2371
2372
  } = ctx;
2372
2373
  return (0, import_lil_fp2.pipe)(
2373
- { file: path.abs(cwd, file) },
2374
+ { file: path2.abs(cwd, file) },
2374
2375
  (0, import_lil_fp2.tap)(() => import_logger3.logger.debug("file:extract", file)),
2375
2376
  import_lil_fp2.Obj.bind("measure", () => import_logger3.logger.time.debug(`Extracted ${file}`)),
2376
2377
  import_lil_fp2.Obj.bind(
@@ -2567,9 +2568,68 @@ var Builder = class {
2567
2568
  }
2568
2569
  };
2569
2570
 
2570
- // src/exec-command.ts
2571
+ // src/debug-files.ts
2571
2572
  init_cjs_shims();
2572
2573
  var import_logger5 = require("@pandacss/logger");
2574
+ var import_promises2 = require("fs/promises");
2575
+ var path = __toESM(require("path"));
2576
+ async function debugFiles(ctx, options) {
2577
+ const parserResultByFilepath = /* @__PURE__ */ new Map();
2578
+ const measureTotal = import_logger5.logger.time.debug(`Analyzed ${ctx.getFiles().length} files`);
2579
+ ctx.config.minify = false;
2580
+ await ctx.getFiles().map(async (file) => {
2581
+ const measure = import_logger5.logger.time.debug(`Parsed ${file}`);
2582
+ const result = ctx.project.parseSourceFile(file);
2583
+ measure();
2584
+ if (!result)
2585
+ return;
2586
+ parserResultByFilepath.set(file, result);
2587
+ const list = result.getAll().map((result2) => {
2588
+ const node = result2.box.getNode();
2589
+ const range = getNodeRange(node);
2590
+ return {
2591
+ name: result2.name,
2592
+ type: result2.type,
2593
+ data: result2.data,
2594
+ kind: node.getKindName(),
2595
+ line: range.startLineNumber,
2596
+ column: range.startColumn
2597
+ };
2598
+ });
2599
+ const css = ctx.getParserCss(result);
2600
+ if (!css)
2601
+ return;
2602
+ if (options.dry) {
2603
+ console.log({ path: file, ast: list, code: css });
2604
+ return Promise.resolve();
2605
+ } else if (options.outdir) {
2606
+ const parsedPath = path.parse(file);
2607
+ const relative3 = path.relative(ctx.config.cwd, parsedPath.dir);
2608
+ const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2609
+ const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2610
+ import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2611
+ await (0, import_promises2.mkdir)(options.outdir, { recursive: true });
2612
+ return Promise.all([
2613
+ (0, import_promises2.writeFile)(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2614
+ (0, import_promises2.writeFile)(`${options.outdir}/${cssPath}`, css)
2615
+ ]);
2616
+ }
2617
+ });
2618
+ measureTotal();
2619
+ }
2620
+ var debugResultSerializer = (_key, value) => {
2621
+ if (value instanceof Set) {
2622
+ return Array.from(value);
2623
+ }
2624
+ if (value instanceof Map) {
2625
+ return Object.fromEntries(value);
2626
+ }
2627
+ return value;
2628
+ };
2629
+
2630
+ // src/exec-command.ts
2631
+ init_cjs_shims();
2632
+ var import_logger6 = require("@pandacss/logger");
2573
2633
  var import_child_process = require("child_process");
2574
2634
  var import_preferred_pm = __toESM(require("preferred-pm"));
2575
2635
  async function execCommand(cmd, cwd) {
@@ -2581,13 +2641,13 @@ async function execCommand(cmd, cwd) {
2581
2641
  }
2582
2642
  const check = (0, import_child_process.spawnSync)(pm, args, { cwd, stdio: "pipe" });
2583
2643
  if (check.status !== 0) {
2584
- import_logger5.logger.error("exec", check.stderr.toString());
2644
+ import_logger6.logger.error("exec", check.stderr.toString());
2585
2645
  }
2586
2646
  }
2587
2647
 
2588
2648
  // src/generate.ts
2589
2649
  init_cjs_shims();
2590
- var import_logger6 = require("@pandacss/logger");
2650
+ var import_logger7 = require("@pandacss/logger");
2591
2651
  var import_ts_pattern = require("ts-pattern");
2592
2652
 
2593
2653
  // src/load-context.ts
@@ -2605,29 +2665,29 @@ var loadContext = async (config, configPath) => {
2605
2665
  // src/generate.ts
2606
2666
  async function build(ctx) {
2607
2667
  const msg = await emitAndExtract(ctx);
2608
- import_logger6.logger.info("css:emit", msg);
2668
+ import_logger7.logger.info("css:emit", msg);
2609
2669
  }
2610
2670
  async function generate(config, configPath) {
2611
2671
  const [ctxRef, loadCtx] = await loadContext(config, configPath);
2612
2672
  const ctx = ctxRef.current;
2613
2673
  await build(ctx);
2614
2674
  const {
2615
- runtime: { fs: fs2, path },
2675
+ runtime: { fs: fs2, path: path2 },
2616
2676
  dependencies,
2617
2677
  config: { cwd }
2618
2678
  } = ctx;
2619
2679
  if (ctx.config.watch) {
2620
2680
  const configWatcher = fs2.watch({ include: dependencies });
2621
2681
  configWatcher.on("change", async () => {
2622
- import_logger6.logger.info("config:change", "Config changed, restarting...");
2682
+ import_logger7.logger.info("config:change", "Config changed, restarting...");
2623
2683
  await loadCtx();
2624
2684
  return build(ctxRef.current);
2625
2685
  });
2626
2686
  const contentWatcher = fs2.watch(ctx.config);
2627
2687
  contentWatcher.on("all", async (event, file) => {
2628
- import_logger6.logger.info(`file:${event}`, file);
2688
+ import_logger7.logger.info(`file:${event}`, file);
2629
2689
  (0, import_ts_pattern.match)(event).with("unlink", () => {
2630
- ctx.project.removeSourceFile(path.abs(cwd, file));
2690
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2631
2691
  ctx.chunks.rm(file);
2632
2692
  }).with("change", async () => {
2633
2693
  ctx.project.reloadSourceFile(file);
@@ -2639,7 +2699,7 @@ async function generate(config, configPath) {
2639
2699
  }).otherwise(() => {
2640
2700
  });
2641
2701
  });
2642
- import_logger6.logger.info("ctx:watch", ctx.messages.watch());
2702
+ import_logger7.logger.info("ctx:watch", ctx.messages.watch());
2643
2703
  }
2644
2704
  }
2645
2705
 
@@ -2665,7 +2725,7 @@ function setupGitIgnore({ config: { outdir } }) {
2665
2725
 
2666
2726
  // src/setup-config.ts
2667
2727
  init_cjs_shims();
2668
- var import_logger7 = require("@pandacss/logger");
2728
+ var import_logger8 = require("@pandacss/logger");
2669
2729
  var import_generator2 = require("@pandacss/generator");
2670
2730
  var import_fs_extra3 = require("fs-extra");
2671
2731
  var import_look_it_up3 = require("look-it-up");
@@ -2679,9 +2739,9 @@ async function setupConfig(cwd, { force }) {
2679
2739
  const cmd = pm === "npm" ? "npm run" : pm;
2680
2740
  const isTs = (0, import_look_it_up3.lookItUpSync)("tsconfig.json", cwd);
2681
2741
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2682
- import_logger7.logger.info("init:config", `creating panda config file: ${(0, import_logger7.quote)(file)}`);
2742
+ import_logger8.logger.info("init:config", `creating panda config file: ${(0, import_logger8.quote)(file)}`);
2683
2743
  if (!force && configFile) {
2684
- import_logger7.logger.warn("init:config", import_generator2.messages.configExists(cmd));
2744
+ import_logger8.logger.warn("init:config", import_generator2.messages.configExists(cmd));
2685
2745
  } else {
2686
2746
  const content = import_outdent2.outdent`
2687
2747
  import { defineConfig } from "@pandacss/dev"
@@ -2701,11 +2761,11 @@ async function setupConfig(cwd, { force }) {
2701
2761
  })
2702
2762
  `;
2703
2763
  await (0, import_fs_extra3.writeFile)((0, import_path4.join)(cwd, file), content);
2704
- import_logger7.logger.log(import_generator2.messages.thankYou());
2764
+ import_logger8.logger.log(import_generator2.messages.thankYou());
2705
2765
  }
2706
2766
  }
2707
2767
  async function setupPostcss(cwd) {
2708
- import_logger7.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger7.quote)("postcss.config.cjs")}`);
2768
+ import_logger8.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger8.quote)("postcss.config.cjs")}`);
2709
2769
  const content = import_outdent2.outdent`
2710
2770
  module.exports = {
2711
2771
  plugins: {
@@ -2720,6 +2780,7 @@ async function setupPostcss(cwd) {
2720
2780
  Builder,
2721
2781
  analyzeTokens,
2722
2782
  createContext,
2783
+ debugFiles,
2723
2784
  discardDuplicate,
2724
2785
  emitAndExtract,
2725
2786
  emitArtifacts,
package/dist/index.mjs CHANGED
@@ -785,13 +785,13 @@ function analyzeTokens(ctx, options = {}) {
785
785
  const result = ctx.project.parseSourceFile(file);
786
786
  const extractMs = performance.now() - start2;
787
787
  extractTimeByFilepath.set(file, extractMs);
788
- logger.debug("analyze", `Extracted ${file} in ${extractMs}ms`);
788
+ logger.debug("analyze", `Parsed ${file} in ${extractMs}ms`);
789
789
  if (result) {
790
790
  parserResultByFilepath.set(file, result);
791
791
  options.onResult?.(file, result);
792
792
  }
793
793
  return [file, result];
794
- }).filter(([, result]) => result);
794
+ });
795
795
  const totalMs = Array.from(extractTimeByFilepath.values()).reduce((a, b) => a + b, 0);
796
796
  logger.debug("analyze", `Analyzed ${ctx.getFiles().length} files in ${totalMs.toFixed(2)}ms`);
797
797
  const minify = ctx.config.minify;
@@ -882,18 +882,18 @@ import { Obj, pipe, tap } from "lil-fp";
882
882
  // src/chunk-engine.ts
883
883
  init_esm_shims();
884
884
  import { mergeCss } from "@pandacss/core";
885
- var getChunkEngine = ({ paths, config, runtime: { path, fs } }) => ({
886
- dir: path.join(...paths.chunk),
885
+ var getChunkEngine = ({ paths, config, runtime: { path: path2, fs } }) => ({
886
+ dir: path2.join(...paths.chunk),
887
887
  readFile(file) {
888
- const fileName = path.join(...paths.chunk, this.format(file));
888
+ const fileName = path2.join(...paths.chunk, this.format(file));
889
889
  return fs.existsSync(fileName) ? fs.readFileSync(fileName) : "";
890
890
  },
891
891
  getFiles() {
892
892
  const files = fs.existsSync(this.dir) ? fs.readDirSync(this.dir) : [];
893
- return files.map((file) => fs.readFileSync(path.join(this.dir, file)));
893
+ return files.map((file) => fs.readFileSync(path2.join(this.dir, file)));
894
894
  },
895
895
  format(file) {
896
- return path.relative(config.cwd, file).replaceAll(path.sep, "__").replace(path.extname(file), ".css");
896
+ return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
897
897
  },
898
898
  getArtifact(file, css) {
899
899
  const fileName = this.format(file);
@@ -904,7 +904,7 @@ var getChunkEngine = ({ paths, config, runtime: { path, fs } }) => ({
904
904
  };
905
905
  },
906
906
  rm(file) {
907
- return fs.rmFileSync(path.join(...paths.chunk, this.format(file)));
907
+ return fs.rmFileSync(path2.join(...paths.chunk, this.format(file)));
908
908
  },
909
909
  empty() {
910
910
  return fs.rmDirSync(this.dir);
@@ -963,8 +963,8 @@ var nodeRuntime = {
963
963
  readDirSync: readdirSync,
964
964
  rmDirSync: emptyDirSync,
965
965
  rmFileSync: removeSync,
966
- ensureDirSync(path) {
967
- return ensureDirSync(path);
966
+ ensureDirSync(path2) {
967
+ return ensureDirSync(path2);
968
968
  },
969
969
  watch(options) {
970
970
  const { include, exclude, cwd, poll } = options;
@@ -995,18 +995,18 @@ process.on("uncaughtException", (reason) => {
995
995
 
996
996
  // src/output-engine.ts
997
997
  init_esm_shims();
998
- var getOutputEngine = ({ paths, runtime: { path, fs } }) => ({
998
+ var getOutputEngine = ({ paths, runtime: { path: path2, fs } }) => ({
999
999
  empty() {
1000
- fs.rmDirSync(path.join(...paths.root));
1000
+ fs.rmDirSync(path2.join(...paths.root));
1001
1001
  },
1002
1002
  async write(output) {
1003
1003
  if (!output)
1004
1004
  return;
1005
1005
  const { dir = paths.root, files } = output;
1006
- fs.ensureDirSync(path.join(...dir));
1006
+ fs.ensureDirSync(path2.join(...dir));
1007
1007
  return Promise.all(
1008
1008
  files.map(async ({ file, code }) => {
1009
- const absPath = path.join(...dir, file);
1009
+ const absPath = path2.join(...dir, file);
1010
1010
  if (code) {
1011
1011
  return fs.writeFile(absPath, code);
1012
1012
  }
@@ -2346,8 +2346,8 @@ async function bundleChunks(ctx) {
2346
2346
  });
2347
2347
  }
2348
2348
  async function writeFileChunk(ctx, file) {
2349
- const { path } = ctx.runtime;
2350
- logger3.debug("chunk:write", `File: ${path.relative(ctx.config.cwd, file)}`);
2349
+ const { path: path2 } = ctx.runtime;
2350
+ logger3.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2351
2351
  const css = extractFile(ctx, file);
2352
2352
  if (!css)
2353
2353
  return;
@@ -2356,11 +2356,11 @@ async function writeFileChunk(ctx, file) {
2356
2356
  }
2357
2357
  function extractFile(ctx, file) {
2358
2358
  const {
2359
- runtime: { path },
2359
+ runtime: { path: path2 },
2360
2360
  config: { cwd }
2361
2361
  } = ctx;
2362
2362
  return pipe2(
2363
- { file: path.abs(cwd, file) },
2363
+ { file: path2.abs(cwd, file) },
2364
2364
  tap2(() => logger3.debug("file:extract", file)),
2365
2365
  Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2366
2366
  Obj2.bind(
@@ -2557,9 +2557,68 @@ var Builder = class {
2557
2557
  }
2558
2558
  };
2559
2559
 
2560
+ // src/debug-files.ts
2561
+ init_esm_shims();
2562
+ import { colors, logger as logger5 } from "@pandacss/logger";
2563
+ import { mkdir, writeFile as writeFile3 } from "fs/promises";
2564
+ import * as path from "path";
2565
+ async function debugFiles(ctx, options) {
2566
+ const parserResultByFilepath = /* @__PURE__ */ new Map();
2567
+ const measureTotal = logger5.time.debug(`Analyzed ${ctx.getFiles().length} files`);
2568
+ ctx.config.minify = false;
2569
+ await ctx.getFiles().map(async (file) => {
2570
+ const measure = logger5.time.debug(`Parsed ${file}`);
2571
+ const result = ctx.project.parseSourceFile(file);
2572
+ measure();
2573
+ if (!result)
2574
+ return;
2575
+ parserResultByFilepath.set(file, result);
2576
+ const list = result.getAll().map((result2) => {
2577
+ const node = result2.box.getNode();
2578
+ const range = getNodeRange(node);
2579
+ return {
2580
+ name: result2.name,
2581
+ type: result2.type,
2582
+ data: result2.data,
2583
+ kind: node.getKindName(),
2584
+ line: range.startLineNumber,
2585
+ column: range.startColumn
2586
+ };
2587
+ });
2588
+ const css = ctx.getParserCss(result);
2589
+ if (!css)
2590
+ return;
2591
+ if (options.dry) {
2592
+ console.log({ path: file, ast: list, code: css });
2593
+ return Promise.resolve();
2594
+ } else if (options.outdir) {
2595
+ const parsedPath = path.parse(file);
2596
+ const relative3 = path.relative(ctx.config.cwd, parsedPath.dir);
2597
+ const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2598
+ const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2599
+ logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2600
+ await mkdir(options.outdir, { recursive: true });
2601
+ return Promise.all([
2602
+ writeFile3(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2603
+ writeFile3(`${options.outdir}/${cssPath}`, css)
2604
+ ]);
2605
+ }
2606
+ });
2607
+ measureTotal();
2608
+ }
2609
+ var debugResultSerializer = (_key, value) => {
2610
+ if (value instanceof Set) {
2611
+ return Array.from(value);
2612
+ }
2613
+ if (value instanceof Map) {
2614
+ return Object.fromEntries(value);
2615
+ }
2616
+ return value;
2617
+ };
2618
+
2560
2619
  // src/exec-command.ts
2561
2620
  init_esm_shims();
2562
- import { logger as logger5 } from "@pandacss/logger";
2621
+ import { logger as logger6 } from "@pandacss/logger";
2563
2622
  import { spawnSync } from "child_process";
2564
2623
  import getPackageManager from "preferred-pm";
2565
2624
  async function execCommand(cmd, cwd) {
@@ -2571,13 +2630,13 @@ async function execCommand(cmd, cwd) {
2571
2630
  }
2572
2631
  const check = spawnSync(pm, args, { cwd, stdio: "pipe" });
2573
2632
  if (check.status !== 0) {
2574
- logger5.error("exec", check.stderr.toString());
2633
+ logger6.error("exec", check.stderr.toString());
2575
2634
  }
2576
2635
  }
2577
2636
 
2578
2637
  // src/generate.ts
2579
2638
  init_esm_shims();
2580
- import { logger as logger6 } from "@pandacss/logger";
2639
+ import { logger as logger7 } from "@pandacss/logger";
2581
2640
  import { match } from "ts-pattern";
2582
2641
 
2583
2642
  // src/load-context.ts
@@ -2595,29 +2654,29 @@ var loadContext = async (config, configPath) => {
2595
2654
  // src/generate.ts
2596
2655
  async function build(ctx) {
2597
2656
  const msg = await emitAndExtract(ctx);
2598
- logger6.info("css:emit", msg);
2657
+ logger7.info("css:emit", msg);
2599
2658
  }
2600
2659
  async function generate(config, configPath) {
2601
2660
  const [ctxRef, loadCtx] = await loadContext(config, configPath);
2602
2661
  const ctx = ctxRef.current;
2603
2662
  await build(ctx);
2604
2663
  const {
2605
- runtime: { fs, path },
2664
+ runtime: { fs, path: path2 },
2606
2665
  dependencies,
2607
2666
  config: { cwd }
2608
2667
  } = ctx;
2609
2668
  if (ctx.config.watch) {
2610
2669
  const configWatcher = fs.watch({ include: dependencies });
2611
2670
  configWatcher.on("change", async () => {
2612
- logger6.info("config:change", "Config changed, restarting...");
2671
+ logger7.info("config:change", "Config changed, restarting...");
2613
2672
  await loadCtx();
2614
2673
  return build(ctxRef.current);
2615
2674
  });
2616
2675
  const contentWatcher = fs.watch(ctx.config);
2617
2676
  contentWatcher.on("all", async (event, file) => {
2618
- logger6.info(`file:${event}`, file);
2677
+ logger7.info(`file:${event}`, file);
2619
2678
  match(event).with("unlink", () => {
2620
- ctx.project.removeSourceFile(path.abs(cwd, file));
2679
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2621
2680
  ctx.chunks.rm(file);
2622
2681
  }).with("change", async () => {
2623
2682
  ctx.project.reloadSourceFile(file);
@@ -2629,7 +2688,7 @@ async function generate(config, configPath) {
2629
2688
  }).otherwise(() => {
2630
2689
  });
2631
2690
  });
2632
- logger6.info("ctx:watch", ctx.messages.watch());
2691
+ logger7.info("ctx:watch", ctx.messages.watch());
2633
2692
  }
2634
2693
  }
2635
2694
 
@@ -2655,9 +2714,9 @@ function setupGitIgnore({ config: { outdir } }) {
2655
2714
 
2656
2715
  // src/setup-config.ts
2657
2716
  init_esm_shims();
2658
- import { logger as logger7, quote } from "@pandacss/logger";
2717
+ import { logger as logger8, quote } from "@pandacss/logger";
2659
2718
  import { messages } from "@pandacss/generator";
2660
- import { writeFile as writeFile3 } from "fs-extra";
2719
+ import { writeFile as writeFile4 } from "fs-extra";
2661
2720
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2662
2721
  import { outdent as outdent2 } from "outdent";
2663
2722
  import { join as join2 } from "path";
@@ -2669,9 +2728,9 @@ async function setupConfig(cwd, { force }) {
2669
2728
  const cmd = pm === "npm" ? "npm run" : pm;
2670
2729
  const isTs = lookItUpSync3("tsconfig.json", cwd);
2671
2730
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2672
- logger7.info("init:config", `creating panda config file: ${quote(file)}`);
2731
+ logger8.info("init:config", `creating panda config file: ${quote(file)}`);
2673
2732
  if (!force && configFile) {
2674
- logger7.warn("init:config", messages.configExists(cmd));
2733
+ logger8.warn("init:config", messages.configExists(cmd));
2675
2734
  } else {
2676
2735
  const content = outdent2`
2677
2736
  import { defineConfig } from "@pandacss/dev"
@@ -2690,12 +2749,12 @@ async function setupConfig(cwd, { force }) {
2690
2749
  outdir: "styled-system",
2691
2750
  })
2692
2751
  `;
2693
- await writeFile3(join2(cwd, file), content);
2694
- logger7.log(messages.thankYou());
2752
+ await writeFile4(join2(cwd, file), content);
2753
+ logger8.log(messages.thankYou());
2695
2754
  }
2696
2755
  }
2697
2756
  async function setupPostcss(cwd) {
2698
- logger7.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
2757
+ logger8.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
2699
2758
  const content = outdent2`
2700
2759
  module.exports = {
2701
2760
  plugins: {
@@ -2703,12 +2762,13 @@ async function setupPostcss(cwd) {
2703
2762
  },
2704
2763
  }
2705
2764
  `;
2706
- await writeFile3(join2(cwd, "postcss.config.cjs"), content);
2765
+ await writeFile4(join2(cwd, "postcss.config.cjs"), content);
2707
2766
  }
2708
2767
  export {
2709
2768
  Builder,
2710
2769
  analyzeTokens,
2711
2770
  createContext,
2771
+ debugFiles,
2712
2772
  discardDuplicate2 as discardDuplicate,
2713
2773
  emitAndExtract,
2714
2774
  emitArtifacts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20230418123438",
3
+ "version": "0.0.0-dev-20230420112920",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,17 +33,17 @@
33
33
  "preferred-pm": "^3.0.3",
34
34
  "ts-morph": "18.0.0",
35
35
  "ts-pattern": "4.2.2",
36
- "@pandacss/config": "0.0.0-dev-20230418123438",
37
- "@pandacss/core": "0.0.0-dev-20230418123438",
38
- "@pandacss/error": "0.0.0-dev-20230418123438",
39
- "@pandacss/generator": "0.0.0-dev-20230418123438",
40
- "@pandacss/is-valid-prop": "0.0.0-dev-20230418123438",
41
- "@pandacss/logger": "0.0.0-dev-20230418123438",
42
- "@pandacss/parser": "0.0.0-dev-20230418123438",
43
- "@pandacss/extractor": "0.0.0-dev-20230418123438",
44
- "@pandacss/shared": "0.0.0-dev-20230418123438",
45
- "@pandacss/token-dictionary": "0.0.0-dev-20230418123438",
46
- "@pandacss/types": "0.0.0-dev-20230418123438"
36
+ "@pandacss/config": "0.0.0-dev-20230420112920",
37
+ "@pandacss/core": "0.0.0-dev-20230420112920",
38
+ "@pandacss/error": "0.0.0-dev-20230420112920",
39
+ "@pandacss/generator": "0.0.0-dev-20230420112920",
40
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230420112920",
41
+ "@pandacss/logger": "0.0.0-dev-20230420112920",
42
+ "@pandacss/parser": "0.0.0-dev-20230420112920",
43
+ "@pandacss/extractor": "0.0.0-dev-20230420112920",
44
+ "@pandacss/shared": "0.0.0-dev-20230420112920",
45
+ "@pandacss/token-dictionary": "0.0.0-dev-20230420112920",
46
+ "@pandacss/types": "0.0.0-dev-20230420112920"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/fs-extra": "11.0.1",
@@ -53,7 +53,7 @@
53
53
  "@types/pluralize": "0.0.29",
54
54
  "boxen": "^7.0.2",
55
55
  "gzip-size": "^7.0.0",
56
- "@pandacss/fixture": "0.0.0-dev-20230418123438"
56
+ "@pandacss/fixture": "0.0.0-dev-20230420112920"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",