@pandacss/config 0.0.0-dev-20230513102701 → 0.0.0-dev-20230515185702

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.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Config } from '@pandacss/types';
1
+ import * as _pandacss_types from '@pandacss/types';
2
+ import { LoadConfigResult, Config } from '@pandacss/types';
2
3
 
3
4
  declare function findConfigFile({ cwd, file }: {
4
5
  cwd: string;
@@ -9,8 +10,10 @@ type ConfigFileOptions = {
9
10
  cwd: string;
10
11
  file?: string;
11
12
  };
12
- declare function loadConfigFile(options: ConfigFileOptions): Promise<{
13
- config: any;
13
+ declare function loadConfigFile(options: ConfigFileOptions): Promise<LoadConfigResult>;
14
+ declare function resolveConfigFile(result: Awaited<ReturnType<typeof bundleConfigFile>>, cwd: string): Promise<LoadConfigResult>;
15
+ declare function bundleConfigFile(options: ConfigFileOptions): Promise<{
16
+ config: _pandacss_types.Config;
14
17
  path: string;
15
18
  dependencies: string[];
16
19
  }>;
@@ -26,6 +29,6 @@ declare function mergeConfigs(configs: ExtendableConfig[]): any;
26
29
  /**
27
30
  * Recursively merge all presets into a single config
28
31
  */
29
- declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<any>;
32
+ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<Config>;
30
33
 
31
- export { findConfigFile, getResolvedConfig, loadConfigFile, mergeConfigs };
34
+ export { bundleConfigFile, findConfigFile, getResolvedConfig, loadConfigFile, mergeConfigs, resolveConfigFile };
package/dist/index.js CHANGED
@@ -30,10 +30,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ bundleConfigFile: () => bundleConfigFile,
33
34
  findConfigFile: () => findConfigFile,
34
35
  getResolvedConfig: () => getResolvedConfig,
35
36
  loadConfigFile: () => loadConfigFile,
36
- mergeConfigs: () => mergeConfigs
37
+ mergeConfigs: () => mergeConfigs,
38
+ resolveConfigFile: () => resolveConfigFile
37
39
  });
38
40
  module.exports = __toCommonJS(src_exports);
39
41
 
@@ -155,6 +157,15 @@ async function getResolvedConfig(config, cwd) {
155
157
 
156
158
  // src/load-config.ts
157
159
  async function loadConfigFile(options) {
160
+ const result = await bundleConfigFile(options);
161
+ return resolveConfigFile(result, options.cwd);
162
+ }
163
+ async function resolveConfigFile(result, cwd) {
164
+ result.config.presets ||= ["@pandacss/dev/presets"];
165
+ const mergedConfig = await getResolvedConfig(result.config, cwd);
166
+ return { ...result, config: mergedConfig };
167
+ }
168
+ async function bundleConfigFile(options) {
158
169
  const { cwd, file } = options;
159
170
  const filePath = findConfigFile({ cwd, file });
160
171
  if (!filePath) {
@@ -165,18 +176,18 @@ async function loadConfigFile(options) {
165
176
  if (typeof result.config !== "object") {
166
177
  throw new import_error.ConfigError(`\u{1F4A5} Config must export or return an object.`);
167
178
  }
168
- result.config.presets ||= ["@pandacss/dev/presets"];
169
- const mergedConfig = await getResolvedConfig(result.config, cwd);
170
179
  return {
171
180
  ...result,
172
- config: mergedConfig,
181
+ config: result.config,
173
182
  path: filePath
174
183
  };
175
184
  }
176
185
  // Annotate the CommonJS export names for ESM import in node:
177
186
  0 && (module.exports = {
187
+ bundleConfigFile,
178
188
  findConfigFile,
179
189
  getResolvedConfig,
180
190
  loadConfigFile,
181
- mergeConfigs
191
+ mergeConfigs,
192
+ resolveConfigFile
182
193
  });
package/dist/index.mjs CHANGED
@@ -116,6 +116,15 @@ async function getResolvedConfig(config, cwd) {
116
116
 
117
117
  // src/load-config.ts
118
118
  async function loadConfigFile(options) {
119
+ const result = await bundleConfigFile(options);
120
+ return resolveConfigFile(result, options.cwd);
121
+ }
122
+ async function resolveConfigFile(result, cwd) {
123
+ result.config.presets ||= ["@pandacss/dev/presets"];
124
+ const mergedConfig = await getResolvedConfig(result.config, cwd);
125
+ return { ...result, config: mergedConfig };
126
+ }
127
+ async function bundleConfigFile(options) {
119
128
  const { cwd, file } = options;
120
129
  const filePath = findConfigFile({ cwd, file });
121
130
  if (!filePath) {
@@ -126,17 +135,17 @@ async function loadConfigFile(options) {
126
135
  if (typeof result.config !== "object") {
127
136
  throw new ConfigError(`\u{1F4A5} Config must export or return an object.`);
128
137
  }
129
- result.config.presets ||= ["@pandacss/dev/presets"];
130
- const mergedConfig = await getResolvedConfig(result.config, cwd);
131
138
  return {
132
139
  ...result,
133
- config: mergedConfig,
140
+ config: result.config,
134
141
  path: filePath
135
142
  };
136
143
  }
137
144
  export {
145
+ bundleConfigFile,
138
146
  findConfigFile,
139
147
  getResolvedConfig,
140
148
  loadConfigFile,
141
- mergeConfigs
149
+ mergeConfigs,
150
+ resolveConfigFile
142
151
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.0.0-dev-20230513102701",
3
+ "version": "0.0.0-dev-20230515185702",
4
4
  "description": "Find and load panda config",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -17,9 +17,9 @@
17
17
  "bundle-n-require": "^1.0.1",
18
18
  "merge-anything": "^5.1.6",
19
19
  "escalade": "3.1.1",
20
- "@pandacss/logger": "0.0.0-dev-20230513102701",
21
- "@pandacss/error": "0.0.0-dev-20230513102701",
22
- "@pandacss/types": "0.0.0-dev-20230513102701"
20
+ "@pandacss/logger": "0.0.0-dev-20230515185702",
21
+ "@pandacss/error": "0.0.0-dev-20230515185702",
22
+ "@pandacss/types": "0.0.0-dev-20230515185702"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "pnpm tsup src/index.ts --format=esm,cjs --shims --dts",