@pandacss/config 2.1.1 → 2.2.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/import-meta-url-SQ7JCEJ3.js +34 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +103 -81
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/import-meta-url.ts
|
|
2
|
+
import { parse } from "acorn";
|
|
3
|
+
import { simple } from "acorn-walk";
|
|
4
|
+
import MagicString from "magic-string";
|
|
5
|
+
function replaceImportMetaUrl(code, replacement) {
|
|
6
|
+
const ast = parse(code, {
|
|
7
|
+
ecmaVersion: "latest",
|
|
8
|
+
sourceType: "module"
|
|
9
|
+
});
|
|
10
|
+
const output = new MagicString(code);
|
|
11
|
+
let changed = false;
|
|
12
|
+
simple(ast, {
|
|
13
|
+
MemberExpression(node) {
|
|
14
|
+
if (!isImportMetaUrl(node)) return;
|
|
15
|
+
output.overwrite(node.start, node.end, replacement);
|
|
16
|
+
changed = true;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return changed ? output.toString() : code;
|
|
20
|
+
}
|
|
21
|
+
function isImportMetaUrl(node) {
|
|
22
|
+
if (node.computed || !isIdentifier(node.property, "url")) return false;
|
|
23
|
+
const object = node.object;
|
|
24
|
+
return isNode(object, "MetaProperty") && isIdentifier(object.meta, "import") && isIdentifier(object.property, "meta");
|
|
25
|
+
}
|
|
26
|
+
function isIdentifier(value, name) {
|
|
27
|
+
return isNode(value, "Identifier") && value.name === name;
|
|
28
|
+
}
|
|
29
|
+
function isNode(value, type) {
|
|
30
|
+
return !!value && typeof value === "object" && value.type === type;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
replaceImportMetaUrl
|
|
34
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ interface DesignSystemArtifactConflict {
|
|
|
53
53
|
patterns: string[];
|
|
54
54
|
}
|
|
55
55
|
declare function collectArtifactConflicts(metadata: DesignSystemMetadata | undefined): DesignSystemArtifactConflict[];
|
|
56
|
-
declare function collectExportMissingDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
56
|
+
declare function collectExportMissingDiagnostics(metadata: DesignSystemMetadata | undefined, jsxFramework?: string): Diagnostic[];
|
|
57
57
|
declare function collectNameCollisionDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
58
58
|
|
|
59
59
|
interface LoadConfigOptions {
|
package/dist/index.js
CHANGED
|
@@ -21,24 +21,22 @@ import {
|
|
|
21
21
|
import { applyConfigDefaults as applyConfigDefaults2 } from "@pandacss/compiler-shared";
|
|
22
22
|
|
|
23
23
|
// src/bundle.ts
|
|
24
|
-
import { existsSync, realpathSync } from "node:fs";
|
|
24
|
+
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
25
25
|
import { mkdir, unlink, writeFile } from "node:fs/promises";
|
|
26
26
|
import { builtinModules } from "node:module";
|
|
27
27
|
import { tmpdir } from "node:os";
|
|
28
|
-
import { basename, dirname, isAbsolute as isAbsolute2, join, normalize, relative } from "node:path";
|
|
28
|
+
import { basename, dirname, extname, isAbsolute as isAbsolute2, join, normalize, relative, sep } from "node:path";
|
|
29
29
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
30
30
|
|
|
31
31
|
// src/bundle-plugins.ts
|
|
32
|
-
import { parse } from "acorn";
|
|
33
|
-
import { simple } from "acorn-walk";
|
|
34
|
-
import MagicString from "magic-string";
|
|
35
32
|
import { isAbsolute } from "node:path";
|
|
36
33
|
import { pathToFileURL } from "node:url";
|
|
37
34
|
function importMetaUrlPlugin() {
|
|
38
35
|
return {
|
|
39
36
|
name: "panda-import-meta-url",
|
|
40
|
-
transform(code, id) {
|
|
37
|
+
async transform(code, id) {
|
|
41
38
|
if (!isAbsolute(id) || !code.includes("import.meta.url")) return;
|
|
39
|
+
const { replaceImportMetaUrl } = await import("./import-meta-url-SQ7JCEJ3.js");
|
|
42
40
|
const replacement = JSON.stringify(pathToFileURL(id).href);
|
|
43
41
|
const patched = replaceImportMetaUrl(code, replacement);
|
|
44
42
|
if (patched === code) return;
|
|
@@ -46,32 +44,52 @@ function importMetaUrlPlugin() {
|
|
|
46
44
|
}
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
var sideEffectImportRe = /^[ \t]*import[ \t]*(['"])([^'"\n]+)\1/gm;
|
|
48
|
+
var nodeModulesRe = /[\\/]node_modules[\\/]/;
|
|
49
|
+
function sideEffectImportsPlugin() {
|
|
50
|
+
const importsByFile = /* @__PURE__ */ new Map();
|
|
51
|
+
return {
|
|
52
|
+
name: "panda-side-effect-imports",
|
|
53
|
+
transform(code, id) {
|
|
54
|
+
if (nodeModulesRe.test(id) || !code.includes("import")) return;
|
|
55
|
+
const specifiers = new Set(Array.from(code.matchAll(sideEffectImportRe), (match) => match[2]));
|
|
56
|
+
if (specifiers.size > 0) importsByFile.set(id, specifiers);
|
|
57
|
+
},
|
|
58
|
+
async resolveId(source, importer) {
|
|
59
|
+
if (!importer || !importsByFile.get(importer)?.has(source)) return;
|
|
60
|
+
const resolved = await this.resolve(source, importer, { skipSelf: true });
|
|
61
|
+
return resolved && { ...resolved, moduleSideEffects: true };
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
-
return changed ? output.toString() : code;
|
|
63
|
+
};
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
|
|
66
|
+
// src/resolve.ts
|
|
67
|
+
import { createRequire } from "node:module";
|
|
68
|
+
import { resolve } from "node:path";
|
|
69
|
+
function tryResolveFrom(request, fromDir) {
|
|
70
|
+
try {
|
|
71
|
+
return createRequire(resolve(fromDir, "noop.js")).resolve(request, { paths: [fromDir] });
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (isResolveMiss(error)) return void 0;
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
77
|
+
function isResolveMiss(error) {
|
|
78
|
+
const code = errorCode(error);
|
|
79
|
+
return code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
|
|
72
80
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
81
|
+
function resolveFrom(request, fromDir) {
|
|
82
|
+
try {
|
|
83
|
+
return { kind: "resolved", path: createRequire(resolve(fromDir, "noop.js")).resolve(request, { paths: [fromDir] }) };
|
|
84
|
+
} catch (error) {
|
|
85
|
+
const code = errorCode(error);
|
|
86
|
+
if (code === "ERR_PACKAGE_PATH_NOT_EXPORTED") return { kind: "not-exported" };
|
|
87
|
+
if (code === "MODULE_NOT_FOUND") return { kind: "not-installed" };
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function errorCode(error) {
|
|
92
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
75
93
|
}
|
|
76
94
|
|
|
77
95
|
// src/bundle.ts
|
|
@@ -83,8 +101,8 @@ async function bundleConfig(filepath, cwd) {
|
|
|
83
101
|
cwd,
|
|
84
102
|
platform: "node",
|
|
85
103
|
external: (id) => nodeBuiltins.has(id),
|
|
86
|
-
treeshake:
|
|
87
|
-
plugins: [importMetaUrlPlugin()]
|
|
104
|
+
treeshake: true,
|
|
105
|
+
plugins: [importMetaUrlPlugin(), sideEffectImportsPlugin()]
|
|
88
106
|
});
|
|
89
107
|
let chunks;
|
|
90
108
|
try {
|
|
@@ -98,10 +116,40 @@ async function bundleConfig(filepath, cwd) {
|
|
|
98
116
|
}
|
|
99
117
|
const dependencies = collectDependencies(chunks.output, filepath, cwd);
|
|
100
118
|
const mod = await loadBundledModule(filepath, output.code);
|
|
119
|
+
return { config: await configFromModule(mod), dependencies };
|
|
120
|
+
}
|
|
121
|
+
async function importInstalledConfig(specifier, cwd) {
|
|
122
|
+
if (specifier.startsWith(".") || isAbsolute2(specifier)) return void 0;
|
|
123
|
+
const resolved = tryResolveFrom(specifier, cwd);
|
|
124
|
+
if (!resolved) return void 0;
|
|
125
|
+
const file = canonical(resolved);
|
|
126
|
+
if (!file.includes(`${sep}node_modules${sep}`) || !isEsmFile(file)) return void 0;
|
|
127
|
+
const mod = await import(
|
|
128
|
+
/* @vite-ignore */
|
|
129
|
+
`${pathToFileURL2(file).href}?mtime=${statSync(file).mtimeMs}`
|
|
130
|
+
);
|
|
131
|
+
return { config: await configFromModule(mod), dependencies: [normalize(relative(canonical(cwd), file))] };
|
|
132
|
+
}
|
|
133
|
+
async function configFromModule(mod) {
|
|
101
134
|
const hasDefaultExport = Object.prototype.hasOwnProperty.call(mod ?? {}, "default");
|
|
102
135
|
const exported = hasDefaultExport ? mod.default : mod;
|
|
103
|
-
|
|
104
|
-
|
|
136
|
+
return hasDefaultExport && isPromiseLike(exported) ? await exported : exported;
|
|
137
|
+
}
|
|
138
|
+
function isEsmFile(file) {
|
|
139
|
+
const extension = extname(file);
|
|
140
|
+
if (extension === ".mjs") return true;
|
|
141
|
+
if (extension !== ".js") return false;
|
|
142
|
+
return nearestPackageType(dirname(file)) === "module";
|
|
143
|
+
}
|
|
144
|
+
function nearestPackageType(start) {
|
|
145
|
+
let current = start;
|
|
146
|
+
while (true) {
|
|
147
|
+
const candidate = join(current, "package.json");
|
|
148
|
+
if (existsSync(candidate)) return JSON.parse(readFileSync(candidate, "utf8")).type;
|
|
149
|
+
const parent = dirname(current);
|
|
150
|
+
if (parent === current) return void 0;
|
|
151
|
+
current = parent;
|
|
152
|
+
}
|
|
105
153
|
}
|
|
106
154
|
async function loadBundledModule(filepath, code) {
|
|
107
155
|
const target = tempTargetFor(filepath);
|
|
@@ -179,7 +227,7 @@ function canonical(filepath) {
|
|
|
179
227
|
|
|
180
228
|
// src/find.ts
|
|
181
229
|
import { readdirSync } from "node:fs";
|
|
182
|
-
import { dirname as dirname2, resolve } from "node:path";
|
|
230
|
+
import { dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
183
231
|
var configFiles = /* @__PURE__ */ new Set([
|
|
184
232
|
"panda.config.ts",
|
|
185
233
|
"panda.config.js",
|
|
@@ -190,7 +238,7 @@ var configFiles = /* @__PURE__ */ new Set([
|
|
|
190
238
|
]);
|
|
191
239
|
var isPandaConfig = (file) => configFiles.has(file);
|
|
192
240
|
function findUp(cwd) {
|
|
193
|
-
let dir =
|
|
241
|
+
let dir = resolve2(cwd);
|
|
194
242
|
while (true) {
|
|
195
243
|
let entries;
|
|
196
244
|
try {
|
|
@@ -199,7 +247,7 @@ function findUp(cwd) {
|
|
|
199
247
|
entries = [];
|
|
200
248
|
}
|
|
201
249
|
const match = entries.find(isPandaConfig);
|
|
202
|
-
if (match) return
|
|
250
|
+
if (match) return resolve2(dir, match);
|
|
203
251
|
const parent = dirname2(dir);
|
|
204
252
|
if (parent === dir) return void 0;
|
|
205
253
|
dir = parent;
|
|
@@ -208,7 +256,7 @@ function findUp(cwd) {
|
|
|
208
256
|
function findConfig(options) {
|
|
209
257
|
const { cwd, file } = options;
|
|
210
258
|
if (file) {
|
|
211
|
-
return
|
|
259
|
+
return resolve2(cwd, file);
|
|
212
260
|
}
|
|
213
261
|
const configPath = findUp(cwd);
|
|
214
262
|
if (!configPath) {
|
|
@@ -441,41 +489,12 @@ import { normalize as normalize2, relative as relative5 } from "node:path";
|
|
|
441
489
|
import {
|
|
442
490
|
outdirBasename
|
|
443
491
|
} from "@pandacss/compiler-shared";
|
|
444
|
-
import { readFileSync as
|
|
492
|
+
import { readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
445
493
|
import { dirname as dirname4, resolve as resolve4 } from "node:path";
|
|
446
494
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
447
495
|
|
|
448
|
-
// src/resolve.ts
|
|
449
|
-
import { createRequire } from "node:module";
|
|
450
|
-
import { resolve as resolve2 } from "node:path";
|
|
451
|
-
function tryResolveFrom(request, fromDir) {
|
|
452
|
-
try {
|
|
453
|
-
return createRequire(resolve2(fromDir, "noop.js")).resolve(request, { paths: [fromDir] });
|
|
454
|
-
} catch (error) {
|
|
455
|
-
if (isResolveMiss(error)) return void 0;
|
|
456
|
-
throw error;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function isResolveMiss(error) {
|
|
460
|
-
const code = errorCode(error);
|
|
461
|
-
return code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
|
|
462
|
-
}
|
|
463
|
-
function resolveFrom(request, fromDir) {
|
|
464
|
-
try {
|
|
465
|
-
return { kind: "resolved", path: createRequire(resolve2(fromDir, "noop.js")).resolve(request, { paths: [fromDir] }) };
|
|
466
|
-
} catch (error) {
|
|
467
|
-
const code = errorCode(error);
|
|
468
|
-
if (code === "ERR_PACKAGE_PATH_NOT_EXPORTED") return { kind: "not-exported" };
|
|
469
|
-
if (code === "MODULE_NOT_FOUND") return { kind: "not-installed" };
|
|
470
|
-
throw error;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function errorCode(error) {
|
|
474
|
-
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
496
|
// src/design-system/package.ts
|
|
478
|
-
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
497
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
479
498
|
import { dirname as dirname3, join as join2 } from "node:path";
|
|
480
499
|
|
|
481
500
|
// src/design-system/publishable-files.ts
|
|
@@ -598,7 +617,7 @@ function readPackageIdentity(cwd) {
|
|
|
598
617
|
if (packagePath === void 0) {
|
|
599
618
|
throw new Error(`Could not find a package.json from ${JSON.stringify(cwd)} to build the design system manifest.`);
|
|
600
619
|
}
|
|
601
|
-
const pkg = JSON.parse(
|
|
620
|
+
const pkg = JSON.parse(readFileSync2(packagePath, "utf8"));
|
|
602
621
|
const name = pkg.name;
|
|
603
622
|
if (typeof name !== "string" || name.length === 0) {
|
|
604
623
|
throw new Error(`${JSON.stringify(packagePath)} has no "name"; a design system must be a named package.`);
|
|
@@ -730,7 +749,7 @@ function collectArtifactConflicts(metadata) {
|
|
|
730
749
|
patterns: ds.patternNames.filter((name) => appPatterns.has(name))
|
|
731
750
|
})).filter((entry) => entry.recipes.length > 0 || entry.patterns.length > 0);
|
|
732
751
|
}
|
|
733
|
-
function collectExportMissingDiagnostics(metadata) {
|
|
752
|
+
function collectExportMissingDiagnostics(metadata, jsxFramework) {
|
|
734
753
|
const overlay = buildCodegenOverlay(metadata);
|
|
735
754
|
if (!overlay) return [];
|
|
736
755
|
const [ds] = metadata.designSystem;
|
|
@@ -745,9 +764,8 @@ function collectExportMissingDiagnostics(metadata) {
|
|
|
745
764
|
if (overlay.ownedPatterns.length > 0) {
|
|
746
765
|
required.push("./patterns", "./patterns/*");
|
|
747
766
|
}
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
if (overlay.ownedPatterns.length > 0 || overlay.virtualizeCss && (appPatterns > 0 || dsPatterns > 0)) {
|
|
767
|
+
const reexportsJsx = overlay.virtualizeCss || overlay.ownedPatterns.length > 0;
|
|
768
|
+
if (generatesJsx(jsxFramework) && reexportsJsx) {
|
|
751
769
|
required.push("./jsx", "./jsx/*");
|
|
752
770
|
}
|
|
753
771
|
return required.filter((subpath) => !hasExport(ds.packageExports, subpath)).map((subpath) => exportMissingDiagnostic(ds.name, subpath));
|
|
@@ -795,6 +813,10 @@ function identCollisions(kind, names) {
|
|
|
795
813
|
}
|
|
796
814
|
return collisions;
|
|
797
815
|
}
|
|
816
|
+
var JSX_FRAMEWORKS = /* @__PURE__ */ new Set(["react", "preact", "solid", "vue"]);
|
|
817
|
+
function generatesJsx(jsxFramework) {
|
|
818
|
+
return jsxFramework !== void 0 && JSX_FRAMEWORKS.has(jsxFramework);
|
|
819
|
+
}
|
|
798
820
|
function hasExport(packageExports, subpath) {
|
|
799
821
|
return packageExports != null && Object.prototype.hasOwnProperty.call(packageExports, subpath);
|
|
800
822
|
}
|
|
@@ -843,7 +865,7 @@ function manifestNotExportedError(spec) {
|
|
|
843
865
|
async function loadManifestLevel(spec, manifestPath, deps) {
|
|
844
866
|
let parsed;
|
|
845
867
|
try {
|
|
846
|
-
parsed = JSON.parse(
|
|
868
|
+
parsed = JSON.parse(readFileSync3(manifestPath, "utf8"));
|
|
847
869
|
} catch (error) {
|
|
848
870
|
const message = `Failed to parse ${JSON.stringify(manifestPath)} as JSON: ${errorMessage(error)}. This file must be generated by \`panda lib\`, not hand-written or added to \`include\`.`;
|
|
849
871
|
throw createConfigError(message, [
|
|
@@ -894,7 +916,7 @@ function readPackageExports(manifestPath) {
|
|
|
894
916
|
try {
|
|
895
917
|
const packageJsonPath = nearestPackageJson(dirname4(manifestPath));
|
|
896
918
|
if (packageJsonPath === void 0) return void 0;
|
|
897
|
-
const pkg = JSON.parse(
|
|
919
|
+
const pkg = JSON.parse(readFileSync3(packageJsonPath, "utf8"));
|
|
898
920
|
return isExportsMap(pkg.exports) ? pkg.exports : void 0;
|
|
899
921
|
} catch {
|
|
900
922
|
return void 0;
|
|
@@ -905,7 +927,7 @@ function isExportsMap(value) {
|
|
|
905
927
|
}
|
|
906
928
|
function presetImportUrl(path) {
|
|
907
929
|
const url = pathToFileURL3(path);
|
|
908
|
-
url.searchParams.set("mtime", String(
|
|
930
|
+
url.searchParams.set("mtime", String(statSync2(path).mtimeMs));
|
|
909
931
|
return url.href;
|
|
910
932
|
}
|
|
911
933
|
function designSystemImportMap(map, spec) {
|
|
@@ -1010,7 +1032,7 @@ function unsupportedSpecifierError(spec, protocol) {
|
|
|
1010
1032
|
|
|
1011
1033
|
// src/design-system/smart-include.ts
|
|
1012
1034
|
import { existsSync as existsSync3 } from "node:fs";
|
|
1013
|
-
import { dirname as dirname5, isAbsolute as isAbsolute4, join as join3, relative as relative4, resolve as resolve5, sep } from "node:path";
|
|
1035
|
+
import { dirname as dirname5, isAbsolute as isAbsolute4, join as join3, relative as relative4, resolve as resolve5, sep as sep2 } from "node:path";
|
|
1014
1036
|
var SMART_INCLUDE_EXTENSIONS = ["js", "mjs", "cjs", "jsx", "ts", "cts", "mts", "tsx", "vue", "svelte", "astro"];
|
|
1015
1037
|
var MANIFEST_SUBPATH = "panda/lib.json";
|
|
1016
1038
|
var PACKAGE_SPECIFIER = /^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/i;
|
|
@@ -1079,7 +1101,7 @@ function tryResolve(request, cwd) {
|
|
|
1079
1101
|
function isInsideCwd(relativePath) {
|
|
1080
1102
|
if (relativePath === "" || relativePath === "..") return false;
|
|
1081
1103
|
if (isAbsolute4(relativePath)) return false;
|
|
1082
|
-
return !relativePath.startsWith(`..${
|
|
1104
|
+
return !relativePath.startsWith(`..${sep2}`);
|
|
1083
1105
|
}
|
|
1084
1106
|
function nearestPackageDir(from) {
|
|
1085
1107
|
let dir = dirname5(from);
|
|
@@ -1309,7 +1331,7 @@ function collectPresetResolvedHooks(config) {
|
|
|
1309
1331
|
return collectPluginHookHandlers(config, "preset:resolved");
|
|
1310
1332
|
}
|
|
1311
1333
|
async function runPresetResolvedHooks(preset, source, hooks) {
|
|
1312
|
-
let current = preset;
|
|
1334
|
+
let current = hooks.length > 0 ? clone(preset) : preset;
|
|
1313
1335
|
const name = source.name ?? source.specifier ?? presetName(current) ?? "unknown-preset";
|
|
1314
1336
|
for (const entry of hooks) {
|
|
1315
1337
|
const hook = normalizeHook(entry.value, "preset:resolved");
|
|
@@ -1323,7 +1345,7 @@ async function runPresetResolvedHooks(preset, source, hooks) {
|
|
|
1323
1345
|
async function resolvePreset(preset, cwd) {
|
|
1324
1346
|
if (typeof preset === "string") {
|
|
1325
1347
|
try {
|
|
1326
|
-
const result = await bundleConfig(preset, cwd);
|
|
1348
|
+
const result = await importInstalledConfig(preset, cwd) ?? await bundleConfig(preset, cwd);
|
|
1327
1349
|
return {
|
|
1328
1350
|
config: ensureConfigObject(result.config, preset),
|
|
1329
1351
|
dependencies: result.dependencies,
|
|
@@ -1551,7 +1573,7 @@ function isConfigSnapshot(input) {
|
|
|
1551
1573
|
}
|
|
1552
1574
|
|
|
1553
1575
|
// src/version.ts
|
|
1554
|
-
import { readFileSync as
|
|
1576
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
1555
1577
|
import { dirname as dirname6, join as join4 } from "node:path";
|
|
1556
1578
|
import { fileURLToPath } from "node:url";
|
|
1557
1579
|
var MAJOR_VERSION_RE = /\d+/;
|
|
@@ -1559,7 +1581,7 @@ var STAMPABLE_PANDA_RANGE_RE = /^[v=><~^]|^\d/;
|
|
|
1559
1581
|
function readPandaVersion() {
|
|
1560
1582
|
try {
|
|
1561
1583
|
const pkgPath = join4(dirname6(fileURLToPath(import.meta.url)), "../package.json");
|
|
1562
|
-
return JSON.parse(
|
|
1584
|
+
return JSON.parse(readFileSync4(pkgPath, "utf8")).version;
|
|
1563
1585
|
} catch {
|
|
1564
1586
|
return void 0;
|
|
1565
1587
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Self-contained loader that bundles and serializes a Panda config for the Rust compiler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@pandacss/compiler-shared": "2.
|
|
43
|
-
"@pandacss/types": "2.
|
|
42
|
+
"@pandacss/compiler-shared": "2.2.0",
|
|
43
|
+
"@pandacss/types": "2.2.0",
|
|
44
44
|
"acorn": "^8.17.0",
|
|
45
45
|
"acorn-walk": "^8.3.5",
|
|
46
46
|
"javascript-stringify": "2.1.0",
|