@pandacss/node 0.24.2 → 0.26.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
@@ -207,16 +207,15 @@ declare class Builder {
207
207
  private hasEmitted;
208
208
  private filesMeta;
209
209
  private affecteds;
210
+ private configDependencies;
210
211
  getConfigPath: (cwd?: string) => string;
212
+ setConfigDependencies(options: SetupContextOptions): void;
211
213
  setup: (options?: {
212
214
  configPath?: string;
213
215
  cwd?: string;
214
216
  }) => Promise<PandaContext | undefined>;
215
217
  emit(): Promise<void>;
216
- setupContext: (options: {
217
- configPath: string;
218
- cwd?: string;
219
- }) => Promise<PandaContext>;
218
+ setupContext: (options: SetupContextOptions) => Promise<PandaContext>;
220
219
  getContextOrThrow: () => PandaContext;
221
220
  getFileMeta: (file: string) => {
222
221
  mtime: number;
@@ -229,7 +228,6 @@ declare class Builder {
229
228
  extractFile: (ctx: PandaContext, file: string) => _pandacss_parser.ParserResult | undefined;
230
229
  extract: () => void;
231
230
  isValidRoot: (root: Root) => boolean;
232
- private initialRoot;
233
231
  write: (root: Root) => void;
234
232
  registerDependency: (fn: (dep: Message) => void) => void;
235
233
  }
@@ -237,6 +235,10 @@ interface FileMeta {
237
235
  mtime: number;
238
236
  isUnchanged: boolean;
239
237
  }
238
+ interface SetupContextOptions {
239
+ configPath: string;
240
+ cwd?: string;
241
+ }
240
242
 
241
243
  declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
242
244
  box: string;
package/dist/index.d.ts CHANGED
@@ -207,16 +207,15 @@ declare class Builder {
207
207
  private hasEmitted;
208
208
  private filesMeta;
209
209
  private affecteds;
210
+ private configDependencies;
210
211
  getConfigPath: (cwd?: string) => string;
212
+ setConfigDependencies(options: SetupContextOptions): void;
211
213
  setup: (options?: {
212
214
  configPath?: string;
213
215
  cwd?: string;
214
216
  }) => Promise<PandaContext | undefined>;
215
217
  emit(): Promise<void>;
216
- setupContext: (options: {
217
- configPath: string;
218
- cwd?: string;
219
- }) => Promise<PandaContext>;
218
+ setupContext: (options: SetupContextOptions) => Promise<PandaContext>;
220
219
  getContextOrThrow: () => PandaContext;
221
220
  getFileMeta: (file: string) => {
222
221
  mtime: number;
@@ -229,7 +228,6 @@ declare class Builder {
229
228
  extractFile: (ctx: PandaContext, file: string) => _pandacss_parser.ParserResult | undefined;
230
229
  extract: () => void;
231
230
  isValidRoot: (root: Root) => boolean;
232
- private initialRoot;
233
231
  write: (root: Root) => void;
234
232
  registerDependency: (fn: (dep: Message) => void) => void;
235
233
  }
@@ -237,6 +235,10 @@ interface FileMeta {
237
235
  mtime: number;
238
236
  isUnchanged: boolean;
239
237
  }
238
+ interface SetupContextOptions {
239
+ configPath: string;
240
+ cwd?: string;
241
+ }
240
242
 
241
243
  declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
242
244
  box: string;
package/dist/index.js CHANGED
@@ -864,18 +864,18 @@ function pLimit(concurrency) {
864
864
  queue.dequeue()();
865
865
  }
866
866
  };
867
- const run = async (fn, resolve3, args) => {
867
+ const run = async (fn, resolve4, args) => {
868
868
  activeCount++;
869
869
  const result = (async () => fn(...args))();
870
- resolve3(result);
870
+ resolve4(result);
871
871
  try {
872
872
  await result;
873
873
  } catch {
874
874
  }
875
875
  next();
876
876
  };
877
- const enqueue = (fn, resolve3, args) => {
878
- queue.enqueue(run.bind(void 0, fn, resolve3, args));
877
+ const enqueue = (fn, resolve4, args) => {
878
+ queue.enqueue(run.bind(void 0, fn, resolve4, args));
879
879
  (async () => {
880
880
  await Promise.resolve();
881
881
  if (activeCount < concurrency && queue.size > 0) {
@@ -883,8 +883,8 @@ function pLimit(concurrency) {
883
883
  }
884
884
  })();
885
885
  };
886
- const generator = (fn, ...args) => new Promise((resolve3) => {
887
- enqueue(fn, resolve3, args);
886
+ const generator = (fn, ...args) => new Promise((resolve4) => {
887
+ enqueue(fn, resolve4, args);
888
888
  });
889
889
  Object.defineProperties(generator, {
890
890
  activeCount: {
@@ -2529,7 +2529,6 @@ async function loadConfigAndCreateContext(options = {}) {
2529
2529
  };
2530
2530
  }
2531
2531
  }
2532
- conf.config.outdir ??= "styled-system";
2533
2532
  const hooks = (0, import_hookable.createHooks)();
2534
2533
  if (conf.config.hooks) {
2535
2534
  hooks.addHooks(conf.config.hooks);
@@ -2580,12 +2579,13 @@ function parseDependency(fileOrGlob) {
2580
2579
  message = { type: "dependency", file: (0, import_pathe2.resolve)(fileOrGlob) };
2581
2580
  }
2582
2581
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2583
- message = { type: "dependency", file: message.dir };
2582
+ message = { type: "dependency", file: (0, import_pathe2.resolve)(message.dir) };
2584
2583
  }
2585
2584
  return message;
2586
2585
  }
2587
2586
 
2588
2587
  // src/builder.ts
2588
+ var import_pathe3 = require("pathe");
2589
2589
  var fileModifiedMap = /* @__PURE__ */ new Map();
2590
2590
  var Builder = class {
2591
2591
  /**
@@ -2595,6 +2595,7 @@ var Builder = class {
2595
2595
  hasEmitted = false;
2596
2596
  filesMeta;
2597
2597
  affecteds;
2598
+ configDependencies = /* @__PURE__ */ new Set();
2598
2599
  getConfigPath = (cwd) => {
2599
2600
  const configPath = (0, import_config3.findConfig)({ cwd });
2600
2601
  if (!configPath) {
@@ -2602,9 +2603,23 @@ var Builder = class {
2602
2603
  }
2603
2604
  return configPath;
2604
2605
  };
2606
+ setConfigDependencies(options) {
2607
+ const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2608
+ const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2609
+ const { deps: foundDeps } = (0, import_config3.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
2610
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2611
+ const configDeps = /* @__PURE__ */ new Set([
2612
+ ...foundDeps,
2613
+ ...(this.context?.conf.dependencies ?? []).map((file) => (0, import_pathe3.resolve)(cwd, file))
2614
+ ]);
2615
+ this.configDependencies = configDeps;
2616
+ import_logger6.logger.debug("builder", "Config dependencies");
2617
+ import_logger6.logger.debug("builder", configDeps);
2618
+ }
2605
2619
  setup = async (options = {}) => {
2606
2620
  import_logger6.logger.debug("builder", "\u{1F6A7} Setup");
2607
2621
  const configPath = options.configPath ?? this.getConfigPath(options.cwd);
2622
+ this.setConfigDependencies({ configPath, cwd: options.cwd });
2608
2623
  if (!this.context) {
2609
2624
  return this.setupContext({ configPath, cwd: options.cwd });
2610
2625
  }
@@ -2691,23 +2706,13 @@ var Builder = class {
2691
2706
  });
2692
2707
  return valid;
2693
2708
  };
2694
- initialRoot;
2695
2709
  write = (root) => {
2696
- if (!this.initialRoot) {
2697
- this.initialRoot = root.toString();
2698
- }
2699
- root.removeAll();
2700
2710
  const ctx = this.getContextOrThrow();
2701
2711
  const sheet = ctx.createSheet();
2702
2712
  ctx.appendBaselineCss(sheet);
2703
2713
  ctx.appendParserCss(sheet);
2704
2714
  const css = ctx.getCss(sheet);
2705
- root.append(
2706
- (0, import_core.optimizeCss)(`
2707
- ${this.initialRoot}
2708
- ${css}
2709
- `)
2710
- );
2715
+ root.append((0, import_core.optimizeCss)(css));
2711
2716
  };
2712
2717
  registerDependency = (fn) => {
2713
2718
  const ctx = this.getContextOrThrow();
@@ -2717,7 +2722,7 @@ var Builder = class {
2717
2722
  fn(dependency);
2718
2723
  }
2719
2724
  }
2720
- for (const file of ctx.conf.dependencies) {
2725
+ for (const file of this.configDependencies) {
2721
2726
  fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2722
2727
  }
2723
2728
  };
@@ -2765,7 +2770,7 @@ var cssgen = async (ctx, options) => {
2765
2770
  // src/debug.ts
2766
2771
  init_cjs_shims();
2767
2772
  var import_logger8 = require("@pandacss/logger");
2768
- var import_pathe3 = require("pathe");
2773
+ var import_pathe4 = require("pathe");
2769
2774
  async function debug(ctx, options) {
2770
2775
  const files = ctx.getFiles();
2771
2776
  const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
@@ -2800,7 +2805,7 @@ async function debug(ctx, options) {
2800
2805
  }
2801
2806
  if (outdir) {
2802
2807
  filesWithCss.push(file);
2803
- const parsedPath = (0, import_pathe3.parse)(file);
2808
+ const parsedPath = (0, import_pathe4.parse)(file);
2804
2809
  const relative2 = path.relative(ctx.config.cwd, parsedPath.dir);
2805
2810
  const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2806
2811
  const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
@@ -2914,12 +2919,12 @@ function setupGitIgnore(ctx) {
2914
2919
  // src/setup-config.ts
2915
2920
  init_cjs_shims();
2916
2921
  var import_config6 = require("@pandacss/config");
2917
- var import_generator3 = require("@pandacss/generator");
2922
+ var import_core2 = require("@pandacss/core");
2918
2923
  var import_logger10 = require("@pandacss/logger");
2919
2924
  var import_fs_extra2 = __toESM(require("fs-extra"));
2920
2925
  var import_look_it_up2 = require("look-it-up");
2921
2926
  var import_outdent2 = require("outdent");
2922
- var import_pathe4 = require("pathe");
2927
+ var import_pathe5 = require("pathe");
2923
2928
  var import_preferred_pm = __toESM(require("preferred-pm"));
2924
2929
  var import_prettier = __toESM(require("prettier"));
2925
2930
  async function setupConfig(cwd, opts = {}) {
@@ -2932,7 +2937,7 @@ async function setupConfig(cwd, opts = {}) {
2932
2937
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2933
2938
  import_logger10.logger.info("init:config", `creating panda config file: ${(0, import_logger10.quote)(file)}`);
2934
2939
  if (!force && configFile) {
2935
- import_logger10.logger.warn("init:config", import_generator3.messages.configExists(cmd));
2940
+ import_logger10.logger.warn("init:config", import_core2.messages.configExists(cmd));
2936
2941
  } else {
2937
2942
  const content = import_outdent2.outdent`
2938
2943
  import { defineConfig } from "@pandacss/dev"
@@ -2964,8 +2969,8 @@ jsxFramework: '${jsxFramework}',` : ""}
2964
2969
  syntax: '${syntax}'` : ""}
2965
2970
  })
2966
2971
  `;
2967
- await import_fs_extra2.default.writeFile((0, import_pathe4.join)(cwd, file), import_prettier.default.format(content));
2968
- import_logger10.logger.log(import_generator3.messages.thankYou());
2972
+ await import_fs_extra2.default.writeFile((0, import_pathe5.join)(cwd, file), import_prettier.default.format(content));
2973
+ import_logger10.logger.log(import_core2.messages.thankYou());
2969
2974
  }
2970
2975
  }
2971
2976
  async function setupPostcss(cwd) {
@@ -2977,7 +2982,7 @@ module.exports = {
2977
2982
  },
2978
2983
  }
2979
2984
  `;
2980
- await import_fs_extra2.default.writeFile((0, import_pathe4.join)(cwd, "postcss.config.cjs"), content);
2985
+ await import_fs_extra2.default.writeFile((0, import_pathe5.join)(cwd, "postcss.config.cjs"), content);
2981
2986
  }
2982
2987
  // Annotate the CommonJS export names for ESM import in node:
2983
2988
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -762,7 +762,7 @@ async function buildInfo(ctx, outfile) {
762
762
 
763
763
  // src/builder.ts
764
764
  init_esm_shims();
765
- import { findConfig } from "@pandacss/config";
765
+ import { findConfig, getConfigDependencies } from "@pandacss/config";
766
766
  import { optimizeCss } from "@pandacss/core";
767
767
  import { ConfigNotFoundError } from "@pandacss/error";
768
768
  import { logger as logger6 } from "@pandacss/logger";
@@ -840,18 +840,18 @@ function pLimit(concurrency) {
840
840
  queue.dequeue()();
841
841
  }
842
842
  };
843
- const run = async (fn, resolve3, args) => {
843
+ const run = async (fn, resolve4, args) => {
844
844
  activeCount++;
845
845
  const result = (async () => fn(...args))();
846
- resolve3(result);
846
+ resolve4(result);
847
847
  try {
848
848
  await result;
849
849
  } catch {
850
850
  }
851
851
  next();
852
852
  };
853
- const enqueue = (fn, resolve3, args) => {
854
- queue.enqueue(run.bind(void 0, fn, resolve3, args));
853
+ const enqueue = (fn, resolve4, args) => {
854
+ queue.enqueue(run.bind(void 0, fn, resolve4, args));
855
855
  (async () => {
856
856
  await Promise.resolve();
857
857
  if (activeCount < concurrency && queue.size > 0) {
@@ -859,8 +859,8 @@ function pLimit(concurrency) {
859
859
  }
860
860
  })();
861
861
  };
862
- const generator = (fn, ...args) => new Promise((resolve3) => {
863
- enqueue(fn, resolve3, args);
862
+ const generator = (fn, ...args) => new Promise((resolve4) => {
863
+ enqueue(fn, resolve4, args);
864
864
  });
865
865
  Object.defineProperties(generator, {
866
866
  activeCount: {
@@ -2505,7 +2505,6 @@ async function loadConfigAndCreateContext(options = {}) {
2505
2505
  };
2506
2506
  }
2507
2507
  }
2508
- conf.config.outdir ??= "styled-system";
2509
2508
  const hooks = createHooks();
2510
2509
  if (conf.config.hooks) {
2511
2510
  hooks.addHooks(conf.config.hooks);
@@ -2556,12 +2555,13 @@ function parseDependency(fileOrGlob) {
2556
2555
  message = { type: "dependency", file: resolve2(fileOrGlob) };
2557
2556
  }
2558
2557
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2559
- message = { type: "dependency", file: message.dir };
2558
+ message = { type: "dependency", file: resolve2(message.dir) };
2560
2559
  }
2561
2560
  return message;
2562
2561
  }
2563
2562
 
2564
2563
  // src/builder.ts
2564
+ import { resolve as resolve3 } from "pathe";
2565
2565
  var fileModifiedMap = /* @__PURE__ */ new Map();
2566
2566
  var Builder = class {
2567
2567
  /**
@@ -2571,6 +2571,7 @@ var Builder = class {
2571
2571
  hasEmitted = false;
2572
2572
  filesMeta;
2573
2573
  affecteds;
2574
+ configDependencies = /* @__PURE__ */ new Set();
2574
2575
  getConfigPath = (cwd) => {
2575
2576
  const configPath = findConfig({ cwd });
2576
2577
  if (!configPath) {
@@ -2578,9 +2579,23 @@ var Builder = class {
2578
2579
  }
2579
2580
  return configPath;
2580
2581
  };
2582
+ setConfigDependencies(options) {
2583
+ const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2584
+ const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2585
+ const { deps: foundDeps } = getConfigDependencies(options.configPath, tsOptions, compilerOptions);
2586
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2587
+ const configDeps = /* @__PURE__ */ new Set([
2588
+ ...foundDeps,
2589
+ ...(this.context?.conf.dependencies ?? []).map((file) => resolve3(cwd, file))
2590
+ ]);
2591
+ this.configDependencies = configDeps;
2592
+ logger6.debug("builder", "Config dependencies");
2593
+ logger6.debug("builder", configDeps);
2594
+ }
2581
2595
  setup = async (options = {}) => {
2582
2596
  logger6.debug("builder", "\u{1F6A7} Setup");
2583
2597
  const configPath = options.configPath ?? this.getConfigPath(options.cwd);
2598
+ this.setConfigDependencies({ configPath, cwd: options.cwd });
2584
2599
  if (!this.context) {
2585
2600
  return this.setupContext({ configPath, cwd: options.cwd });
2586
2601
  }
@@ -2667,23 +2682,13 @@ var Builder = class {
2667
2682
  });
2668
2683
  return valid;
2669
2684
  };
2670
- initialRoot;
2671
2685
  write = (root) => {
2672
- if (!this.initialRoot) {
2673
- this.initialRoot = root.toString();
2674
- }
2675
- root.removeAll();
2676
2686
  const ctx = this.getContextOrThrow();
2677
2687
  const sheet = ctx.createSheet();
2678
2688
  ctx.appendBaselineCss(sheet);
2679
2689
  ctx.appendParserCss(sheet);
2680
2690
  const css = ctx.getCss(sheet);
2681
- root.append(
2682
- optimizeCss(`
2683
- ${this.initialRoot}
2684
- ${css}
2685
- `)
2686
- );
2691
+ root.append(optimizeCss(css));
2687
2692
  };
2688
2693
  registerDependency = (fn) => {
2689
2694
  const ctx = this.getContextOrThrow();
@@ -2693,7 +2698,7 @@ var Builder = class {
2693
2698
  fn(dependency);
2694
2699
  }
2695
2700
  }
2696
- for (const file of ctx.conf.dependencies) {
2701
+ for (const file of this.configDependencies) {
2697
2702
  fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2698
2703
  }
2699
2704
  };
@@ -2890,7 +2895,7 @@ function setupGitIgnore(ctx) {
2890
2895
  // src/setup-config.ts
2891
2896
  init_esm_shims();
2892
2897
  import { findConfig as findConfig2 } from "@pandacss/config";
2893
- import { messages } from "@pandacss/generator";
2898
+ import { messages } from "@pandacss/core";
2894
2899
  import { logger as logger10, quote } from "@pandacss/logger";
2895
2900
  import fsExtra2 from "fs-extra";
2896
2901
  import { lookItUpSync as lookItUpSync2 } from "look-it-up";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.24.2",
3
+ "version": "0.26.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -53,16 +53,16 @@
53
53
  "ts-morph": "19.0.0",
54
54
  "ts-pattern": "5.0.5",
55
55
  "tsconfck": "^2.1.2",
56
- "@pandacss/config": "0.24.2",
57
- "@pandacss/error": "0.24.2",
58
- "@pandacss/generator": "0.24.2",
59
- "@pandacss/extractor": "0.24.2",
60
- "@pandacss/core": "0.24.2",
61
- "@pandacss/logger": "0.24.2",
62
- "@pandacss/parser": "0.24.2",
63
- "@pandacss/shared": "0.24.2",
64
- "@pandacss/token-dictionary": "0.24.2",
65
- "@pandacss/types": "0.24.2"
56
+ "@pandacss/config": "0.26.0",
57
+ "@pandacss/core": "0.26.0",
58
+ "@pandacss/error": "0.26.0",
59
+ "@pandacss/extractor": "0.26.0",
60
+ "@pandacss/generator": "0.26.0",
61
+ "@pandacss/logger": "0.26.0",
62
+ "@pandacss/parser": "0.26.0",
63
+ "@pandacss/shared": "0.26.0",
64
+ "@pandacss/token-dictionary": "0.26.0",
65
+ "@pandacss/types": "0.26.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/fs-extra": "11.0.4",