@pandacss/config 0.0.0-dev-20230530140607 → 0.0.0-dev-20230530153916
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 +3 -1
- package/dist/index.js +62 -5
- package/dist/index.mjs +61 -5
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ declare function findConfigFile({ cwd, file }: {
|
|
|
6
6
|
file?: string;
|
|
7
7
|
}): string | void;
|
|
8
8
|
|
|
9
|
+
declare function getConfigDependencies(filePath: string): Set<string>;
|
|
10
|
+
|
|
9
11
|
type ConfigFileOptions = {
|
|
10
12
|
cwd: string;
|
|
11
13
|
file?: string;
|
|
@@ -31,4 +33,4 @@ declare function mergeConfigs(configs: ExtendableConfig[]): any;
|
|
|
31
33
|
*/
|
|
32
34
|
declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<Config>;
|
|
33
35
|
|
|
34
|
-
export { bundleConfigFile, findConfigFile, getResolvedConfig, loadConfigFile, mergeConfigs, resolveConfigFile };
|
|
36
|
+
export { bundleConfigFile, findConfigFile, getConfigDependencies, getResolvedConfig, loadConfigFile, mergeConfigs, resolveConfigFile };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
bundleConfigFile: () => bundleConfigFile,
|
|
34
34
|
findConfigFile: () => findConfigFile,
|
|
35
|
+
getConfigDependencies: () => getConfigDependencies,
|
|
35
36
|
getResolvedConfig: () => getResolvedConfig,
|
|
36
37
|
loadConfigFile: () => loadConfigFile,
|
|
37
38
|
mergeConfigs: () => mergeConfigs,
|
|
@@ -53,6 +54,57 @@ function findConfigFile({ cwd, file }) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
// src/get-mod-deps.ts
|
|
58
|
+
var import_fs = __toESM(require("fs"));
|
|
59
|
+
var import_path2 = __toESM(require("path"));
|
|
60
|
+
var jsExtensions = [".js", ".cjs", ".mjs"];
|
|
61
|
+
var jsResolutionOrder = ["", ".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"];
|
|
62
|
+
var tsResolutionOrder = ["", ".ts", ".cts", ".mts", ".tsx", ".js", ".cjs", ".mjs", ".jsx"];
|
|
63
|
+
function resolveWithExtension(file, extensions) {
|
|
64
|
+
for (const ext of extensions) {
|
|
65
|
+
const full = `${file}${ext}`;
|
|
66
|
+
if (import_fs.default.existsSync(full) && import_fs.default.statSync(full).isFile()) {
|
|
67
|
+
return full;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const ext of extensions) {
|
|
71
|
+
const full = `${file}/index${ext}`;
|
|
72
|
+
if (import_fs.default.existsSync(full)) {
|
|
73
|
+
return full;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function* getDeps(filename, base, seen, ext = import_path2.default.extname(filename)) {
|
|
79
|
+
const absoluteFile = resolveWithExtension(
|
|
80
|
+
import_path2.default.resolve(base, filename),
|
|
81
|
+
jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder
|
|
82
|
+
);
|
|
83
|
+
if (absoluteFile === null)
|
|
84
|
+
return;
|
|
85
|
+
if (seen.has(absoluteFile))
|
|
86
|
+
return;
|
|
87
|
+
seen.add(absoluteFile);
|
|
88
|
+
yield absoluteFile;
|
|
89
|
+
base = import_path2.default.dirname(absoluteFile);
|
|
90
|
+
ext = import_path2.default.extname(absoluteFile);
|
|
91
|
+
const contents = import_fs.default.readFileSync(absoluteFile, "utf-8");
|
|
92
|
+
for (const match of [
|
|
93
|
+
...contents.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
94
|
+
...contents.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
95
|
+
...contents.matchAll(/require\(['"`](.+)['"`]\)/gi)
|
|
96
|
+
]) {
|
|
97
|
+
if (!match[1].startsWith("."))
|
|
98
|
+
continue;
|
|
99
|
+
yield* getDeps(match[1], base, seen, ext);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function getConfigDependencies(filePath) {
|
|
103
|
+
if (filePath === null)
|
|
104
|
+
return /* @__PURE__ */ new Set();
|
|
105
|
+
return new Set(getDeps(filePath, import_path2.default.dirname(filePath), /* @__PURE__ */ new Set()));
|
|
106
|
+
}
|
|
107
|
+
|
|
56
108
|
// src/load-config.ts
|
|
57
109
|
var import_error = require("@pandacss/error");
|
|
58
110
|
var import_logger = require("@pandacss/logger");
|
|
@@ -61,11 +113,15 @@ var import_logger = require("@pandacss/logger");
|
|
|
61
113
|
var import_merge_anything = require("merge-anything");
|
|
62
114
|
|
|
63
115
|
// src/bundle.ts
|
|
64
|
-
var
|
|
65
|
-
async
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
116
|
+
var import_jiti = __toESM(require("jiti"));
|
|
117
|
+
var bundle = async (filePath, cwd) => {
|
|
118
|
+
const jiti = (0, import_jiti.default)(cwd, { cache: false, requireCache: false, v8cache: false });
|
|
119
|
+
const conf = jiti(filePath);
|
|
120
|
+
return {
|
|
121
|
+
config: conf.default ? conf.default : conf,
|
|
122
|
+
dependencies: Array.from(getConfigDependencies(filePath))
|
|
123
|
+
};
|
|
124
|
+
};
|
|
69
125
|
|
|
70
126
|
// src/utils.ts
|
|
71
127
|
var isObject = (value) => {
|
|
@@ -186,6 +242,7 @@ async function bundleConfigFile(options) {
|
|
|
186
242
|
0 && (module.exports = {
|
|
187
243
|
bundleConfigFile,
|
|
188
244
|
findConfigFile,
|
|
245
|
+
getConfigDependencies,
|
|
189
246
|
getResolvedConfig,
|
|
190
247
|
loadConfigFile,
|
|
191
248
|
mergeConfigs,
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,57 @@ function findConfigFile({ cwd, file }) {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
// src/get-mod-deps.ts
|
|
16
|
+
import fs from "fs";
|
|
17
|
+
import path from "path";
|
|
18
|
+
var jsExtensions = [".js", ".cjs", ".mjs"];
|
|
19
|
+
var jsResolutionOrder = ["", ".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"];
|
|
20
|
+
var tsResolutionOrder = ["", ".ts", ".cts", ".mts", ".tsx", ".js", ".cjs", ".mjs", ".jsx"];
|
|
21
|
+
function resolveWithExtension(file, extensions) {
|
|
22
|
+
for (const ext of extensions) {
|
|
23
|
+
const full = `${file}${ext}`;
|
|
24
|
+
if (fs.existsSync(full) && fs.statSync(full).isFile()) {
|
|
25
|
+
return full;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const ext of extensions) {
|
|
29
|
+
const full = `${file}/index${ext}`;
|
|
30
|
+
if (fs.existsSync(full)) {
|
|
31
|
+
return full;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function* getDeps(filename, base, seen, ext = path.extname(filename)) {
|
|
37
|
+
const absoluteFile = resolveWithExtension(
|
|
38
|
+
path.resolve(base, filename),
|
|
39
|
+
jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder
|
|
40
|
+
);
|
|
41
|
+
if (absoluteFile === null)
|
|
42
|
+
return;
|
|
43
|
+
if (seen.has(absoluteFile))
|
|
44
|
+
return;
|
|
45
|
+
seen.add(absoluteFile);
|
|
46
|
+
yield absoluteFile;
|
|
47
|
+
base = path.dirname(absoluteFile);
|
|
48
|
+
ext = path.extname(absoluteFile);
|
|
49
|
+
const contents = fs.readFileSync(absoluteFile, "utf-8");
|
|
50
|
+
for (const match of [
|
|
51
|
+
...contents.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
52
|
+
...contents.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
53
|
+
...contents.matchAll(/require\(['"`](.+)['"`]\)/gi)
|
|
54
|
+
]) {
|
|
55
|
+
if (!match[1].startsWith("."))
|
|
56
|
+
continue;
|
|
57
|
+
yield* getDeps(match[1], base, seen, ext);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function getConfigDependencies(filePath) {
|
|
61
|
+
if (filePath === null)
|
|
62
|
+
return /* @__PURE__ */ new Set();
|
|
63
|
+
return new Set(getDeps(filePath, path.dirname(filePath), /* @__PURE__ */ new Set()));
|
|
64
|
+
}
|
|
65
|
+
|
|
15
66
|
// src/load-config.ts
|
|
16
67
|
import { ConfigError, ConfigNotFoundError } from "@pandacss/error";
|
|
17
68
|
import { logger } from "@pandacss/logger";
|
|
@@ -20,11 +71,15 @@ import { logger } from "@pandacss/logger";
|
|
|
20
71
|
import { mergeAndConcat } from "merge-anything";
|
|
21
72
|
|
|
22
73
|
// src/bundle.ts
|
|
23
|
-
import
|
|
24
|
-
async
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
74
|
+
import createJITI from "jiti";
|
|
75
|
+
var bundle = async (filePath, cwd) => {
|
|
76
|
+
const jiti = createJITI(cwd, { cache: false, requireCache: false, v8cache: false });
|
|
77
|
+
const conf = jiti(filePath);
|
|
78
|
+
return {
|
|
79
|
+
config: conf.default ? conf.default : conf,
|
|
80
|
+
dependencies: Array.from(getConfigDependencies(filePath))
|
|
81
|
+
};
|
|
82
|
+
};
|
|
28
83
|
|
|
29
84
|
// src/utils.ts
|
|
30
85
|
var isObject = (value) => {
|
|
@@ -144,6 +199,7 @@ async function bundleConfigFile(options) {
|
|
|
144
199
|
export {
|
|
145
200
|
bundleConfigFile,
|
|
146
201
|
findConfigFile,
|
|
202
|
+
getConfigDependencies,
|
|
147
203
|
getResolvedConfig,
|
|
148
204
|
loadConfigFile,
|
|
149
205
|
mergeConfigs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230530153916",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bundle-n-require": "^1.0.1",
|
|
18
|
-
"merge-anything": "^5.1.7",
|
|
19
17
|
"escalade": "3.1.1",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"@pandacss/
|
|
18
|
+
"jiti": "^1.18.2",
|
|
19
|
+
"merge-anything": "^5.1.7",
|
|
20
|
+
"@pandacss/error": "0.0.0-dev-20230530153916",
|
|
21
|
+
"@pandacss/logger": "0.0.0-dev-20230530153916",
|
|
22
|
+
"@pandacss/types": "0.0.0-dev-20230530153916"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "pnpm tsup src/index.ts --format=esm,cjs --shims --dts",
|