@pandacss/config 0.0.0-dev-20231122180455 → 0.0.0-dev-20231128191244

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
@@ -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
 
@@ -318,6 +321,9 @@ async function getResolvedConfig(config, cwd) {
318
321
  // src/load-config.ts
319
322
  var import_error = require("@pandacss/error");
320
323
  var import_logger = require("@pandacss/logger");
324
+ var import_shared = require("@pandacss/shared");
325
+
326
+ // src/bundled-preset.ts
321
327
  var import_preset_base = require("@pandacss/preset-base");
322
328
  var import_preset_panda = require("@pandacss/preset-panda");
323
329
  var bundledPresets = {
@@ -327,6 +333,11 @@ var bundledPresets = {
327
333
  };
328
334
  var bundledPresetsNames = Object.keys(bundledPresets);
329
335
  var isBundledPreset = (preset) => bundledPresetsNames.includes(preset);
336
+ var getBundledPreset = (preset) => {
337
+ return typeof preset === "string" && isBundledPreset(preset) ? bundledPresets[preset] : void 0;
338
+ };
339
+
340
+ // src/load-config.ts
330
341
  async function loadConfigFile(options) {
331
342
  const result = await bundleConfigFile(options);
332
343
  return resolveConfigFile(result, options.cwd);
@@ -338,18 +349,16 @@ async function resolveConfigFile(result, cwd) {
338
349
  }
339
350
  if (result.config.presets) {
340
351
  result.config.presets.forEach((preset) => {
341
- if (typeof preset === "string" && isBundledPreset(preset)) {
342
- presets.add(bundledPresets[preset]);
343
- } else {
344
- presets.add(preset);
345
- }
352
+ presets.add(getBundledPreset(preset) ?? preset);
346
353
  });
347
354
  } else if (!result.config.eject) {
348
355
  presets.add(import_preset_panda.preset);
349
356
  }
350
357
  result.config.presets = Array.from(presets);
351
358
  const mergedConfig = await getResolvedConfig(result.config, cwd);
352
- return { ...result, config: mergedConfig };
359
+ const serialized = (0, import_shared.stringifyJson)(mergedConfig);
360
+ const deserialize = () => (0, import_shared.parseJson)(serialized);
361
+ return { ...result, serialized, deserialize, config: mergedConfig };
353
362
  }
354
363
  async function bundleConfigFile(options) {
355
364
  const { cwd, file } = options;
package/dist/index.mjs CHANGED
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.0.0-dev-20231122180455",
3
+ "version": "0.0.0-dev-20231128191244",
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.0.0-dev-20231122180455",
53
- "@pandacss/logger": "0.0.0-dev-20231122180455",
54
- "@pandacss/preset-base": "0.0.0-dev-20231122180455",
55
- "@pandacss/preset-panda": "0.0.0-dev-20231122180455",
56
- "@pandacss/types": "0.0.0-dev-20231122180455"
52
+ "@pandacss/error": "0.0.0-dev-20231128191244",
53
+ "@pandacss/logger": "0.0.0-dev-20231128191244",
54
+ "@pandacss/preset-base": "0.0.0-dev-20231128191244",
55
+ "@pandacss/preset-panda": "0.0.0-dev-20231128191244",
56
+ "@pandacss/shared": "0.0.0-dev-20231128191244",
57
+ "@pandacss/types": "0.0.0-dev-20231128191244"
57
58
  },
58
59
  "devDependencies": {
59
60
  "pkg-types": "1.0.3"