@pandacss/node 0.0.0-dev-20230601202405 → 0.0.0-dev-20230602151911

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
@@ -188,7 +188,9 @@ declare class Builder {
188
188
  writeFileCss(file: string, css: string): void;
189
189
  checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
190
190
  getConfigPath(): string;
191
- setup(): Promise<void>;
191
+ setup(options?: {
192
+ configPath?: string;
193
+ }): Promise<void>;
192
194
  setupContext(options: {
193
195
  configPath: string;
194
196
  depsModifiedMap: Map<string, number>;
package/dist/index.js CHANGED
@@ -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
  ),
@@ -2502,7 +2504,7 @@ var Builder = class {
2502
2504
  delete require.cache[file];
2503
2505
  }
2504
2506
  if (setupCount > 0) {
2505
- import_logger4.logger.info("postcss", "\u2699\uFE0F Config changed, reloading");
2507
+ import_logger4.logger.info("builder", "\u2699\uFE0F Config changed, reloading");
2506
2508
  }
2507
2509
  return { isModified: true, modifiedMap: newModified };
2508
2510
  }
@@ -2513,8 +2515,9 @@ var Builder = class {
2513
2515
  }
2514
2516
  return configPath;
2515
2517
  }
2516
- async setup() {
2517
- const configPath = this.getConfigPath();
2518
+ async setup(options = {}) {
2519
+ import_logger4.logger.info("builder", "\u{1F6A7} Setup");
2520
+ const configPath = options.configPath ?? this.getConfigPath();
2518
2521
  const configDeps = (0, import_config3.getConfigDependencies)(configPath);
2519
2522
  const deps = this.checkConfigDeps(configPath, configDeps);
2520
2523
  if (deps.isModified) {
@@ -2628,17 +2631,18 @@ var Builder = class {
2628
2631
  // src/debug-files.ts
2629
2632
  init_cjs_shims();
2630
2633
  var import_logger5 = require("@pandacss/logger");
2631
- var import_promises2 = require("fs/promises");
2632
- var path = __toESM(require("path"));
2634
+ var nodePath = __toESM(require("path"));
2633
2635
  async function debugFiles(ctx, options) {
2634
2636
  const files = ctx.getFiles();
2635
2637
  const measureTotal = import_logger5.logger.time.debug(`Done parsing ${files.length} files`);
2636
2638
  ctx.config.minify = false;
2637
2639
  ctx.config.optimize = true;
2638
- if (!options.dry && options.outdir) {
2639
- await (0, import_promises2.mkdir)(options.outdir, { recursive: true });
2640
- import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/config.json`)}`);
2641
- 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));
2642
2646
  }
2643
2647
  const filesWithCss = [];
2644
2648
  await Promise.all(
@@ -2648,18 +2652,7 @@ async function debugFiles(ctx, options) {
2648
2652
  measure();
2649
2653
  if (!result)
2650
2654
  return;
2651
- const list = result.toArray().map((result2) => {
2652
- const node = result2.box.getNode();
2653
- const range = result2.box.getRange();
2654
- return {
2655
- name: result2.name,
2656
- type: result2.type,
2657
- data: result2.data,
2658
- kind: node.getKindName(),
2659
- line: range.startLineNumber,
2660
- column: range.startColumn
2661
- };
2662
- });
2655
+ const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
2663
2656
  const css = ctx.getParserCss(result);
2664
2657
  if (!css)
2665
2658
  return;
@@ -2667,17 +2660,17 @@ async function debugFiles(ctx, options) {
2667
2660
  console.log({ path: file, ast: list, code: css });
2668
2661
  return Promise.resolve();
2669
2662
  }
2670
- if (options.outdir) {
2663
+ if (outdir) {
2671
2664
  filesWithCss.push(file);
2672
- const parsedPath = path.parse(file);
2673
- const relative4 = path.relative(ctx.config.cwd, parsedPath.dir);
2674
- const astJsonPath = `${relative4}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2675
- const cssPath = `${relative4}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2676
- import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2677
- 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}`)}`);
2678
2671
  return Promise.all([
2679
- (0, import_promises2.writeFile)(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2680
- (0, import_promises2.writeFile)(`${options.outdir}/${cssPath}`, css)
2672
+ fs2.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2673
+ fs2.writeFile(`${outdir}/${cssPath}`, css)
2681
2674
  ]);
2682
2675
  }
2683
2676
  })
@@ -2740,7 +2733,7 @@ async function generate(config, configPath) {
2740
2733
  const ctx = ctxRef.current;
2741
2734
  await build(ctx);
2742
2735
  const {
2743
- runtime: { fs: fs2, path: path3 },
2736
+ runtime: { fs: fs2, path: path2 },
2744
2737
  dependencies,
2745
2738
  config: { cwd }
2746
2739
  } = ctx;
@@ -2755,7 +2748,7 @@ async function generate(config, configPath) {
2755
2748
  contentWatcher.on("all", async (event, file) => {
2756
2749
  import_logger7.logger.info(`file:${event}`, file);
2757
2750
  (0, import_ts_pattern.match)(event).with("unlink", () => {
2758
- ctx.project.removeSourceFile(path3.abs(cwd, file));
2751
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2759
2752
  ctx.chunks.rm(file);
2760
2753
  }).with("change", async () => {
2761
2754
  ctx.project.reloadSourceFile(file);
@@ -2856,12 +2849,12 @@ async function setupPostcss(cwd) {
2856
2849
  // src/ship-files.ts
2857
2850
  init_cjs_shims();
2858
2851
  var import_logger9 = require("@pandacss/logger");
2859
- var import_parser3 = require("@pandacss/parser");
2860
- var import_promises3 = require("fs/promises");
2861
- 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"));
2862
2855
  async function shipFiles(ctx, outfile) {
2863
2856
  const files = ctx.getFiles();
2864
- const extractResult = (0, import_parser3.createParserResult)();
2857
+ const extractResult = (0, import_parser2.createParserResult)();
2865
2858
  const filesWithCss = [];
2866
2859
  files.forEach(async (file) => {
2867
2860
  const result = ctx.project.parseSourceFile(file);
@@ -2871,13 +2864,13 @@ async function shipFiles(ctx, outfile) {
2871
2864
  if (!css)
2872
2865
  return;
2873
2866
  extractResult.merge(result);
2874
- filesWithCss.push(path2.relative(ctx.config.cwd, file));
2867
+ filesWithCss.push(path.relative(ctx.config.cwd, file));
2875
2868
  });
2876
2869
  import_logger9.logger.info("cli", `Found ${import_logger9.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2877
2870
  const minify = ctx.config.minify;
2878
2871
  import_logger9.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger9.colors.bold(outfile)}`);
2879
2872
  const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
2880
- await (0, import_promises3.writeFile)(outfile, output);
2873
+ await (0, import_promises2.writeFile)(outfile, output);
2881
2874
  import_logger9.logger.info("cli", "Done!");
2882
2875
  }
2883
2876
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -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
  ),
@@ -2487,7 +2489,7 @@ var Builder = class {
2487
2489
  delete __require.cache[file];
2488
2490
  }
2489
2491
  if (setupCount > 0) {
2490
- logger4.info("postcss", "\u2699\uFE0F Config changed, reloading");
2492
+ logger4.info("builder", "\u2699\uFE0F Config changed, reloading");
2491
2493
  }
2492
2494
  return { isModified: true, modifiedMap: newModified };
2493
2495
  }
@@ -2498,8 +2500,9 @@ var Builder = class {
2498
2500
  }
2499
2501
  return configPath;
2500
2502
  }
2501
- async setup() {
2502
- const configPath = this.getConfigPath();
2503
+ async setup(options = {}) {
2504
+ logger4.info("builder", "\u{1F6A7} Setup");
2505
+ const configPath = options.configPath ?? this.getConfigPath();
2503
2506
  const configDeps = getConfigDependencies(configPath);
2504
2507
  const deps = this.checkConfigDeps(configPath, configDeps);
2505
2508
  if (deps.isModified) {
@@ -2613,17 +2616,18 @@ var Builder = class {
2613
2616
  // src/debug-files.ts
2614
2617
  init_esm_shims();
2615
2618
  import { colors, logger as logger5 } from "@pandacss/logger";
2616
- import { mkdir, writeFile as writeFile3 } from "fs/promises";
2617
- import * as path from "path";
2619
+ import * as nodePath from "path";
2618
2620
  async function debugFiles(ctx, options) {
2619
2621
  const files = ctx.getFiles();
2620
2622
  const measureTotal = logger5.time.debug(`Done parsing ${files.length} files`);
2621
2623
  ctx.config.minify = false;
2622
2624
  ctx.config.optimize = true;
2623
- if (!options.dry && options.outdir) {
2624
- await mkdir(options.outdir, { recursive: true });
2625
- logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/config.json`)}`);
2626
- 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));
2627
2631
  }
2628
2632
  const filesWithCss = [];
2629
2633
  await Promise.all(
@@ -2633,18 +2637,7 @@ async function debugFiles(ctx, options) {
2633
2637
  measure();
2634
2638
  if (!result)
2635
2639
  return;
2636
- const list = result.toArray().map((result2) => {
2637
- const node = result2.box.getNode();
2638
- const range = result2.box.getRange();
2639
- return {
2640
- name: result2.name,
2641
- type: result2.type,
2642
- data: result2.data,
2643
- kind: node.getKindName(),
2644
- line: range.startLineNumber,
2645
- column: range.startColumn
2646
- };
2647
- });
2640
+ const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
2648
2641
  const css = ctx.getParserCss(result);
2649
2642
  if (!css)
2650
2643
  return;
@@ -2652,17 +2645,17 @@ async function debugFiles(ctx, options) {
2652
2645
  console.log({ path: file, ast: list, code: css });
2653
2646
  return Promise.resolve();
2654
2647
  }
2655
- if (options.outdir) {
2648
+ if (outdir) {
2656
2649
  filesWithCss.push(file);
2657
- const parsedPath = path.parse(file);
2658
- const relative4 = path.relative(ctx.config.cwd, parsedPath.dir);
2659
- const astJsonPath = `${relative4}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2660
- const cssPath = `${relative4}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2661
- logger5.info("cli", `Writing ${colors.bold(`${options.outdir}/${astJsonPath}`)}`);
2662
- 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}`)}`);
2663
2656
  return Promise.all([
2664
- writeFile3(`${options.outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2665
- writeFile3(`${options.outdir}/${cssPath}`, css)
2657
+ fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
2658
+ fs.writeFile(`${outdir}/${cssPath}`, css)
2666
2659
  ]);
2667
2660
  }
2668
2661
  })
@@ -2725,7 +2718,7 @@ async function generate(config, configPath) {
2725
2718
  const ctx = ctxRef.current;
2726
2719
  await build(ctx);
2727
2720
  const {
2728
- runtime: { fs, path: path3 },
2721
+ runtime: { fs, path: path2 },
2729
2722
  dependencies,
2730
2723
  config: { cwd }
2731
2724
  } = ctx;
@@ -2740,7 +2733,7 @@ async function generate(config, configPath) {
2740
2733
  contentWatcher.on("all", async (event, file) => {
2741
2734
  logger7.info(`file:${event}`, file);
2742
2735
  match(event).with("unlink", () => {
2743
- ctx.project.removeSourceFile(path3.abs(cwd, file));
2736
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2744
2737
  ctx.chunks.rm(file);
2745
2738
  }).with("change", async () => {
2746
2739
  ctx.project.reloadSourceFile(file);
@@ -2783,7 +2776,7 @@ function setupGitIgnore({ config: { outdir, gitignore = true } }) {
2783
2776
  init_esm_shims();
2784
2777
  import { logger as logger8, quote } from "@pandacss/logger";
2785
2778
  import { messages } from "@pandacss/generator";
2786
- import { writeFile as writeFile4 } from "fs-extra";
2779
+ import { writeFile as writeFile3 } from "fs-extra";
2787
2780
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2788
2781
  import { outdent as outdent2 } from "outdent";
2789
2782
  import { join as join2 } from "path";
@@ -2822,7 +2815,7 @@ outExtension: '${outExtension}',` : ""}
2822
2815
  jsxFramework: '${jsxFramework}'` : ""}
2823
2816
  })
2824
2817
  `;
2825
- await writeFile4(join2(cwd, file), content);
2818
+ await writeFile3(join2(cwd, file), content);
2826
2819
  logger8.log(messages.thankYou());
2827
2820
  }
2828
2821
  }
@@ -2835,15 +2828,15 @@ async function setupPostcss(cwd) {
2835
2828
  },
2836
2829
  }
2837
2830
  `;
2838
- await writeFile4(join2(cwd, "postcss.config.cjs"), content);
2831
+ await writeFile3(join2(cwd, "postcss.config.cjs"), content);
2839
2832
  }
2840
2833
 
2841
2834
  // src/ship-files.ts
2842
2835
  init_esm_shims();
2843
2836
  import { colors as colors2, logger as logger9 } from "@pandacss/logger";
2844
2837
  import { createParserResult } from "@pandacss/parser";
2845
- import { writeFile as writeFile5 } from "fs/promises";
2846
- import * as path2 from "path";
2838
+ import { writeFile as writeFile4 } from "fs/promises";
2839
+ import * as path from "path";
2847
2840
  async function shipFiles(ctx, outfile) {
2848
2841
  const files = ctx.getFiles();
2849
2842
  const extractResult = createParserResult();
@@ -2856,13 +2849,13 @@ async function shipFiles(ctx, outfile) {
2856
2849
  if (!css)
2857
2850
  return;
2858
2851
  extractResult.merge(result);
2859
- filesWithCss.push(path2.relative(ctx.config.cwd, file));
2852
+ filesWithCss.push(path.relative(ctx.config.cwd, file));
2860
2853
  });
2861
2854
  logger9.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2862
2855
  const minify = ctx.config.minify;
2863
2856
  logger9.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
2864
2857
  const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
2865
- await writeFile5(outfile, output);
2858
+ await writeFile4(outfile, output);
2866
2859
  logger9.info("cli", "Done!");
2867
2860
  }
2868
2861
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20230601202405",
3
+ "version": "0.0.0-dev-20230602151911",
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-20230601202405",
36
- "@pandacss/core": "0.0.0-dev-20230601202405",
37
- "@pandacss/error": "0.0.0-dev-20230601202405",
38
- "@pandacss/extractor": "0.0.0-dev-20230601202405",
39
- "@pandacss/generator": "0.0.0-dev-20230601202405",
40
- "@pandacss/is-valid-prop": "0.0.0-dev-20230601202405",
41
- "@pandacss/logger": "0.0.0-dev-20230601202405",
42
- "@pandacss/parser": "0.0.0-dev-20230601202405",
43
- "@pandacss/shared": "0.0.0-dev-20230601202405",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20230601202405",
45
- "@pandacss/types": "0.0.0-dev-20230601202405"
35
+ "@pandacss/config": "0.0.0-dev-20230602151911",
36
+ "@pandacss/core": "0.0.0-dev-20230602151911",
37
+ "@pandacss/error": "0.0.0-dev-20230602151911",
38
+ "@pandacss/extractor": "0.0.0-dev-20230602151911",
39
+ "@pandacss/generator": "0.0.0-dev-20230602151911",
40
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230602151911",
41
+ "@pandacss/logger": "0.0.0-dev-20230602151911",
42
+ "@pandacss/parser": "0.0.0-dev-20230602151911",
43
+ "@pandacss/shared": "0.0.0-dev-20230602151911",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20230602151911",
45
+ "@pandacss/types": "0.0.0-dev-20230602151911"
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-20230601202405"
55
+ "@pandacss/fixture": "0.0.0-dev-20230602151911"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",