@pandacss/config 1.9.1 → 1.11.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-LPLV42H5.mjs → chunk-FQ7G6ORY.mjs} +15 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -8
- package/dist/index.mjs +38 -6
- package/dist/merge-config.d.mts +4 -2
- package/dist/merge-config.d.ts +4 -2
- package/dist/merge-config.js +19 -5
- package/dist/merge-config.mjs +5 -3
- package/package.json +7 -7
|
@@ -98,6 +98,18 @@ var reducers = {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
return preset;
|
|
101
|
+
}),
|
|
102
|
+
"css:optimize": createReducer((fns) => (_args) => {
|
|
103
|
+
const args = Object.assign({}, _args);
|
|
104
|
+
const original = _args.css;
|
|
105
|
+
let css = args.css;
|
|
106
|
+
for (const hookFn of fns) {
|
|
107
|
+
const result = hookFn(Object.assign(args, { css, original }));
|
|
108
|
+
if (result !== void 0) {
|
|
109
|
+
css = result;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return css;
|
|
101
113
|
})
|
|
102
114
|
};
|
|
103
115
|
var syncHooks = [
|
|
@@ -105,7 +117,8 @@ var syncHooks = [
|
|
|
105
117
|
"parser:before",
|
|
106
118
|
"parser:preprocess",
|
|
107
119
|
"parser:after",
|
|
108
|
-
"cssgen:done"
|
|
120
|
+
"cssgen:done",
|
|
121
|
+
"css:optimize"
|
|
109
122
|
];
|
|
110
123
|
var callAllAsync = (...fns) => async (...a) => {
|
|
111
124
|
for (const fn of fns) {
|
|
@@ -120,8 +133,7 @@ var tryCatch = (name, fn) => {
|
|
|
120
133
|
try {
|
|
121
134
|
return fn(...args);
|
|
122
135
|
} catch (e) {
|
|
123
|
-
logger.
|
|
124
|
-
console.error(e);
|
|
136
|
+
logger.caughtError("hooks", `Error in plugin "${name}"`, e);
|
|
125
137
|
}
|
|
126
138
|
};
|
|
127
139
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export { diffConfigs } from './diff-config.mjs';
|
|
|
4
4
|
import { TSConfig } from 'pkg-types';
|
|
5
5
|
import { P as PathMapping } from './ts-config-paths-qwrwgu2Q.mjs';
|
|
6
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-qwrwgu2Q.mjs';
|
|
7
|
-
export { mergeConfigs } from './merge-config.mjs';
|
|
7
|
+
export { mergeConfigs, mergeHooks } from './merge-config.mjs';
|
|
8
8
|
|
|
9
9
|
interface ConfigFileOptions {
|
|
10
10
|
cwd: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { diffConfigs } from './diff-config.js';
|
|
|
4
4
|
import { TSConfig } from 'pkg-types';
|
|
5
5
|
import { P as PathMapping } from './ts-config-paths-qwrwgu2Q.js';
|
|
6
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-qwrwgu2Q.js';
|
|
7
|
-
export { mergeConfigs } from './merge-config.js';
|
|
7
|
+
export { mergeConfigs, mergeHooks } from './merge-config.js';
|
|
8
8
|
|
|
9
9
|
interface ConfigFileOptions {
|
|
10
10
|
cwd: string;
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
getResolvedConfig: () => getResolvedConfig,
|
|
39
39
|
loadConfig: () => loadConfig,
|
|
40
40
|
mergeConfigs: () => mergeConfigs,
|
|
41
|
+
mergeHooks: () => mergeHooks,
|
|
41
42
|
resolveConfig: () => resolveConfig
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -501,6 +502,18 @@ var reducers = {
|
|
|
501
502
|
}
|
|
502
503
|
}
|
|
503
504
|
return preset;
|
|
505
|
+
}),
|
|
506
|
+
"css:optimize": createReducer((fns) => (_args) => {
|
|
507
|
+
const args = Object.assign({}, _args);
|
|
508
|
+
const original = _args.css;
|
|
509
|
+
let css = args.css;
|
|
510
|
+
for (const hookFn of fns) {
|
|
511
|
+
const result = hookFn(Object.assign(args, { css, original }));
|
|
512
|
+
if (result !== void 0) {
|
|
513
|
+
css = result;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return css;
|
|
504
517
|
})
|
|
505
518
|
};
|
|
506
519
|
var syncHooks = [
|
|
@@ -508,7 +521,8 @@ var syncHooks = [
|
|
|
508
521
|
"parser:before",
|
|
509
522
|
"parser:preprocess",
|
|
510
523
|
"parser:after",
|
|
511
|
-
"cssgen:done"
|
|
524
|
+
"cssgen:done",
|
|
525
|
+
"css:optimize"
|
|
512
526
|
];
|
|
513
527
|
var callAllAsync = (...fns) => async (...a) => {
|
|
514
528
|
for (const fn of fns) {
|
|
@@ -523,8 +537,7 @@ var tryCatch = (name, fn) => {
|
|
|
523
537
|
try {
|
|
524
538
|
return fn(...args);
|
|
525
539
|
} catch (e) {
|
|
526
|
-
import_logger2.logger.
|
|
527
|
-
console.error(e);
|
|
540
|
+
import_logger2.logger.caughtError("hooks", `Error in plugin "${name}"`, e);
|
|
528
541
|
}
|
|
529
542
|
};
|
|
530
543
|
};
|
|
@@ -742,6 +755,30 @@ var validateBreakpoints = (breakpoints, addError) => {
|
|
|
742
755
|
|
|
743
756
|
// src/validation/validate-condition.ts
|
|
744
757
|
var import_shared8 = require("@pandacss/shared");
|
|
758
|
+
var validateObjectCondition = (obj, addError) => {
|
|
759
|
+
let hasSlot = false;
|
|
760
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
761
|
+
if (!key.startsWith("@") && !key.includes("&")) {
|
|
762
|
+
addError("conditions", `Selectors should contain the \`&\` character: \`${key}\``);
|
|
763
|
+
}
|
|
764
|
+
if (value === "@slot") {
|
|
765
|
+
hasSlot = true;
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
if (typeof value === "string") {
|
|
769
|
+
addError(
|
|
770
|
+
"conditions",
|
|
771
|
+
`Object condition leaves must be the literal string \`'@slot'\`, got \`${JSON.stringify(value)}\` at \`${key}\``
|
|
772
|
+
);
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
if (typeof value === "object" && value !== null) {
|
|
776
|
+
const nested = validateObjectCondition(value, addError);
|
|
777
|
+
if (nested.hasSlot) hasSlot = true;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return { hasSlot };
|
|
781
|
+
};
|
|
745
782
|
var validateConditions = (conditions, addError) => {
|
|
746
783
|
if (!conditions) return;
|
|
747
784
|
Object.values(conditions).forEach((condition) => {
|
|
@@ -751,11 +788,18 @@ var validateConditions = (conditions, addError) => {
|
|
|
751
788
|
}
|
|
752
789
|
return;
|
|
753
790
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
791
|
+
if (Array.isArray(condition)) {
|
|
792
|
+
condition.forEach((c) => {
|
|
793
|
+
if (!c.startsWith("@") && !c.includes("&")) {
|
|
794
|
+
addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const { hasSlot } = validateObjectCondition(condition, addError);
|
|
800
|
+
if (!hasSlot) {
|
|
801
|
+
addError("conditions", `Object conditions must contain at least one \`'@slot'\` marker`);
|
|
802
|
+
}
|
|
759
803
|
});
|
|
760
804
|
};
|
|
761
805
|
|
|
@@ -1035,5 +1079,6 @@ async function loadConfig(options) {
|
|
|
1035
1079
|
getResolvedConfig,
|
|
1036
1080
|
loadConfig,
|
|
1037
1081
|
mergeConfigs,
|
|
1082
|
+
mergeHooks,
|
|
1038
1083
|
resolveConfig
|
|
1039
1084
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
mergeConfigs,
|
|
11
11
|
mergeHooks,
|
|
12
12
|
serializeTokenValue
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FQ7G6ORY.mjs";
|
|
14
14
|
import {
|
|
15
15
|
resolveTsPathPattern
|
|
16
16
|
} from "./chunk-RPIVZP2I.mjs";
|
|
@@ -300,6 +300,30 @@ var validateBreakpoints = (breakpoints, addError) => {
|
|
|
300
300
|
|
|
301
301
|
// src/validation/validate-condition.ts
|
|
302
302
|
import { isString } from "@pandacss/shared";
|
|
303
|
+
var validateObjectCondition = (obj, addError) => {
|
|
304
|
+
let hasSlot = false;
|
|
305
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
306
|
+
if (!key.startsWith("@") && !key.includes("&")) {
|
|
307
|
+
addError("conditions", `Selectors should contain the \`&\` character: \`${key}\``);
|
|
308
|
+
}
|
|
309
|
+
if (value === "@slot") {
|
|
310
|
+
hasSlot = true;
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
if (typeof value === "string") {
|
|
314
|
+
addError(
|
|
315
|
+
"conditions",
|
|
316
|
+
`Object condition leaves must be the literal string \`'@slot'\`, got \`${JSON.stringify(value)}\` at \`${key}\``
|
|
317
|
+
);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (typeof value === "object" && value !== null) {
|
|
321
|
+
const nested = validateObjectCondition(value, addError);
|
|
322
|
+
if (nested.hasSlot) hasSlot = true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return { hasSlot };
|
|
326
|
+
};
|
|
303
327
|
var validateConditions = (conditions, addError) => {
|
|
304
328
|
if (!conditions) return;
|
|
305
329
|
Object.values(conditions).forEach((condition) => {
|
|
@@ -309,11 +333,18 @@ var validateConditions = (conditions, addError) => {
|
|
|
309
333
|
}
|
|
310
334
|
return;
|
|
311
335
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
336
|
+
if (Array.isArray(condition)) {
|
|
337
|
+
condition.forEach((c) => {
|
|
338
|
+
if (!c.startsWith("@") && !c.includes("&")) {
|
|
339
|
+
addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const { hasSlot } = validateObjectCondition(condition, addError);
|
|
345
|
+
if (!hasSlot) {
|
|
346
|
+
addError("conditions", `Object conditions must contain at least one \`'@slot'\` marker`);
|
|
347
|
+
}
|
|
317
348
|
});
|
|
318
349
|
};
|
|
319
350
|
|
|
@@ -592,5 +623,6 @@ export {
|
|
|
592
623
|
getResolvedConfig,
|
|
593
624
|
loadConfig,
|
|
594
625
|
mergeConfigs,
|
|
626
|
+
mergeHooks,
|
|
595
627
|
resolveConfig
|
|
596
628
|
};
|
package/dist/merge-config.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Config } from '@pandacss/types';
|
|
1
|
+
import { PandaPlugin, PandaHooks, Config } from '@pandacss/types';
|
|
2
|
+
|
|
3
|
+
declare const mergeHooks: (plugins: PandaPlugin[]) => Partial<PandaHooks>;
|
|
2
4
|
|
|
3
5
|
type Extendable<T> = T & {
|
|
4
6
|
extend?: T;
|
|
@@ -9,4 +11,4 @@ type ExtendableConfig = Extendable<Config>;
|
|
|
9
11
|
*/
|
|
10
12
|
declare function mergeConfigs(configs: ExtendableConfig[]): any;
|
|
11
13
|
|
|
12
|
-
export { mergeConfigs };
|
|
14
|
+
export { mergeConfigs, mergeHooks };
|
package/dist/merge-config.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Config } from '@pandacss/types';
|
|
1
|
+
import { PandaPlugin, PandaHooks, Config } from '@pandacss/types';
|
|
2
|
+
|
|
3
|
+
declare const mergeHooks: (plugins: PandaPlugin[]) => Partial<PandaHooks>;
|
|
2
4
|
|
|
3
5
|
type Extendable<T> = T & {
|
|
4
6
|
extend?: T;
|
|
@@ -9,4 +11,4 @@ type ExtendableConfig = Extendable<Config>;
|
|
|
9
11
|
*/
|
|
10
12
|
declare function mergeConfigs(configs: ExtendableConfig[]): any;
|
|
11
13
|
|
|
12
|
-
export { mergeConfigs };
|
|
14
|
+
export { mergeConfigs, mergeHooks };
|
package/dist/merge-config.js
CHANGED
|
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/merge-config.ts
|
|
21
21
|
var merge_config_exports = {};
|
|
22
22
|
__export(merge_config_exports, {
|
|
23
|
-
mergeConfigs: () => mergeConfigs
|
|
23
|
+
mergeConfigs: () => mergeConfigs,
|
|
24
|
+
mergeHooks: () => mergeHooks
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(merge_config_exports);
|
|
26
27
|
var import_shared2 = require("@pandacss/shared");
|
|
@@ -122,6 +123,18 @@ var reducers = {
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
return preset;
|
|
126
|
+
}),
|
|
127
|
+
"css:optimize": createReducer((fns) => (_args) => {
|
|
128
|
+
const args = Object.assign({}, _args);
|
|
129
|
+
const original = _args.css;
|
|
130
|
+
let css = args.css;
|
|
131
|
+
for (const hookFn of fns) {
|
|
132
|
+
const result = hookFn(Object.assign(args, { css, original }));
|
|
133
|
+
if (result !== void 0) {
|
|
134
|
+
css = result;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return css;
|
|
125
138
|
})
|
|
126
139
|
};
|
|
127
140
|
var syncHooks = [
|
|
@@ -129,7 +142,8 @@ var syncHooks = [
|
|
|
129
142
|
"parser:before",
|
|
130
143
|
"parser:preprocess",
|
|
131
144
|
"parser:after",
|
|
132
|
-
"cssgen:done"
|
|
145
|
+
"cssgen:done",
|
|
146
|
+
"css:optimize"
|
|
133
147
|
];
|
|
134
148
|
var callAllAsync = (...fns) => async (...a) => {
|
|
135
149
|
for (const fn of fns) {
|
|
@@ -144,8 +158,7 @@ var tryCatch = (name, fn) => {
|
|
|
144
158
|
try {
|
|
145
159
|
return fn(...args);
|
|
146
160
|
} catch (e) {
|
|
147
|
-
import_logger.logger.
|
|
148
|
-
console.error(e);
|
|
161
|
+
import_logger.logger.caughtError("hooks", `Error in plugin "${name}"`, e);
|
|
149
162
|
}
|
|
150
163
|
};
|
|
151
164
|
};
|
|
@@ -241,5 +254,6 @@ function mergeConfigs(configs) {
|
|
|
241
254
|
}
|
|
242
255
|
// Annotate the CommonJS export names for ESM import in node:
|
|
243
256
|
0 && (module.exports = {
|
|
244
|
-
mergeConfigs
|
|
257
|
+
mergeConfigs,
|
|
258
|
+
mergeHooks
|
|
245
259
|
});
|
package/dist/merge-config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"bundle-n-require": "1.1.2",
|
|
73
73
|
"escalade": "3.2.0",
|
|
74
74
|
"microdiff": "1.5.0",
|
|
75
|
-
"typescript": "
|
|
76
|
-
"@pandacss/logger": "1.
|
|
77
|
-
"@pandacss/preset-base": "1.
|
|
78
|
-
"@pandacss/preset-panda": "1.
|
|
79
|
-
"@pandacss/shared": "1.
|
|
80
|
-
"@pandacss/types": "1.
|
|
75
|
+
"typescript": "6.0.2",
|
|
76
|
+
"@pandacss/logger": "1.11.0",
|
|
77
|
+
"@pandacss/preset-base": "1.11.0",
|
|
78
|
+
"@pandacss/preset-panda": "1.11.0",
|
|
79
|
+
"@pandacss/shared": "1.11.0",
|
|
80
|
+
"@pandacss/types": "1.11.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"pkg-types": "2.3.0"
|