@pandacss/transformer 2.0.0-beta.9

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Chakra Systems Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ import * as _rolldown from 'rolldown';
2
+ import * as unplugin from 'unplugin';
3
+ import * as _rollup from 'rollup';
4
+ import * as _webpack from 'webpack';
5
+ import * as _vite from 'vite';
6
+ import * as _pandacss_compiler_shared from '@pandacss/compiler-shared';
7
+ import { PandaTransformerOptions, PandaSourceTransformContext, PandaSourceTransformResult, Compiler, SourceTransformer, TransformerOptions, TransformSourceRequest, TransformResult } from '@pandacss/compiler-shared';
8
+ export { PandaSourceTransformContext, PandaSourceTransformResult, PandaTransformerOptions, SourceTransformer, TransformResult, TransformSourceInput, TransformSourceRequest, TransformerOptions } from '@pandacss/compiler-shared';
9
+ export { CxOptions, CxSeparator, PandaClassPart, createCx, cx, getMergeKey, splitClassName } from './runtime/cx.js';
10
+ export { StringCvaConfig, css, cva, sva } from './runtime/internal.js';
11
+
12
+ /** Marker baked into the default bundle — replaced per-project at load time. */
13
+ declare const CX_SEPARATOR_PLACEHOLDER = "__PANDA_CX_SEPARATOR__";
14
+ declare function resolveCxSeparator(config: Record<string, unknown> | undefined): string;
15
+ /** Patch the prebuilt virtual `@pandacss-internal/css` module with the project separator. */
16
+ declare function buildInternalCssRuntimeSource(separator: string, base?: string): string;
17
+ /** Virtual module source for `@pandacss-internal/css`. */
18
+ declare function getInternalCssRuntimeSource(separator?: string): string;
19
+
20
+ /** Transformed source imports — mirrors styled-system/css surface. */
21
+ declare const INTERNAL_CSS_IMPORT = "@pandacss-internal/css";
22
+ declare const INTERNAL_CSS_RESOLVED_ID = "\0pandacss:internal:css";
23
+
24
+ declare function resolveCompiler(options: PandaTransformerOptions): Compiler | undefined;
25
+ declare function resolveTransformer(options: PandaTransformerOptions): SourceTransformer | undefined;
26
+ declare function runSourceTransform(ctx: PandaSourceTransformContext, options: PandaTransformerOptions, code: string, id: string): PandaSourceTransformResult | null;
27
+ declare function createPandaSourcePluginHooks(resolveOptions: () => PandaTransformerOptions): {
28
+ resolveId(id: string): "\0pandacss:internal:css" | null;
29
+ load(id: string): string | null;
30
+ transform(this: PandaSourceTransformContext, code: string, id: string): PandaSourceTransformResult | null;
31
+ };
32
+
33
+ declare const pandaTransformer: unplugin.UnpluginInstance<PandaTransformerOptions, boolean>;
34
+
35
+ declare function createSourceTransformer(compiler: Compiler): SourceTransformer;
36
+ declare function transformSource(input: TransformSourceRequest): TransformResult;
37
+ declare function shouldTransform(path: string, options?: TransformerOptions): boolean;
38
+
39
+ declare const vite: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _vite.Plugin<any> | _vite.Plugin<any>[];
40
+ declare const webpack: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _webpack.WebpackPluginInstance;
41
+ declare const rollup: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _rollup.Plugin<any> | _rollup.Plugin<any>[];
42
+ declare const esbuild: (options: _pandacss_compiler_shared.PandaTransformerOptions) => unplugin.EsbuildPlugin;
43
+ declare const rspack: (options: _pandacss_compiler_shared.PandaTransformerOptions) => RspackPluginInstance;
44
+ declare const rolldown: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _rolldown.Plugin<any> | _rolldown.Plugin<any>[];
45
+
46
+ export { CX_SEPARATOR_PLACEHOLDER, INTERNAL_CSS_IMPORT, INTERNAL_CSS_RESOLVED_ID, buildInternalCssRuntimeSource, createPandaSourcePluginHooks, createSourceTransformer, pandaTransformer as default, esbuild, getInternalCssRuntimeSource, pandaTransformer, resolveCompiler, resolveCxSeparator, resolveTransformer, rolldown, rollup, rspack, runSourceTransform, shouldTransform, transformSource, vite, webpack };
package/dist/index.js ADDED
@@ -0,0 +1,468 @@
1
+ // src/runtime/internal/cx.ts
2
+ var bakedSeparator = typeof __PANDA_CX_SEPARATOR__ !== "undefined" && __PANDA_CX_SEPARATOR__ ? __PANDA_CX_SEPARATOR__ : "_";
3
+ function splitClassName(className) {
4
+ const segments = [];
5
+ let current = "";
6
+ let bracketDepth = 0;
7
+ for (let i = 0; i < className.length; i++) {
8
+ const ch = className[i];
9
+ if (ch === "[") {
10
+ bracketDepth++;
11
+ current += ch;
12
+ } else if (ch === "]") {
13
+ bracketDepth--;
14
+ current += ch;
15
+ } else if (ch === ":" && bracketDepth === 0) {
16
+ if (current) segments.push(current);
17
+ current = "";
18
+ } else {
19
+ current += ch;
20
+ }
21
+ }
22
+ if (current) segments.push(current);
23
+ return segments;
24
+ }
25
+ function getMergeKey(className, separator) {
26
+ let cls = className;
27
+ if (cls.endsWith("!")) {
28
+ cls = cls.slice(0, -1);
29
+ }
30
+ const segments = splitClassName(cls);
31
+ if (segments.length === 0) return null;
32
+ const last = segments[segments.length - 1];
33
+ const sepIdx = last.indexOf(separator);
34
+ if (sepIdx < 1) return null;
35
+ const property = last.slice(0, sepIdx);
36
+ if (segments.length === 1) {
37
+ return property;
38
+ }
39
+ const conditions = segments.slice(0, -1).join(":");
40
+ return `${conditions}:${property}`;
41
+ }
42
+ function flattenParts(parts, out) {
43
+ for (const part of parts) {
44
+ if (!part) continue;
45
+ if (Array.isArray(part)) {
46
+ flattenParts(part, out);
47
+ continue;
48
+ }
49
+ if (part === "") continue;
50
+ out.push(part);
51
+ }
52
+ }
53
+ function mergeClassStrings(separator, classes) {
54
+ const seen = /* @__PURE__ */ new Map();
55
+ const order = [];
56
+ let id = 0;
57
+ for (const cls of classes) {
58
+ for (const token of cls.split(" ")) {
59
+ if (!token) continue;
60
+ const key = getMergeKey(token, separator);
61
+ if (key !== null) {
62
+ if (!seen.has(key)) order.push(key);
63
+ seen.set(key, token);
64
+ } else {
65
+ const uniqueKey = `__${id++}`;
66
+ order.push(uniqueKey);
67
+ seen.set(uniqueKey, token);
68
+ }
69
+ }
70
+ }
71
+ let str = "";
72
+ for (let i = 0; i < order.length; i++) {
73
+ if (str) str += " ";
74
+ str += seen.get(order[i]);
75
+ }
76
+ return str;
77
+ }
78
+ function createCx(options = {}) {
79
+ const separator = options.separator ?? bakedSeparator;
80
+ return function cx2(...parts) {
81
+ const flat = [];
82
+ flattenParts(parts, flat);
83
+ return mergeClassStrings(separator, flat);
84
+ };
85
+ }
86
+ var cx = createCx();
87
+
88
+ // src/runtime/internal/css.ts
89
+ function css(...styles) {
90
+ return cx(...styles);
91
+ }
92
+
93
+ // src/runtime/internal/cva.ts
94
+ function withDefaults(defaults, props) {
95
+ const out = { ...defaults };
96
+ for (const key in props) {
97
+ if (props[key] !== void 0) out[key] = props[key];
98
+ }
99
+ return out;
100
+ }
101
+ function compoundMatches(compound, variants) {
102
+ for (const key in compound) {
103
+ if (key === "css" || key === "className" || key === "classNames") continue;
104
+ const expected = compound[key];
105
+ const actual = variants[key];
106
+ if (Array.isArray(expected)) {
107
+ if (!expected.includes(actual)) return false;
108
+ } else if (actual !== expected) {
109
+ return false;
110
+ }
111
+ }
112
+ return true;
113
+ }
114
+ function toVariantMap(variants) {
115
+ const map = {};
116
+ for (const key in variants) map[key] = Object.keys(variants[key] ?? {});
117
+ return map;
118
+ }
119
+ function cva(config) {
120
+ const base = config.base ?? "";
121
+ const variants = config.variants ?? {};
122
+ const defaultVariants = config.defaultVariants ?? {};
123
+ const compoundVariants = config.compoundVariants ?? [];
124
+ const variantKeys = Object.keys(variants);
125
+ const resolve = (props = {}) => {
126
+ const computed = withDefaults(defaultVariants, props);
127
+ const parts = [];
128
+ if (base) parts.push(base);
129
+ for (const key of variantKeys) {
130
+ const value = computed[key];
131
+ if (typeof value === "string" && variants[key]?.[value]) {
132
+ parts.push(variants[key][value]);
133
+ }
134
+ }
135
+ for (const compound of compoundVariants) {
136
+ if (!compoundMatches(compound, computed)) continue;
137
+ const cls = compound.className ?? compound.css;
138
+ if (typeof cls === "string" && cls) parts.push(cls);
139
+ }
140
+ return cx(...parts);
141
+ };
142
+ const cvaFn = (props = {}) => resolve(props);
143
+ return Object.assign(cvaFn, {
144
+ __cva__: true,
145
+ variantKeys,
146
+ variantMap: toVariantMap(variants),
147
+ raw: resolve,
148
+ config,
149
+ getVariantProps(props) {
150
+ return withDefaults(defaultVariants, props);
151
+ },
152
+ splitVariantProps(props) {
153
+ const rest = {};
154
+ const variantProps = {};
155
+ for (const key in props) {
156
+ if (variantKeys.includes(key)) variantProps[key] = props[key];
157
+ else rest[key] = props[key];
158
+ }
159
+ return [rest, variantProps];
160
+ }
161
+ });
162
+ }
163
+
164
+ // src/runtime/internal/sva.ts
165
+ function slotCompoundVariants(compoundVariants, slot) {
166
+ if (!compoundVariants?.length) return void 0;
167
+ return compoundVariants.map((compound) => {
168
+ const next = {};
169
+ for (const key in compound) {
170
+ if (key === "css" || key === "className" || key === "classNames") continue;
171
+ next[key] = compound[key];
172
+ }
173
+ const css2 = compound.css;
174
+ if (typeof css2 === "string") next.css = css2;
175
+ else if (css2 && typeof css2 === "object" && slot in css2) next.css = css2[slot];
176
+ const className = compound.classNames?.[slot] ?? compound.className;
177
+ if (className) next.className = className;
178
+ return next;
179
+ }).filter((compound) => compound.css || compound.className);
180
+ }
181
+ function getSlotRecipes(config) {
182
+ const slots = config.slots ?? Object.keys(config.base ?? {});
183
+ const recipes = {};
184
+ for (const slot of slots) {
185
+ recipes[slot] = {
186
+ base: config.base?.[slot],
187
+ variants: config.variants,
188
+ defaultVariants: config.defaultVariants,
189
+ compoundVariants: slotCompoundVariants(config.compoundVariants, slot)
190
+ };
191
+ if (config.className?.[slot]) {
192
+ recipes[slot] = {
193
+ ...recipes[slot],
194
+ base: cx(recipes[slot]?.base, config.className[slot])
195
+ };
196
+ }
197
+ }
198
+ return recipes;
199
+ }
200
+ function sva(config) {
201
+ const slotRecipes = getSlotRecipes(config);
202
+ const slots = Object.entries(slotRecipes).map(([slot, recipe]) => [slot, cva(recipe)]);
203
+ const defaultVariants = config.defaultVariants ?? {};
204
+ const variantKeys = Object.keys(config.variants ?? {});
205
+ const svaFn = (props = {}) => {
206
+ const result = {};
207
+ for (const [slot, slotFn] of slots) {
208
+ result[slot] = slotFn(props);
209
+ }
210
+ return result;
211
+ };
212
+ const raw = (props = {}) => {
213
+ const result = {};
214
+ for (const [slot, slotFn] of slots) {
215
+ result[slot] = slotFn.raw(props);
216
+ }
217
+ return result;
218
+ };
219
+ return Object.assign(svaFn, {
220
+ __cva__: false,
221
+ raw,
222
+ config,
223
+ variantMap: Object.fromEntries(variantKeys.map((key) => [key, Object.keys(config.variants?.[key] ?? {})])),
224
+ variantKeys,
225
+ classNameMap: config.className ?? {},
226
+ getVariantProps(props) {
227
+ const out = { ...defaultVariants };
228
+ for (const key in props) {
229
+ if (props[key] !== void 0) out[key] = props[key];
230
+ }
231
+ return out;
232
+ },
233
+ splitVariantProps(props) {
234
+ const rest = {};
235
+ const variantProps = {};
236
+ for (const key in props) {
237
+ if (variantKeys.includes(key)) variantProps[key] = props[key];
238
+ else rest[key] = props[key];
239
+ }
240
+ return [rest, variantProps];
241
+ }
242
+ });
243
+ }
244
+
245
+ // src/runtime/internal/source.ts
246
+ var internalCssSource = 'var x="__PANDA_CX_SEPARATOR__";function m(t){let r=[],n="",s=0;for(let a=0;a<t.length;a++){let i=t[a];i==="["?(s++,n+=i):i==="]"?(s--,n+=i):i===":"&&s===0?(n&&r.push(n),n=""):n+=i}return n&&r.push(n),r}function C(t,r){let n=t;n.endsWith("!")&&(n=n.slice(0,-1));let s=m(n);if(s.length===0)return null;let a=s[s.length-1],i=a.indexOf(r);if(i<1)return null;let u=a.slice(0,i);return s.length===1?u:`${s.slice(0,-1).join(":")}:${u}`}function R(t,r){for(let n of t)if(n){if(Array.isArray(n)){R(n,r);continue}n!==""&&r.push(n)}}function V(t,r){let n=new Map,s=[],a=0;for(let u of r)for(let o of u.split(" ")){if(!o)continue;let e=C(o,t);if(e!==null)n.has(e)||s.push(e),n.set(e,o);else{let c=`__${a++}`;s.push(c),n.set(c,o)}}let i="";for(let u=0;u<s.length;u++)i&&(i+=" "),i+=n.get(s[u]);return i}function v(t={}){let r=t.separator??x;return function(...s){let a=[];return R(s,a),V(r,a)}}var g=v();function y(...t){return g(...t)}function _(t,r){let n={...t};for(let s in r)r[s]!==void 0&&(n[s]=r[s]);return n}function w(t,r){for(let n in t){if(n==="css"||n==="className"||n==="classNames")continue;let s=t[n],a=r[n];if(Array.isArray(s)){if(!s.includes(a))return!1}else if(a!==s)return!1}return!0}function N(t){let r={};for(let n in t)r[n]=Object.keys(t[n]??{});return r}function p(t){let r=t.base??"",n=t.variants??{},s=t.defaultVariants??{},a=t.compoundVariants??[],i=Object.keys(n),u=(e={})=>{let c=_(s,e),f=[];r&&f.push(r);for(let l of i){let d=c[l];typeof d=="string"&&n[l]?.[d]&&f.push(n[l][d])}for(let l of a){if(!w(l,c))continue;let d=l.className??l.css;typeof d=="string"&&d&&f.push(d)}return g(...f)};return Object.assign((e={})=>u(e),{__cva__:!0,variantKeys:i,variantMap:N(n),raw:u,config:t,getVariantProps(e){return _(s,e)},splitVariantProps(e){let c={},f={};for(let l in e)i.includes(l)?f[l]=e[l]:c[l]=e[l];return[c,f]}})}function P(t,r){if(t?.length)return t.map(n=>{let s={};for(let u in n)u==="css"||u==="className"||u==="classNames"||(s[u]=n[u]);let a=n.css;typeof a=="string"?s.css=a:a&&typeof a=="object"&&r in a&&(s.css=a[r]);let i=n.classNames?.[r]??n.className;return i&&(s.className=i),s}).filter(n=>n.css||n.className)}function b(t){let r=t.slots??Object.keys(t.base??{}),n={};for(let s of r)n[s]={base:t.base?.[s],variants:t.variants,defaultVariants:t.defaultVariants,compoundVariants:P(t.compoundVariants,s)},t.className?.[s]&&(n[s]={...n[s],base:g(n[s]?.base,t.className[s])});return n}function k(t){let r=b(t),n=Object.entries(r).map(([o,e])=>[o,p(e)]),s=t.defaultVariants??{},a=Object.keys(t.variants??{});return Object.assign((o={})=>{let e={};for(let[c,f]of n)e[c]=f(o);return e},{__cva__:!1,raw:(o={})=>{let e={};for(let[c,f]of n)e[c]=f.raw(o);return e},config:t,variantMap:Object.fromEntries(a.map(o=>[o,Object.keys(t.variants?.[o]??{})])),variantKeys:a,classNameMap:t.className??{},getVariantProps(o){let e={...s};for(let c in o)o[c]!==void 0&&(e[c]=o[c]);return e},splitVariantProps(o){let e={},c={};for(let f in o)a.includes(f)?c[f]=o[f]:e[f]=o[f];return[e,c]}})}export{y as css,p as cva,g as cx,k as sva};\n';
247
+
248
+ // src/runtime/internal/load.ts
249
+ var CX_SEPARATOR_PLACEHOLDER = "__PANDA_CX_SEPARATOR__";
250
+ var runtimeCache = /* @__PURE__ */ new Map();
251
+ function resolveCxSeparator(config) {
252
+ const raw = config?.separator;
253
+ if (typeof raw === "string" && raw.length > 0) return raw;
254
+ return "_";
255
+ }
256
+ function patchSeparator(source, separator) {
257
+ const quoted = JSON.stringify(separator);
258
+ if (source.includes(CX_SEPARATOR_PLACEHOLDER)) {
259
+ return source.split(CX_SEPARATOR_PLACEHOLDER).join(separator);
260
+ }
261
+ return source.replace(/var d="_"/, `var d=${quoted}`);
262
+ }
263
+ function buildInternalCssRuntimeSource(separator, base = internalCssSource) {
264
+ return patchSeparator(base, separator);
265
+ }
266
+ function getInternalCssRuntimeSource(separator = "_") {
267
+ const cached = runtimeCache.get(separator);
268
+ if (cached) return cached;
269
+ const source = buildInternalCssRuntimeSource(separator);
270
+ runtimeCache.set(separator, source);
271
+ return source;
272
+ }
273
+
274
+ // src/runtime/internal/ids.ts
275
+ var INTERNAL_CSS_IMPORT = "@pandacss-internal/css";
276
+ var INTERNAL_CSS_RESOLVED_ID = "\0pandacss:internal:css";
277
+ function isInternalCssImport(id) {
278
+ return id === INTERNAL_CSS_IMPORT;
279
+ }
280
+ function isInternalCssResolvedId(id) {
281
+ return id === INTERNAL_CSS_RESOLVED_ID;
282
+ }
283
+
284
+ // src/transform.ts
285
+ function createSourceTransformer(compiler) {
286
+ const binding = compiler;
287
+ return {
288
+ compiler,
289
+ transformSource(input) {
290
+ if (typeof binding.transformSource !== "function") {
291
+ throw new Error("Source transforms are not available for this compiler instance");
292
+ }
293
+ return normalizeResult(binding.transformSource(toNativeInput(input)));
294
+ }
295
+ };
296
+ }
297
+ function transformSource(input) {
298
+ const transformer = input.transformer ?? (input.compiler ? createSourceTransformer(input.compiler) : void 0);
299
+ if (!transformer) {
300
+ throw new Error("Source transforms require a compiler or source transformer");
301
+ }
302
+ return transformer.transformSource(input);
303
+ }
304
+ function normalizeResult(result) {
305
+ return {
306
+ code: result.code,
307
+ map: result.map,
308
+ changed: result.changed,
309
+ bailed: result.bailed,
310
+ diagnostics: result.diagnostics,
311
+ dependencies: result.dependencies,
312
+ helper: result.helper
313
+ };
314
+ }
315
+ function toNativeInput(input) {
316
+ return {
317
+ path: input.path,
318
+ source: input.source,
319
+ ...toNativeOptions(input)
320
+ };
321
+ }
322
+ function toNativeOptions(options) {
323
+ return {
324
+ mode: options.mode,
325
+ helperCx: options.helper?.cx === true ? "true" : options.helper?.cx === false ? "false" : "auto",
326
+ targetsCss: options.targets?.css,
327
+ targetsPatterns: options.targets?.patterns,
328
+ targetsRecipes: options.targets?.recipes,
329
+ targetsTokens: options.targets?.tokens,
330
+ targetsJsx: options.targets?.jsx
331
+ };
332
+ }
333
+ var SOURCE_RE = /\.(c|m)?(t|j)sx?$/;
334
+ function shouldTransform(path, options = {}) {
335
+ const id = path.split("?")[0] ?? path;
336
+ if (!SOURCE_RE.test(id)) return false;
337
+ if (options.include && !matchesAny(id, options.include)) return false;
338
+ if (options.exclude && matchesAny(id, options.exclude)) return false;
339
+ return true;
340
+ }
341
+ function matchesAny(path, patterns) {
342
+ const list = Array.isArray(patterns) ? patterns : [patterns];
343
+ return list.some((pattern) => pattern.test(path));
344
+ }
345
+
346
+ // src/hooks.ts
347
+ function resolveCompiler(options) {
348
+ return options.compiler ?? options.getCompiler?.() ?? resolveTransformer(options)?.compiler;
349
+ }
350
+ function resolveTransformer(options) {
351
+ const transformer = options.transformer ?? options.getTransformer?.();
352
+ if (transformer) return transformer;
353
+ const compiler = options.compiler ?? options.getCompiler?.();
354
+ return compiler ? createSourceTransformer(compiler) : void 0;
355
+ }
356
+ function runSourceTransform(ctx, options, code, id) {
357
+ if (!shouldTransform(id, options)) return null;
358
+ const transformer = resolveTransformer(options);
359
+ if (!transformer) return null;
360
+ const {
361
+ compiler: _compiler,
362
+ getCompiler: _getCompiler,
363
+ getTransformer: _getTransformer,
364
+ transformer: _transformer,
365
+ ...transformOptions
366
+ } = options;
367
+ const result = transformSource({ ...transformOptions, transformer, path: id, source: code });
368
+ for (const dep of result.dependencies) {
369
+ ctx.addWatchFile?.(dep);
370
+ }
371
+ if (!result.changed) return null;
372
+ return {
373
+ code: result.code,
374
+ map: result.map,
375
+ diagnostics: result.diagnostics,
376
+ dependencies: result.dependencies,
377
+ changed: result.changed,
378
+ bailed: result.bailed
379
+ };
380
+ }
381
+ function createPandaSourcePluginHooks(resolveOptions) {
382
+ return {
383
+ resolveId(id) {
384
+ if (isInternalCssImport(id)) {
385
+ return INTERNAL_CSS_RESOLVED_ID;
386
+ }
387
+ return null;
388
+ },
389
+ load(id) {
390
+ if (!isInternalCssResolvedId(id)) return null;
391
+ const compiler = resolveCompiler(resolveOptions());
392
+ return getInternalCssRuntimeSource(resolveCxSeparator(compiler?.config()));
393
+ },
394
+ transform(code, id) {
395
+ return runSourceTransform(this, resolveOptions(), code, id);
396
+ }
397
+ };
398
+ }
399
+
400
+ // src/plugin.ts
401
+ import { createUnplugin } from "unplugin";
402
+ var pandaTransformer = createUnplugin((options) => {
403
+ const {
404
+ compiler: _compiler,
405
+ transformer: _transformer,
406
+ getCompiler: _getCompiler,
407
+ getTransformer: _getTransformer,
408
+ ...transformOptions
409
+ } = options;
410
+ const hooks = createPandaSourcePluginHooks(() => ({
411
+ ...transformOptions,
412
+ compiler: options.compiler,
413
+ transformer: options.transformer,
414
+ getCompiler: options.getCompiler,
415
+ getTransformer: options.getTransformer
416
+ }));
417
+ return {
418
+ name: "pandacss-transformer",
419
+ enforce: "pre",
420
+ ...hooks,
421
+ loadInclude(id) {
422
+ return id === INTERNAL_CSS_RESOLVED_ID;
423
+ },
424
+ transformInclude(id) {
425
+ return shouldTransform(id, transformOptions);
426
+ }
427
+ };
428
+ });
429
+ var plugin_default = pandaTransformer;
430
+
431
+ // src/index.ts
432
+ var src_default = plugin_default;
433
+ var vite = plugin_default.vite;
434
+ var webpack = plugin_default.webpack;
435
+ var rollup = plugin_default.rollup;
436
+ var esbuild = plugin_default.esbuild;
437
+ var rspack = plugin_default.rspack;
438
+ var rolldown = plugin_default.rolldown;
439
+ export {
440
+ CX_SEPARATOR_PLACEHOLDER,
441
+ INTERNAL_CSS_IMPORT,
442
+ INTERNAL_CSS_RESOLVED_ID,
443
+ buildInternalCssRuntimeSource,
444
+ createCx,
445
+ createPandaSourcePluginHooks,
446
+ createSourceTransformer,
447
+ css,
448
+ cva,
449
+ cx,
450
+ src_default as default,
451
+ esbuild,
452
+ getInternalCssRuntimeSource,
453
+ getMergeKey,
454
+ pandaTransformer,
455
+ resolveCompiler,
456
+ resolveCxSeparator,
457
+ resolveTransformer,
458
+ rolldown,
459
+ rollup,
460
+ rspack,
461
+ runSourceTransform,
462
+ shouldTransform,
463
+ splitClassName,
464
+ sva,
465
+ transformSource,
466
+ vite,
467
+ webpack
468
+ };
@@ -0,0 +1,16 @@
1
+ type PandaClassPart = string | false | null | undefined | PandaClassPart[];
2
+ type CxSeparator = '_' | '=' | '-';
3
+ interface CxOptions {
4
+ /** Panda `config.separator` — defaults to `_`. */
5
+ separator?: CxSeparator | string;
6
+ }
7
+ /** Split a className by ':' while respecting bracket boundaries. */
8
+ declare function splitClassName(className: string): string[];
9
+ /** Merge key for one Panda atomic class token (conditions + property). */
10
+ declare function getMergeKey(className: string, separator: string): string | null;
11
+ /** Build a transform-time `cx` helper bound to the project separator. */
12
+ declare function createCx(options?: CxOptions): (...parts: PandaClassPart[]) => string;
13
+ /** Default transform-time `cx` — mirrors styled-system naming with Panda merge semantics. */
14
+ declare const cx: (...parts: PandaClassPart[]) => string;
15
+
16
+ export { type CxOptions, type CxSeparator, type PandaClassPart, createCx, cx, getMergeKey, splitClassName };
@@ -0,0 +1,92 @@
1
+ // src/runtime/internal/cx.ts
2
+ var bakedSeparator = typeof __PANDA_CX_SEPARATOR__ !== "undefined" && __PANDA_CX_SEPARATOR__ ? __PANDA_CX_SEPARATOR__ : "_";
3
+ function splitClassName(className) {
4
+ const segments = [];
5
+ let current = "";
6
+ let bracketDepth = 0;
7
+ for (let i = 0; i < className.length; i++) {
8
+ const ch = className[i];
9
+ if (ch === "[") {
10
+ bracketDepth++;
11
+ current += ch;
12
+ } else if (ch === "]") {
13
+ bracketDepth--;
14
+ current += ch;
15
+ } else if (ch === ":" && bracketDepth === 0) {
16
+ if (current) segments.push(current);
17
+ current = "";
18
+ } else {
19
+ current += ch;
20
+ }
21
+ }
22
+ if (current) segments.push(current);
23
+ return segments;
24
+ }
25
+ function getMergeKey(className, separator) {
26
+ let cls = className;
27
+ if (cls.endsWith("!")) {
28
+ cls = cls.slice(0, -1);
29
+ }
30
+ const segments = splitClassName(cls);
31
+ if (segments.length === 0) return null;
32
+ const last = segments[segments.length - 1];
33
+ const sepIdx = last.indexOf(separator);
34
+ if (sepIdx < 1) return null;
35
+ const property = last.slice(0, sepIdx);
36
+ if (segments.length === 1) {
37
+ return property;
38
+ }
39
+ const conditions = segments.slice(0, -1).join(":");
40
+ return `${conditions}:${property}`;
41
+ }
42
+ function flattenParts(parts, out) {
43
+ for (const part of parts) {
44
+ if (!part) continue;
45
+ if (Array.isArray(part)) {
46
+ flattenParts(part, out);
47
+ continue;
48
+ }
49
+ if (part === "") continue;
50
+ out.push(part);
51
+ }
52
+ }
53
+ function mergeClassStrings(separator, classes) {
54
+ const seen = /* @__PURE__ */ new Map();
55
+ const order = [];
56
+ let id = 0;
57
+ for (const cls of classes) {
58
+ for (const token of cls.split(" ")) {
59
+ if (!token) continue;
60
+ const key = getMergeKey(token, separator);
61
+ if (key !== null) {
62
+ if (!seen.has(key)) order.push(key);
63
+ seen.set(key, token);
64
+ } else {
65
+ const uniqueKey = `__${id++}`;
66
+ order.push(uniqueKey);
67
+ seen.set(uniqueKey, token);
68
+ }
69
+ }
70
+ }
71
+ let str = "";
72
+ for (let i = 0; i < order.length; i++) {
73
+ if (str) str += " ";
74
+ str += seen.get(order[i]);
75
+ }
76
+ return str;
77
+ }
78
+ function createCx(options = {}) {
79
+ const separator = options.separator ?? bakedSeparator;
80
+ return function cx2(...parts) {
81
+ const flat = [];
82
+ flattenParts(parts, flat);
83
+ return mergeClassStrings(separator, flat);
84
+ };
85
+ }
86
+ var cx = createCx();
87
+ export {
88
+ createCx,
89
+ cx,
90
+ getMergeKey,
91
+ splitClassName
92
+ };
@@ -0,0 +1,54 @@
1
+ export { CxOptions, CxSeparator, PandaClassPart, createCx, cx, getMergeKey, splitClassName } from './cx.js';
2
+
3
+ /** Transformed `css()` sites receive pre-encoded class strings only. */
4
+ declare function css(...styles: string[]): string;
5
+
6
+ type VariantMap = Record<string, Record<string, string>>;
7
+ type CompoundVariant = Record<string, unknown> & {
8
+ css?: string;
9
+ className?: string;
10
+ };
11
+ interface StringCvaConfig {
12
+ base?: string;
13
+ variants?: VariantMap;
14
+ defaultVariants?: Record<string, string>;
15
+ compoundVariants?: CompoundVariant[];
16
+ }
17
+ /** String-branch recipe factory for transformed source (TW-style cva). */
18
+ declare function cva(config: StringCvaConfig): ((props?: Record<string, unknown>) => string) & {
19
+ __cva__: true;
20
+ variantKeys: string[];
21
+ variantMap: Record<string, string[]>;
22
+ raw: (props?: Record<string, unknown>) => string;
23
+ config: StringCvaConfig;
24
+ getVariantProps(props: Record<string, unknown>): Record<string, unknown>;
25
+ splitVariantProps(props: Record<string, unknown>): readonly [Record<string, unknown>, Record<string, unknown>];
26
+ };
27
+
28
+ type SvaConfig = {
29
+ slots?: string[];
30
+ base?: Record<string, string>;
31
+ variants?: StringCvaConfig['variants'];
32
+ defaultVariants?: StringCvaConfig['defaultVariants'];
33
+ compoundVariants?: Array<Record<string, unknown> & {
34
+ css?: Record<string, string> | string;
35
+ className?: string;
36
+ classNames?: Record<string, string>;
37
+ }>;
38
+ className?: Record<string, string>;
39
+ };
40
+ /** String-branch slot recipe factory for transformed source. */
41
+ declare function sva(config: SvaConfig): ((props?: Record<string, unknown>) => Record<string, string>) & {
42
+ __cva__: false;
43
+ raw: (props?: Record<string, unknown>) => Record<string, string>;
44
+ config: SvaConfig;
45
+ variantMap: {
46
+ [k: string]: string[];
47
+ };
48
+ variantKeys: string[];
49
+ classNameMap: Record<string, string>;
50
+ getVariantProps(props: Record<string, unknown>): Record<string, unknown>;
51
+ splitVariantProps(props: Record<string, unknown>): readonly [Record<string, unknown>, Record<string, unknown>];
52
+ };
53
+
54
+ export { type StringCvaConfig, css, cva, sva };
@@ -0,0 +1,252 @@
1
+ // src/runtime/internal/cx.ts
2
+ var bakedSeparator = typeof __PANDA_CX_SEPARATOR__ !== "undefined" && __PANDA_CX_SEPARATOR__ ? __PANDA_CX_SEPARATOR__ : "_";
3
+ function splitClassName(className) {
4
+ const segments = [];
5
+ let current = "";
6
+ let bracketDepth = 0;
7
+ for (let i = 0; i < className.length; i++) {
8
+ const ch = className[i];
9
+ if (ch === "[") {
10
+ bracketDepth++;
11
+ current += ch;
12
+ } else if (ch === "]") {
13
+ bracketDepth--;
14
+ current += ch;
15
+ } else if (ch === ":" && bracketDepth === 0) {
16
+ if (current) segments.push(current);
17
+ current = "";
18
+ } else {
19
+ current += ch;
20
+ }
21
+ }
22
+ if (current) segments.push(current);
23
+ return segments;
24
+ }
25
+ function getMergeKey(className, separator) {
26
+ let cls = className;
27
+ if (cls.endsWith("!")) {
28
+ cls = cls.slice(0, -1);
29
+ }
30
+ const segments = splitClassName(cls);
31
+ if (segments.length === 0) return null;
32
+ const last = segments[segments.length - 1];
33
+ const sepIdx = last.indexOf(separator);
34
+ if (sepIdx < 1) return null;
35
+ const property = last.slice(0, sepIdx);
36
+ if (segments.length === 1) {
37
+ return property;
38
+ }
39
+ const conditions = segments.slice(0, -1).join(":");
40
+ return `${conditions}:${property}`;
41
+ }
42
+ function flattenParts(parts, out) {
43
+ for (const part of parts) {
44
+ if (!part) continue;
45
+ if (Array.isArray(part)) {
46
+ flattenParts(part, out);
47
+ continue;
48
+ }
49
+ if (part === "") continue;
50
+ out.push(part);
51
+ }
52
+ }
53
+ function mergeClassStrings(separator, classes) {
54
+ const seen = /* @__PURE__ */ new Map();
55
+ const order = [];
56
+ let id = 0;
57
+ for (const cls of classes) {
58
+ for (const token of cls.split(" ")) {
59
+ if (!token) continue;
60
+ const key = getMergeKey(token, separator);
61
+ if (key !== null) {
62
+ if (!seen.has(key)) order.push(key);
63
+ seen.set(key, token);
64
+ } else {
65
+ const uniqueKey = `__${id++}`;
66
+ order.push(uniqueKey);
67
+ seen.set(uniqueKey, token);
68
+ }
69
+ }
70
+ }
71
+ let str = "";
72
+ for (let i = 0; i < order.length; i++) {
73
+ if (str) str += " ";
74
+ str += seen.get(order[i]);
75
+ }
76
+ return str;
77
+ }
78
+ function createCx(options = {}) {
79
+ const separator = options.separator ?? bakedSeparator;
80
+ return function cx2(...parts) {
81
+ const flat = [];
82
+ flattenParts(parts, flat);
83
+ return mergeClassStrings(separator, flat);
84
+ };
85
+ }
86
+ var cx = createCx();
87
+
88
+ // src/runtime/internal/css.ts
89
+ function css(...styles) {
90
+ return cx(...styles);
91
+ }
92
+
93
+ // src/runtime/internal/cva.ts
94
+ function withDefaults(defaults, props) {
95
+ const out = { ...defaults };
96
+ for (const key in props) {
97
+ if (props[key] !== void 0) out[key] = props[key];
98
+ }
99
+ return out;
100
+ }
101
+ function compoundMatches(compound, variants) {
102
+ for (const key in compound) {
103
+ if (key === "css" || key === "className" || key === "classNames") continue;
104
+ const expected = compound[key];
105
+ const actual = variants[key];
106
+ if (Array.isArray(expected)) {
107
+ if (!expected.includes(actual)) return false;
108
+ } else if (actual !== expected) {
109
+ return false;
110
+ }
111
+ }
112
+ return true;
113
+ }
114
+ function toVariantMap(variants) {
115
+ const map = {};
116
+ for (const key in variants) map[key] = Object.keys(variants[key] ?? {});
117
+ return map;
118
+ }
119
+ function cva(config) {
120
+ const base = config.base ?? "";
121
+ const variants = config.variants ?? {};
122
+ const defaultVariants = config.defaultVariants ?? {};
123
+ const compoundVariants = config.compoundVariants ?? [];
124
+ const variantKeys = Object.keys(variants);
125
+ const resolve = (props = {}) => {
126
+ const computed = withDefaults(defaultVariants, props);
127
+ const parts = [];
128
+ if (base) parts.push(base);
129
+ for (const key of variantKeys) {
130
+ const value = computed[key];
131
+ if (typeof value === "string" && variants[key]?.[value]) {
132
+ parts.push(variants[key][value]);
133
+ }
134
+ }
135
+ for (const compound of compoundVariants) {
136
+ if (!compoundMatches(compound, computed)) continue;
137
+ const cls = compound.className ?? compound.css;
138
+ if (typeof cls === "string" && cls) parts.push(cls);
139
+ }
140
+ return cx(...parts);
141
+ };
142
+ const cvaFn = (props = {}) => resolve(props);
143
+ return Object.assign(cvaFn, {
144
+ __cva__: true,
145
+ variantKeys,
146
+ variantMap: toVariantMap(variants),
147
+ raw: resolve,
148
+ config,
149
+ getVariantProps(props) {
150
+ return withDefaults(defaultVariants, props);
151
+ },
152
+ splitVariantProps(props) {
153
+ const rest = {};
154
+ const variantProps = {};
155
+ for (const key in props) {
156
+ if (variantKeys.includes(key)) variantProps[key] = props[key];
157
+ else rest[key] = props[key];
158
+ }
159
+ return [rest, variantProps];
160
+ }
161
+ });
162
+ }
163
+
164
+ // src/runtime/internal/sva.ts
165
+ function slotCompoundVariants(compoundVariants, slot) {
166
+ if (!compoundVariants?.length) return void 0;
167
+ return compoundVariants.map((compound) => {
168
+ const next = {};
169
+ for (const key in compound) {
170
+ if (key === "css" || key === "className" || key === "classNames") continue;
171
+ next[key] = compound[key];
172
+ }
173
+ const css2 = compound.css;
174
+ if (typeof css2 === "string") next.css = css2;
175
+ else if (css2 && typeof css2 === "object" && slot in css2) next.css = css2[slot];
176
+ const className = compound.classNames?.[slot] ?? compound.className;
177
+ if (className) next.className = className;
178
+ return next;
179
+ }).filter((compound) => compound.css || compound.className);
180
+ }
181
+ function getSlotRecipes(config) {
182
+ const slots = config.slots ?? Object.keys(config.base ?? {});
183
+ const recipes = {};
184
+ for (const slot of slots) {
185
+ recipes[slot] = {
186
+ base: config.base?.[slot],
187
+ variants: config.variants,
188
+ defaultVariants: config.defaultVariants,
189
+ compoundVariants: slotCompoundVariants(config.compoundVariants, slot)
190
+ };
191
+ if (config.className?.[slot]) {
192
+ recipes[slot] = {
193
+ ...recipes[slot],
194
+ base: cx(recipes[slot]?.base, config.className[slot])
195
+ };
196
+ }
197
+ }
198
+ return recipes;
199
+ }
200
+ function sva(config) {
201
+ const slotRecipes = getSlotRecipes(config);
202
+ const slots = Object.entries(slotRecipes).map(([slot, recipe]) => [slot, cva(recipe)]);
203
+ const defaultVariants = config.defaultVariants ?? {};
204
+ const variantKeys = Object.keys(config.variants ?? {});
205
+ const svaFn = (props = {}) => {
206
+ const result = {};
207
+ for (const [slot, slotFn] of slots) {
208
+ result[slot] = slotFn(props);
209
+ }
210
+ return result;
211
+ };
212
+ const raw = (props = {}) => {
213
+ const result = {};
214
+ for (const [slot, slotFn] of slots) {
215
+ result[slot] = slotFn.raw(props);
216
+ }
217
+ return result;
218
+ };
219
+ return Object.assign(svaFn, {
220
+ __cva__: false,
221
+ raw,
222
+ config,
223
+ variantMap: Object.fromEntries(variantKeys.map((key) => [key, Object.keys(config.variants?.[key] ?? {})])),
224
+ variantKeys,
225
+ classNameMap: config.className ?? {},
226
+ getVariantProps(props) {
227
+ const out = { ...defaultVariants };
228
+ for (const key in props) {
229
+ if (props[key] !== void 0) out[key] = props[key];
230
+ }
231
+ return out;
232
+ },
233
+ splitVariantProps(props) {
234
+ const rest = {};
235
+ const variantProps = {};
236
+ for (const key in props) {
237
+ if (variantKeys.includes(key)) variantProps[key] = props[key];
238
+ else rest[key] = props[key];
239
+ }
240
+ return [rest, variantProps];
241
+ }
242
+ });
243
+ }
244
+ export {
245
+ createCx,
246
+ css,
247
+ cva,
248
+ cx,
249
+ getMergeKey,
250
+ splitClassName,
251
+ sva
252
+ };
@@ -0,0 +1 @@
1
+ var x="__PANDA_CX_SEPARATOR__";function m(t){let r=[],n="",s=0;for(let a=0;a<t.length;a++){let i=t[a];i==="["?(s++,n+=i):i==="]"?(s--,n+=i):i===":"&&s===0?(n&&r.push(n),n=""):n+=i}return n&&r.push(n),r}function C(t,r){let n=t;n.endsWith("!")&&(n=n.slice(0,-1));let s=m(n);if(s.length===0)return null;let a=s[s.length-1],i=a.indexOf(r);if(i<1)return null;let u=a.slice(0,i);return s.length===1?u:`${s.slice(0,-1).join(":")}:${u}`}function R(t,r){for(let n of t)if(n){if(Array.isArray(n)){R(n,r);continue}n!==""&&r.push(n)}}function V(t,r){let n=new Map,s=[],a=0;for(let u of r)for(let o of u.split(" ")){if(!o)continue;let e=C(o,t);if(e!==null)n.has(e)||s.push(e),n.set(e,o);else{let c=`__${a++}`;s.push(c),n.set(c,o)}}let i="";for(let u=0;u<s.length;u++)i&&(i+=" "),i+=n.get(s[u]);return i}function v(t={}){let r=t.separator??x;return function(...s){let a=[];return R(s,a),V(r,a)}}var g=v();function y(...t){return g(...t)}function _(t,r){let n={...t};for(let s in r)r[s]!==void 0&&(n[s]=r[s]);return n}function w(t,r){for(let n in t){if(n==="css"||n==="className"||n==="classNames")continue;let s=t[n],a=r[n];if(Array.isArray(s)){if(!s.includes(a))return!1}else if(a!==s)return!1}return!0}function N(t){let r={};for(let n in t)r[n]=Object.keys(t[n]??{});return r}function p(t){let r=t.base??"",n=t.variants??{},s=t.defaultVariants??{},a=t.compoundVariants??[],i=Object.keys(n),u=(e={})=>{let c=_(s,e),f=[];r&&f.push(r);for(let l of i){let d=c[l];typeof d=="string"&&n[l]?.[d]&&f.push(n[l][d])}for(let l of a){if(!w(l,c))continue;let d=l.className??l.css;typeof d=="string"&&d&&f.push(d)}return g(...f)};return Object.assign((e={})=>u(e),{__cva__:!0,variantKeys:i,variantMap:N(n),raw:u,config:t,getVariantProps(e){return _(s,e)},splitVariantProps(e){let c={},f={};for(let l in e)i.includes(l)?f[l]=e[l]:c[l]=e[l];return[c,f]}})}function P(t,r){if(t?.length)return t.map(n=>{let s={};for(let u in n)u==="css"||u==="className"||u==="classNames"||(s[u]=n[u]);let a=n.css;typeof a=="string"?s.css=a:a&&typeof a=="object"&&r in a&&(s.css=a[r]);let i=n.classNames?.[r]??n.className;return i&&(s.className=i),s}).filter(n=>n.css||n.className)}function b(t){let r=t.slots??Object.keys(t.base??{}),n={};for(let s of r)n[s]={base:t.base?.[s],variants:t.variants,defaultVariants:t.defaultVariants,compoundVariants:P(t.compoundVariants,s)},t.className?.[s]&&(n[s]={...n[s],base:g(n[s]?.base,t.className[s])});return n}function k(t){let r=b(t),n=Object.entries(r).map(([o,e])=>[o,p(e)]),s=t.defaultVariants??{},a=Object.keys(t.variants??{});return Object.assign((o={})=>{let e={};for(let[c,f]of n)e[c]=f(o);return e},{__cva__:!1,raw:(o={})=>{let e={};for(let[c,f]of n)e[c]=f.raw(o);return e},config:t,variantMap:Object.fromEntries(a.map(o=>[o,Object.keys(t.variants?.[o]??{})])),variantKeys:a,classNameMap:t.className??{},getVariantProps(o){let e={...s};for(let c in o)o[c]!==void 0&&(e[c]=o[c]);return e},splitVariantProps(o){let e={},c={};for(let f in o)a.includes(f)?c[f]=o[f]:e[f]=o[f];return[e,c]}})}export{y as css,p as cva,g as cx,k as sva};
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@pandacss/transformer",
3
+ "version": "2.0.0-beta.9",
4
+ "description": "Source transformer facade for Panda CSS",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "author": "Segun Adebayo <joseshegs@gmail.com>",
9
+ "license": "MIT",
10
+ "exports": {
11
+ ".": {
12
+ "source": "./src/index.ts",
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./cx": {
17
+ "source": "./src/runtime/internal/cx.ts",
18
+ "types": "./dist/runtime/cx.d.ts",
19
+ "default": "./dist/runtime/cx.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "sideEffects": false,
24
+ "homepage": "https://panda-css.com",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/chakra-ui/panda.git",
28
+ "directory": "packages/transformer"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "dependencies": {
37
+ "unplugin": "^2.3.10",
38
+ "@pandacss/compiler": "2.0.0-beta.9",
39
+ "@pandacss/compiler-shared": "2.0.0-beta.9"
40
+ },
41
+ "peerDependencies": {
42
+ "vite": ">=6.0.0",
43
+ "webpack": ">=5.0.0",
44
+ "rollup": ">=3.0.0"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "vite": {
48
+ "optional": true
49
+ },
50
+ "webpack": {
51
+ "optional": true
52
+ },
53
+ "rollup": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "engines": {
58
+ "node": ">=22"
59
+ },
60
+ "scripts": {
61
+ "build": "tsup",
62
+ "build:fast": "tsup --no-dts",
63
+ "dev": "tsup --no-dts --watch",
64
+ "test": "vitest run"
65
+ }
66
+ }