@pandacss/config 0.54.0 → 1.0.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/{chunk-4TLLLDPT.mjs → chunk-B47HB6K3.mjs} +5 -10
- package/dist/{chunk-Q2O7DCQS.mjs → chunk-U3UHISDU.mjs} +5 -8
- package/dist/diff-config.js +5 -8
- package/dist/diff-config.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +51 -75
- package/dist/index.mjs +21 -37
- package/dist/merge-config.js +3 -6
- package/dist/merge-config.mjs +1 -1
- package/package.json +8 -8
|
@@ -124,11 +124,9 @@ var isTokenReference = (value) => typeof value === "string" && REFERENCE_REGEX.t
|
|
|
124
124
|
var formatPath = (path) => path;
|
|
125
125
|
var SEP = ".";
|
|
126
126
|
function getReferences(value) {
|
|
127
|
-
if (typeof value !== "string")
|
|
128
|
-
return [];
|
|
127
|
+
if (typeof value !== "string") return [];
|
|
129
128
|
const matches = value.match(REFERENCE_REGEX);
|
|
130
|
-
if (!matches)
|
|
131
|
-
return [];
|
|
129
|
+
if (!matches) return [];
|
|
132
130
|
return matches.map((match) => match.replace(curlyBracketRegex, "")).map((value2) => {
|
|
133
131
|
return value2.trim().split("/")[0];
|
|
134
132
|
});
|
|
@@ -149,8 +147,7 @@ var serializeTokenValue = (value) => {
|
|
|
149
147
|
// src/merge-config.ts
|
|
150
148
|
function getExtends(items) {
|
|
151
149
|
return items.reduce((merged, { extend }) => {
|
|
152
|
-
if (!extend)
|
|
153
|
-
return merged;
|
|
150
|
+
if (!extend) return merged;
|
|
154
151
|
return mergeWith(merged, extend, (originalValue, newValue) => {
|
|
155
152
|
if (newValue === void 0) {
|
|
156
153
|
return originalValue ?? [];
|
|
@@ -214,16 +211,14 @@ function mergeConfigs(configs) {
|
|
|
214
211
|
if (withoutEmpty.theme?.tokens) {
|
|
215
212
|
walkObject(withoutEmpty.theme.tokens, (args) => args, {
|
|
216
213
|
stop(token) {
|
|
217
|
-
if (!isValidToken(token))
|
|
218
|
-
return false;
|
|
214
|
+
if (!isValidToken(token)) return false;
|
|
219
215
|
const keys = Object.keys(token);
|
|
220
216
|
const nestedKeys = keys.filter((k) => !tokenKeys.includes(k));
|
|
221
217
|
const nested = nestedKeys.length > 0;
|
|
222
218
|
if (nested) {
|
|
223
219
|
token.DEFAULT ||= {};
|
|
224
220
|
tokenKeys.forEach((key) => {
|
|
225
|
-
if (token[key] == null)
|
|
226
|
-
return;
|
|
221
|
+
if (token[key] == null) return;
|
|
227
222
|
token.DEFAULT[key] ||= token[key];
|
|
228
223
|
delete token[key];
|
|
229
224
|
});
|
|
@@ -4,8 +4,7 @@ import microdiff from "microdiff";
|
|
|
4
4
|
|
|
5
5
|
// src/create-matcher.ts
|
|
6
6
|
function createMatcher(id, patterns) {
|
|
7
|
-
if (!patterns?.length)
|
|
8
|
-
return () => void 0;
|
|
7
|
+
if (!patterns?.length) return () => void 0;
|
|
9
8
|
const includePatterns = [];
|
|
10
9
|
const excludePatterns = [];
|
|
11
10
|
const deduped = new Set(patterns);
|
|
@@ -20,8 +19,7 @@ function createMatcher(id, patterns) {
|
|
|
20
19
|
const include = new RegExp(includePatterns.join("|"));
|
|
21
20
|
const exclude = new RegExp(excludePatterns.join("|"));
|
|
22
21
|
return (path) => {
|
|
23
|
-
if (excludePatterns.length && exclude.test(path))
|
|
24
|
-
return;
|
|
22
|
+
if (excludePatterns.length && exclude.test(path)) return;
|
|
25
23
|
return include.test(path) ? id : void 0;
|
|
26
24
|
};
|
|
27
25
|
}
|
|
@@ -78,6 +76,7 @@ var artifactConfigDeps = {
|
|
|
78
76
|
"jsx-helpers": jsx,
|
|
79
77
|
"jsx-patterns": jsx.concat("patterns"),
|
|
80
78
|
"jsx-patterns-index": jsx.concat("patterns"),
|
|
79
|
+
"jsx-create-style-context": jsx,
|
|
81
80
|
"css-index": ["syntax"],
|
|
82
81
|
"package.json": ["forceConsistentTypeExtension", "outExtension"],
|
|
83
82
|
"types-styles": ["shorthands"],
|
|
@@ -89,8 +88,7 @@ var artifactConfigDeps = {
|
|
|
89
88
|
themes: ["themes"].concat(tokens)
|
|
90
89
|
};
|
|
91
90
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
92
|
-
if (!paths.length)
|
|
93
|
-
return () => void 0;
|
|
91
|
+
if (!paths.length) return () => void 0;
|
|
94
92
|
return createMatcher(key, paths.concat(all));
|
|
95
93
|
});
|
|
96
94
|
|
|
@@ -116,8 +114,7 @@ function diffConfigs(config, prevConfig) {
|
|
|
116
114
|
const changePath = change.path.join(".");
|
|
117
115
|
artifactMatchers.forEach((matcher) => {
|
|
118
116
|
const id = matcher(changePath);
|
|
119
|
-
if (!id)
|
|
120
|
-
return;
|
|
117
|
+
if (!id) return;
|
|
121
118
|
if (id === "recipes") {
|
|
122
119
|
const name = dashCase(change.path.slice(1, 3).join("."));
|
|
123
120
|
affected.artifacts.add(name);
|
package/dist/diff-config.js
CHANGED
|
@@ -38,8 +38,7 @@ var import_microdiff = __toESM(require("microdiff"));
|
|
|
38
38
|
|
|
39
39
|
// src/create-matcher.ts
|
|
40
40
|
function createMatcher(id, patterns) {
|
|
41
|
-
if (!patterns?.length)
|
|
42
|
-
return () => void 0;
|
|
41
|
+
if (!patterns?.length) return () => void 0;
|
|
43
42
|
const includePatterns = [];
|
|
44
43
|
const excludePatterns = [];
|
|
45
44
|
const deduped = new Set(patterns);
|
|
@@ -54,8 +53,7 @@ function createMatcher(id, patterns) {
|
|
|
54
53
|
const include = new RegExp(includePatterns.join("|"));
|
|
55
54
|
const exclude = new RegExp(excludePatterns.join("|"));
|
|
56
55
|
return (path) => {
|
|
57
|
-
if (excludePatterns.length && exclude.test(path))
|
|
58
|
-
return;
|
|
56
|
+
if (excludePatterns.length && exclude.test(path)) return;
|
|
59
57
|
return include.test(path) ? id : void 0;
|
|
60
58
|
};
|
|
61
59
|
}
|
|
@@ -112,6 +110,7 @@ var artifactConfigDeps = {
|
|
|
112
110
|
"jsx-helpers": jsx,
|
|
113
111
|
"jsx-patterns": jsx.concat("patterns"),
|
|
114
112
|
"jsx-patterns-index": jsx.concat("patterns"),
|
|
113
|
+
"jsx-create-style-context": jsx,
|
|
115
114
|
"css-index": ["syntax"],
|
|
116
115
|
"package.json": ["forceConsistentTypeExtension", "outExtension"],
|
|
117
116
|
"types-styles": ["shorthands"],
|
|
@@ -123,8 +122,7 @@ var artifactConfigDeps = {
|
|
|
123
122
|
themes: ["themes"].concat(tokens)
|
|
124
123
|
};
|
|
125
124
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
126
|
-
if (!paths.length)
|
|
127
|
-
return () => void 0;
|
|
125
|
+
if (!paths.length) return () => void 0;
|
|
128
126
|
return createMatcher(key, paths.concat(all));
|
|
129
127
|
});
|
|
130
128
|
|
|
@@ -150,8 +148,7 @@ function diffConfigs(config, prevConfig) {
|
|
|
150
148
|
const changePath = change.path.join(".");
|
|
151
149
|
artifactMatchers.forEach((matcher) => {
|
|
152
150
|
const id = matcher(changePath);
|
|
153
|
-
if (!id)
|
|
154
|
-
return;
|
|
151
|
+
if (!id) return;
|
|
155
152
|
if (id === "recipes") {
|
|
156
153
|
const name = (0, import_shared.dashCase)(change.path.slice(1, 3).join("."));
|
|
157
154
|
affected.artifacts.add(name);
|
package/dist/diff-config.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
2
|
import { Config, ConfigTsOptions, LoadConfigResult } from '@pandacss/types';
|
|
3
3
|
export { diffConfigs } from './diff-config.mjs';
|
|
4
|
+
import { TSConfig } from 'pkg-types';
|
|
4
5
|
import { P as PathMapping } from './ts-config-paths-qwrwgu2Q.mjs';
|
|
5
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-qwrwgu2Q.mjs';
|
|
6
|
-
import { TSConfig } from 'pkg-types';
|
|
7
7
|
export { mergeConfigs } from './merge-config.mjs';
|
|
8
8
|
|
|
9
9
|
interface ConfigFileOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
2
|
import { Config, ConfigTsOptions, LoadConfigResult } from '@pandacss/types';
|
|
3
3
|
export { diffConfigs } from './diff-config.js';
|
|
4
|
+
import { TSConfig } from 'pkg-types';
|
|
4
5
|
import { P as PathMapping } from './ts-config-paths-qwrwgu2Q.js';
|
|
5
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-qwrwgu2Q.js';
|
|
6
|
-
import { TSConfig } from 'pkg-types';
|
|
7
7
|
export { mergeConfigs } from './merge-config.js';
|
|
8
8
|
|
|
9
9
|
interface ConfigFileOptions {
|
package/dist/index.js
CHANGED
|
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
bundleConfig: () => bundleConfig,
|
|
34
34
|
convertTsPathsToRegexes: () => convertTsPathsToRegexes,
|
|
35
35
|
diffConfigs: () => diffConfigs,
|
|
@@ -40,7 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
mergeConfigs: () => mergeConfigs,
|
|
41
41
|
resolveConfig: () => resolveConfig
|
|
42
42
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
45
|
// src/bundle-config.ts
|
|
46
46
|
var import_logger = require("@pandacss/logger");
|
|
@@ -115,8 +115,7 @@ var import_microdiff = __toESM(require("microdiff"));
|
|
|
115
115
|
|
|
116
116
|
// src/create-matcher.ts
|
|
117
117
|
function createMatcher(id, patterns) {
|
|
118
|
-
if (!patterns?.length)
|
|
119
|
-
return () => void 0;
|
|
118
|
+
if (!patterns?.length) return () => void 0;
|
|
120
119
|
const includePatterns = [];
|
|
121
120
|
const excludePatterns = [];
|
|
122
121
|
const deduped = new Set(patterns);
|
|
@@ -131,8 +130,7 @@ function createMatcher(id, patterns) {
|
|
|
131
130
|
const include = new RegExp(includePatterns.join("|"));
|
|
132
131
|
const exclude = new RegExp(excludePatterns.join("|"));
|
|
133
132
|
return (path2) => {
|
|
134
|
-
if (excludePatterns.length && exclude.test(path2))
|
|
135
|
-
return;
|
|
133
|
+
if (excludePatterns.length && exclude.test(path2)) return;
|
|
136
134
|
return include.test(path2) ? id : void 0;
|
|
137
135
|
};
|
|
138
136
|
}
|
|
@@ -189,6 +187,7 @@ var artifactConfigDeps = {
|
|
|
189
187
|
"jsx-helpers": jsx,
|
|
190
188
|
"jsx-patterns": jsx.concat("patterns"),
|
|
191
189
|
"jsx-patterns-index": jsx.concat("patterns"),
|
|
190
|
+
"jsx-create-style-context": jsx,
|
|
192
191
|
"css-index": ["syntax"],
|
|
193
192
|
"package.json": ["forceConsistentTypeExtension", "outExtension"],
|
|
194
193
|
"types-styles": ["shorthands"],
|
|
@@ -200,8 +199,7 @@ var artifactConfigDeps = {
|
|
|
200
199
|
themes: ["themes"].concat(tokens)
|
|
201
200
|
};
|
|
202
201
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
203
|
-
if (!paths.length)
|
|
204
|
-
return () => void 0;
|
|
202
|
+
if (!paths.length) return () => void 0;
|
|
205
203
|
return createMatcher(key, paths.concat(all));
|
|
206
204
|
});
|
|
207
205
|
|
|
@@ -227,8 +225,7 @@ function diffConfigs(config, prevConfig) {
|
|
|
227
225
|
const changePath = change.path.join(".");
|
|
228
226
|
artifactMatchers.forEach((matcher) => {
|
|
229
227
|
const id = matcher(changePath);
|
|
230
|
-
if (!id)
|
|
231
|
-
return;
|
|
228
|
+
if (!id) return;
|
|
232
229
|
if (id === "recipes") {
|
|
233
230
|
const name = (0, import_shared3.dashCase)(change.path.slice(1, 3).join("."));
|
|
234
231
|
affected.artifacts.add(name);
|
|
@@ -246,9 +243,29 @@ function diffConfigs(config, prevConfig) {
|
|
|
246
243
|
// src/get-mod-deps.ts
|
|
247
244
|
var import_fs = __toESM(require("fs"));
|
|
248
245
|
var import_path4 = __toESM(require("path"));
|
|
246
|
+
var import_typescript = __toESM(require("typescript"));
|
|
249
247
|
|
|
250
|
-
// src/ts-
|
|
248
|
+
// src/resolve-ts-path-pattern.ts
|
|
251
249
|
var import_path2 = require("path");
|
|
250
|
+
var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
|
|
251
|
+
for (const mapping of pathMappings) {
|
|
252
|
+
const match = moduleSpecifier.match(mapping.pattern);
|
|
253
|
+
if (!match) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
for (const pathTemplate of mapping.paths) {
|
|
257
|
+
let starCount = 0;
|
|
258
|
+
const mappedId = pathTemplate.replace(/\*/g, () => {
|
|
259
|
+
const matchIndex = Math.min(++starCount, match.length - 1);
|
|
260
|
+
return match[matchIndex];
|
|
261
|
+
});
|
|
262
|
+
return mappedId.split(import_path2.sep).join(import_path2.posix.sep);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// src/ts-config-paths.ts
|
|
268
|
+
var import_path3 = require("path");
|
|
252
269
|
function convertTsPathsToRegexes(paths, baseUrl) {
|
|
253
270
|
const sortedPatterns = Object.keys(paths).sort((a, b) => getPrefixLength(b) - getPrefixLength(a));
|
|
254
271
|
const resolved = [];
|
|
@@ -257,7 +274,7 @@ function convertTsPathsToRegexes(paths, baseUrl) {
|
|
|
257
274
|
pattern = escapeStringRegexp(pattern).replace(/\*/g, "(.+)");
|
|
258
275
|
resolved.push({
|
|
259
276
|
pattern: new RegExp("^" + pattern + "$"),
|
|
260
|
-
paths: relativePaths.map((relativePath) => (0,
|
|
277
|
+
paths: relativePaths.map((relativePath) => (0, import_path3.resolve)(baseUrl, relativePath))
|
|
261
278
|
});
|
|
262
279
|
}
|
|
263
280
|
return resolved;
|
|
@@ -270,27 +287,7 @@ function escapeStringRegexp(string) {
|
|
|
270
287
|
return string.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
271
288
|
}
|
|
272
289
|
|
|
273
|
-
// src/resolve-ts-path-pattern.ts
|
|
274
|
-
var import_path3 = require("path");
|
|
275
|
-
var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
|
|
276
|
-
for (const mapping of pathMappings) {
|
|
277
|
-
const match = moduleSpecifier.match(mapping.pattern);
|
|
278
|
-
if (!match) {
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
for (const pathTemplate of mapping.paths) {
|
|
282
|
-
let starCount = 0;
|
|
283
|
-
const mappedId = pathTemplate.replace(/\*/g, () => {
|
|
284
|
-
const matchIndex = Math.min(++starCount, match.length - 1);
|
|
285
|
-
return match[matchIndex];
|
|
286
|
-
});
|
|
287
|
-
return mappedId.split(import_path3.sep).join(import_path3.posix.sep);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
290
|
// src/get-mod-deps.ts
|
|
293
|
-
var import_typescript = __toESM(require("typescript"));
|
|
294
291
|
var jsExtensions = [".js", ".cjs", ".mjs"];
|
|
295
292
|
var jsResolutionOrder = ["", ".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"];
|
|
296
293
|
var tsResolutionOrder = ["", ".ts", ".cts", ".mts", ".tsx", ".js", ".cjs", ".mjs", ".jsx"];
|
|
@@ -320,13 +317,11 @@ function getDeps(opts, fromAlias) {
|
|
|
320
317
|
import_path4.default.resolve(opts.cwd, filename),
|
|
321
318
|
jsExtensions.includes(opts.ext) ? jsResolutionOrder : tsResolutionOrder
|
|
322
319
|
);
|
|
323
|
-
if (absoluteFile === null)
|
|
324
|
-
return;
|
|
320
|
+
if (absoluteFile === null) return;
|
|
325
321
|
if (fromAlias) {
|
|
326
322
|
opts.foundModuleAliases.set(fromAlias, absoluteFile);
|
|
327
323
|
}
|
|
328
|
-
if (seen.size > 1 && seen.has(absoluteFile))
|
|
329
|
-
return;
|
|
324
|
+
if (seen.size > 1 && seen.has(absoluteFile)) return;
|
|
330
325
|
seen.add(absoluteFile);
|
|
331
326
|
const contents = import_fs.default.readFileSync(absoluteFile, "utf-8");
|
|
332
327
|
const fileDeps = [
|
|
@@ -335,8 +330,7 @@ function getDeps(opts, fromAlias) {
|
|
|
335
330
|
...contents.matchAll(requireRegex),
|
|
336
331
|
...contents.matchAll(exportRegex)
|
|
337
332
|
];
|
|
338
|
-
if (!fileDeps.length)
|
|
339
|
-
return;
|
|
333
|
+
if (!fileDeps.length) return;
|
|
340
334
|
const nextOpts = {
|
|
341
335
|
// Resolve new base for new imports/requires
|
|
342
336
|
cwd: import_path4.default.dirname(absoluteFile),
|
|
@@ -358,19 +352,16 @@ function getDeps(opts, fromAlias) {
|
|
|
358
352
|
getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
|
|
359
353
|
return;
|
|
360
354
|
}
|
|
361
|
-
if (!opts.pathMappings)
|
|
362
|
-
return;
|
|
355
|
+
if (!opts.pathMappings) return;
|
|
363
356
|
const filename2 = resolveTsPathPattern(opts.pathMappings, mod);
|
|
364
|
-
if (!filename2)
|
|
365
|
-
return;
|
|
357
|
+
if (!filename2) return;
|
|
366
358
|
getDeps(Object.assign({}, nextOpts, { filename: filename2 }), mod);
|
|
367
359
|
} catch (err) {
|
|
368
360
|
}
|
|
369
361
|
});
|
|
370
362
|
}
|
|
371
363
|
function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compilerOptions) {
|
|
372
|
-
if (filePath === null)
|
|
373
|
-
return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
|
|
364
|
+
if (filePath === null) return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
|
|
374
365
|
const foundModuleAliases = /* @__PURE__ */ new Map();
|
|
375
366
|
const deps = /* @__PURE__ */ new Set();
|
|
376
367
|
deps.add(filePath);
|
|
@@ -513,11 +504,9 @@ var isTokenReference = (value) => typeof value === "string" && REFERENCE_REGEX.t
|
|
|
513
504
|
var formatPath = (path2) => path2;
|
|
514
505
|
var SEP = ".";
|
|
515
506
|
function getReferences(value) {
|
|
516
|
-
if (typeof value !== "string")
|
|
517
|
-
return [];
|
|
507
|
+
if (typeof value !== "string") return [];
|
|
518
508
|
const matches = value.match(REFERENCE_REGEX);
|
|
519
|
-
if (!matches)
|
|
520
|
-
return [];
|
|
509
|
+
if (!matches) return [];
|
|
521
510
|
return matches.map((match) => match.replace(curlyBracketRegex, "")).map((value2) => {
|
|
522
511
|
return value2.trim().split("/")[0];
|
|
523
512
|
});
|
|
@@ -538,8 +527,7 @@ var serializeTokenValue = (value) => {
|
|
|
538
527
|
// src/merge-config.ts
|
|
539
528
|
function getExtends(items) {
|
|
540
529
|
return items.reduce((merged, { extend }) => {
|
|
541
|
-
if (!extend)
|
|
542
|
-
return merged;
|
|
530
|
+
if (!extend) return merged;
|
|
543
531
|
return (0, import_shared5.mergeWith)(merged, extend, (originalValue, newValue) => {
|
|
544
532
|
if (newValue === void 0) {
|
|
545
533
|
return originalValue ?? [];
|
|
@@ -603,16 +591,14 @@ function mergeConfigs(configs) {
|
|
|
603
591
|
if (withoutEmpty.theme?.tokens) {
|
|
604
592
|
(0, import_shared5.walkObject)(withoutEmpty.theme.tokens, (args) => args, {
|
|
605
593
|
stop(token) {
|
|
606
|
-
if (!isValidToken(token))
|
|
607
|
-
return false;
|
|
594
|
+
if (!isValidToken(token)) return false;
|
|
608
595
|
const keys = Object.keys(token);
|
|
609
596
|
const nestedKeys = keys.filter((k) => !tokenKeys.includes(k));
|
|
610
597
|
const nested = nestedKeys.length > 0;
|
|
611
598
|
if (nested) {
|
|
612
599
|
token.DEFAULT ||= {};
|
|
613
600
|
tokenKeys.forEach((key) => {
|
|
614
|
-
if (token[key] == null)
|
|
615
|
-
return;
|
|
601
|
+
if (token[key] == null) return;
|
|
616
602
|
token.DEFAULT[key] ||= token[key];
|
|
617
603
|
delete token[key];
|
|
618
604
|
});
|
|
@@ -688,8 +674,7 @@ var validateArtifactNames = (names, addError) => {
|
|
|
688
674
|
// src/validation/validate-breakpoints.ts
|
|
689
675
|
var import_shared6 = require("@pandacss/shared");
|
|
690
676
|
var validateBreakpoints = (breakpoints, addError) => {
|
|
691
|
-
if (!breakpoints)
|
|
692
|
-
return;
|
|
677
|
+
if (!breakpoints) return;
|
|
693
678
|
const units = /* @__PURE__ */ new Set();
|
|
694
679
|
const values = Object.values(breakpoints);
|
|
695
680
|
for (const value of values) {
|
|
@@ -704,8 +689,7 @@ var validateBreakpoints = (breakpoints, addError) => {
|
|
|
704
689
|
// src/validation/validate-condition.ts
|
|
705
690
|
var import_shared7 = require("@pandacss/shared");
|
|
706
691
|
var validateConditions = (conditions, addError) => {
|
|
707
|
-
if (!conditions)
|
|
708
|
-
return;
|
|
692
|
+
if (!conditions) return;
|
|
709
693
|
Object.values(conditions).forEach((condition) => {
|
|
710
694
|
if ((0, import_shared7.isString)(condition)) {
|
|
711
695
|
if (!condition.startsWith("@") && !condition.includes("&")) {
|
|
@@ -723,8 +707,7 @@ var validateConditions = (conditions, addError) => {
|
|
|
723
707
|
|
|
724
708
|
// src/validation/validate-patterns.ts
|
|
725
709
|
var validatePatterns = (patterns, names) => {
|
|
726
|
-
if (!patterns)
|
|
727
|
-
return;
|
|
710
|
+
if (!patterns) return;
|
|
728
711
|
Object.keys(patterns).forEach((patternName) => {
|
|
729
712
|
names.patterns.add(patternName);
|
|
730
713
|
});
|
|
@@ -736,8 +719,7 @@ var validateRecipes = (options) => {
|
|
|
736
719
|
config: { theme },
|
|
737
720
|
artifacts
|
|
738
721
|
} = options;
|
|
739
|
-
if (!theme)
|
|
740
|
-
return;
|
|
722
|
+
if (!theme) return;
|
|
741
723
|
if (theme.recipes) {
|
|
742
724
|
Object.keys(theme.recipes).forEach((recipeName) => {
|
|
743
725
|
artifacts.recipes.add(recipeName);
|
|
@@ -777,8 +759,7 @@ var validateTokenReferences = (props) => {
|
|
|
777
759
|
addError("tokens", `Unknown token reference: \`${currentPath}\` used in \`${value}\``);
|
|
778
760
|
}
|
|
779
761
|
const deps = refsByPath.get(currentPath);
|
|
780
|
-
if (!deps)
|
|
781
|
-
continue;
|
|
762
|
+
if (!deps) continue;
|
|
782
763
|
for (const transitiveDep of deps) {
|
|
783
764
|
if (path2 === transitiveDep) {
|
|
784
765
|
addError(
|
|
@@ -800,8 +781,7 @@ var validateTokens = (options) => {
|
|
|
800
781
|
tokens: tokens2,
|
|
801
782
|
addError
|
|
802
783
|
} = options;
|
|
803
|
-
if (!theme)
|
|
804
|
-
return;
|
|
784
|
+
if (!theme) return;
|
|
805
785
|
const { tokenNames, semanticTokenNames, valueAtPath, refsByPath, typeByPath } = tokens2;
|
|
806
786
|
if (theme.tokens) {
|
|
807
787
|
const tokenPaths = /* @__PURE__ */ new Set();
|
|
@@ -837,8 +817,7 @@ var validateTokens = (options) => {
|
|
|
837
817
|
refsByPath.set(formattedPath, /* @__PURE__ */ new Set([]));
|
|
838
818
|
}
|
|
839
819
|
const references = refsByPath.get(formattedPath);
|
|
840
|
-
if (!references)
|
|
841
|
-
return;
|
|
820
|
+
if (!references) return;
|
|
842
821
|
getReferences(valueStr).forEach((reference) => {
|
|
843
822
|
references.add(reference);
|
|
844
823
|
});
|
|
@@ -856,8 +835,7 @@ var validateTokens = (options) => {
|
|
|
856
835
|
if (path2.includes("DEFAULT")) {
|
|
857
836
|
valueAtPath.set(path2.replace(SEP + "DEFAULT", ""), value);
|
|
858
837
|
}
|
|
859
|
-
if (!isValidToken(value))
|
|
860
|
-
return;
|
|
838
|
+
if (!isValidToken(value)) return;
|
|
861
839
|
(0, import_shared8.walkObject)(value, (itemValue, paths2) => {
|
|
862
840
|
const valuePath = paths2.join(SEP);
|
|
863
841
|
const formattedPath = formatPath(path2);
|
|
@@ -872,8 +850,7 @@ var validateTokens = (options) => {
|
|
|
872
850
|
refsByPath.set(formattedPath, /* @__PURE__ */ new Set());
|
|
873
851
|
}
|
|
874
852
|
const references = refsByPath.get(formattedPath);
|
|
875
|
-
if (!references)
|
|
876
|
-
return;
|
|
853
|
+
if (!references) return;
|
|
877
854
|
getReferences(valueStr).forEach((reference) => {
|
|
878
855
|
references.add(reference);
|
|
879
856
|
});
|
|
@@ -901,8 +878,7 @@ var validateTokens = (options) => {
|
|
|
901
878
|
|
|
902
879
|
// src/validate-config.ts
|
|
903
880
|
var validateConfig = (config) => {
|
|
904
|
-
if (config.validation === "none")
|
|
905
|
-
return;
|
|
881
|
+
if (config.validation === "none") return;
|
|
906
882
|
const warnings = /* @__PURE__ */ new Set();
|
|
907
883
|
const addError = (scope, message) => {
|
|
908
884
|
warnings.add(`[${scope}] ` + message);
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
diffConfigs
|
|
3
|
+
} from "./chunk-U3UHISDU.mjs";
|
|
1
4
|
import {
|
|
2
5
|
SEP,
|
|
3
6
|
formatPath,
|
|
@@ -6,10 +9,7 @@ import {
|
|
|
6
9
|
isValidToken,
|
|
7
10
|
mergeConfigs,
|
|
8
11
|
serializeTokenValue
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
diffConfigs
|
|
12
|
-
} from "./chunk-Q2O7DCQS.mjs";
|
|
12
|
+
} from "./chunk-B47HB6K3.mjs";
|
|
13
13
|
import {
|
|
14
14
|
resolveTsPathPattern
|
|
15
15
|
} from "./chunk-RPIVZP2I.mjs";
|
|
@@ -84,6 +84,7 @@ async function bundleConfig(options) {
|
|
|
84
84
|
// src/get-mod-deps.ts
|
|
85
85
|
import fs from "fs";
|
|
86
86
|
import path from "path";
|
|
87
|
+
import ts from "typescript";
|
|
87
88
|
|
|
88
89
|
// src/ts-config-paths.ts
|
|
89
90
|
import { resolve as resolve2 } from "path";
|
|
@@ -109,7 +110,6 @@ function escapeStringRegexp(string) {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
// src/get-mod-deps.ts
|
|
112
|
-
import ts from "typescript";
|
|
113
113
|
var jsExtensions = [".js", ".cjs", ".mjs"];
|
|
114
114
|
var jsResolutionOrder = ["", ".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"];
|
|
115
115
|
var tsResolutionOrder = ["", ".ts", ".cts", ".mts", ".tsx", ".js", ".cjs", ".mjs", ".jsx"];
|
|
@@ -139,13 +139,11 @@ function getDeps(opts, fromAlias) {
|
|
|
139
139
|
path.resolve(opts.cwd, filename),
|
|
140
140
|
jsExtensions.includes(opts.ext) ? jsResolutionOrder : tsResolutionOrder
|
|
141
141
|
);
|
|
142
|
-
if (absoluteFile === null)
|
|
143
|
-
return;
|
|
142
|
+
if (absoluteFile === null) return;
|
|
144
143
|
if (fromAlias) {
|
|
145
144
|
opts.foundModuleAliases.set(fromAlias, absoluteFile);
|
|
146
145
|
}
|
|
147
|
-
if (seen.size > 1 && seen.has(absoluteFile))
|
|
148
|
-
return;
|
|
146
|
+
if (seen.size > 1 && seen.has(absoluteFile)) return;
|
|
149
147
|
seen.add(absoluteFile);
|
|
150
148
|
const contents = fs.readFileSync(absoluteFile, "utf-8");
|
|
151
149
|
const fileDeps = [
|
|
@@ -154,8 +152,7 @@ function getDeps(opts, fromAlias) {
|
|
|
154
152
|
...contents.matchAll(requireRegex),
|
|
155
153
|
...contents.matchAll(exportRegex)
|
|
156
154
|
];
|
|
157
|
-
if (!fileDeps.length)
|
|
158
|
-
return;
|
|
155
|
+
if (!fileDeps.length) return;
|
|
159
156
|
const nextOpts = {
|
|
160
157
|
// Resolve new base for new imports/requires
|
|
161
158
|
cwd: path.dirname(absoluteFile),
|
|
@@ -177,19 +174,16 @@ function getDeps(opts, fromAlias) {
|
|
|
177
174
|
getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
|
|
178
175
|
return;
|
|
179
176
|
}
|
|
180
|
-
if (!opts.pathMappings)
|
|
181
|
-
return;
|
|
177
|
+
if (!opts.pathMappings) return;
|
|
182
178
|
const filename2 = resolveTsPathPattern(opts.pathMappings, mod);
|
|
183
|
-
if (!filename2)
|
|
184
|
-
return;
|
|
179
|
+
if (!filename2) return;
|
|
185
180
|
getDeps(Object.assign({}, nextOpts, { filename: filename2 }), mod);
|
|
186
181
|
} catch (err) {
|
|
187
182
|
}
|
|
188
183
|
});
|
|
189
184
|
}
|
|
190
185
|
function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compilerOptions) {
|
|
191
|
-
if (filePath === null)
|
|
192
|
-
return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
|
|
186
|
+
if (filePath === null) return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
|
|
193
187
|
const foundModuleAliases = /* @__PURE__ */ new Map();
|
|
194
188
|
const deps = /* @__PURE__ */ new Set();
|
|
195
189
|
deps.add(filePath);
|
|
@@ -270,8 +264,7 @@ var validateArtifactNames = (names, addError) => {
|
|
|
270
264
|
// src/validation/validate-breakpoints.ts
|
|
271
265
|
import { getUnit } from "@pandacss/shared";
|
|
272
266
|
var validateBreakpoints = (breakpoints, addError) => {
|
|
273
|
-
if (!breakpoints)
|
|
274
|
-
return;
|
|
267
|
+
if (!breakpoints) return;
|
|
275
268
|
const units = /* @__PURE__ */ new Set();
|
|
276
269
|
const values = Object.values(breakpoints);
|
|
277
270
|
for (const value of values) {
|
|
@@ -286,8 +279,7 @@ var validateBreakpoints = (breakpoints, addError) => {
|
|
|
286
279
|
// src/validation/validate-condition.ts
|
|
287
280
|
import { isString } from "@pandacss/shared";
|
|
288
281
|
var validateConditions = (conditions, addError) => {
|
|
289
|
-
if (!conditions)
|
|
290
|
-
return;
|
|
282
|
+
if (!conditions) return;
|
|
291
283
|
Object.values(conditions).forEach((condition) => {
|
|
292
284
|
if (isString(condition)) {
|
|
293
285
|
if (!condition.startsWith("@") && !condition.includes("&")) {
|
|
@@ -305,8 +297,7 @@ var validateConditions = (conditions, addError) => {
|
|
|
305
297
|
|
|
306
298
|
// src/validation/validate-patterns.ts
|
|
307
299
|
var validatePatterns = (patterns, names) => {
|
|
308
|
-
if (!patterns)
|
|
309
|
-
return;
|
|
300
|
+
if (!patterns) return;
|
|
310
301
|
Object.keys(patterns).forEach((patternName) => {
|
|
311
302
|
names.patterns.add(patternName);
|
|
312
303
|
});
|
|
@@ -318,8 +309,7 @@ var validateRecipes = (options) => {
|
|
|
318
309
|
config: { theme },
|
|
319
310
|
artifacts
|
|
320
311
|
} = options;
|
|
321
|
-
if (!theme)
|
|
322
|
-
return;
|
|
312
|
+
if (!theme) return;
|
|
323
313
|
if (theme.recipes) {
|
|
324
314
|
Object.keys(theme.recipes).forEach((recipeName) => {
|
|
325
315
|
artifacts.recipes.add(recipeName);
|
|
@@ -359,8 +349,7 @@ var validateTokenReferences = (props) => {
|
|
|
359
349
|
addError("tokens", `Unknown token reference: \`${currentPath}\` used in \`${value}\``);
|
|
360
350
|
}
|
|
361
351
|
const deps = refsByPath.get(currentPath);
|
|
362
|
-
if (!deps)
|
|
363
|
-
continue;
|
|
352
|
+
if (!deps) continue;
|
|
364
353
|
for (const transitiveDep of deps) {
|
|
365
354
|
if (path2 === transitiveDep) {
|
|
366
355
|
addError(
|
|
@@ -382,8 +371,7 @@ var validateTokens = (options) => {
|
|
|
382
371
|
tokens,
|
|
383
372
|
addError
|
|
384
373
|
} = options;
|
|
385
|
-
if (!theme)
|
|
386
|
-
return;
|
|
374
|
+
if (!theme) return;
|
|
387
375
|
const { tokenNames, semanticTokenNames, valueAtPath, refsByPath, typeByPath } = tokens;
|
|
388
376
|
if (theme.tokens) {
|
|
389
377
|
const tokenPaths = /* @__PURE__ */ new Set();
|
|
@@ -419,8 +407,7 @@ var validateTokens = (options) => {
|
|
|
419
407
|
refsByPath.set(formattedPath, /* @__PURE__ */ new Set([]));
|
|
420
408
|
}
|
|
421
409
|
const references = refsByPath.get(formattedPath);
|
|
422
|
-
if (!references)
|
|
423
|
-
return;
|
|
410
|
+
if (!references) return;
|
|
424
411
|
getReferences(valueStr).forEach((reference) => {
|
|
425
412
|
references.add(reference);
|
|
426
413
|
});
|
|
@@ -438,8 +425,7 @@ var validateTokens = (options) => {
|
|
|
438
425
|
if (path2.includes("DEFAULT")) {
|
|
439
426
|
valueAtPath.set(path2.replace(SEP + "DEFAULT", ""), value);
|
|
440
427
|
}
|
|
441
|
-
if (!isValidToken(value))
|
|
442
|
-
return;
|
|
428
|
+
if (!isValidToken(value)) return;
|
|
443
429
|
walkObject(value, (itemValue, paths2) => {
|
|
444
430
|
const valuePath = paths2.join(SEP);
|
|
445
431
|
const formattedPath = formatPath(path2);
|
|
@@ -454,8 +440,7 @@ var validateTokens = (options) => {
|
|
|
454
440
|
refsByPath.set(formattedPath, /* @__PURE__ */ new Set());
|
|
455
441
|
}
|
|
456
442
|
const references = refsByPath.get(formattedPath);
|
|
457
|
-
if (!references)
|
|
458
|
-
return;
|
|
443
|
+
if (!references) return;
|
|
459
444
|
getReferences(valueStr).forEach((reference) => {
|
|
460
445
|
references.add(reference);
|
|
461
446
|
});
|
|
@@ -483,8 +468,7 @@ var validateTokens = (options) => {
|
|
|
483
468
|
|
|
484
469
|
// src/validate-config.ts
|
|
485
470
|
var validateConfig = (config) => {
|
|
486
|
-
if (config.validation === "none")
|
|
487
|
-
return;
|
|
471
|
+
if (config.validation === "none") return;
|
|
488
472
|
const warnings = /* @__PURE__ */ new Set();
|
|
489
473
|
const addError = (scope, message) => {
|
|
490
474
|
warnings.add(`[${scope}] ` + message);
|
package/dist/merge-config.js
CHANGED
|
@@ -146,8 +146,7 @@ var isValidToken = (token) => (0, import_shared.isObject)(token) && Object.hasOw
|
|
|
146
146
|
// src/merge-config.ts
|
|
147
147
|
function getExtends(items) {
|
|
148
148
|
return items.reduce((merged, { extend }) => {
|
|
149
|
-
if (!extend)
|
|
150
|
-
return merged;
|
|
149
|
+
if (!extend) return merged;
|
|
151
150
|
return (0, import_shared2.mergeWith)(merged, extend, (originalValue, newValue) => {
|
|
152
151
|
if (newValue === void 0) {
|
|
153
152
|
return originalValue ?? [];
|
|
@@ -211,16 +210,14 @@ function mergeConfigs(configs) {
|
|
|
211
210
|
if (withoutEmpty.theme?.tokens) {
|
|
212
211
|
(0, import_shared2.walkObject)(withoutEmpty.theme.tokens, (args) => args, {
|
|
213
212
|
stop(token) {
|
|
214
|
-
if (!isValidToken(token))
|
|
215
|
-
return false;
|
|
213
|
+
if (!isValidToken(token)) return false;
|
|
216
214
|
const keys = Object.keys(token);
|
|
217
215
|
const nestedKeys = keys.filter((k) => !tokenKeys.includes(k));
|
|
218
216
|
const nested = nestedKeys.length > 0;
|
|
219
217
|
if (nested) {
|
|
220
218
|
token.DEFAULT ||= {};
|
|
221
219
|
tokenKeys.forEach((key) => {
|
|
222
|
-
if (token[key] == null)
|
|
223
|
-
return;
|
|
220
|
+
if (token[key] == null) return;
|
|
224
221
|
token.DEFAULT[key] ||= token[key];
|
|
225
222
|
delete token[key];
|
|
226
223
|
});
|
package/dist/merge-config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
"escalade": "3.1.2",
|
|
73
73
|
"merge-anything": "5.1.7",
|
|
74
74
|
"microdiff": "1.3.2",
|
|
75
|
-
"typescript": "5.
|
|
76
|
-
"@pandacss/logger": "0.
|
|
77
|
-
"@pandacss/preset-base": "0.
|
|
78
|
-
"@pandacss/preset-panda": "0.
|
|
79
|
-
"@pandacss/shared": "0.
|
|
80
|
-
"@pandacss/types": "0.
|
|
75
|
+
"typescript": "5.8.3",
|
|
76
|
+
"@pandacss/logger": "1.0.0",
|
|
77
|
+
"@pandacss/preset-base": "1.0.0",
|
|
78
|
+
"@pandacss/preset-panda": "1.0.0",
|
|
79
|
+
"@pandacss/shared": "1.0.0",
|
|
80
|
+
"@pandacss/types": "1.0.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"pkg-types": "
|
|
83
|
+
"pkg-types": "2.2.0"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "tsup --tsconfig tsconfig.build.json --dts",
|