@pandacss/node 0.27.2 → 0.28.0

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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _pandacss_types from '@pandacss/types';
2
- import { LoadConfigResult, Artifact, Runtime, PandaHookable, ConfigResultWithHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
2
+ import { LoadConfigResult, Artifact, Runtime, PandaHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
3
3
  import { StyleEncoder, Stylesheet } from '@pandacss/core';
4
4
  import { Generator } from '@pandacss/generator';
5
5
  import * as _pandacss_parser from '@pandacss/parser';
@@ -25,7 +25,7 @@ declare class DiffEngine {
25
25
 
26
26
  interface OutputEngineOptions extends Generator {
27
27
  runtime: Runtime;
28
- hooks: PandaHookable;
28
+ hooks: Partial<PandaHooks>;
29
29
  }
30
30
  declare class OutputEngine {
31
31
  private paths;
@@ -42,7 +42,7 @@ declare class PandaContext extends Generator {
42
42
  project: Project;
43
43
  output: OutputEngine;
44
44
  diff: DiffEngine;
45
- constructor(conf: ConfigResultWithHooks);
45
+ constructor(conf: LoadConfigResult);
46
46
  getFiles: () => string[];
47
47
  parseFile: (filePath: string, styleEncoder?: StyleEncoder) => ParserResult | undefined;
48
48
  parseFiles: (styleEncoder?: StyleEncoder) => {
@@ -245,6 +245,8 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
245
245
  msg: string;
246
246
  }>;
247
247
 
248
+ declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
249
+
248
250
  declare function loadConfigAndCreateContext(options?: {
249
251
  cwd?: string;
250
252
  config?: Config;
@@ -278,4 +280,4 @@ type SetupOptions = Partial<Config> & {
278
280
  declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
279
281
  declare function setupPostcss(cwd: string): Promise<void>;
280
282
 
281
- export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
283
+ export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _pandacss_types from '@pandacss/types';
2
- import { LoadConfigResult, Artifact, Runtime, PandaHookable, ConfigResultWithHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
2
+ import { LoadConfigResult, Artifact, Runtime, PandaHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
3
3
  import { StyleEncoder, Stylesheet } from '@pandacss/core';
4
4
  import { Generator } from '@pandacss/generator';
5
5
  import * as _pandacss_parser from '@pandacss/parser';
@@ -25,7 +25,7 @@ declare class DiffEngine {
25
25
 
26
26
  interface OutputEngineOptions extends Generator {
27
27
  runtime: Runtime;
28
- hooks: PandaHookable;
28
+ hooks: Partial<PandaHooks>;
29
29
  }
30
30
  declare class OutputEngine {
31
31
  private paths;
@@ -42,7 +42,7 @@ declare class PandaContext extends Generator {
42
42
  project: Project;
43
43
  output: OutputEngine;
44
44
  diff: DiffEngine;
45
- constructor(conf: ConfigResultWithHooks);
45
+ constructor(conf: LoadConfigResult);
46
46
  getFiles: () => string[];
47
47
  parseFile: (filePath: string, styleEncoder?: StyleEncoder) => ParserResult | undefined;
48
48
  parseFiles: (styleEncoder?: StyleEncoder) => {
@@ -245,6 +245,8 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
245
245
  msg: string;
246
246
  }>;
247
247
 
248
+ declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
249
+
248
250
  declare function loadConfigAndCreateContext(options?: {
249
251
  cwd?: string;
250
252
  config?: Config;
@@ -278,4 +280,4 @@ type SetupOptions = Partial<Config> & {
278
280
  declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
279
281
  declare function setupPostcss(cwd: string): Promise<void>;
280
282
 
281
- export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
283
+ export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
package/dist/index.js CHANGED
@@ -416,6 +416,7 @@ __export(src_exports, {
416
416
  setupConfig: () => setupConfig,
417
417
  setupGitIgnore: () => setupGitIgnore,
418
418
  setupPostcss: () => setupPostcss,
419
+ startProfiling: () => startProfiling,
419
420
  writeAnalyzeJSON: () => writeAnalyzeJSON
420
421
  });
421
422
  module.exports = __toCommonJS(src_exports);
@@ -786,7 +787,7 @@ async function buildInfo(ctx, outfile) {
786
787
 
787
788
  // src/builder.ts
788
789
  init_cjs_shims();
789
- var import_config3 = require("@pandacss/config");
790
+ var import_config4 = require("@pandacss/config");
790
791
  var import_core = require("@pandacss/core");
791
792
  var import_error = require("@pandacss/error");
792
793
  var import_logger6 = require("@pandacss/logger");
@@ -2224,7 +2225,7 @@ async function codegen(ctx, ids) {
2224
2225
  ctx.output.empty();
2225
2226
  const promises = ctx.getArtifacts(ids).map((artifact) => limit(() => ctx.output.write(artifact)));
2226
2227
  await Promise.allSettled(promises);
2227
- void ctx.hooks.callHook("generator:done");
2228
+ await ctx.hooks["codegen:done"]?.({ changed: ids });
2228
2229
  return {
2229
2230
  box: createBox({
2230
2231
  content: ctx.messages.codegenComplete(),
@@ -2236,9 +2237,7 @@ async function codegen(ctx, ids) {
2236
2237
 
2237
2238
  // src/config.ts
2238
2239
  init_cjs_shims();
2239
- var import_config2 = require("@pandacss/config");
2240
- var import_hookable = require("hookable");
2241
- var import_tsconfck = require("tsconfck");
2240
+ var import_config3 = require("@pandacss/config");
2242
2241
  var import_browserslist = __toESM(require("browserslist"));
2243
2242
 
2244
2243
  // src/create-context.ts
@@ -2263,6 +2262,8 @@ var DiffEngine = class {
2263
2262
  */
2264
2263
  async reloadConfigAndRefreshContext(fn) {
2265
2264
  const conf = await (0, import_config.loadConfig)({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
2265
+ const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
2266
+ Object.assign(conf, { tsconfig, tsconfigFile, tsOptions });
2266
2267
  return this.refresh(conf, fn);
2267
2268
  }
2268
2269
  /**
@@ -2325,8 +2326,8 @@ var nodeRuntime = {
2325
2326
  readDirSync: import_fs_extra.default.readdirSync,
2326
2327
  rmDirSync: import_fs_extra.default.emptyDirSync,
2327
2328
  rmFileSync: import_fs_extra.default.removeSync,
2328
- ensureDirSync(path) {
2329
- return import_fs_extra.default.ensureDirSync(path);
2329
+ ensureDirSync(path2) {
2330
+ return import_fs_extra.default.ensureDirSync(path2);
2330
2331
  },
2331
2332
  watch(options) {
2332
2333
  const { include, exclude, cwd, poll } = options;
@@ -2504,11 +2505,39 @@ var PandaContext = class extends import_generator2.Generator {
2504
2505
  };
2505
2506
  };
2506
2507
 
2508
+ // src/load-tsconfig.ts
2509
+ init_cjs_shims();
2510
+ var import_config2 = require("@pandacss/config");
2511
+ var import_tsconfck = require("tsconfck");
2512
+ async function loadTsConfig(conf, cwd) {
2513
+ const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, {
2514
+ root: cwd,
2515
+ //@ts-ignore
2516
+ resolveWithEmptyIfConfigNotFound: true
2517
+ });
2518
+ if (!tsconfigResult)
2519
+ return;
2520
+ const { tsconfig, tsconfigFile } = tsconfigResult;
2521
+ const { compilerOptions } = tsconfig;
2522
+ const result = {
2523
+ tsconfig,
2524
+ tsconfigFile
2525
+ };
2526
+ if (compilerOptions?.paths) {
2527
+ const baseUrl = compilerOptions.baseUrl;
2528
+ result.tsOptions = {
2529
+ baseUrl,
2530
+ pathMappings: (0, import_config2.convertTsPathsToRegexes)(compilerOptions.paths, baseUrl ?? cwd)
2531
+ };
2532
+ }
2533
+ return result;
2534
+ }
2535
+
2507
2536
  // src/config.ts
2508
2537
  async function loadConfigAndCreateContext(options = {}) {
2509
2538
  const { config, configPath } = options;
2510
2539
  const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
2511
- const conf = await (0, import_config2.loadConfig)({ cwd, file: configPath });
2540
+ const conf = await (0, import_config3.loadConfig)({ cwd, file: configPath });
2512
2541
  if (config) {
2513
2542
  Object.assign(conf.config, config);
2514
2543
  }
@@ -2518,32 +2547,11 @@ async function loadConfigAndCreateContext(options = {}) {
2518
2547
  if (conf.config.lightningcss && !conf.config.browserslist) {
2519
2548
  conf.config.browserslist ||= import_browserslist.default.findConfig(cwd)?.defaults;
2520
2549
  }
2521
- const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, {
2522
- root: cwd,
2523
- // @ts-ignore
2524
- resolveWithEmptyIfConfigNotFound: true
2525
- });
2526
- if (tsconfigResult) {
2527
- conf.tsconfig = tsconfigResult.tsconfig;
2528
- conf.tsconfigFile = tsconfigResult.tsconfigFile;
2529
- const options2 = tsconfigResult.tsconfig?.compilerOptions;
2530
- if (options2?.paths) {
2531
- const baseUrl = options2.baseUrl;
2532
- conf.tsOptions = {
2533
- baseUrl,
2534
- pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2.paths, baseUrl ?? cwd)
2535
- };
2536
- }
2537
- }
2538
- const hooks = (0, import_hookable.createHooks)();
2539
- if (conf.config.hooks) {
2540
- hooks.addHooks(conf.config.hooks);
2550
+ const tsConfResult = await loadTsConfig(conf, cwd);
2551
+ if (tsConfResult) {
2552
+ Object.assign(conf, tsConfResult);
2541
2553
  }
2542
- await hooks.callHook("config:resolved", conf);
2543
- if (conf.config.logLevel === "debug") {
2544
- (0, import_hookable.createDebugger)(hooks, { tag: "panda" });
2545
- }
2546
- return new PandaContext({ ...conf, hooks });
2554
+ return new PandaContext(conf);
2547
2555
  }
2548
2556
 
2549
2557
  // src/parse-dependency.ts
@@ -2602,7 +2610,7 @@ var Builder = class {
2602
2610
  affecteds;
2603
2611
  configDependencies = /* @__PURE__ */ new Set();
2604
2612
  getConfigPath = (cwd) => {
2605
- const configPath = (0, import_config3.findConfig)({ cwd });
2613
+ const configPath = (0, import_config4.findConfig)({ cwd });
2606
2614
  if (!configPath) {
2607
2615
  throw new import_error.ConfigNotFoundError();
2608
2616
  }
@@ -2611,7 +2619,7 @@ var Builder = class {
2611
2619
  setConfigDependencies(options) {
2612
2620
  const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2613
2621
  const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2614
- const { deps: foundDeps } = (0, import_config3.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
2622
+ const { deps: foundDeps } = (0, import_config4.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
2615
2623
  const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2616
2624
  const configDeps = /* @__PURE__ */ new Set([
2617
2625
  ...foundDeps,
@@ -2630,12 +2638,12 @@ var Builder = class {
2630
2638
  }
2631
2639
  const ctx = this.getContextOrThrow();
2632
2640
  this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2633
- this.context = new PandaContext({ ...conf, hooks: ctx.hooks });
2641
+ this.context = new PandaContext(conf);
2634
2642
  });
2635
2643
  import_logger6.logger.debug("builder", this.affecteds);
2636
2644
  if (this.affecteds.hasConfigChanged) {
2637
2645
  import_logger6.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
2638
- await ctx.hooks.callHook("config:change", ctx.config);
2646
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: this.affecteds });
2639
2647
  return;
2640
2648
  }
2641
2649
  this.filesMeta = this.checkFilesChanged(ctx.getFiles());
@@ -2737,14 +2745,44 @@ var Builder = class {
2737
2745
  };
2738
2746
  };
2739
2747
 
2740
- // src/cssgen.ts
2748
+ // src/cpu-profile.ts
2741
2749
  init_cjs_shims();
2742
2750
  var import_logger7 = require("@pandacss/logger");
2751
+ var import_fs2 = __toESM(require("fs"));
2752
+ var import_path4 = __toESM(require("path"));
2753
+ var startProfiling = async (cwd, prefix) => {
2754
+ const v8Profiler = (await import("v8-profiler-next")).default;
2755
+ const date = /* @__PURE__ */ new Date();
2756
+ const timestamp = date.toISOString().replace(/[-:.]/g, "");
2757
+ const title = `panda-${prefix}-${timestamp}`;
2758
+ v8Profiler.setGenerateType(1);
2759
+ v8Profiler.startProfiling(title, true);
2760
+ const stopProfiling = () => {
2761
+ const profile = v8Profiler.stopProfiling(title);
2762
+ profile.export(function(error, result) {
2763
+ if (error) {
2764
+ console.error(error);
2765
+ return;
2766
+ }
2767
+ if (!result)
2768
+ return;
2769
+ const outfile = import_path4.default.join(cwd, `${title}.cpuprofile`);
2770
+ import_fs2.default.writeFileSync(outfile, result);
2771
+ import_logger7.logger.info("cpu-prof", outfile);
2772
+ profile.delete();
2773
+ });
2774
+ };
2775
+ return stopProfiling;
2776
+ };
2777
+
2778
+ // src/cssgen.ts
2779
+ init_cjs_shims();
2780
+ var import_logger8 = require("@pandacss/logger");
2743
2781
  var cssgen = async (ctx, options) => {
2744
2782
  const { outfile, type, minimal } = options;
2745
2783
  const sheet = ctx.createSheet();
2746
2784
  if (type) {
2747
- const done = import_logger7.logger.time.info(ctx.messages.cssArtifactComplete(type));
2785
+ const done = import_logger8.logger.time.info(ctx.messages.cssArtifactComplete(type));
2748
2786
  ctx.appendCssOfType(type, sheet);
2749
2787
  if (outfile) {
2750
2788
  const css = ctx.getCss(sheet);
@@ -2755,7 +2793,7 @@ var cssgen = async (ctx, options) => {
2755
2793
  done();
2756
2794
  } else {
2757
2795
  const { files } = ctx.parseFiles();
2758
- const done = import_logger7.logger.time.info(ctx.messages.buildComplete(files.length));
2796
+ const done = import_logger8.logger.time.info(ctx.messages.buildComplete(files.length));
2759
2797
  if (!minimal) {
2760
2798
  ctx.appendLayerParams(sheet);
2761
2799
  ctx.appendBaselineCss(sheet);
@@ -2773,19 +2811,19 @@ var cssgen = async (ctx, options) => {
2773
2811
 
2774
2812
  // src/debug.ts
2775
2813
  init_cjs_shims();
2776
- var import_logger8 = require("@pandacss/logger");
2777
- var import_path4 = require("path");
2814
+ var import_logger9 = require("@pandacss/logger");
2815
+ var import_path5 = require("path");
2778
2816
  async function debug(ctx, options) {
2779
2817
  const files = ctx.getFiles();
2780
- const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
2818
+ const measureTotal = import_logger9.logger.time.debug(`Done parsing ${files.length} files`);
2781
2819
  ctx.config.minify = false;
2782
2820
  ctx.config.optimize = true;
2783
- const { fs, path } = ctx.runtime;
2821
+ const { fs: fs2, path: path2 } = ctx.runtime;
2784
2822
  const outdir = options.outdir;
2785
2823
  if (!options.dry && outdir) {
2786
- fs.ensureDirSync(outdir);
2787
- import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/config.json`)}`);
2788
- await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2824
+ fs2.ensureDirSync(outdir);
2825
+ import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/config.json`)}`);
2826
+ await fs2.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2789
2827
  }
2790
2828
  if (options.onlyConfig) {
2791
2829
  measureTotal();
@@ -2793,14 +2831,14 @@ async function debug(ctx, options) {
2793
2831
  }
2794
2832
  const filesWithCss = [];
2795
2833
  files.map((file) => {
2796
- const measure = import_logger8.logger.time.debug(`Parsed ${file}`);
2834
+ const measure = import_logger9.logger.time.debug(`Parsed ${file}`);
2797
2835
  const encoder = ctx.encoder.clone();
2798
2836
  const result = ctx.project.parseSourceFile(file, encoder);
2799
2837
  measure();
2800
2838
  if (!result || result.isEmpty() || encoder.isEmpty())
2801
2839
  return;
2802
2840
  const styles4 = ctx.decoder.clone().collect(encoder);
2803
- const css = ctx.getParserCss(styles4, file);
2841
+ const css = ctx.getParserCss(styles4);
2804
2842
  if (!css)
2805
2843
  return;
2806
2844
  if (options.dry) {
@@ -2809,32 +2847,32 @@ async function debug(ctx, options) {
2809
2847
  }
2810
2848
  if (outdir) {
2811
2849
  filesWithCss.push(file);
2812
- const parsedPath = (0, import_path4.parse)(file);
2813
- const relative2 = path.relative(ctx.config.cwd, parsedPath.dir);
2814
- const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2815
- const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2816
- import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${astJsonPath}`)}`);
2817
- import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${cssPath}`)}`);
2850
+ const parsedPath = (0, import_path5.parse)(file);
2851
+ const relative2 = path2.relative(ctx.config.cwd, parsedPath.dir);
2852
+ const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
2853
+ const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
2854
+ import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${astJsonPath}`)}`);
2855
+ import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${cssPath}`)}`);
2818
2856
  return Promise.allSettled([
2819
- fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2820
- fs.writeFile(`${outdir}/${cssPath}`, css)
2857
+ fs2.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2858
+ fs2.writeFile(`${outdir}/${cssPath}`, css)
2821
2859
  ]);
2822
2860
  }
2823
2861
  });
2824
- import_logger8.logger.info("cli", `Found ${import_logger8.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2862
+ import_logger9.logger.info("cli", `Found ${import_logger9.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2825
2863
  measureTotal();
2826
2864
  }
2827
2865
 
2828
2866
  // src/generate.ts
2829
2867
  init_cjs_shims();
2830
- var import_logger9 = require("@pandacss/logger");
2868
+ var import_logger10 = require("@pandacss/logger");
2831
2869
  var import_ts_pattern = require("ts-pattern");
2832
2870
  async function build(ctx, artifactIds) {
2833
2871
  await codegen(ctx, artifactIds);
2834
2872
  if (ctx.config.emitTokensOnly) {
2835
- return import_logger9.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2873
+ return import_logger10.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2836
2874
  }
2837
- const done = import_logger9.logger.time.info("");
2875
+ const done = import_logger10.logger.time.info("");
2838
2876
  const sheet = ctx.createSheet();
2839
2877
  ctx.appendLayerParams(sheet);
2840
2878
  ctx.appendBaselineCss(sheet);
@@ -2847,24 +2885,24 @@ async function generate(config, configPath) {
2847
2885
  let ctx = await loadConfigAndCreateContext({ config, configPath });
2848
2886
  await build(ctx);
2849
2887
  const {
2850
- runtime: { fs, path },
2888
+ runtime: { fs: fs2, path: path2 },
2851
2889
  config: { cwd }
2852
2890
  } = ctx;
2853
2891
  if (ctx.config.watch) {
2854
- const configWatcher = fs.watch({ include: ctx.conf.dependencies });
2892
+ const configWatcher = fs2.watch({ include: ctx.conf.dependencies });
2855
2893
  configWatcher.on("change", async () => {
2856
2894
  const affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2857
- ctx = new PandaContext({ ...conf, hooks: ctx.hooks });
2895
+ ctx = new PandaContext(conf);
2858
2896
  });
2859
2897
  if (!affecteds.hasConfigChanged) {
2860
- import_logger9.logger.debug("builder", "Config didnt change, skipping rebuild");
2898
+ import_logger10.logger.debug("builder", "Config didnt change, skipping rebuild");
2861
2899
  return;
2862
2900
  }
2863
- import_logger9.logger.info("config:change", "Config changed, restarting...");
2864
- await ctx.hooks.callHook("config:change", ctx.config);
2901
+ import_logger10.logger.info("config:change", "Config changed, restarting...");
2902
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: affecteds });
2865
2903
  return build(ctx, Array.from(affecteds.artifacts));
2866
2904
  });
2867
- const contentWatcher = fs.watch(ctx.config);
2905
+ const contentWatcher = fs2.watch(ctx.config);
2868
2906
  const bundleStyles = async (ctx2, changedFilePath) => {
2869
2907
  const outfile = ctx2.runtime.path.join(...ctx2.paths.root, "styles.css");
2870
2908
  const parserResult = ctx2.project.parseSourceFile(changedFilePath);
@@ -2879,10 +2917,10 @@ async function generate(config, configPath) {
2879
2917
  }
2880
2918
  };
2881
2919
  contentWatcher.on("all", async (event, file) => {
2882
- import_logger9.logger.info(`file:${event}`, file);
2883
- const filePath = path.abs(cwd, file);
2920
+ import_logger10.logger.info(`file:${event}`, file);
2921
+ const filePath = path2.abs(cwd, file);
2884
2922
  (0, import_ts_pattern.match)(event).with("unlink", () => {
2885
- ctx.project.removeSourceFile(path.abs(cwd, file));
2923
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2886
2924
  }).with("change", async () => {
2887
2925
  ctx.project.reloadSourceFile(file);
2888
2926
  return bundleStyles(ctx, filePath);
@@ -2892,13 +2930,13 @@ async function generate(config, configPath) {
2892
2930
  }).otherwise(() => {
2893
2931
  });
2894
2932
  });
2895
- import_logger9.logger.info("ctx:watch", ctx.messages.watch());
2933
+ import_logger10.logger.info("ctx:watch", ctx.messages.watch());
2896
2934
  }
2897
2935
  }
2898
2936
 
2899
2937
  // src/git-ignore.ts
2900
2938
  init_cjs_shims();
2901
- var import_fs2 = require("fs");
2939
+ var import_fs3 = require("fs");
2902
2940
  var import_look_it_up = require("look-it-up");
2903
2941
  var import_outdent = __toESM(require("outdent"));
2904
2942
  function setupGitIgnore(ctx) {
@@ -2913,36 +2951,36 @@ function setupGitIgnore(ctx) {
2913
2951
  `;
2914
2952
  const file = (0, import_look_it_up.lookItUpSync)(".gitignore");
2915
2953
  if (!file) {
2916
- return (0, import_fs2.writeFileSync)(".gitignore", txt);
2954
+ return (0, import_fs3.writeFileSync)(".gitignore", txt);
2917
2955
  }
2918
- const content = (0, import_fs2.readFileSync)(file, "utf-8");
2956
+ const content = (0, import_fs3.readFileSync)(file, "utf-8");
2919
2957
  if (!content.includes(outdir)) {
2920
- (0, import_fs2.appendFileSync)(file, txt);
2958
+ (0, import_fs3.appendFileSync)(file, txt);
2921
2959
  }
2922
2960
  }
2923
2961
 
2924
2962
  // src/setup-config.ts
2925
2963
  init_cjs_shims();
2926
- var import_config6 = require("@pandacss/config");
2964
+ var import_config7 = require("@pandacss/config");
2927
2965
  var import_core2 = require("@pandacss/core");
2928
- var import_logger10 = require("@pandacss/logger");
2966
+ var import_logger11 = require("@pandacss/logger");
2929
2967
  var import_fs_extra2 = __toESM(require("fs-extra"));
2930
2968
  var import_look_it_up2 = require("look-it-up");
2931
2969
  var import_outdent2 = require("outdent");
2932
- var import_path5 = require("path");
2970
+ var import_path6 = require("path");
2933
2971
  var import_preferred_pm = __toESM(require("preferred-pm"));
2934
2972
  var import_prettier = __toESM(require("prettier"));
2935
2973
  async function setupConfig(cwd, opts = {}) {
2936
2974
  const { force, outExtension, jsxFramework, syntax } = opts;
2937
- const configFile = (0, import_config6.findConfig)({ cwd });
2975
+ const configFile = (0, import_config7.findConfig)({ cwd });
2938
2976
  const pmResult = await (0, import_preferred_pm.default)(cwd);
2939
2977
  const pm = pmResult?.name ?? "npm";
2940
2978
  const cmd = pm === "npm" ? "npm run" : pm;
2941
2979
  const isTs = (0, import_look_it_up2.lookItUpSync)("tsconfig.json", cwd);
2942
2980
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2943
- import_logger10.logger.info("init:config", `creating panda config file: ${(0, import_logger10.quote)(file)}`);
2981
+ import_logger11.logger.info("init:config", `creating panda config file: ${(0, import_logger11.quote)(file)}`);
2944
2982
  if (!force && configFile) {
2945
- import_logger10.logger.warn("init:config", import_core2.messages.configExists(cmd));
2983
+ import_logger11.logger.warn("init:config", import_core2.messages.configExists(cmd));
2946
2984
  } else {
2947
2985
  const content = import_outdent2.outdent`
2948
2986
  import { defineConfig } from "@pandacss/dev"
@@ -2974,12 +3012,12 @@ jsxFramework: '${jsxFramework}',` : ""}
2974
3012
  syntax: '${syntax}'` : ""}
2975
3013
  })
2976
3014
  `;
2977
- await import_fs_extra2.default.writeFile((0, import_path5.join)(cwd, file), import_prettier.default.format(content));
2978
- import_logger10.logger.log(import_core2.messages.thankYou());
3015
+ await import_fs_extra2.default.writeFile((0, import_path6.join)(cwd, file), import_prettier.default.format(content, { parser: "babel" }));
3016
+ import_logger11.logger.log(import_core2.messages.thankYou());
2979
3017
  }
2980
3018
  }
2981
3019
  async function setupPostcss(cwd) {
2982
- import_logger10.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger10.quote)("postcss.config.cjs")}`);
3020
+ import_logger11.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger11.quote)("postcss.config.cjs")}`);
2983
3021
  const content = import_outdent2.outdent`
2984
3022
  module.exports = {
2985
3023
  plugins: {
@@ -2987,7 +3025,7 @@ module.exports = {
2987
3025
  },
2988
3026
  }
2989
3027
  `;
2990
- await import_fs_extra2.default.writeFile((0, import_path5.join)(cwd, "postcss.config.cjs"), content);
3028
+ await import_fs_extra2.default.writeFile((0, import_path6.join)(cwd, "postcss.config.cjs"), content);
2991
3029
  }
2992
3030
  // Annotate the CommonJS export names for ESM import in node:
2993
3031
  0 && (module.exports = {
@@ -3004,5 +3042,6 @@ module.exports = {
3004
3042
  setupConfig,
3005
3043
  setupGitIgnore,
3006
3044
  setupPostcss,
3045
+ startProfiling,
3007
3046
  writeAnalyzeJSON
3008
3047
  });
package/dist/index.mjs CHANGED
@@ -2200,7 +2200,7 @@ async function codegen(ctx, ids) {
2200
2200
  ctx.output.empty();
2201
2201
  const promises = ctx.getArtifacts(ids).map((artifact) => limit(() => ctx.output.write(artifact)));
2202
2202
  await Promise.allSettled(promises);
2203
- void ctx.hooks.callHook("generator:done");
2203
+ await ctx.hooks["codegen:done"]?.({ changed: ids });
2204
2204
  return {
2205
2205
  box: createBox({
2206
2206
  content: ctx.messages.codegenComplete(),
@@ -2212,9 +2212,7 @@ async function codegen(ctx, ids) {
2212
2212
 
2213
2213
  // src/config.ts
2214
2214
  init_esm_shims();
2215
- import { convertTsPathsToRegexes, loadConfig as loadConfig2 } from "@pandacss/config";
2216
- import { createDebugger, createHooks } from "hookable";
2217
- import { parse } from "tsconfck";
2215
+ import { loadConfig as loadConfig2 } from "@pandacss/config";
2218
2216
  import browserslist from "browserslist";
2219
2217
 
2220
2218
  // src/create-context.ts
@@ -2239,6 +2237,8 @@ var DiffEngine = class {
2239
2237
  */
2240
2238
  async reloadConfigAndRefreshContext(fn) {
2241
2239
  const conf = await loadConfig({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
2240
+ const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
2241
+ Object.assign(conf, { tsconfig, tsconfigFile, tsOptions });
2242
2242
  return this.refresh(conf, fn);
2243
2243
  }
2244
2244
  /**
@@ -2301,8 +2301,8 @@ var nodeRuntime = {
2301
2301
  readDirSync: fsExtra.readdirSync,
2302
2302
  rmDirSync: fsExtra.emptyDirSync,
2303
2303
  rmFileSync: fsExtra.removeSync,
2304
- ensureDirSync(path) {
2305
- return fsExtra.ensureDirSync(path);
2304
+ ensureDirSync(path2) {
2305
+ return fsExtra.ensureDirSync(path2);
2306
2306
  },
2307
2307
  watch(options) {
2308
2308
  const { include, exclude, cwd, poll } = options;
@@ -2480,6 +2480,34 @@ var PandaContext = class extends Generator2 {
2480
2480
  };
2481
2481
  };
2482
2482
 
2483
+ // src/load-tsconfig.ts
2484
+ init_esm_shims();
2485
+ import { convertTsPathsToRegexes } from "@pandacss/config";
2486
+ import { parse } from "tsconfck";
2487
+ async function loadTsConfig(conf, cwd) {
2488
+ const tsconfigResult = await parse(conf.path, {
2489
+ root: cwd,
2490
+ //@ts-ignore
2491
+ resolveWithEmptyIfConfigNotFound: true
2492
+ });
2493
+ if (!tsconfigResult)
2494
+ return;
2495
+ const { tsconfig, tsconfigFile } = tsconfigResult;
2496
+ const { compilerOptions } = tsconfig;
2497
+ const result = {
2498
+ tsconfig,
2499
+ tsconfigFile
2500
+ };
2501
+ if (compilerOptions?.paths) {
2502
+ const baseUrl = compilerOptions.baseUrl;
2503
+ result.tsOptions = {
2504
+ baseUrl,
2505
+ pathMappings: convertTsPathsToRegexes(compilerOptions.paths, baseUrl ?? cwd)
2506
+ };
2507
+ }
2508
+ return result;
2509
+ }
2510
+
2483
2511
  // src/config.ts
2484
2512
  async function loadConfigAndCreateContext(options = {}) {
2485
2513
  const { config, configPath } = options;
@@ -2494,32 +2522,11 @@ async function loadConfigAndCreateContext(options = {}) {
2494
2522
  if (conf.config.lightningcss && !conf.config.browserslist) {
2495
2523
  conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
2496
2524
  }
2497
- const tsconfigResult = await parse(conf.path, {
2498
- root: cwd,
2499
- // @ts-ignore
2500
- resolveWithEmptyIfConfigNotFound: true
2501
- });
2502
- if (tsconfigResult) {
2503
- conf.tsconfig = tsconfigResult.tsconfig;
2504
- conf.tsconfigFile = tsconfigResult.tsconfigFile;
2505
- const options2 = tsconfigResult.tsconfig?.compilerOptions;
2506
- if (options2?.paths) {
2507
- const baseUrl = options2.baseUrl;
2508
- conf.tsOptions = {
2509
- baseUrl,
2510
- pathMappings: convertTsPathsToRegexes(options2.paths, baseUrl ?? cwd)
2511
- };
2512
- }
2513
- }
2514
- const hooks = createHooks();
2515
- if (conf.config.hooks) {
2516
- hooks.addHooks(conf.config.hooks);
2517
- }
2518
- await hooks.callHook("config:resolved", conf);
2519
- if (conf.config.logLevel === "debug") {
2520
- createDebugger(hooks, { tag: "panda" });
2525
+ const tsConfResult = await loadTsConfig(conf, cwd);
2526
+ if (tsConfResult) {
2527
+ Object.assign(conf, tsConfResult);
2521
2528
  }
2522
- return new PandaContext({ ...conf, hooks });
2529
+ return new PandaContext(conf);
2523
2530
  }
2524
2531
 
2525
2532
  // src/parse-dependency.ts
@@ -2606,12 +2613,12 @@ var Builder = class {
2606
2613
  }
2607
2614
  const ctx = this.getContextOrThrow();
2608
2615
  this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2609
- this.context = new PandaContext({ ...conf, hooks: ctx.hooks });
2616
+ this.context = new PandaContext(conf);
2610
2617
  });
2611
2618
  logger6.debug("builder", this.affecteds);
2612
2619
  if (this.affecteds.hasConfigChanged) {
2613
2620
  logger6.debug("builder", "\u2699\uFE0F Config changed, reloading");
2614
- await ctx.hooks.callHook("config:change", ctx.config);
2621
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: this.affecteds });
2615
2622
  return;
2616
2623
  }
2617
2624
  this.filesMeta = this.checkFilesChanged(ctx.getFiles());
@@ -2713,14 +2720,44 @@ var Builder = class {
2713
2720
  };
2714
2721
  };
2715
2722
 
2716
- // src/cssgen.ts
2723
+ // src/cpu-profile.ts
2717
2724
  init_esm_shims();
2718
2725
  import { logger as logger7 } from "@pandacss/logger";
2726
+ import fs from "fs";
2727
+ import path from "path";
2728
+ var startProfiling = async (cwd, prefix) => {
2729
+ const v8Profiler = (await import("v8-profiler-next")).default;
2730
+ const date = /* @__PURE__ */ new Date();
2731
+ const timestamp = date.toISOString().replace(/[-:.]/g, "");
2732
+ const title = `panda-${prefix}-${timestamp}`;
2733
+ v8Profiler.setGenerateType(1);
2734
+ v8Profiler.startProfiling(title, true);
2735
+ const stopProfiling = () => {
2736
+ const profile = v8Profiler.stopProfiling(title);
2737
+ profile.export(function(error, result) {
2738
+ if (error) {
2739
+ console.error(error);
2740
+ return;
2741
+ }
2742
+ if (!result)
2743
+ return;
2744
+ const outfile = path.join(cwd, `${title}.cpuprofile`);
2745
+ fs.writeFileSync(outfile, result);
2746
+ logger7.info("cpu-prof", outfile);
2747
+ profile.delete();
2748
+ });
2749
+ };
2750
+ return stopProfiling;
2751
+ };
2752
+
2753
+ // src/cssgen.ts
2754
+ init_esm_shims();
2755
+ import { logger as logger8 } from "@pandacss/logger";
2719
2756
  var cssgen = async (ctx, options) => {
2720
2757
  const { outfile, type, minimal } = options;
2721
2758
  const sheet = ctx.createSheet();
2722
2759
  if (type) {
2723
- const done = logger7.time.info(ctx.messages.cssArtifactComplete(type));
2760
+ const done = logger8.time.info(ctx.messages.cssArtifactComplete(type));
2724
2761
  ctx.appendCssOfType(type, sheet);
2725
2762
  if (outfile) {
2726
2763
  const css = ctx.getCss(sheet);
@@ -2731,7 +2768,7 @@ var cssgen = async (ctx, options) => {
2731
2768
  done();
2732
2769
  } else {
2733
2770
  const { files } = ctx.parseFiles();
2734
- const done = logger7.time.info(ctx.messages.buildComplete(files.length));
2771
+ const done = logger8.time.info(ctx.messages.buildComplete(files.length));
2735
2772
  if (!minimal) {
2736
2773
  ctx.appendLayerParams(sheet);
2737
2774
  ctx.appendBaselineCss(sheet);
@@ -2749,19 +2786,19 @@ var cssgen = async (ctx, options) => {
2749
2786
 
2750
2787
  // src/debug.ts
2751
2788
  init_esm_shims();
2752
- import { colors as colors2, logger as logger8 } from "@pandacss/logger";
2789
+ import { colors as colors2, logger as logger9 } from "@pandacss/logger";
2753
2790
  import { parse as parse2 } from "path";
2754
2791
  async function debug(ctx, options) {
2755
2792
  const files = ctx.getFiles();
2756
- const measureTotal = logger8.time.debug(`Done parsing ${files.length} files`);
2793
+ const measureTotal = logger9.time.debug(`Done parsing ${files.length} files`);
2757
2794
  ctx.config.minify = false;
2758
2795
  ctx.config.optimize = true;
2759
- const { fs, path } = ctx.runtime;
2796
+ const { fs: fs2, path: path2 } = ctx.runtime;
2760
2797
  const outdir = options.outdir;
2761
2798
  if (!options.dry && outdir) {
2762
- fs.ensureDirSync(outdir);
2763
- logger8.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
2764
- await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2799
+ fs2.ensureDirSync(outdir);
2800
+ logger9.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
2801
+ await fs2.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2765
2802
  }
2766
2803
  if (options.onlyConfig) {
2767
2804
  measureTotal();
@@ -2769,14 +2806,14 @@ async function debug(ctx, options) {
2769
2806
  }
2770
2807
  const filesWithCss = [];
2771
2808
  files.map((file) => {
2772
- const measure = logger8.time.debug(`Parsed ${file}`);
2809
+ const measure = logger9.time.debug(`Parsed ${file}`);
2773
2810
  const encoder = ctx.encoder.clone();
2774
2811
  const result = ctx.project.parseSourceFile(file, encoder);
2775
2812
  measure();
2776
2813
  if (!result || result.isEmpty() || encoder.isEmpty())
2777
2814
  return;
2778
2815
  const styles4 = ctx.decoder.clone().collect(encoder);
2779
- const css = ctx.getParserCss(styles4, file);
2816
+ const css = ctx.getParserCss(styles4);
2780
2817
  if (!css)
2781
2818
  return;
2782
2819
  if (options.dry) {
@@ -2786,31 +2823,31 @@ async function debug(ctx, options) {
2786
2823
  if (outdir) {
2787
2824
  filesWithCss.push(file);
2788
2825
  const parsedPath = parse2(file);
2789
- const relative2 = path.relative(ctx.config.cwd, parsedPath.dir);
2790
- const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2791
- const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
2792
- logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
2793
- logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
2826
+ const relative2 = path2.relative(ctx.config.cwd, parsedPath.dir);
2827
+ const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
2828
+ const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
2829
+ logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
2830
+ logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
2794
2831
  return Promise.allSettled([
2795
- fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2796
- fs.writeFile(`${outdir}/${cssPath}`, css)
2832
+ fs2.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2833
+ fs2.writeFile(`${outdir}/${cssPath}`, css)
2797
2834
  ]);
2798
2835
  }
2799
2836
  });
2800
- logger8.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2837
+ logger9.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
2801
2838
  measureTotal();
2802
2839
  }
2803
2840
 
2804
2841
  // src/generate.ts
2805
2842
  init_esm_shims();
2806
- import { logger as logger9 } from "@pandacss/logger";
2843
+ import { logger as logger10 } from "@pandacss/logger";
2807
2844
  import { match } from "ts-pattern";
2808
2845
  async function build(ctx, artifactIds) {
2809
2846
  await codegen(ctx, artifactIds);
2810
2847
  if (ctx.config.emitTokensOnly) {
2811
- return logger9.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2848
+ return logger10.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2812
2849
  }
2813
- const done = logger9.time.info("");
2850
+ const done = logger10.time.info("");
2814
2851
  const sheet = ctx.createSheet();
2815
2852
  ctx.appendLayerParams(sheet);
2816
2853
  ctx.appendBaselineCss(sheet);
@@ -2823,24 +2860,24 @@ async function generate(config, configPath) {
2823
2860
  let ctx = await loadConfigAndCreateContext({ config, configPath });
2824
2861
  await build(ctx);
2825
2862
  const {
2826
- runtime: { fs, path },
2863
+ runtime: { fs: fs2, path: path2 },
2827
2864
  config: { cwd }
2828
2865
  } = ctx;
2829
2866
  if (ctx.config.watch) {
2830
- const configWatcher = fs.watch({ include: ctx.conf.dependencies });
2867
+ const configWatcher = fs2.watch({ include: ctx.conf.dependencies });
2831
2868
  configWatcher.on("change", async () => {
2832
2869
  const affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
2833
- ctx = new PandaContext({ ...conf, hooks: ctx.hooks });
2870
+ ctx = new PandaContext(conf);
2834
2871
  });
2835
2872
  if (!affecteds.hasConfigChanged) {
2836
- logger9.debug("builder", "Config didnt change, skipping rebuild");
2873
+ logger10.debug("builder", "Config didnt change, skipping rebuild");
2837
2874
  return;
2838
2875
  }
2839
- logger9.info("config:change", "Config changed, restarting...");
2840
- await ctx.hooks.callHook("config:change", ctx.config);
2876
+ logger10.info("config:change", "Config changed, restarting...");
2877
+ await ctx.hooks["config:change"]?.({ config: ctx.config, changes: affecteds });
2841
2878
  return build(ctx, Array.from(affecteds.artifacts));
2842
2879
  });
2843
- const contentWatcher = fs.watch(ctx.config);
2880
+ const contentWatcher = fs2.watch(ctx.config);
2844
2881
  const bundleStyles = async (ctx2, changedFilePath) => {
2845
2882
  const outfile = ctx2.runtime.path.join(...ctx2.paths.root, "styles.css");
2846
2883
  const parserResult = ctx2.project.parseSourceFile(changedFilePath);
@@ -2855,10 +2892,10 @@ async function generate(config, configPath) {
2855
2892
  }
2856
2893
  };
2857
2894
  contentWatcher.on("all", async (event, file) => {
2858
- logger9.info(`file:${event}`, file);
2859
- const filePath = path.abs(cwd, file);
2895
+ logger10.info(`file:${event}`, file);
2896
+ const filePath = path2.abs(cwd, file);
2860
2897
  match(event).with("unlink", () => {
2861
- ctx.project.removeSourceFile(path.abs(cwd, file));
2898
+ ctx.project.removeSourceFile(path2.abs(cwd, file));
2862
2899
  }).with("change", async () => {
2863
2900
  ctx.project.reloadSourceFile(file);
2864
2901
  return bundleStyles(ctx, filePath);
@@ -2868,7 +2905,7 @@ async function generate(config, configPath) {
2868
2905
  }).otherwise(() => {
2869
2906
  });
2870
2907
  });
2871
- logger9.info("ctx:watch", ctx.messages.watch());
2908
+ logger10.info("ctx:watch", ctx.messages.watch());
2872
2909
  }
2873
2910
  }
2874
2911
 
@@ -2901,7 +2938,7 @@ function setupGitIgnore(ctx) {
2901
2938
  init_esm_shims();
2902
2939
  import { findConfig as findConfig2 } from "@pandacss/config";
2903
2940
  import { messages } from "@pandacss/core";
2904
- import { logger as logger10, quote } from "@pandacss/logger";
2941
+ import { logger as logger11, quote } from "@pandacss/logger";
2905
2942
  import fsExtra2 from "fs-extra";
2906
2943
  import { lookItUpSync as lookItUpSync2 } from "look-it-up";
2907
2944
  import { outdent as outdent2 } from "outdent";
@@ -2916,9 +2953,9 @@ async function setupConfig(cwd, opts = {}) {
2916
2953
  const cmd = pm === "npm" ? "npm run" : pm;
2917
2954
  const isTs = lookItUpSync2("tsconfig.json", cwd);
2918
2955
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2919
- logger10.info("init:config", `creating panda config file: ${quote(file)}`);
2956
+ logger11.info("init:config", `creating panda config file: ${quote(file)}`);
2920
2957
  if (!force && configFile) {
2921
- logger10.warn("init:config", messages.configExists(cmd));
2958
+ logger11.warn("init:config", messages.configExists(cmd));
2922
2959
  } else {
2923
2960
  const content = outdent2`
2924
2961
  import { defineConfig } from "@pandacss/dev"
@@ -2950,12 +2987,12 @@ jsxFramework: '${jsxFramework}',` : ""}
2950
2987
  syntax: '${syntax}'` : ""}
2951
2988
  })
2952
2989
  `;
2953
- await fsExtra2.writeFile(join2(cwd, file), prettier.format(content));
2954
- logger10.log(messages.thankYou());
2990
+ await fsExtra2.writeFile(join2(cwd, file), prettier.format(content, { parser: "babel" }));
2991
+ logger11.log(messages.thankYou());
2955
2992
  }
2956
2993
  }
2957
2994
  async function setupPostcss(cwd) {
2958
- logger10.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
2995
+ logger11.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
2959
2996
  const content = outdent2`
2960
2997
  module.exports = {
2961
2998
  plugins: {
@@ -2979,5 +3016,6 @@ export {
2979
3016
  setupConfig,
2980
3017
  setupGitIgnore,
2981
3018
  setupPostcss,
3019
+ startProfiling,
2982
3020
  writeAnalyzeJSON
2983
3021
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.27.2",
3
+ "version": "0.28.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -39,7 +39,6 @@
39
39
  "filesize": "^10.0.8",
40
40
  "fs-extra": "11.1.1",
41
41
  "glob-parent": "^6.0.2",
42
- "hookable": "5.5.3",
43
42
  "is-glob": "^4.0.3",
44
43
  "lodash.merge": "4.6.2",
45
44
  "look-it-up": "2.1.0",
@@ -53,16 +52,17 @@
53
52
  "ts-morph": "19.0.0",
54
53
  "ts-pattern": "5.0.5",
55
54
  "tsconfck": "^2.1.2",
56
- "@pandacss/config": "0.27.2",
57
- "@pandacss/core": "0.27.2",
58
- "@pandacss/error": "0.27.2",
59
- "@pandacss/extractor": "0.27.2",
60
- "@pandacss/generator": "0.27.2",
61
- "@pandacss/logger": "0.27.2",
62
- "@pandacss/parser": "0.27.2",
63
- "@pandacss/shared": "0.27.2",
64
- "@pandacss/token-dictionary": "0.27.2",
65
- "@pandacss/types": "0.27.2"
55
+ "v8-profiler-next": "^1.10.0",
56
+ "@pandacss/config": "0.28.0",
57
+ "@pandacss/core": "0.28.0",
58
+ "@pandacss/error": "0.28.0",
59
+ "@pandacss/extractor": "0.28.0",
60
+ "@pandacss/generator": "0.28.0",
61
+ "@pandacss/logger": "0.28.0",
62
+ "@pandacss/parser": "0.28.0",
63
+ "@pandacss/shared": "0.28.0",
64
+ "@pandacss/token-dictionary": "0.28.0",
65
+ "@pandacss/types": "0.28.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/fs-extra": "11.0.4",