@pandacss/node 0.24.1 → 0.25.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;
@@ -237,6 +236,10 @@ interface FileMeta {
237
236
  mtime: number;
238
237
  isUnchanged: boolean;
239
238
  }
239
+ interface SetupContextOptions {
240
+ configPath: string;
241
+ cwd?: string;
242
+ }
240
243
 
241
244
  declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
242
245
  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;
@@ -237,6 +236,10 @@ interface FileMeta {
237
236
  mtime: number;
238
237
  isUnchanged: boolean;
239
238
  }
239
+ interface SetupContextOptions {
240
+ configPath: string;
241
+ cwd?: string;
242
+ }
240
243
 
241
244
  declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
242
245
  box: string;
package/dist/index.js CHANGED
@@ -773,24 +773,12 @@ var writeAnalyzeJSON = (filePath, result, ctx) => {
773
773
  // src/build-info.ts
774
774
  init_cjs_shims();
775
775
  var import_logger2 = require("@pandacss/logger");
776
-
777
- // package.json
778
- var version = "0.24.1";
779
-
780
- // src/build-info.ts
781
776
  async function buildInfo(ctx, outfile) {
782
777
  const { filesWithCss, files } = ctx.parseFiles();
783
778
  import_logger2.logger.info("cli", `Found ${import_logger2.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
784
779
  const minify = ctx.config.minify;
785
780
  import_logger2.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger2.colors.bold(outfile)}`);
786
- const output = JSON.stringify(
787
- {
788
- schemaVersion: version,
789
- styles: ctx.encoder.toJSON()
790
- },
791
- null,
792
- minify ? 0 : 2
793
- );
781
+ const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
794
782
  ctx.output.ensure(outfile, process.cwd());
795
783
  await ctx.runtime.fs.writeFile(outfile, output);
796
784
  import_logger2.logger.info("cli", "Done!");
@@ -876,18 +864,18 @@ function pLimit(concurrency) {
876
864
  queue.dequeue()();
877
865
  }
878
866
  };
879
- const run = async (fn, resolve3, args) => {
867
+ const run = async (fn, resolve4, args) => {
880
868
  activeCount++;
881
869
  const result = (async () => fn(...args))();
882
- resolve3(result);
870
+ resolve4(result);
883
871
  try {
884
872
  await result;
885
873
  } catch {
886
874
  }
887
875
  next();
888
876
  };
889
- const enqueue = (fn, resolve3, args) => {
890
- 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));
891
879
  (async () => {
892
880
  await Promise.resolve();
893
881
  if (activeCount < concurrency && queue.size > 0) {
@@ -895,8 +883,8 @@ function pLimit(concurrency) {
895
883
  }
896
884
  })();
897
885
  };
898
- const generator = (fn, ...args) => new Promise((resolve3) => {
899
- enqueue(fn, resolve3, args);
886
+ const generator = (fn, ...args) => new Promise((resolve4) => {
887
+ enqueue(fn, resolve4, args);
900
888
  });
901
889
  Object.defineProperties(generator, {
902
890
  activeCount: {
@@ -1271,10 +1259,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1271
1259
  return 3;
1272
1260
  }
1273
1261
  if ("TERM_PROGRAM" in env) {
1274
- const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1262
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1275
1263
  switch (env.TERM_PROGRAM) {
1276
1264
  case "iTerm.app": {
1277
- return version2 >= 3 ? 3 : 2;
1265
+ return version >= 3 ? 3 : 2;
1278
1266
  }
1279
1267
  case "Apple_Terminal": {
1280
1268
  return 2;
@@ -2592,12 +2580,13 @@ function parseDependency(fileOrGlob) {
2592
2580
  message = { type: "dependency", file: (0, import_pathe2.resolve)(fileOrGlob) };
2593
2581
  }
2594
2582
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2595
- message = { type: "dependency", file: message.dir };
2583
+ message = { type: "dependency", file: (0, import_pathe2.resolve)(message.dir) };
2596
2584
  }
2597
2585
  return message;
2598
2586
  }
2599
2587
 
2600
2588
  // src/builder.ts
2589
+ var import_pathe3 = require("pathe");
2601
2590
  var fileModifiedMap = /* @__PURE__ */ new Map();
2602
2591
  var Builder = class {
2603
2592
  /**
@@ -2607,6 +2596,7 @@ var Builder = class {
2607
2596
  hasEmitted = false;
2608
2597
  filesMeta;
2609
2598
  affecteds;
2599
+ configDependencies = /* @__PURE__ */ new Set();
2610
2600
  getConfigPath = (cwd) => {
2611
2601
  const configPath = (0, import_config3.findConfig)({ cwd });
2612
2602
  if (!configPath) {
@@ -2614,9 +2604,23 @@ var Builder = class {
2614
2604
  }
2615
2605
  return configPath;
2616
2606
  };
2607
+ setConfigDependencies(options) {
2608
+ const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2609
+ const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2610
+ const { deps: foundDeps } = (0, import_config3.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
2611
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2612
+ const configDeps = /* @__PURE__ */ new Set([
2613
+ ...foundDeps,
2614
+ ...(this.context?.conf.dependencies ?? []).map((file) => (0, import_pathe3.resolve)(cwd, file))
2615
+ ]);
2616
+ this.configDependencies = configDeps;
2617
+ import_logger6.logger.debug("builder", "Config dependencies");
2618
+ import_logger6.logger.debug("builder", configDeps);
2619
+ }
2617
2620
  setup = async (options = {}) => {
2618
2621
  import_logger6.logger.debug("builder", "\u{1F6A7} Setup");
2619
2622
  const configPath = options.configPath ?? this.getConfigPath(options.cwd);
2623
+ this.setConfigDependencies({ configPath, cwd: options.cwd });
2620
2624
  if (!this.context) {
2621
2625
  return this.setupContext({ configPath, cwd: options.cwd });
2622
2626
  }
@@ -2729,7 +2733,7 @@ var Builder = class {
2729
2733
  fn(dependency);
2730
2734
  }
2731
2735
  }
2732
- for (const file of ctx.conf.dependencies) {
2736
+ for (const file of this.configDependencies) {
2733
2737
  fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2734
2738
  }
2735
2739
  };
@@ -2777,7 +2781,7 @@ var cssgen = async (ctx, options) => {
2777
2781
  // src/debug.ts
2778
2782
  init_cjs_shims();
2779
2783
  var import_logger8 = require("@pandacss/logger");
2780
- var import_pathe3 = require("pathe");
2784
+ var import_pathe4 = require("pathe");
2781
2785
  async function debug(ctx, options) {
2782
2786
  const files = ctx.getFiles();
2783
2787
  const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
@@ -2812,7 +2816,7 @@ async function debug(ctx, options) {
2812
2816
  }
2813
2817
  if (outdir) {
2814
2818
  filesWithCss.push(file);
2815
- const parsedPath = (0, import_pathe3.parse)(file);
2819
+ const parsedPath = (0, import_pathe4.parse)(file);
2816
2820
  const relative2 = path.relative(ctx.config.cwd, parsedPath.dir);
2817
2821
  const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path.sep, "__");
2818
2822
  const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path.sep, "__");
@@ -2931,7 +2935,7 @@ var import_logger10 = require("@pandacss/logger");
2931
2935
  var import_fs_extra2 = __toESM(require("fs-extra"));
2932
2936
  var import_look_it_up2 = require("look-it-up");
2933
2937
  var import_outdent2 = require("outdent");
2934
- var import_pathe4 = require("pathe");
2938
+ var import_pathe5 = require("pathe");
2935
2939
  var import_preferred_pm = __toESM(require("preferred-pm"));
2936
2940
  var import_prettier = __toESM(require("prettier"));
2937
2941
  async function setupConfig(cwd, opts = {}) {
@@ -2976,7 +2980,7 @@ jsxFramework: '${jsxFramework}',` : ""}
2976
2980
  syntax: '${syntax}'` : ""}
2977
2981
  })
2978
2982
  `;
2979
- await import_fs_extra2.default.writeFile((0, import_pathe4.join)(cwd, file), import_prettier.default.format(content));
2983
+ await import_fs_extra2.default.writeFile((0, import_pathe5.join)(cwd, file), import_prettier.default.format(content));
2980
2984
  import_logger10.logger.log(import_generator3.messages.thankYou());
2981
2985
  }
2982
2986
  }
@@ -2989,7 +2993,7 @@ module.exports = {
2989
2993
  },
2990
2994
  }
2991
2995
  `;
2992
- await import_fs_extra2.default.writeFile((0, import_pathe4.join)(cwd, "postcss.config.cjs"), content);
2996
+ await import_fs_extra2.default.writeFile((0, import_pathe5.join)(cwd, "postcss.config.cjs"), content);
2993
2997
  }
2994
2998
  // Annotate the CommonJS export names for ESM import in node:
2995
2999
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -749,24 +749,12 @@ var writeAnalyzeJSON = (filePath, result, ctx) => {
749
749
  // src/build-info.ts
750
750
  init_esm_shims();
751
751
  import { colors, logger as logger2 } from "@pandacss/logger";
752
-
753
- // package.json
754
- var version = "0.24.1";
755
-
756
- // src/build-info.ts
757
752
  async function buildInfo(ctx, outfile) {
758
753
  const { filesWithCss, files } = ctx.parseFiles();
759
754
  logger2.info("cli", `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
760
755
  const minify = ctx.config.minify;
761
756
  logger2.info("cli", `Writing ${minify ? "[min] " : " "}${colors.bold(outfile)}`);
762
- const output = JSON.stringify(
763
- {
764
- schemaVersion: version,
765
- styles: ctx.encoder.toJSON()
766
- },
767
- null,
768
- minify ? 0 : 2
769
- );
757
+ const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
770
758
  ctx.output.ensure(outfile, process.cwd());
771
759
  await ctx.runtime.fs.writeFile(outfile, output);
772
760
  logger2.info("cli", "Done!");
@@ -774,7 +762,7 @@ async function buildInfo(ctx, outfile) {
774
762
 
775
763
  // src/builder.ts
776
764
  init_esm_shims();
777
- import { findConfig } from "@pandacss/config";
765
+ import { findConfig, getConfigDependencies } from "@pandacss/config";
778
766
  import { optimizeCss } from "@pandacss/core";
779
767
  import { ConfigNotFoundError } from "@pandacss/error";
780
768
  import { logger as logger6 } from "@pandacss/logger";
@@ -852,18 +840,18 @@ function pLimit(concurrency) {
852
840
  queue.dequeue()();
853
841
  }
854
842
  };
855
- const run = async (fn, resolve3, args) => {
843
+ const run = async (fn, resolve4, args) => {
856
844
  activeCount++;
857
845
  const result = (async () => fn(...args))();
858
- resolve3(result);
846
+ resolve4(result);
859
847
  try {
860
848
  await result;
861
849
  } catch {
862
850
  }
863
851
  next();
864
852
  };
865
- const enqueue = (fn, resolve3, args) => {
866
- 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));
867
855
  (async () => {
868
856
  await Promise.resolve();
869
857
  if (activeCount < concurrency && queue.size > 0) {
@@ -871,8 +859,8 @@ function pLimit(concurrency) {
871
859
  }
872
860
  })();
873
861
  };
874
- const generator = (fn, ...args) => new Promise((resolve3) => {
875
- enqueue(fn, resolve3, args);
862
+ const generator = (fn, ...args) => new Promise((resolve4) => {
863
+ enqueue(fn, resolve4, args);
876
864
  });
877
865
  Object.defineProperties(generator, {
878
866
  activeCount: {
@@ -1247,10 +1235,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1247
1235
  return 3;
1248
1236
  }
1249
1237
  if ("TERM_PROGRAM" in env) {
1250
- const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1238
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1251
1239
  switch (env.TERM_PROGRAM) {
1252
1240
  case "iTerm.app": {
1253
- return version2 >= 3 ? 3 : 2;
1241
+ return version >= 3 ? 3 : 2;
1254
1242
  }
1255
1243
  case "Apple_Terminal": {
1256
1244
  return 2;
@@ -2568,12 +2556,13 @@ function parseDependency(fileOrGlob) {
2568
2556
  message = { type: "dependency", file: resolve2(fileOrGlob) };
2569
2557
  }
2570
2558
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2571
- message = { type: "dependency", file: message.dir };
2559
+ message = { type: "dependency", file: resolve2(message.dir) };
2572
2560
  }
2573
2561
  return message;
2574
2562
  }
2575
2563
 
2576
2564
  // src/builder.ts
2565
+ import { resolve as resolve3 } from "pathe";
2577
2566
  var fileModifiedMap = /* @__PURE__ */ new Map();
2578
2567
  var Builder = class {
2579
2568
  /**
@@ -2583,6 +2572,7 @@ var Builder = class {
2583
2572
  hasEmitted = false;
2584
2573
  filesMeta;
2585
2574
  affecteds;
2575
+ configDependencies = /* @__PURE__ */ new Set();
2586
2576
  getConfigPath = (cwd) => {
2587
2577
  const configPath = findConfig({ cwd });
2588
2578
  if (!configPath) {
@@ -2590,9 +2580,23 @@ var Builder = class {
2590
2580
  }
2591
2581
  return configPath;
2592
2582
  };
2583
+ setConfigDependencies(options) {
2584
+ const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2585
+ const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
2586
+ const { deps: foundDeps } = getConfigDependencies(options.configPath, tsOptions, compilerOptions);
2587
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2588
+ const configDeps = /* @__PURE__ */ new Set([
2589
+ ...foundDeps,
2590
+ ...(this.context?.conf.dependencies ?? []).map((file) => resolve3(cwd, file))
2591
+ ]);
2592
+ this.configDependencies = configDeps;
2593
+ logger6.debug("builder", "Config dependencies");
2594
+ logger6.debug("builder", configDeps);
2595
+ }
2593
2596
  setup = async (options = {}) => {
2594
2597
  logger6.debug("builder", "\u{1F6A7} Setup");
2595
2598
  const configPath = options.configPath ?? this.getConfigPath(options.cwd);
2599
+ this.setConfigDependencies({ configPath, cwd: options.cwd });
2596
2600
  if (!this.context) {
2597
2601
  return this.setupContext({ configPath, cwd: options.cwd });
2598
2602
  }
@@ -2705,7 +2709,7 @@ var Builder = class {
2705
2709
  fn(dependency);
2706
2710
  }
2707
2711
  }
2708
- for (const file of ctx.conf.dependencies) {
2712
+ for (const file of this.configDependencies) {
2709
2713
  fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2710
2714
  }
2711
2715
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.24.1",
3
+ "version": "0.25.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.1",
57
- "@pandacss/error": "0.24.1",
58
- "@pandacss/core": "0.24.1",
59
- "@pandacss/extractor": "0.24.1",
60
- "@pandacss/generator": "0.24.1",
61
- "@pandacss/logger": "0.24.1",
62
- "@pandacss/parser": "0.24.1",
63
- "@pandacss/shared": "0.24.1",
64
- "@pandacss/types": "0.24.1",
65
- "@pandacss/token-dictionary": "0.24.1"
56
+ "@pandacss/config": "0.25.0",
57
+ "@pandacss/core": "0.25.0",
58
+ "@pandacss/error": "0.25.0",
59
+ "@pandacss/generator": "0.25.0",
60
+ "@pandacss/parser": "0.25.0",
61
+ "@pandacss/extractor": "0.25.0",
62
+ "@pandacss/shared": "0.25.0",
63
+ "@pandacss/logger": "0.25.0",
64
+ "@pandacss/types": "0.25.0",
65
+ "@pandacss/token-dictionary": "0.25.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/fs-extra": "11.0.4",