@pandacss/config 2.0.0-beta.2 → 2.0.0-beta.20
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-LUSBBUHX.js → chunk-LDC4ZCDS.js} +56 -50
- package/dist/chunk-R4R5RHIS.js +73 -0
- package/dist/{chunk-VYX3JX5J.js → chunk-Y642H6DU.js} +54 -4
- package/dist/index.d.ts +129 -5
- package/dist/index.js +1154 -91
- package/dist/{merge-Bt4BM1CH.d.ts → merge-EXcM0jFd.d.ts} +7 -8
- package/dist/merge.d.ts +1 -1
- package/dist/merge.js +2 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/serialize.js +2 -1
- package/package.json +4 -4
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.code = `ERR_PANDA_${code}`;
|
|
8
|
-
this.hint = opts?.hint;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
PandaError,
|
|
3
|
+
clone,
|
|
4
|
+
isPlainObject,
|
|
5
|
+
omitKeys
|
|
6
|
+
} from "./chunk-R4R5RHIS.js";
|
|
11
7
|
|
|
12
8
|
// src/sources.ts
|
|
13
9
|
var sectionKeySet = /* @__PURE__ */ new Set([
|
|
@@ -18,11 +14,9 @@ var sectionKeySet = /* @__PURE__ */ new Set([
|
|
|
18
14
|
"globalCss",
|
|
19
15
|
"globalVars",
|
|
20
16
|
"globalFontface",
|
|
21
|
-
"globalPositionTry",
|
|
22
17
|
"staticCss",
|
|
23
18
|
"themes"
|
|
24
19
|
]);
|
|
25
|
-
var omitKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
26
20
|
var tokenKeys = /* @__PURE__ */ new Set(["description", "extensions", "type", "value", "deprecated"]);
|
|
27
21
|
var directFieldSections = /* @__PURE__ */ new Set(["patterns", "utilities"]);
|
|
28
22
|
var themeEntryKeys = /* @__PURE__ */ new Set([
|
|
@@ -33,7 +27,8 @@ var themeEntryKeys = /* @__PURE__ */ new Set([
|
|
|
33
27
|
"layerStyles",
|
|
34
28
|
"recipes",
|
|
35
29
|
"slotRecipes",
|
|
36
|
-
"textStyles"
|
|
30
|
+
"textStyles",
|
|
31
|
+
"viewTransitions"
|
|
37
32
|
]);
|
|
38
33
|
var SourceTracker = class {
|
|
39
34
|
sources;
|
|
@@ -101,30 +96,6 @@ function shouldTrackThemePath(rest, value, current) {
|
|
|
101
96
|
if (key === "containerNames" || key === "colorPalette") return rest.length <= 2;
|
|
102
97
|
return rest.length <= 2;
|
|
103
98
|
}
|
|
104
|
-
function isPlainObject(value) {
|
|
105
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
106
|
-
const proto = Object.getPrototypeOf(value);
|
|
107
|
-
return proto === Object.prototype || proto === null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/shared.ts
|
|
111
|
-
var omitKeys2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
112
|
-
function isPlainObject2(value) {
|
|
113
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
114
|
-
const proto = Object.getPrototypeOf(value);
|
|
115
|
-
return proto === Object.prototype || proto === null;
|
|
116
|
-
}
|
|
117
|
-
function clone(value) {
|
|
118
|
-
if (Array.isArray(value)) return value.map((item) => clone(item));
|
|
119
|
-
if (isPlainObject2(value)) {
|
|
120
|
-
const result = {};
|
|
121
|
-
for (const [key, item] of Object.entries(value)) {
|
|
122
|
-
if (item !== void 0 && !omitKeys2.has(key)) result[key] = clone(item);
|
|
123
|
-
}
|
|
124
|
-
return result;
|
|
125
|
-
}
|
|
126
|
-
return value;
|
|
127
|
-
}
|
|
128
99
|
|
|
129
100
|
// src/merge.ts
|
|
130
101
|
var sectionKeys = [
|
|
@@ -135,13 +106,24 @@ var sectionKeys = [
|
|
|
135
106
|
"globalCss",
|
|
136
107
|
"globalVars",
|
|
137
108
|
"globalFontface",
|
|
138
|
-
"globalPositionTry",
|
|
139
109
|
"staticCss",
|
|
140
110
|
"themes"
|
|
141
111
|
];
|
|
142
112
|
var sectionKeySet2 = new Set(sectionKeys);
|
|
143
113
|
var runtimeOnlyKeys = /* @__PURE__ */ new Set(["presets", "plugins", "hooks", "name", "extend"]);
|
|
144
114
|
var tokenKeys2 = /* @__PURE__ */ new Set(["description", "extensions", "type", "value", "deprecated"]);
|
|
115
|
+
var themeRegistryKeys = /* @__PURE__ */ new Set([
|
|
116
|
+
"tokens",
|
|
117
|
+
"semanticTokens",
|
|
118
|
+
"keyframes",
|
|
119
|
+
"recipes",
|
|
120
|
+
"slotRecipes",
|
|
121
|
+
"textStyles",
|
|
122
|
+
"layerStyles",
|
|
123
|
+
"animationStyles",
|
|
124
|
+
"viewTransitions",
|
|
125
|
+
"positionTry"
|
|
126
|
+
]);
|
|
145
127
|
function mergeConfigsWithSources(configs) {
|
|
146
128
|
const tracker = new SourceTracker(configs.map((item) => item.source));
|
|
147
129
|
const config = mergeConfigs(configs, tracker);
|
|
@@ -154,13 +136,15 @@ function mergeConfigs(configs, tracker) {
|
|
|
154
136
|
const config = tracker ? configs[index].config : configs[index];
|
|
155
137
|
const context = tracker ? { tracker, sourceId: index, path: [] } : void 0;
|
|
156
138
|
for (const [key, value] of Object.entries(config)) {
|
|
157
|
-
if (value === void 0 || sectionKeySet2.has(key) || runtimeOnlyKeys.has(key) ||
|
|
139
|
+
if (value === void 0 || sectionKeySet2.has(key) || runtimeOnlyKeys.has(key) || omitKeys.has(key)) continue;
|
|
158
140
|
result[key] = clone(value);
|
|
159
141
|
context?.tracker.record([key], context.sourceId, "replace");
|
|
160
142
|
}
|
|
161
143
|
for (const key of sectionKeys) {
|
|
162
144
|
const section = config[key];
|
|
163
|
-
if (
|
|
145
|
+
if (!isPlainObject(section)) continue;
|
|
146
|
+
applySectionBase(key, sections[key], section, context);
|
|
147
|
+
applySectionExtend(key, sections[key], section, context);
|
|
164
148
|
}
|
|
165
149
|
}
|
|
166
150
|
for (const key of sectionKeys) {
|
|
@@ -169,21 +153,45 @@ function mergeConfigs(configs, tracker) {
|
|
|
169
153
|
if (result.theme?.tokens) normalizeNestedTokens(result.theme.tokens, tracker);
|
|
170
154
|
return result;
|
|
171
155
|
}
|
|
172
|
-
function
|
|
156
|
+
function applySectionBase(sectionName, target, section, context) {
|
|
173
157
|
const childContext = context && { ...context, path: [sectionName] };
|
|
174
158
|
for (const [key, value] of Object.entries(section)) {
|
|
175
|
-
if (key === "extend" || value === void 0 ||
|
|
176
|
-
|
|
159
|
+
if (key === "extend" || value === void 0 || omitKeys.has(key)) continue;
|
|
160
|
+
if (isRegistry(sectionName, key, value)) {
|
|
161
|
+
replaceRegistryEntries(target, key, value, childContext);
|
|
162
|
+
} else {
|
|
163
|
+
replaceValue(target, key, value, childContext);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function isRegistry(sectionName, key, value) {
|
|
168
|
+
return sectionName === "theme" && themeRegistryKeys.has(key) && isPlainObject(value);
|
|
169
|
+
}
|
|
170
|
+
function replaceRegistryEntries(target, key, registry, context) {
|
|
171
|
+
const entries = isPlainObject(target[key]) ? target[key] : target[key] = {};
|
|
172
|
+
const entryContext = context && { ...context, path: context.path.concat(key) };
|
|
173
|
+
for (const [name, value] of Object.entries(registry)) {
|
|
174
|
+
if (value === void 0 || omitKeys.has(name)) continue;
|
|
175
|
+
replaceValue(entries, name, value, entryContext);
|
|
177
176
|
}
|
|
177
|
+
}
|
|
178
|
+
function applySectionExtend(sectionName, target, section, context) {
|
|
178
179
|
if (section.extend === void 0) return;
|
|
179
|
-
if (!
|
|
180
|
+
if (!isPlainObject(section.extend)) {
|
|
180
181
|
throw new PandaError("CONFIG_ERROR", `\u{1F4A5} Config section \`${sectionName}.extend\` must be an object.`);
|
|
181
182
|
}
|
|
183
|
+
const childContext = context && { ...context, path: [sectionName] };
|
|
182
184
|
for (const [key, value] of Object.entries(section.extend)) {
|
|
183
|
-
if (value === void 0 ||
|
|
185
|
+
if (value === void 0 || omitKeys.has(key)) continue;
|
|
184
186
|
mergeValue(target, key, value, "concat", childContext);
|
|
185
187
|
}
|
|
186
188
|
}
|
|
189
|
+
function replaceValue(target, key, value, context) {
|
|
190
|
+
const path = context?.path.concat(key);
|
|
191
|
+
recordSource(context, path, value, target[key], "replace");
|
|
192
|
+
target[key] = clone(value);
|
|
193
|
+
recordNestedSources(context, path, value);
|
|
194
|
+
}
|
|
187
195
|
function mergeValue(target, key, value, arrayMode, context) {
|
|
188
196
|
const current = target[key];
|
|
189
197
|
const path = context?.path.concat(key);
|
|
@@ -192,11 +200,11 @@ function mergeValue(target, key, value, arrayMode, context) {
|
|
|
192
200
|
recordSource(context, path, value, current, arrayMode === "concat" ? "append" : "replace");
|
|
193
201
|
return;
|
|
194
202
|
}
|
|
195
|
-
if (
|
|
203
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
196
204
|
recordSource(context, path, value, current, "append");
|
|
197
205
|
const childContext = context && path ? { ...context, path } : void 0;
|
|
198
206
|
for (const [childKey, childValue] of Object.entries(value)) {
|
|
199
|
-
if (childValue !== void 0 && !
|
|
207
|
+
if (childValue !== void 0 && !omitKeys.has(childKey))
|
|
200
208
|
mergeValue(current, childKey, childValue, arrayMode, childContext);
|
|
201
209
|
}
|
|
202
210
|
return;
|
|
@@ -210,7 +218,7 @@ function normalizeNestedTokens(tokens, tracker) {
|
|
|
210
218
|
while (stack.length > 0) {
|
|
211
219
|
const current = stack.pop();
|
|
212
220
|
for (const [key, value] of Object.entries(current.value)) {
|
|
213
|
-
if (!
|
|
221
|
+
if (!isPlainObject(value)) continue;
|
|
214
222
|
if (isValidToken(value)) {
|
|
215
223
|
normalizeToken(value, tracker, current.path.concat(key));
|
|
216
224
|
} else {
|
|
@@ -243,8 +251,6 @@ function isValidToken(token) {
|
|
|
243
251
|
}
|
|
244
252
|
|
|
245
253
|
export {
|
|
246
|
-
PandaError,
|
|
247
|
-
isPlainObject2 as isPlainObject,
|
|
248
254
|
mergeConfigsWithSources,
|
|
249
255
|
mergeConfigs
|
|
250
256
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/error.ts
|
|
2
|
+
var PandaError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
hint;
|
|
5
|
+
diagnostics;
|
|
6
|
+
constructor(code, message, opts) {
|
|
7
|
+
super(message, { cause: opts?.cause });
|
|
8
|
+
this.code = `ERR_PANDA_${code}`;
|
|
9
|
+
this.hint = opts?.hint;
|
|
10
|
+
this.diagnostics = opts?.diagnostics;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function createConfigError(message, diagnostics) {
|
|
14
|
+
return new PandaError("CONFIG_ERROR", `\u{1F4A5} ${message}`, { diagnostics });
|
|
15
|
+
}
|
|
16
|
+
function createConfigDiagnostic(code, message, help) {
|
|
17
|
+
return {
|
|
18
|
+
code,
|
|
19
|
+
message,
|
|
20
|
+
severity: "error",
|
|
21
|
+
category: "config",
|
|
22
|
+
...help ? { help } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/shared.ts
|
|
27
|
+
var omitKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
28
|
+
function isPlainObject(value) {
|
|
29
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
30
|
+
const proto = Object.getPrototypeOf(value);
|
|
31
|
+
return proto === Object.prototype || proto === null;
|
|
32
|
+
}
|
|
33
|
+
function clone(value) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
const len = value.length;
|
|
36
|
+
const out2 = new Array(len);
|
|
37
|
+
for (let i = 0; i < len; i++) out2[i] = clone(value[i]);
|
|
38
|
+
return out2;
|
|
39
|
+
}
|
|
40
|
+
if (!isPlainObject(value)) return value;
|
|
41
|
+
const source = value;
|
|
42
|
+
const out = {};
|
|
43
|
+
const keys = Object.keys(source);
|
|
44
|
+
for (let i = 0; i < keys.length; i++) {
|
|
45
|
+
const key = keys[i];
|
|
46
|
+
if (omitKeys.has(key)) continue;
|
|
47
|
+
const item = source[key];
|
|
48
|
+
if (item !== void 0) out[key] = clone(item);
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
function ensureConfigObject(config, name) {
|
|
53
|
+
if (isPlainObject(config)) return config;
|
|
54
|
+
throw new PandaError("CONFIG_ERROR", `\u{1F4A5} Preset ${JSON.stringify(name)} must resolve to an object.`);
|
|
55
|
+
}
|
|
56
|
+
function errorMessage(error) {
|
|
57
|
+
return error instanceof Error ? error.message : String(error);
|
|
58
|
+
}
|
|
59
|
+
function compact(value) {
|
|
60
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
PandaError,
|
|
65
|
+
createConfigError,
|
|
66
|
+
createConfigDiagnostic,
|
|
67
|
+
omitKeys,
|
|
68
|
+
isPlainObject,
|
|
69
|
+
clone,
|
|
70
|
+
ensureConfigObject,
|
|
71
|
+
errorMessage,
|
|
72
|
+
compact
|
|
73
|
+
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compact,
|
|
3
|
+
createConfigError,
|
|
4
|
+
isPlainObject
|
|
5
|
+
} from "./chunk-R4R5RHIS.js";
|
|
6
|
+
|
|
1
7
|
// src/serialize.ts
|
|
2
8
|
import {
|
|
3
9
|
normalizeImportMap
|
|
@@ -5,7 +11,6 @@ import {
|
|
|
5
11
|
import { stringify } from "javascript-stringify";
|
|
6
12
|
|
|
7
13
|
// src/hooks.ts
|
|
8
|
-
var compact = (value) => Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
9
14
|
function serializeHooks(config, callbacks, sanitize2, hashCallbackSource2) {
|
|
10
15
|
const parserBefore = collectPluginHookHandlers(config, "parser:before").map((entry, index) => {
|
|
11
16
|
const hook = normalizeHook(entry.value, "parser:before");
|
|
@@ -46,10 +51,55 @@ function normalizeHook(value, name) {
|
|
|
46
51
|
return { filter: record.filter, handler: record.handler };
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
// src/utility-global-vars.ts
|
|
55
|
+
function mergeUtilityGlobalVars(config) {
|
|
56
|
+
const utilities = config.utilities;
|
|
57
|
+
if (!isPlainObject(utilities)) return config;
|
|
58
|
+
const merged = {};
|
|
59
|
+
const owners = /* @__PURE__ */ new Map();
|
|
60
|
+
let found = false;
|
|
61
|
+
const nextUtilities = {};
|
|
62
|
+
for (const [name, utility] of Object.entries(utilities)) {
|
|
63
|
+
if (!isPlainObject(utility) || !isPlainObject(utility.globalVars)) {
|
|
64
|
+
nextUtilities[name] = utility;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
found = true;
|
|
68
|
+
const { globalVars, ...rest } = utility;
|
|
69
|
+
nextUtilities[name] = rest;
|
|
70
|
+
for (const [key, definition] of Object.entries(globalVars)) {
|
|
71
|
+
const previous = merged[key];
|
|
72
|
+
if (previous !== void 0 && !isSameDefinition(previous, definition)) {
|
|
73
|
+
throw createConfigError(
|
|
74
|
+
`The \`${owners.get(key)}\` and \`${name}\` utilities both register \`${key}\`, with different definitions.
|
|
75
|
+
A CSS variable has one registration for the whole document, so share one definition between them.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
merged[key] = definition;
|
|
79
|
+
owners.set(key, name);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!found) return config;
|
|
83
|
+
const configVars = isPlainObject(config.globalVars) ? config.globalVars : {};
|
|
84
|
+
return {
|
|
85
|
+
...config,
|
|
86
|
+
utilities: nextUtilities,
|
|
87
|
+
globalVars: { ...merged, ...configVars },
|
|
88
|
+
utilityGlobalVars: Object.fromEntries(owners)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function isSameDefinition(a, b) {
|
|
92
|
+
if (a === b) return true;
|
|
93
|
+
if (!isPlainObject(a) || !isPlainObject(b)) return false;
|
|
94
|
+
const keys = Object.keys(a);
|
|
95
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
96
|
+
return keys.every((key) => a[key] === b[key]);
|
|
97
|
+
}
|
|
98
|
+
|
|
49
99
|
// src/serialize.ts
|
|
50
|
-
var compact2 = (value) => Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
51
100
|
var runtimeOnlyKeys = /* @__PURE__ */ new Set(["hooks", "plugins", "presets", "name"]);
|
|
52
|
-
function createConfigSnapshot(
|
|
101
|
+
function createConfigSnapshot(input) {
|
|
102
|
+
const config = mergeUtilityGlobalVars(input);
|
|
53
103
|
const callbacks = {};
|
|
54
104
|
const hooks = serializeHooks(config, callbacks, sanitize, hashCallbackSource);
|
|
55
105
|
const serialized = {
|
|
@@ -94,7 +144,7 @@ function attachPatternCodegenSource(serialized, config) {
|
|
|
94
144
|
if (!patterns || !serializedPatterns) return;
|
|
95
145
|
for (const [name, pattern] of Object.entries(patterns)) {
|
|
96
146
|
if (typeof pattern?.transform !== "function") continue;
|
|
97
|
-
const source = stringify(
|
|
147
|
+
const source = stringify(compact({ transform: pattern.transform, defaultValues: pattern.defaultValues })) ?? "";
|
|
98
148
|
if (serializedPatterns[name]) serializedPatterns[name].codegenSource = source;
|
|
99
149
|
}
|
|
100
150
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SerializedConfig, ProjectCallbacks, ProjectHooks, ConfigSnapshot, DiffConfigResult } from '@pandacss/compiler-shared';
|
|
1
|
+
import { DesignSystemManifest, CodegenOverlay, Diagnostic, SerializedConfig, ProjectCallbacks, ProjectHooks, ConfigSnapshot, DiffConfigResult, DesignSystemManifestImportMap } from '@pandacss/compiler-shared';
|
|
2
2
|
export { DiffConfigResult } from '@pandacss/compiler-shared';
|
|
3
|
-
import { HookRegistry, Config } from '@pandacss/types';
|
|
4
|
-
import { C as ConfigSources } from './merge-
|
|
5
|
-
export { a as ConfigSourceEntry, m as mergeConfigs } from './merge-
|
|
3
|
+
import { HookRegistry, Config, UserConfig } from '@pandacss/types';
|
|
4
|
+
import { C as ConfigSources } from './merge-EXcM0jFd.js';
|
|
5
|
+
export { a as ConfigSourceEntry, m as mergeConfigs } from './merge-EXcM0jFd.js';
|
|
6
6
|
export { ConfigSnapshot, createConfigSnapshot } from './serialize.js';
|
|
7
7
|
|
|
8
8
|
interface PluginHookEntry<Name extends keyof HookRegistry> {
|
|
@@ -13,8 +13,49 @@ interface PluginHookEntry<Name extends keyof HookRegistry> {
|
|
|
13
13
|
type HostHooks = {
|
|
14
14
|
'codegen:prepare'?: Array<PluginHookEntry<'codegen:prepare'>>;
|
|
15
15
|
'codegen:done'?: Array<PluginHookEntry<'codegen:done'>>;
|
|
16
|
+
'cssgen:done'?: Array<PluginHookEntry<'cssgen:done'>>;
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
interface DesignSystemOverlayInput {
|
|
20
|
+
authored: {
|
|
21
|
+
conditions: boolean;
|
|
22
|
+
breakpoints: boolean;
|
|
23
|
+
utilities: boolean;
|
|
24
|
+
tokens: boolean;
|
|
25
|
+
};
|
|
26
|
+
compatible: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ResolvedDesignSystem {
|
|
30
|
+
name: string;
|
|
31
|
+
specifier: string;
|
|
32
|
+
manifest: DesignSystemManifest;
|
|
33
|
+
manifestPath: string;
|
|
34
|
+
buildInfoPath: string;
|
|
35
|
+
files: string[];
|
|
36
|
+
tokenPaths: string[];
|
|
37
|
+
recipeNames: string[];
|
|
38
|
+
patternNames: string[];
|
|
39
|
+
importMap?: DesignSystemManifest['importMap'];
|
|
40
|
+
packageExports?: Record<string, unknown>;
|
|
41
|
+
optionMismatch?: string[];
|
|
42
|
+
}
|
|
43
|
+
interface DesignSystemMetadata {
|
|
44
|
+
designSystem?: ResolvedDesignSystem[];
|
|
45
|
+
userRecipeNames?: string[];
|
|
46
|
+
userPatternNames?: string[];
|
|
47
|
+
overlayInput?: DesignSystemOverlayInput;
|
|
48
|
+
}
|
|
49
|
+
declare function buildCodegenOverlay(metadata: DesignSystemMetadata | undefined): CodegenOverlay | undefined;
|
|
50
|
+
interface DesignSystemArtifactConflict {
|
|
51
|
+
name: string;
|
|
52
|
+
recipes: string[];
|
|
53
|
+
patterns: string[];
|
|
54
|
+
}
|
|
55
|
+
declare function collectArtifactConflicts(metadata: DesignSystemMetadata | undefined): DesignSystemArtifactConflict[];
|
|
56
|
+
declare function collectExportMissingDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
57
|
+
declare function collectNameCollisionDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
58
|
+
|
|
18
59
|
interface LoadConfigOptions {
|
|
19
60
|
cwd: string;
|
|
20
61
|
/** Explicit config file path (relative to `cwd`); otherwise discovered upward. */
|
|
@@ -37,6 +78,11 @@ interface LoadConfigResult {
|
|
|
37
78
|
dependencies: string[];
|
|
38
79
|
metadata?: {
|
|
39
80
|
sources?: ConfigSources;
|
|
81
|
+
designSystem?: ResolvedDesignSystem[];
|
|
82
|
+
userTokenPaths?: string[];
|
|
83
|
+
userRecipeNames?: string[];
|
|
84
|
+
userPatternNames?: string[];
|
|
85
|
+
overlayInput?: DesignSystemOverlayInput;
|
|
40
86
|
};
|
|
41
87
|
}
|
|
42
88
|
|
|
@@ -81,4 +127,82 @@ interface BundleConfigResult<T = Config> {
|
|
|
81
127
|
*/
|
|
82
128
|
declare function bundleConfig<T extends Config = Config>(filepath: string, cwd: string): Promise<BundleConfigResult<T>>;
|
|
83
129
|
|
|
84
|
-
|
|
130
|
+
declare function readPandaVersion(): string | undefined;
|
|
131
|
+
declare function getPandaMajorRange(): string | undefined;
|
|
132
|
+
declare function isStampablePandaRange(range: string | undefined): range is string;
|
|
133
|
+
|
|
134
|
+
interface CompilePresetResult {
|
|
135
|
+
code: string;
|
|
136
|
+
dependencies: string[];
|
|
137
|
+
}
|
|
138
|
+
interface CompilePresetOptions {
|
|
139
|
+
configPath: string;
|
|
140
|
+
cwd: string;
|
|
141
|
+
}
|
|
142
|
+
declare function compilePreset(options: CompilePresetOptions): Promise<CompilePresetResult>;
|
|
143
|
+
|
|
144
|
+
interface PackageIdentity {
|
|
145
|
+
name: string;
|
|
146
|
+
version?: string;
|
|
147
|
+
pandaPeer?: string;
|
|
148
|
+
packagePath: string;
|
|
149
|
+
/** package.json `"files"` when it's a string array; used for lib fallback publish checks. */
|
|
150
|
+
publishFiles?: string[];
|
|
151
|
+
}
|
|
152
|
+
declare function resolvePublishedPandaRange(range: string | undefined, currentVersion: string | undefined): string;
|
|
153
|
+
declare function readPackageIdentity(cwd: string): PackageIdentity;
|
|
154
|
+
declare function defaultImportMap(name: string): DesignSystemManifestImportMap;
|
|
155
|
+
interface SyncExportsResult {
|
|
156
|
+
changed: boolean;
|
|
157
|
+
json: string;
|
|
158
|
+
/** Existing subpaths whose value differed from the one Panda wrote (overwritten). */
|
|
159
|
+
conflicts: string[];
|
|
160
|
+
}
|
|
161
|
+
interface SyncExportsOptions {
|
|
162
|
+
packageJson: string;
|
|
163
|
+
entries: Record<string, unknown>;
|
|
164
|
+
}
|
|
165
|
+
declare function syncExports(options: SyncExportsOptions): SyncExportsResult;
|
|
166
|
+
|
|
167
|
+
interface FilterPublishableLibFilesOptions {
|
|
168
|
+
/** Fallback paths relative to the lib outdir (same form as manifest `files`). */
|
|
169
|
+
files: string[];
|
|
170
|
+
packageRoot: string;
|
|
171
|
+
/** Lib outdir — resolve `files` entries from here. */
|
|
172
|
+
outRoot: string;
|
|
173
|
+
/** package.json `"files"`; omit when the whole package is packed. */
|
|
174
|
+
publishFiles?: string[];
|
|
175
|
+
}
|
|
176
|
+
interface FilterPublishableLibFilesResult {
|
|
177
|
+
files: string[];
|
|
178
|
+
unpublished: string[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Drop inferred lib fallback paths that would not ship in the npm tarball when
|
|
182
|
+
* package.json `"files"` is set. Explicit `--files` should skip this filter.
|
|
183
|
+
*
|
|
184
|
+
* Runs once at `panda lib` time (not on consume/cssgen). Patterns are compiled
|
|
185
|
+
* once per call; the common `"files": ["dist"]` case is prefix-only.
|
|
186
|
+
*/
|
|
187
|
+
declare function filterPublishableLibFiles(options: FilterPublishableLibFilesOptions): FilterPublishableLibFilesResult;
|
|
188
|
+
/** Read package.json `"files"` when it is a non-empty string array. */
|
|
189
|
+
declare function readPublishFilesField(value: unknown): string[] | undefined;
|
|
190
|
+
|
|
191
|
+
interface SmartIncludeResult {
|
|
192
|
+
include: string[];
|
|
193
|
+
excludes: string[];
|
|
194
|
+
changed: boolean;
|
|
195
|
+
}
|
|
196
|
+
declare function resolveSmartInclude(include: string[], cwd: string, deps: Set<string>): SmartIncludeResult;
|
|
197
|
+
declare function mergeExcludes(existing: string[] | undefined, additions: string[]): string[];
|
|
198
|
+
|
|
199
|
+
declare function collectTokenPaths(config: Pick<UserConfig, 'theme'> | undefined): string[];
|
|
200
|
+
|
|
201
|
+
declare function toPosixPath(path: string): string;
|
|
202
|
+
declare function toPosixRelative(from: string, to: string): string;
|
|
203
|
+
declare function toRelativeKey(key: string, cwd: string): string;
|
|
204
|
+
|
|
205
|
+
declare function collectRecipeNames(config: Pick<UserConfig, 'theme'> | undefined): string[];
|
|
206
|
+
declare function collectPatternNames(config: Pick<UserConfig, 'patterns'> | undefined): string[];
|
|
207
|
+
|
|
208
|
+
export { type BundleConfigResult, type CompilePresetOptions, type CompilePresetResult, ConfigSources, type DesignSystemArtifactConflict, type DesignSystemMetadata, type DesignSystemOverlayInput, type FilterPublishableLibFilesOptions, type FilterPublishableLibFilesResult, type HostHooks, type LoadConfigOptions, type LoadConfigResult, type PackageIdentity, type ResolvedDesignSystem, type SyncExportsOptions, type SyncExportsResult, buildCodegenOverlay, bundleConfig, collectArtifactConflicts, collectExportMissingDiagnostics, collectNameCollisionDiagnostics, collectPatternNames, collectRecipeNames, collectTokenPaths, compilePreset, defaultImportMap, diffConfig, filterPublishableLibFiles, findConfig, getPandaMajorRange, isStampablePandaRange, loadConfig, mergeExcludes, readPackageIdentity, readPandaVersion, readPublishFilesField, resolvePublishedPandaRange, resolveSmartInclude, syncExports, toPosixPath, toPosixRelative, toRelativeKey };
|