@pandacss/config 0.19.0 → 0.21.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.
@@ -81,7 +81,8 @@ function mergeConfigs(configs) {
81
81
  theme: mergeExtensions(configs.map((config) => config.theme ?? {})),
82
82
  patterns: mergeExtensions(configs.map((config) => config.patterns ?? {})),
83
83
  utilities: mergeExtensions(configs.map((config) => config.utilities ?? {})),
84
- globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {}))
84
+ globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {})),
85
+ staticCss: mergeExtensions(configs.map((config) => config.staticCss ?? {}))
85
86
  },
86
87
  ...configs
87
88
  );
package/dist/index.d.mts CHANGED
@@ -38,8 +38,19 @@ interface ConfigFileOptions {
38
38
  cwd: string;
39
39
  file?: string;
40
40
  }
41
+ /**
42
+ * Find, load and resolve the final config (including presets)
43
+ */
41
44
  declare function loadConfigFile(options: ConfigFileOptions): Promise<LoadConfigResult>;
45
+ /**
46
+ * Resolve the final config (including presets)
47
+ * @pandacss/preset-base: ALWAYS included if NOT using eject: true
48
+ * @pandacss/preset-panda: only included by default if no presets
49
+ */
42
50
  declare function resolveConfigFile(result: Awaited<ReturnType<typeof bundleConfigFile>>, cwd: string): Promise<LoadConfigResult>;
51
+ /**
52
+ * Find and bundle the config file
53
+ */
43
54
  declare function bundleConfigFile(options: ConfigFileOptions): Promise<{
44
55
  config: _pandacss_types.Config;
45
56
  path: string;
package/dist/index.d.ts CHANGED
@@ -38,8 +38,19 @@ interface ConfigFileOptions {
38
38
  cwd: string;
39
39
  file?: string;
40
40
  }
41
+ /**
42
+ * Find, load and resolve the final config (including presets)
43
+ */
41
44
  declare function loadConfigFile(options: ConfigFileOptions): Promise<LoadConfigResult>;
45
+ /**
46
+ * Resolve the final config (including presets)
47
+ * @pandacss/preset-base: ALWAYS included if NOT using eject: true
48
+ * @pandacss/preset-panda: only included by default if no presets
49
+ */
42
50
  declare function resolveConfigFile(result: Awaited<ReturnType<typeof bundleConfigFile>>, cwd: string): Promise<LoadConfigResult>;
51
+ /**
52
+ * Find and bundle the config file
53
+ */
43
54
  declare function bundleConfigFile(options: ConfigFileOptions): Promise<{
44
55
  config: _pandacss_types.Config;
45
56
  path: string;
package/dist/index.js CHANGED
@@ -202,7 +202,10 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compi
202
202
  // src/bundle.ts
203
203
  var import_bundle_n_require = require("bundle-n-require");
204
204
  async function bundle(filepath, cwd) {
205
- const { mod: config, dependencies } = await (0, import_bundle_n_require.bundleNRequire)(filepath, { cwd, interopDefault: true });
205
+ const { mod: config, dependencies } = await (0, import_bundle_n_require.bundleNRequire)(filepath, {
206
+ cwd,
207
+ interopDefault: true
208
+ });
206
209
  return { config: config?.default ?? config, dependencies };
207
210
  }
208
211
 
@@ -289,7 +292,8 @@ function mergeConfigs(configs2) {
289
292
  theme: mergeExtensions(configs2.map((config) => config.theme ?? {})),
290
293
  patterns: mergeExtensions(configs2.map((config) => config.patterns ?? {})),
291
294
  utilities: mergeExtensions(configs2.map((config) => config.utilities ?? {})),
292
- globalCss: mergeExtensions(configs2.map((config) => config.globalCss ?? {}))
295
+ globalCss: mergeExtensions(configs2.map((config) => config.globalCss ?? {})),
296
+ staticCss: mergeExtensions(configs2.map((config) => config.staticCss ?? {}))
293
297
  },
294
298
  ...configs2
295
299
  );
@@ -318,6 +322,9 @@ async function getResolvedConfig(config, cwd) {
318
322
  // src/load-config.ts
319
323
  var import_error = require("@pandacss/error");
320
324
  var import_logger = require("@pandacss/logger");
325
+ var import_shared = require("@pandacss/shared");
326
+
327
+ // src/bundled-preset.ts
321
328
  var import_preset_base = require("@pandacss/preset-base");
322
329
  var import_preset_panda = require("@pandacss/preset-panda");
323
330
  var bundledPresets = {
@@ -327,6 +334,11 @@ var bundledPresets = {
327
334
  };
328
335
  var bundledPresetsNames = Object.keys(bundledPresets);
329
336
  var isBundledPreset = (preset) => bundledPresetsNames.includes(preset);
337
+ var getBundledPreset = (preset) => {
338
+ return typeof preset === "string" && isBundledPreset(preset) ? bundledPresets[preset] : void 0;
339
+ };
340
+
341
+ // src/load-config.ts
330
342
  async function loadConfigFile(options) {
331
343
  const result = await bundleConfigFile(options);
332
344
  return resolveConfigFile(result, options.cwd);
@@ -338,18 +350,16 @@ async function resolveConfigFile(result, cwd) {
338
350
  }
339
351
  if (result.config.presets) {
340
352
  result.config.presets.forEach((preset) => {
341
- if (typeof preset === "string" && isBundledPreset(preset)) {
342
- presets.add(bundledPresets[preset]);
343
- } else {
344
- presets.add(preset);
345
- }
353
+ presets.add(getBundledPreset(preset) ?? preset);
346
354
  });
347
355
  } else if (!result.config.eject) {
348
356
  presets.add(import_preset_panda.preset);
349
357
  }
350
358
  result.config.presets = Array.from(presets);
351
359
  const mergedConfig = await getResolvedConfig(result.config, cwd);
352
- return { ...result, config: mergedConfig };
360
+ const serialized = (0, import_shared.stringifyJson)(mergedConfig);
361
+ const deserialize = () => (0, import_shared.parseJson)(serialized);
362
+ return { ...result, serialized, deserialize, config: mergedConfig };
353
363
  }
354
364
  async function bundleConfigFile(options) {
355
365
  const { cwd, file } = options;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeConfigs
3
- } from "./chunk-5FP5NJ64.mjs";
3
+ } from "./chunk-TCZHQ5GD.mjs";
4
4
  import {
5
5
  resolveTsPathPattern
6
6
  } from "./chunk-RPIVZP2I.mjs";
@@ -147,7 +147,10 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compi
147
147
  // src/bundle.ts
148
148
  import { bundleNRequire } from "bundle-n-require";
149
149
  async function bundle(filepath, cwd) {
150
- const { mod: config, dependencies } = await bundleNRequire(filepath, { cwd, interopDefault: true });
150
+ const { mod: config, dependencies } = await bundleNRequire(filepath, {
151
+ cwd,
152
+ interopDefault: true
153
+ });
151
154
  return { config: config?.default ?? config, dependencies };
152
155
  }
153
156
 
@@ -173,6 +176,9 @@ async function getResolvedConfig(config, cwd) {
173
176
  // src/load-config.ts
174
177
  import { ConfigError, ConfigNotFoundError } from "@pandacss/error";
175
178
  import { logger } from "@pandacss/logger";
179
+ import { parseJson, stringifyJson } from "@pandacss/shared";
180
+
181
+ // src/bundled-preset.ts
176
182
  import { preset as presetBase } from "@pandacss/preset-base";
177
183
  import { preset as presetPanda } from "@pandacss/preset-panda";
178
184
  var bundledPresets = {
@@ -182,6 +188,11 @@ var bundledPresets = {
182
188
  };
183
189
  var bundledPresetsNames = Object.keys(bundledPresets);
184
190
  var isBundledPreset = (preset) => bundledPresetsNames.includes(preset);
191
+ var getBundledPreset = (preset) => {
192
+ return typeof preset === "string" && isBundledPreset(preset) ? bundledPresets[preset] : void 0;
193
+ };
194
+
195
+ // src/load-config.ts
185
196
  async function loadConfigFile(options) {
186
197
  const result = await bundleConfigFile(options);
187
198
  return resolveConfigFile(result, options.cwd);
@@ -193,18 +204,16 @@ async function resolveConfigFile(result, cwd) {
193
204
  }
194
205
  if (result.config.presets) {
195
206
  result.config.presets.forEach((preset) => {
196
- if (typeof preset === "string" && isBundledPreset(preset)) {
197
- presets.add(bundledPresets[preset]);
198
- } else {
199
- presets.add(preset);
200
- }
207
+ presets.add(getBundledPreset(preset) ?? preset);
201
208
  });
202
209
  } else if (!result.config.eject) {
203
210
  presets.add(presetPanda);
204
211
  }
205
212
  result.config.presets = Array.from(presets);
206
213
  const mergedConfig = await getResolvedConfig(result.config, cwd);
207
- return { ...result, config: mergedConfig };
214
+ const serialized = stringifyJson(mergedConfig);
215
+ const deserialize = () => parseJson(serialized);
216
+ return { ...result, serialized, deserialize, config: mergedConfig };
208
217
  }
209
218
  async function bundleConfigFile(options) {
210
219
  const { cwd, file } = options;
@@ -105,7 +105,8 @@ function mergeConfigs(configs) {
105
105
  theme: mergeExtensions(configs.map((config) => config.theme ?? {})),
106
106
  patterns: mergeExtensions(configs.map((config) => config.patterns ?? {})),
107
107
  utilities: mergeExtensions(configs.map((config) => config.utilities ?? {})),
108
- globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {}))
108
+ globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {})),
109
+ staticCss: mergeExtensions(configs.map((config) => config.staticCss ?? {}))
109
110
  },
110
111
  ...configs
111
112
  );
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeConfigs
3
- } from "./chunk-5FP5NJ64.mjs";
3
+ } from "./chunk-TCZHQ5GD.mjs";
4
4
  export {
5
5
  mergeConfigs
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Find and load panda config",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -49,11 +49,12 @@
49
49
  "jiti": "^1.19.1",
50
50
  "merge-anything": "^5.1.7",
51
51
  "typescript": "^5.2.2",
52
- "@pandacss/error": "0.19.0",
53
- "@pandacss/logger": "0.19.0",
54
- "@pandacss/preset-base": "0.19.0",
55
- "@pandacss/preset-panda": "0.19.0",
56
- "@pandacss/types": "0.19.0"
52
+ "@pandacss/error": "0.21.0",
53
+ "@pandacss/logger": "0.21.0",
54
+ "@pandacss/preset-base": "0.21.0",
55
+ "@pandacss/preset-panda": "0.21.0",
56
+ "@pandacss/shared": "0.21.0",
57
+ "@pandacss/types": "0.21.0"
57
58
  },
58
59
  "devDependencies": {
59
60
  "pkg-types": "1.0.3"