@pandacss/node 0.0.0-dev-20230602132346 → 0.0.0-dev-20230602152922

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.
Files changed (3) hide show
  1. package/dist/index.js +50 -58
  2. package/dist/index.mjs +51 -59
  3. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.0.4/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.0.4/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  }
40
40
  });
41
41
 
@@ -885,18 +885,18 @@ var import_lil_fp = require("lil-fp");
885
885
  // src/chunk-engine.ts
886
886
  init_cjs_shims();
887
887
  var import_core = require("@pandacss/core");
888
- var getChunkEngine = ({ paths, config, runtime: { path: path3, fs: fs2 } }) => ({
889
- dir: path3.join(...paths.chunk),
888
+ var getChunkEngine = ({ paths, config, runtime: { path: path2, fs: fs2 } }) => ({
889
+ dir: path2.join(...paths.chunk),
890
890
  readFile(file) {
891
- const fileName = path3.join(...paths.chunk, this.format(file));
891
+ const fileName = path2.join(...paths.chunk, this.format(file));
892
892
  return fs2.existsSync(fileName) ? fs2.readFileSync(fileName) : "";
893
893
  },
894
894
  getFiles() {
895
895
  const files = fs2.existsSync(this.dir) ? fs2.readDirSync(this.dir) : [];
896
- return files.map((file) => fs2.readFileSync(path3.join(this.dir, file)));
896
+ return files.map((file) => fs2.readFileSync(path2.join(this.dir, file)));
897
897
  },
898
898
  format(file) {
899
- return path3.relative(config.cwd, file).replaceAll(path3.sep, "__").replace(path3.extname(file), ".css");
899
+ return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
900
900
  },
901
901
  getArtifact(file, css) {
902
902
  const fileName = this.format(file);
@@ -907,7 +907,7 @@ var getChunkEngine = ({ paths, config, runtime: { path: path3, fs: fs2 } }) => (
907
907
  };
908
908
  },
909
909
  rm(file) {
910
- return fs2.rmFileSync(path3.join(...paths.chunk, this.format(file)));
910
+ return fs2.rmFileSync(path2.join(...paths.chunk, this.format(file)));
911
911
  },
912
912
  empty() {
913
913
  return fs2.rmDirSync(this.dir);
@@ -950,15 +950,19 @@ var nodeRuntime = {
950
950
  glob(opts) {
951
951
  if (!opts.include)
952
952
  return [];
953
- return import_fast_glob.default.sync(opts.include, { cwd: opts.cwd, ignore: opts.exclude, absolute: true });
953
+ const ignore = opts.exclude ?? [];
954
+ if (!ignore.length) {
955
+ ignore.push("**/*.d.ts");
956
+ }
957
+ return import_fast_glob.default.sync(opts.include, { cwd: opts.cwd, ignore, absolute: true });
954
958
  },
955
959
  writeFile: import_fs_extra.writeFile,
956
960
  writeFileSync: import_fs_extra.writeFileSync,
957
961
  readDirSync: import_fs_extra.readdirSync,
958
962
  rmDirSync: import_fs_extra.emptyDirSync,
959
963
  rmFileSync: import_fs_extra.removeSync,
960
- ensureDirSync(path3) {
961
- return (0, import_fs_extra.ensureDirSync)(path3);
964
+ ensureDirSync(path2) {
965
+ return (0, import_fs_extra.ensureDirSync)(path2);
962
966
  },
963
967
  watch(options) {
964
968
  const { include, exclude, cwd, poll } = options;
@@ -989,18 +993,18 @@ process.on("uncaughtException", (reason) => {
989
993
 
990
994
  // src/output-engine.ts
991
995
  init_cjs_shims();
992
- var getOutputEngine = ({ paths, runtime: { path: path3, fs: fs2 } }) => ({
996
+ var getOutputEngine = ({ paths, runtime: { path: path2, fs: fs2 } }) => ({
993
997
  empty() {
994
- fs2.rmDirSync(path3.join(...paths.root));
998
+ fs2.rmDirSync(path2.join(...paths.root));
995
999
  },
996
1000
  async write(output) {
997
1001
  if (!output)
998
1002
  return;
999
1003
  const { dir = paths.root, files } = output;
1000
- fs2.ensureDirSync(path3.join(...dir));
1004
+ fs2.ensureDirSync(path2.join(...dir));
1001
1005
  return Promise.all(
1002
1006
  files.map(async ({ file, code }) => {
1003
- const absPath = path3.join(...dir, file);
1007
+ const absPath = path2.join(...dir, file);
1004
1008
  if (code) {
1005
1009
  return fs2.writeFile(absPath, code);
1006
1010
  }
@@ -1051,6 +1055,7 @@ async function loadConfigAndCreateContext(options = {}) {
1051
1055
  if (options.cwd) {
1052
1056
  conf.config.cwd = options.cwd;
1053
1057
  }
1058
+ conf.config.outdir ??= "styled-system";
1054
1059
  return createContext(conf);
1055
1060
  }
1056
1061
 
@@ -2358,7 +2363,6 @@ var createBox = (options) => boxen(options.content, {
2358
2363
  });
2359
2364
 
2360
2365
  // src/extract.ts
2361
- var import_parser2 = require("@pandacss/parser");
2362
2366
  async function bundleChunks(ctx) {
2363
2367
  const files = ctx.chunks.getFiles();
2364
2368
  return ctx.output.write({
@@ -2367,8 +2371,8 @@ async function bundleChunks(ctx) {
2367
2371
  });
2368
2372
  }
2369
2373
  async function writeFileChunk(ctx, file) {
2370
- const { path: path3 } = ctx.runtime;
2371
- import_logger3.logger.debug("chunk:write", `File: ${path3.relative(ctx.config.cwd, file)}`);
2374
+ const { path: path2 } = ctx.runtime;
2375
+ import_logger3.logger.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2372
2376
  const css = extractFile(ctx, file);
2373
2377
  if (!css)
2374
2378
  return;
@@ -2377,19 +2381,17 @@ async function writeFileChunk(ctx, file) {
2377
2381
  }
2378
2382
  function extractFile(ctx, file) {
2379
2383
  const {
2380
- runtime: { path: path3, fs: fs2 },
2384
+ runtime: { path: path2 },
2381
2385
  config: { cwd }
2382
2386
  } = ctx;
2383
2387
  return (0, import_lil_fp2.pipe)(
2384
- { file: path3.abs(cwd, file) },
2388
+ { file: path2.abs(cwd, file) },
2385
2389
  (0, import_lil_fp2.tap)(() => import_logger3.logger.debug("file:extract", file)),
2386
2390
  import_lil_fp2.Obj.bind("measure", () => import_logger3.logger.time.debug(`Extracted ${file}`)),
2387
2391
  import_lil_fp2.Obj.bind(
2388
2392
  "result",
2389
2393
  (0, import_lil_fp2.tryCatch)(
2390
- ({ file: file2 }) => {
2391
- return file2.endsWith(".json") ? import_parser2.ParserResult.fromJson(fs2.readFileSync(file2)) : ctx.project.parseSourceFile(file2);
2392
- },
2394
+ ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2393
2395
  (error) => import_logger3.logger.error("file:parse", error)
2394
2396
  )
2395
2397
  ),
@@ -2629,17 +2631,18 @@ var Builder = class {
2629
2631
  // src/debug-files.ts
2630
2632
  init_cjs_shims();
2631
2633
  var import_logger5 = require("@pandacss/logger");
2632
- var import_promises2 = require("fs/promises");
2633
- var path = __toESM(require("path"));
2634
+ var nodePath = __toESM(require("path"));
2634
2635
  async function debugFiles(ctx, options) {
2635
2636
  const files = ctx.getFiles();
2636
2637
  const measureTotal = import_logger5.logger.time.debug(`Done parsing ${files.length} files`);
2637
2638
  ctx.config.minify = false;
2638
2639
  ctx.config.optimize = true;
2639
- if (!options.dry && options.outdir) {
2640
- await (0, import_promises2.mkdir)(options.outdir, { recursive: true });
2641
- import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/config.json`)}`);
2642
- await (0, import_promises2.writeFile)(`${options.outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2640
+ const { fs: fs2, path: path2 } = ctx.runtime;
2641
+ const outdir = options.outdir;
2642
+ if (!options.dry && outdir) {
2643
+ fs2.ensureDirSync(outdir);
2644
+ import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/config.json`)}`);
2645
+ await fs2.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2643
2646
  }
2644
2647
  const filesWithCss = [];
2645
2648
  await Promise.all(
@@ -2649,18 +2652,7 @@ async function debugFiles(ctx, options) {
2649
2652
  measure();
2650
2653
  if (!result)
2651
2654
  return;
2652
- const list = result.toArray().map((result2) => {
2653
- const node = result2.box.getNode();
2654
- const range = result2.box.getRange();
2655
- return {
2656
- name: result2.name,
2657
- type: result2.type,
2658
- data: result2.data,
2659
- kind: node.getKindName(),
2660
- line: range.startLineNumber,
2661
- column: range.startColumn
2662
- };
2663
- });
2655
+ const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
2664
2656
  const css = ctx.getParserCss(result);
2665
2657
  if (!css)
2666
2658
  return;
@@ -2668,17 +2660,17 @@ async function debugFiles(ctx, options) {
2668
2660
  console.log({ path: file, ast: list, code: css });
2669
2661
  return Promise.resolve();
2670
2662
  }
2671
- if (options.outdir) {
2663
+ if (outdir) {
2672
2664
  filesWithCss.push(file);
2673
- const parsedPath = path.parse(file);
2674
- const relative4 = path.relative(ctx.config.cwd, parsedPath.dir);
2675
- const astJsonPath = `${relative4}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2676
- const cssPath = `${relative4}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2677
- import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2678
- import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/${cssPath}`)}`);
2665
+ const parsedPath = nodePath.parse(file);
2666
+ const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
2667
+ const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
2668
+ const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
2669
+ import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${astJsonPath}`)}`);
2670
+ import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${cssPath}`)}`);
2679
2671
  return Promise.all([
2680
- (0, import_promises2.writeFile)(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2681
- (0, import_promises2.writeFile)(`${options.outdir}/${cssPath}`, css)
2672
+ fs2.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2673
+ fs2.writeFile(`${outdir}/${cssPath}`, css)
2682
2674
  ]);
2683
2675
  }
2684
2676
  })
@@ -2741,7 +2733,7 @@ async function generate(config, configPath) {
2741
2733
  const ctx = ctxRef.current;
2742
2734
  await build(ctx);
2743
2735
  const {
2744
- runtime: { fs: fs2, path: path3 },
2736
+ runtime: { fs: fs2, path: path2 },
2745
2737
  dependencies,
2746
2738
  config: { cwd }
2747
2739
  } = ctx;
@@ -2756,7 +2748,7 @@ async function generate(config, configPath) {
2756
2748
  contentWatcher.on("all", async (event, file) => {
2757
2749
  import_logger7.logger.info(`file:${event}`, file);
2758
2750
  (0, import_ts_pattern.match)(event).with("unlink", () => {
2759
- ctx.project.removeSourceFile(path3.abs(cwd, file));
2751
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2760
2752
  ctx.chunks.rm(file);
2761
2753
  }).with("change", async () => {
2762
2754
  ctx.project.reloadSourceFile(file);
@@ -2857,12 +2849,12 @@ async function setupPostcss(cwd) {
2857
2849
  // src/ship-files.ts
2858
2850
  init_cjs_shims();
2859
2851
  var import_logger9 = require("@pandacss/logger");
2860
- var import_parser3 = require("@pandacss/parser");
2861
- var import_promises3 = require("fs/promises");
2862
- var path2 = __toESM(require("path"));
2852
+ var import_parser2 = require("@pandacss/parser");
2853
+ var import_promises2 = require("fs/promises");
2854
+ var path = __toESM(require("path"));
2863
2855
  async function shipFiles(ctx, outfile) {
2864
2856
  const files = ctx.getFiles();
2865
- const extractResult = (0, import_parser3.createParserResult)();
2857
+ const extractResult = (0, import_parser2.createParserResult)();
2866
2858
  const filesWithCss = [];
2867
2859
  files.forEach(async (file) => {
2868
2860
  const result = ctx.project.parseSourceFile(file);
@@ -2872,13 +2864,13 @@ async function shipFiles(ctx, outfile) {
2872
2864
  if (!css)
2873
2865
  return;
2874
2866
  extractResult.merge(result);
2875
- filesWithCss.push(path2.relative(ctx.config.cwd, file));
2867
+ filesWithCss.push(path.relative(ctx.config.cwd, file));
2876
2868
  });
2877
2869
  import_logger9.logger.info("cli", `Found ${import_logger9.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2878
2870
  const minify = ctx.config.minify;
2879
2871
  import_logger9.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger9.colors.bold(outfile)}`);
2880
2872
  const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
2881
- await (0, import_promises3.writeFile)(outfile, output);
2873
+ await (0, import_promises2.writeFile)(outfile, output);
2882
2874
  import_logger9.logger.info("cli", "Done!");
2883
2875
  }
2884
2876
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
- // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.0.4/node_modules/tsup/assets/esm_shims.js
37
+ // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js
38
38
  var init_esm_shims = __esm({
39
- "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.0.4/node_modules/tsup/assets/esm_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js"() {
40
40
  }
41
41
  });
42
42
 
@@ -861,18 +861,18 @@ import { Obj, pipe, tap } from "lil-fp";
861
861
  // src/chunk-engine.ts
862
862
  init_esm_shims();
863
863
  import { mergeCss } from "@pandacss/core";
864
- var getChunkEngine = ({ paths, config, runtime: { path: path3, fs } }) => ({
865
- dir: path3.join(...paths.chunk),
864
+ var getChunkEngine = ({ paths, config, runtime: { path: path2, fs } }) => ({
865
+ dir: path2.join(...paths.chunk),
866
866
  readFile(file) {
867
- const fileName = path3.join(...paths.chunk, this.format(file));
867
+ const fileName = path2.join(...paths.chunk, this.format(file));
868
868
  return fs.existsSync(fileName) ? fs.readFileSync(fileName) : "";
869
869
  },
870
870
  getFiles() {
871
871
  const files = fs.existsSync(this.dir) ? fs.readDirSync(this.dir) : [];
872
- return files.map((file) => fs.readFileSync(path3.join(this.dir, file)));
872
+ return files.map((file) => fs.readFileSync(path2.join(this.dir, file)));
873
873
  },
874
874
  format(file) {
875
- return path3.relative(config.cwd, file).replaceAll(path3.sep, "__").replace(path3.extname(file), ".css");
875
+ return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
876
876
  },
877
877
  getArtifact(file, css) {
878
878
  const fileName = this.format(file);
@@ -883,7 +883,7 @@ var getChunkEngine = ({ paths, config, runtime: { path: path3, fs } }) => ({
883
883
  };
884
884
  },
885
885
  rm(file) {
886
- return fs.rmFileSync(path3.join(...paths.chunk, this.format(file)));
886
+ return fs.rmFileSync(path2.join(...paths.chunk, this.format(file)));
887
887
  },
888
888
  empty() {
889
889
  return fs.rmDirSync(this.dir);
@@ -935,15 +935,19 @@ var nodeRuntime = {
935
935
  glob(opts) {
936
936
  if (!opts.include)
937
937
  return [];
938
- return glob.sync(opts.include, { cwd: opts.cwd, ignore: opts.exclude, absolute: true });
938
+ const ignore = opts.exclude ?? [];
939
+ if (!ignore.length) {
940
+ ignore.push("**/*.d.ts");
941
+ }
942
+ return glob.sync(opts.include, { cwd: opts.cwd, ignore, absolute: true });
939
943
  },
940
944
  writeFile: writeFile2,
941
945
  writeFileSync,
942
946
  readDirSync: readdirSync,
943
947
  rmDirSync: emptyDirSync,
944
948
  rmFileSync: removeSync,
945
- ensureDirSync(path3) {
946
- return ensureDirSync(path3);
949
+ ensureDirSync(path2) {
950
+ return ensureDirSync(path2);
947
951
  },
948
952
  watch(options) {
949
953
  const { include, exclude, cwd, poll } = options;
@@ -974,18 +978,18 @@ process.on("uncaughtException", (reason) => {
974
978
 
975
979
  // src/output-engine.ts
976
980
  init_esm_shims();
977
- var getOutputEngine = ({ paths, runtime: { path: path3, fs } }) => ({
981
+ var getOutputEngine = ({ paths, runtime: { path: path2, fs } }) => ({
978
982
  empty() {
979
- fs.rmDirSync(path3.join(...paths.root));
983
+ fs.rmDirSync(path2.join(...paths.root));
980
984
  },
981
985
  async write(output) {
982
986
  if (!output)
983
987
  return;
984
988
  const { dir = paths.root, files } = output;
985
- fs.ensureDirSync(path3.join(...dir));
989
+ fs.ensureDirSync(path2.join(...dir));
986
990
  return Promise.all(
987
991
  files.map(async ({ file, code }) => {
988
- const absPath = path3.join(...dir, file);
992
+ const absPath = path2.join(...dir, file);
989
993
  if (code) {
990
994
  return fs.writeFile(absPath, code);
991
995
  }
@@ -1036,6 +1040,7 @@ async function loadConfigAndCreateContext(options = {}) {
1036
1040
  if (options.cwd) {
1037
1041
  conf.config.cwd = options.cwd;
1038
1042
  }
1043
+ conf.config.outdir ??= "styled-system";
1039
1044
  return createContext(conf);
1040
1045
  }
1041
1046
 
@@ -2343,7 +2348,6 @@ var createBox = (options) => boxen(options.content, {
2343
2348
  });
2344
2349
 
2345
2350
  // src/extract.ts
2346
- import { ParserResult } from "@pandacss/parser";
2347
2351
  async function bundleChunks(ctx) {
2348
2352
  const files = ctx.chunks.getFiles();
2349
2353
  return ctx.output.write({
@@ -2352,8 +2356,8 @@ async function bundleChunks(ctx) {
2352
2356
  });
2353
2357
  }
2354
2358
  async function writeFileChunk(ctx, file) {
2355
- const { path: path3 } = ctx.runtime;
2356
- logger3.debug("chunk:write", `File: ${path3.relative(ctx.config.cwd, file)}`);
2359
+ const { path: path2 } = ctx.runtime;
2360
+ logger3.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
2357
2361
  const css = extractFile(ctx, file);
2358
2362
  if (!css)
2359
2363
  return;
@@ -2362,19 +2366,17 @@ async function writeFileChunk(ctx, file) {
2362
2366
  }
2363
2367
  function extractFile(ctx, file) {
2364
2368
  const {
2365
- runtime: { path: path3, fs },
2369
+ runtime: { path: path2 },
2366
2370
  config: { cwd }
2367
2371
  } = ctx;
2368
2372
  return pipe2(
2369
- { file: path3.abs(cwd, file) },
2373
+ { file: path2.abs(cwd, file) },
2370
2374
  tap2(() => logger3.debug("file:extract", file)),
2371
2375
  Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2372
2376
  Obj2.bind(
2373
2377
  "result",
2374
2378
  tryCatch(
2375
- ({ file: file2 }) => {
2376
- return file2.endsWith(".json") ? ParserResult.fromJson(fs.readFileSync(file2)) : ctx.project.parseSourceFile(file2);
2377
- },
2379
+ ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2378
2380
  (error) => logger3.error("file:parse", error)
2379
2381
  )
2380
2382
  ),
@@ -2614,17 +2616,18 @@ var Builder = class {
2614
2616
  // src/debug-files.ts
2615
2617
  init_esm_shims();
2616
2618
  import { colors, logger as logger5 } from "@pandacss/logger";
2617
- import { mkdir, writeFile as writeFile3 } from "fs/promises";
2618
- import * as path from "path";
2619
+ import * as nodePath from "path";
2619
2620
  async function debugFiles(ctx, options) {
2620
2621
  const files = ctx.getFiles();
2621
2622
  const measureTotal = logger5.time.debug(`Done parsing ${files.length} files`);
2622
2623
  ctx.config.minify = false;
2623
2624
  ctx.config.optimize = true;
2624
- if (!options.dry && options.outdir) {
2625
- await mkdir(options.outdir, { recursive: true });
2626
- logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/config.json`)}`);
2627
- await writeFile3(`${options.outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2625
+ const { fs, path: path2 } = ctx.runtime;
2626
+ const outdir = options.outdir;
2627
+ if (!options.dry && outdir) {
2628
+ fs.ensureDirSync(outdir);
2629
+ logger5.info("cli", `Writing ${colors.bold(`${outdir}/config.json`)}`);
2630
+ await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2628
2631
  }
2629
2632
  const filesWithCss = [];
2630
2633
  await Promise.all(
@@ -2634,18 +2637,7 @@ async function debugFiles(ctx, options) {
2634
2637
  measure();
2635
2638
  if (!result)
2636
2639
  return;
2637
- const list = result.toArray().map((result2) => {
2638
- const node = result2.box.getNode();
2639
- const range = result2.box.getRange();
2640
- return {
2641
- name: result2.name,
2642
- type: result2.type,
2643
- data: result2.data,
2644
- kind: node.getKindName(),
2645
- line: range.startLineNumber,
2646
- column: range.startColumn
2647
- };
2648
- });
2640
+ const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
2649
2641
  const css = ctx.getParserCss(result);
2650
2642
  if (!css)
2651
2643
  return;
@@ -2653,17 +2645,17 @@ async function debugFiles(ctx, options) {
2653
2645
  console.log({ path: file, ast: list, code: css });
2654
2646
  return Promise.resolve();
2655
2647
  }
2656
- if (options.outdir) {
2648
+ if (outdir) {
2657
2649
  filesWithCss.push(file);
2658
- const parsedPath = path.parse(file);
2659
- const relative4 = path.relative(ctx.config.cwd, parsedPath.dir);
2660
- const astJsonPath = `${relative4}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2661
- const cssPath = `${relative4}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2662
- logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2663
- logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/${cssPath}`)}`);
2650
+ const parsedPath = nodePath.parse(file);
2651
+ const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
2652
+ const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
2653
+ const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
2654
+ logger5.info("cli", `Writing ${colors.bold(`${outdir}/${astJsonPath}`)}`);
2655
+ logger5.info("cli", `Writing ${colors.bold(`${outdir}/${cssPath}`)}`);
2664
2656
  return Promise.all([
2665
- writeFile3(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2666
- writeFile3(`${options.outdir}/${cssPath}`, css)
2657
+ fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2658
+ fs.writeFile(`${outdir}/${cssPath}`, css)
2667
2659
  ]);
2668
2660
  }
2669
2661
  })
@@ -2726,7 +2718,7 @@ async function generate(config, configPath) {
2726
2718
  const ctx = ctxRef.current;
2727
2719
  await build(ctx);
2728
2720
  const {
2729
- runtime: { fs, path: path3 },
2721
+ runtime: { fs, path: path2 },
2730
2722
  dependencies,
2731
2723
  config: { cwd }
2732
2724
  } = ctx;
@@ -2741,7 +2733,7 @@ async function generate(config, configPath) {
2741
2733
  contentWatcher.on("all", async (event, file) => {
2742
2734
  logger7.info(`file:${event}`, file);
2743
2735
  match(event).with("unlink", () => {
2744
- ctx.project.removeSourceFile(path3.abs(cwd, file));
2736
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2745
2737
  ctx.chunks.rm(file);
2746
2738
  }).with("change", async () => {
2747
2739
  ctx.project.reloadSourceFile(file);
@@ -2784,7 +2776,7 @@ function setupGitIgnore({ config: { outdir, gitignore = true } }) {
2784
2776
  init_esm_shims();
2785
2777
  import { logger as logger8, quote } from "@pandacss/logger";
2786
2778
  import { messages } from "@pandacss/generator";
2787
- import { writeFile as writeFile4 } from "fs-extra";
2779
+ import { writeFile as writeFile3 } from "fs-extra";
2788
2780
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2789
2781
  import { outdent as outdent2 } from "outdent";
2790
2782
  import { join as join2 } from "path";
@@ -2823,7 +2815,7 @@ outExtension: '${outExtension}',` : ""}
2823
2815
  jsxFramework: '${jsxFramework}'` : ""}
2824
2816
  })
2825
2817
  `;
2826
- await writeFile4(join2(cwd, file), content);
2818
+ await writeFile3(join2(cwd, file), content);
2827
2819
  logger8.log(messages.thankYou());
2828
2820
  }
2829
2821
  }
@@ -2836,15 +2828,15 @@ async function setupPostcss(cwd) {
2836
2828
  },
2837
2829
  }
2838
2830
  `;
2839
- await writeFile4(join2(cwd, "postcss.config.cjs"), content);
2831
+ await writeFile3(join2(cwd, "postcss.config.cjs"), content);
2840
2832
  }
2841
2833
 
2842
2834
  // src/ship-files.ts
2843
2835
  init_esm_shims();
2844
2836
  import { colors as colors2, logger as logger9 } from "@pandacss/logger";
2845
2837
  import { createParserResult } from "@pandacss/parser";
2846
- import { writeFile as writeFile5 } from "fs/promises";
2847
- import * as path2 from "path";
2838
+ import { writeFile as writeFile4 } from "fs/promises";
2839
+ import * as path from "path";
2848
2840
  async function shipFiles(ctx, outfile) {
2849
2841
  const files = ctx.getFiles();
2850
2842
  const extractResult = createParserResult();
@@ -2857,13 +2849,13 @@ async function shipFiles(ctx, outfile) {
2857
2849
  if (!css)
2858
2850
  return;
2859
2851
  extractResult.merge(result);
2860
- filesWithCss.push(path2.relative(ctx.config.cwd, file));
2852
+ filesWithCss.push(path.relative(ctx.config.cwd, file));
2861
2853
  });
2862
2854
  logger9.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2863
2855
  const minify = ctx.config.minify;
2864
2856
  logger9.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
2865
2857
  const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
2866
- await writeFile5(outfile, output);
2858
+ await writeFile4(outfile, output);
2867
2859
  logger9.info("cli", "Done!");
2868
2860
  }
2869
2861
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20230602132346",
3
+ "version": "0.0.0-dev-20230602152922",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,17 +32,17 @@
32
32
  "preferred-pm": "^3.0.3",
33
33
  "ts-morph": "18.0.0",
34
34
  "ts-pattern": "4.3.0",
35
- "@pandacss/config": "0.0.0-dev-20230602132346",
36
- "@pandacss/core": "0.0.0-dev-20230602132346",
37
- "@pandacss/error": "0.0.0-dev-20230602132346",
38
- "@pandacss/extractor": "0.0.0-dev-20230602132346",
39
- "@pandacss/generator": "0.0.0-dev-20230602132346",
40
- "@pandacss/is-valid-prop": "0.0.0-dev-20230602132346",
41
- "@pandacss/logger": "0.0.0-dev-20230602132346",
42
- "@pandacss/parser": "0.0.0-dev-20230602132346",
43
- "@pandacss/shared": "0.0.0-dev-20230602132346",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20230602132346",
45
- "@pandacss/types": "0.0.0-dev-20230602132346"
35
+ "@pandacss/config": "0.0.0-dev-20230602152922",
36
+ "@pandacss/core": "0.0.0-dev-20230602152922",
37
+ "@pandacss/error": "0.0.0-dev-20230602152922",
38
+ "@pandacss/extractor": "0.0.0-dev-20230602152922",
39
+ "@pandacss/generator": "0.0.0-dev-20230602152922",
40
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230602152922",
41
+ "@pandacss/logger": "0.0.0-dev-20230602152922",
42
+ "@pandacss/parser": "0.0.0-dev-20230602152922",
43
+ "@pandacss/shared": "0.0.0-dev-20230602152922",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20230602152922",
45
+ "@pandacss/types": "0.0.0-dev-20230602152922"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/fs-extra": "11.0.1",
@@ -52,7 +52,7 @@
52
52
  "@types/pluralize": "0.0.29",
53
53
  "boxen": "^7.1.0",
54
54
  "gzip-size": "^7.0.0",
55
- "@pandacss/fixture": "0.0.0-dev-20230602132346"
55
+ "@pandacss/fixture": "0.0.0-dev-20230602152922"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",