@razorwind/core 0.0.5

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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ <!-- START header -->
2
+
3
+ <!-- END header -->
4
+
5
+ # Razorwind
6
+
7
+ **Razorwind** is a unified set of tools that make creating design systems a breeze.
8
+
9
+ ## Installing
10
+
11
+ Using [pnpm](http://pnpm.io):
12
+
13
+ ```bash
14
+ pnpm add -D @razorwind/core
15
+ ```
16
+
17
+ <details>
18
+ <summary>Using npm</summary>
19
+
20
+ ```bash
21
+ npm install -D @razorwind/core
22
+ ```
23
+
24
+ </details>
25
+
26
+ <details>
27
+ <summary>Using yarn</summary>
28
+
29
+ ```bash
30
+ yarn add -D @razorwind/core
31
+ ```
32
+
33
+ </details>
34
+
35
+ ## Development
36
+
37
+ ### Building
38
+
39
+ Run `nx build core` to build the library.
40
+
41
+ ### Running unit tests
42
+
43
+ Run `nx test core` to execute the unit tests via [Vitest](https://vitest.dev/).
44
+
45
+ <!-- START footer -->
46
+
47
+ <!-- END footer -->
@@ -0,0 +1,40 @@
1
+ //#region src/types/config.d.ts
2
+ interface InputOptions {
3
+ /**
4
+ * The path to the registry.json file.
5
+ *
6
+ * @see https://shadcn.com/docs/registry
7
+ */
8
+ registryPath?: string;
9
+ /**
10
+ * The directory or file containing the tokens.
11
+ *
12
+ * @see https://styledictionary.com/info/tokens/
13
+ *
14
+ * @defaultValue "tokens.json" (or "tokens" directory)
15
+ */
16
+ tokensPath?: string;
17
+ }
18
+ interface Config extends InputOptions {
19
+ name?: string;
20
+ title?: string;
21
+ version?: string;
22
+ description?: string;
23
+ author?: string;
24
+ license?: string;
25
+ repository?: string;
26
+ homepage?: string;
27
+ tags?: string[];
28
+ }
29
+ interface UserConfigParams {
30
+ cwd: string;
31
+ mode: string;
32
+ }
33
+ type UserConfig = Config;
34
+ type UserConfigFnObject = (config: UserConfig) => UserConfig;
35
+ type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
36
+ type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
37
+ type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
38
+ //#endregion
39
+ export { UserConfigFn as a, UserConfigParams as c, UserConfigExport as i, InputOptions as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t };
40
+ //# sourceMappingURL=config-CJi9Fu8b.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CJi9Fu8b.d.cts","names":[],"sources":["../src/types/config.ts"],"mappings":";UAkBiB;;;;;;EAMf;;;;;;;;EASA;;UAGe,eAAe;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;KAGU,aAAa;KACb,sBAAsB,QAAQ,eAAe;KAC7C,uBACV,QAAQ,qBACL,QAAQ,aAAa;KACd,gBACV,QAAQ,qBACL,aAAa,eAAe,QAAQ,aAAa;KAC1C,mBACR,aACA,eACA,QAAQ,aAAa,gBACrB,qBACA,sBACA"}
@@ -0,0 +1,40 @@
1
+ //#region src/types/config.d.ts
2
+ interface InputOptions {
3
+ /**
4
+ * The path to the registry.json file.
5
+ *
6
+ * @see https://shadcn.com/docs/registry
7
+ */
8
+ registryPath?: string;
9
+ /**
10
+ * The directory or file containing the tokens.
11
+ *
12
+ * @see https://styledictionary.com/info/tokens/
13
+ *
14
+ * @defaultValue "tokens.json" (or "tokens" directory)
15
+ */
16
+ tokensPath?: string;
17
+ }
18
+ interface Config extends InputOptions {
19
+ name?: string;
20
+ title?: string;
21
+ version?: string;
22
+ description?: string;
23
+ author?: string;
24
+ license?: string;
25
+ repository?: string;
26
+ homepage?: string;
27
+ tags?: string[];
28
+ }
29
+ interface UserConfigParams {
30
+ cwd: string;
31
+ mode: string;
32
+ }
33
+ type UserConfig = Config;
34
+ type UserConfigFnObject = (config: UserConfig) => UserConfig;
35
+ type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
36
+ type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
37
+ type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
38
+ //#endregion
39
+ export { UserConfigFn as a, UserConfigParams as c, UserConfigExport as i, InputOptions as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t };
40
+ //# sourceMappingURL=config-CJi9Fu8b.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CJi9Fu8b.d.mts","names":[],"sources":["../src/types/config.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){return e}exports.defineConfig=e;
@@ -0,0 +1,33 @@
1
+ import { a as UserConfigFn, c as UserConfigParams, i as UserConfigExport, n as InputOptions, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config } from "./config-CJi9Fu8b.cjs";
2
+ //#region src/config.d.ts
3
+ /**
4
+ * Type helper to make it easier to use `razorwind.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { defineConfig } from '@razorwind/core';
9
+ *
10
+ * export default defineConfig({
11
+ * // Your configuration here
12
+ * });
13
+ *
14
+ * // Or with a function
15
+ * export default defineConfig((env) => {
16
+ * console.log(`Running command: ${env.command} in mode: ${env.mode}`);
17
+ * return {
18
+ * // Your configuration here
19
+ * };
20
+ * });
21
+ * ```
22
+ */
23
+ declare function defineConfig(config: UserConfig): UserConfig;
24
+ declare function defineConfig(config: UserConfig[]): UserConfig[];
25
+ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
26
+ declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
27
+ declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
28
+ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
29
+ declare function defineConfig(config: UserConfigFn): UserConfigFn;
30
+ declare function defineConfig(config: UserConfigExport): UserConfigExport;
31
+ //#endregion
32
+ export { type Config, type InputOptions, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
33
+ //# sourceMappingURL=config.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAgDgB,aAAa,QAAQ,aAAa;iBAClC,aAAa,QAAQ,eAAe;iBACpC,aAAa,QAAQ,QAAQ,cAAc,QAAQ;iBACnD,aACd,QAAQ,QAAQ,gBACf,QAAQ;iBACK,aAAa,QAAQ,qBAAqB;iBAC1C,aAAa,QAAQ,sBAAsB;iBAC3C,aAAa,QAAQ,eAAe;iBACpC,aAAa,QAAQ,mBAAmB"}
@@ -0,0 +1,33 @@
1
+ import { a as UserConfigFn, c as UserConfigParams, i as UserConfigExport, n as InputOptions, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config } from "./config-CJi9Fu8b.mjs";
2
+ //#region src/config.d.ts
3
+ /**
4
+ * Type helper to make it easier to use `razorwind.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { defineConfig } from '@razorwind/core';
9
+ *
10
+ * export default defineConfig({
11
+ * // Your configuration here
12
+ * });
13
+ *
14
+ * // Or with a function
15
+ * export default defineConfig((env) => {
16
+ * console.log(`Running command: ${env.command} in mode: ${env.mode}`);
17
+ * return {
18
+ * // Your configuration here
19
+ * };
20
+ * });
21
+ * ```
22
+ */
23
+ declare function defineConfig(config: UserConfig): UserConfig;
24
+ declare function defineConfig(config: UserConfig[]): UserConfig[];
25
+ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
26
+ declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
27
+ declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
28
+ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
29
+ declare function defineConfig(config: UserConfigFn): UserConfigFn;
30
+ declare function defineConfig(config: UserConfigExport): UserConfigExport;
31
+ //#endregion
32
+ export { type Config, type InputOptions, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
33
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ function e(e){return e}export{e as defineConfig};
2
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("@power-plant/core"),l=require("@stryke/path/find"),u=require("@stryke/type-checks/is-set-string"),d=require("style-dictionary");d=s(d,1);let f=require("@stryke/fs/tsconfig"),p=require("@stryke/path/join"),m=require("chalk");m=s(m,1);let ee=require("cosmiconfig"),h=require("fast-glob");h=s(h,1);let g=require("node:path");g=s(g,1);let _=require("shadcn/schema");require("shadcn/preset");let v=require("@stryke/fs/json"),y=require("@stryke/fs/read-file"),b=require("node:fs"),te=require("node:fs/promises"),x=require("zod");x=s(x,1),require("@stryke/http/fetch"),require("@stryke/url/helpers");let S=require("@stryke/fs/get-workspace-root"),ne=require("tsconfig-paths"),re=require("@stryke/path/is-type"),C=require("@power-plant/dtcg-schema"),w=require("@stryke/fs/exists"),ie=require("@stryke/fs/resolve"),T=require("json5");T=s(T,1);let ae=require("smol-toml"),oe=require("yaml"),E=require("@stryke/fs/is-file");const D=process.env.REGISTRY_URL??`https://ui.shadcn.com/r`,O=D.replace(/\/r\/?$/,``),k={"next-app":{name:`next-app`,label:`Next.js`,links:{installation:`${O}/docs/installation/next`,tailwind:`https://tailwindcss.com/docs/guides/nextjs`}},"next-pages":{name:`next-pages`,label:`Next.js`,links:{installation:`${O}/docs/installation/next`,tailwind:`https://tailwindcss.com/docs/guides/nextjs`}},remix:{name:`remix`,label:`Remix`,links:{installation:`${O}/docs/installation/remix`,tailwind:`https://tailwindcss.com/docs/guides/remix`}},"react-router":{name:`react-router`,label:`React Router`,links:{installation:`${O}/docs/installation/react-router`,tailwind:`https://tailwindcss.com/docs/installation/framework-guides/react-router`}},vite:{name:`vite`,label:`Vite`,links:{installation:`${O}/docs/installation/vite`,tailwind:`https://tailwindcss.com/docs/guides/vite`}},astro:{name:`astro`,label:`Astro`,links:{installation:`${O}/docs/installation/astro`,tailwind:`https://tailwindcss.com/docs/guides/astro`}},laravel:{name:`laravel`,label:`Laravel`,links:{installation:`${O}/docs/installation/laravel`,tailwind:`https://tailwindcss.com/docs/guides/laravel`}},"tanstack-start":{name:`tanstack-start`,label:`TanStack Start`,links:{installation:`${O}/docs/installation/tanstack`,tailwind:`https://tailwindcss.com/docs/installation/using-postcss`}},gatsby:{name:`gatsby`,label:`Gatsby`,links:{installation:`${O}/docs/installation/gatsby`,tailwind:`https://tailwindcss.com/docs/guides/gatsby`}},expo:{name:`expo`,label:`Expo`,links:{installation:`${O}/docs/installation/expo`,tailwind:`https://www.nativewind.dev/docs/getting-started/installation`}},manual:{name:`manual`,label:`Manual`,links:{installation:`${O}/docs/installation/manual`,tailwind:`https://tailwindcss.com/docs/installation`}}};function A(e){let t=[e];for(;t.length;){let e=t.shift();if(typeof e==`string`){if(e.startsWith(`./`))return e;continue}if(Array.isArray(e)){t.unshift(...e);continue}e&&typeof e==`object`&&t.unshift(...Object.values(e))}return null}function se(e){if(!e.includes(`*`))return`strip_extension`;let t=e.slice(e.indexOf(`*`)+1);return t&&/^\.[^/]+$/.test(t)?`strip_extension`:`preserve_extension`}function ce(e,t){let n=t.find(t=>!t.hasWildcard&&t.key===e);if(n)return{path:g.default.resolve(n.rootDir,n.target),matchedAlias:n.key,matchedTarget:n.target,emitMode:n.emitMode};let r=t.filter(e=>e.hasWildcard).sort((e,t)=>t.key.length-e.key.length);for(let t of r){let n=le(e,t.key,{allowBareAliasBase:!0});if(n!==null)return{path:g.default.resolve(t.rootDir,ue(t.target,n)),matchedAlias:t.key,matchedTarget:t.target,emitMode:t.emitMode}}return null}function le(e,t,n={}){if(!t.includes(`*`))return e===t?``:null;let[r,i=``]=t.split(`*`);return r&&e.startsWith(r)&&e.endsWith(i)?i?e.slice(r.length,-i.length):e.slice(r.length):n.allowBareAliasBase&&i===``&&r&&r.endsWith(`/`)&&e===r.slice(0,-1)?``:null}function ue(e,t){if(!e.includes(`*`))return e;let[n,r=``]=e.split(`*`);return t?n?`${n}${t}${r}`:t:n?n.replace(/\/$/,``):``}const j=new Map;async function M(e){let t=g.default.resolve(e),n=j.get(t);if(n)return n;let r=(await N(e))?.imports;if(!r||typeof r!=`object`||Array.isArray(r))return j.set(t,[]),[];let i=[];for(let[e,n]of Object.entries(r)){if(!e.startsWith(`#`))continue;let r=A(n);r&&i.push({key:e,aliasBase:e===`#*`?`#`:e.endsWith(`/*`)?e.slice(0,-2):e,target:r,emitMode:se(r),hasWildcard:e.includes(`*`),rootDir:t})}return j.set(t,i),i}async function de(e){let t=(await M(e)).map(e=>e.aliasBase);return t.length?pe(t):null}async function fe(e,t){return ce(e,await M(t))}function pe(e){let t=e.map(e=>e.slice(1).split(`/`).filter(Boolean)).reduce((e,t,n)=>n?e.filter((e,n)=>t[n]===e):t,[]);return t.length?`#${t.join(`/`)}`:`#`}async function N(e=``){return(0,v.readJsonFile)(g.default.join(e,`package.json`))}const P=[`**/node_modules/**`,`.next`,`public`,`dist`,`build`],me=x.z.object({compilerOptions:x.z.object({paths:x.z.record(x.z.string(),x.z.string().or(x.z.array(x.z.string())))})});async function he(e,t){let[n,r,i,a,o,s,c,l]=await Promise.all([h.default.glob(`**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*`,{cwd:e,deep:3,ignore:P}),(0,te.access)((0,p.joinPaths)(e,`src`)).then(()=>!0).catch(()=>!1),xe(e),ve(e),_e(e,t?.configCssFile),F(e),be(e),N(e)]),u=(0,b.existsSync)((0,p.joinPaths)(e,`${r?`src/`:``}app`)),d={framework:k.manual,isSrcDir:r,isRSC:!1,isTsx:i,tailwindConfigFile:a,tailwindCssFile:o,tailwindVersion:s,frameworkVersion:null,aliasPrefix:c.prefix};if(n.find(e=>e.startsWith(`next.config.`))?.length)return d.framework=u?k[`next-app`]:k[`next-pages`],d.isRSC=u,d.frameworkVersion=await ge(d.framework,l),d;if(n.find(e=>e.startsWith(`astro.config.`))?.length)return d.framework=k.astro,d;if(n.find(e=>e.startsWith(`gatsby-config.`))?.length)return d.framework=k.gatsby,d;if(n.find(e=>e.startsWith(`composer.json`))?.length)return d.framework=k.laravel,d;if(Object.keys(l?.dependencies??{}).find(e=>e.startsWith(`@remix-run/`)))return d.framework=k.remix,d;if([...Object.keys(l?.dependencies??{}),...Object.keys(l?.devDependencies??{})].find(e=>e.startsWith(`@tanstack/react-start`)))return d.framework=k[`tanstack-start`],d;if(n.find(e=>e.startsWith(`react-router.config.`))?.length)return d.framework=k[`react-router`],d;if(n.find(e=>e.startsWith(`vite.config.`))?.length)return d.framework=k.vite,d;let f=n.find(e=>e.startsWith(`app.config`));return f?.length&&(await(0,y.readFile)((0,p.joinPaths)(e,f))).includes(`defineConfig`)?(d.framework=k.vite,d):(l?.dependencies?.expo&&(d.framework=k.expo),d)}async function ge(e,t){if(!t||![`next-app`,`next-pages`].includes(e.name))return null;let n=t.dependencies?.next||t.devDependencies?.next;if(!n)return null;let r=n.match(/^[\^~]?(\d+\.\d+\.\d+)/);if(r)return r[1]??null;let i=n.match(/(\d+\.\d+\.\d+)/);return i?i[1]??null:n}async function F(e){let[t,n]=await Promise.all([N(e),Re(e)]);return n?.tailwind?.config===``?`v4`:!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function _e(e,t){if(t&&(0,b.existsSync)(g.default.resolve(e,t)))return t;let[n]=await Promise.all([h.default.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:P}),F(e)]);if(!n.length)return null;for(let t of n){let n=await(0,y.readFile)((0,p.joinPaths)(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function ve(e){let t=await h.default.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:P});return t.length?t[0]??null:null}async function ye(e){let t=await Se(e),n=Object.entries(t?.compilerOptions.paths??{}).length?t?.compilerOptions.paths:null;if(!n||!Object.entries(n).length)return null;for(let[e,t]of Object.entries(n)){let n=Array.isArray(t)?t:[t];if(n.includes(`./*`)||n.includes(`./src/*`)||n.includes(`./app/*`)||n.includes(`./resources/js/*`))return e.replace(/\/\*$/,``)??null}return Object.keys(n)?.[0]?.replace(/\/\*$/,``)??null}async function be(e){let t=await ye(e),n=await de(e);return n&&t?.startsWith(`#`)?{prefix:n,source:`package_imports`}:t?{prefix:t,source:`tsconfig_paths`}:n?{prefix:n,source:`package_imports`}:{prefix:null,source:null}}async function xe(e){return(await h.default.glob(`tsconfig.*`,{cwd:e,deep:1,ignore:P})).length>0}async function Se(e){for(let t of[`tsconfig.json`,`tsconfig.web.json`,`tsconfig.app.json`]){let n=g.default.resolve(e,t);if(!(0,b.existsSync)(n))continue;let r=await(0,y.readFile)(n),i;try{i=JSON.parse(Ce(r))}catch{continue}let a=me.safeParse(i);if(!a.error)return a.data}return null}function Ce(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];if(n){if(t+=a,r){r=!1;continue}if(a===`\\`){r=!0;continue}a===`"`&&(n=!1);continue}if(a===`"`){n=!0,t+=a;continue}if(a===`/`&&o===`/`){for(;i<e.length&&e[i]!==`
2
+ `;)i++;i<e.length&&(t+=e[i]);continue}if(a===`/`&&o===`*`){for(i+=2;i<e.length;){if(e[i]===`*`&&e[i+1]===`/`){i++;break}e[i]===`
3
+ `&&(t+=`
4
+ `),i++}continue}if(a===`,`){let t=i+1;for(;t<e.length;){for(;/\s/.test(e[t]??``);)t++;if(e[t]===`/`&&e[t+1]===`/`){for(t+=2;t<e.length&&e[t]!==`
5
+ `&&e[t]!==`\r`;)t++;continue}if(e[t]===`/`&&e[t+1]===`*`){for(t+=2;t<e.length&&(e[t]!==`*`||e[t+1]!==`/`);)t++;t+=2;continue}break}if(e[t]===`}`||e[t]===`]`)continue}t+=a}return t}function we(e){if(e.startsWith(`#`)||e.startsWith(`.`)||(0,re.isAbsolute)(e))return null;let t=e.split(`/`);return e.startsWith(`@`)?t.length<2?null:{packageName:`${t[0]}/${t[1]}`}:{packageName:t[0]}}const Te=new Map,I=new Map;function Ee(e){let t=[],n=!1,r=0;for(let i of e.split(`
6
+ `)){let e=i.trim();if(!e||e.startsWith(`#`))continue;let a=i.match(/^(\s*)([\w-]+)\s*:/);if(a){r=a[1]?.length??0,n=a[2]===`packages`;continue}if(!n)continue;let o=i.match(/^(\s*)-\s*(.+?)\s*(?:#.*)?$/);((!o||o[1]?.length)??r>=0)||t.push(o[2]?.trim().replace(/^["']|["']$/g,``)??``)}return t}async function De(e){let t=[],n=g.default.resolve(e,`pnpm-workspace.yaml`);if((0,b.existsSync)(n)){let e=await(0,y.readFile)(n);t.push(...Ee(e))}let r=(0,p.joinPaths)(e,`package.json`);if((0,b.existsSync)(r))try{let e=await(0,v.readJsonFile)(r),n=Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages;Array.isArray(n)&&t.push(...n.filter(e=>!e.startsWith(`!`)))}catch{}return Array.from(new Set(t))}async function Oe(e){let t=await De(e),n=new Map;if(!t.length)return n;let r=await(0,h.default)(t.map(e=>g.default.posix.join(e.split(g.default.sep).join(`/`),`package.json`)),{cwd:e,ignore:[`**/node_modules/**`]});for(let t of r){let r=g.default.resolve(e,g.default.dirname(t)),i=(await N(r))?.name;i&&n.set(i,{packageName:i,packageRoot:r})}return n}async function ke(e,t){let n=(0,S.getWorkspaceRoot)(e);if(!n)return null;let r=Te.get(n);if(r?.has(t))return r.get(t)??null;let i=await Oe(n);return Te.set(n,i),i.get(t)??null}function Ae(e,t){if(t===`.`)return e;let n=t.slice(2).replace(/\/\*$/,``);return n?`${e}/${n}`:e}async function je(e){let t=`${e.packageRoot}:${e.packageName}`,n=I.get(t);if(n)return n;let r=(await N(e.packageRoot))?.exports;if(!r||typeof r!=`object`||Array.isArray(r))return I.set(t,[]),[];let i=[];for(let[t,n]of Object.entries(r)){if(t!==`.`&&!t.startsWith(`./`))continue;let r=A(n);if(!r)continue;let a=Ae(e.packageName,t);i.push({key:t.includes(`*`)?`${a}/*`:a,aliasBase:a,target:r,emitMode:se(r),hasWildcard:t.includes(`*`),rootDir:e.packageRoot})}return I.set(t,i),i}async function Me(e,t){let n=we(e);if(!n?.packageName)return null;let r=await ke(t,n.packageName);return r?ce(e,await je(r)):null}async function Ne(e,t){let n=t.cwd??t.baseUrl??(0,S.getWorkspaceRoot)();if(e.startsWith(`#`)){let t=await fe(e,n);if(t)return{path:t.path,source:`package_imports`,matchedAlias:t.matchedAlias,matchedTarget:t.matchedTarget,emitMode:t.emitMode}}let r=await Me(e,n);return r?{path:r.path,source:`workspace_package_exports`,matchedAlias:r.matchedAlias,matchedTarget:r.matchedTarget,emitMode:r.emitMode}:Fe(e,t)}function Pe(e){return/^@[^/]+\/[^/]+(?:\/.*)?$/.test(e)}function Fe(e,t){let n=(0,ne.createMatchPath)(t.baseUrl||t.cwd||(0,S.getWorkspaceRoot)(),t.paths??{})(e,void 0,()=>!0,[`.ts`,`.tsx`,`.jsx`,`.js`,`.css`]);if(!n)return null;let r=Ie(e,t.paths??{});return!r&&Pe(e)?null:{path:n,source:`tsconfig_paths`,matchedAlias:r?.key??e,matchedTarget:r?.target??n,emitMode:`strip_extension`}}function Ie(e,t){for(let[n,r]of Object.entries(t)){let t=Array.isArray(r)?r:[r],i=le(e,n);if(i!==null)return{key:n,target:t[0]?.includes(`*`)&&i!==null?t[0].replace(/\*/g,i):t[0]}}return null}const Le=(0,ee.cosmiconfig)(`components`,{searchPlaces:[`components.json`]});async function Re(e){let t=await Ve(e);return t?(t.iconLibrary||=t.style===`new-york`?`radix`:`lucide`,ze(e,t)):null}const L={"@shadcn":`${D}/styles/{style}/{name}.json`};async function ze(e,t){t.registries={...L,...t.registries??{}};let n=await(0,f.loadTsConfig)(e);if(!n)throw Error(`Failed to load tsconfig.json.`);let r=await R(`utils`,t.aliases.utils,e,n),i=await R(`components`,t.aliases.components,e,n),a=t.aliases.ui?await R(`ui`,t.aliases.ui,e,n):g.default.resolve(i??e,`ui`),o=t.aliases.lib?await R(`lib`,t.aliases.lib,e,n):g.default.resolve(r??e,`..`),s=t.aliases.hooks?await R(`hooks`,t.aliases.hooks,e,n):g.default.resolve(i??e,`..`,`hooks`);return Be(e,{components:i,utils:r,ui:a,lib:o,hooks:s}),_.configSchema.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?g.default.resolve(e,t.tailwind.config):``,tailwindCss:g.default.resolve(e,t.tailwind.css),utils:r,components:i,ui:a,lib:o,hooks:s}})}async function R(e,t,n,r){let i=await Ne(t,{...r,cwd:n});if(!i?.path||t.startsWith(`#`)&&i.path===(0,p.joinPaths)(n,t))return null;if(e!==`utils`&&(i.source===`package_imports`||i.source===`workspace_package_exports`)){if(!i.matchedAlias.includes(`*`)&&/\/index\.[^/]+$/.test(i.path))return g.default.dirname(i.path);if(i.matchedAlias.includes(`*`)&&/\.[^/]+$/.test(i.path))return i.path.replace(/\.[^/]+$/,``)}return i.path}function Be(e,t){let n=[`components`,`ui`,`lib`,`hooks`,`utils`].filter(e=>!t[e]);if(n.length)throw Error([`Could not resolve the following aliases in ${m.default.cyan(e)}: ${m.default.cyan(n.join(`, `))}.`,`Configure path aliases in ${m.default.cyan(`tsconfig.json`)} or imports in ${m.default.cyan(`package.json`)} for this workspace and try again.`].join(`
7
+ `))}async function Ve(e){try{let t=await Le.search(e);if(!t)return null;let n=_.rawConfigSchema.parse(t.config);if(n.registries){for(let e of Object.keys(n.registries))if(e in L)throw Error(`"${e}" is a built-in registry and cannot be overridden.`)}return n}catch(t){let n=`${e}/components.json`;throw t instanceof Error&&t.message.includes(`reserved registry`)?t:Error(`Invalid configuration found in ${m.default.cyan(n)}.`)}}function He(e){let t={resolvedPaths:{cwd:process.cwd(),tailwindConfig:``,tailwindCss:``,utils:``,components:``,ui:``,lib:``,hooks:``},style:``,tailwind:{config:``,css:``,baseColor:``,cssVariables:!1},rsc:!1,tsx:!0,aliases:{components:``,utils:``},registries:{...L}};return e?{...t,...e,resolvedPaths:{...t.resolvedPaths,...e.resolvedPaths??{}},tailwind:{...t.tailwind,...e.tailwind??{}},aliases:{...t.aliases,...e.aliases??{}},registries:{...t.registries,...e.registries??{}}}:t}const Ue=x.z.object({category:x.z.enum([`block`,`component`,`ui`,`page`]),name:x.z.string(),title:x.z.string(),description:x.z.string().optional(),tags:x.z.array(x.z.string()).optional(),related:x.z.array(x.z.string()).optional(),since:x.z.string().optional(),version:x.z.string().optional(),repository:x.z.string().optional(),homepage:x.z.string().optional(),dependencies:x.z.record(x.z.string(),x.z.string()).optional(),registryDependencies:x.z.record(x.z.string(),x.z.string()).optional(),files:x.z.array(x.z.string()).optional()});x.z.record(x.z.string(),Ue);function We(e){return x.default.unknown().transform((t,n)=>{let r=e.safeParse(t);if(!r.success){for(let e of r.error.issues)n.addIssue({code:`custom`,message:e.message,path:e.path});return x.default.NEVER}return r.data})}const Ge=x.default.union([C.tokensSchema,x.default.record(x.default.string(),C.tokensSchema)]),Ke=x.default.object({registry:We(_.configSchema),tokens:Ge}),qe=[`razorwind-json`,`razorwind-yaml`,`razorwind-toml`,`razorwind-css`],z=[`json`,`json5`,`jsonc`,`yaml`,`yml`,`toml`,`css`,`js`,`mjs`,`cjs`,`ts`,`mts`,`cts`],Je=z.join(`,`),Ye=[`tokens.json`,`tokens.json5`,`tokens.jsonc`,`tokens.yaml`,`tokens.yml`,`tokens.toml`,`tokens.css`,`design-tokens.json`,`design-tokens.yaml`,`design-tokens.yml`,`tokens`,`design-tokens`,`src/tokens`,`src/design-tokens`,`packages/tokens`,`style-dictionary.config.js`,`style-dictionary.config.mjs`,`style-dictionary.config.ts`,`sd.config.js`,`sd.config.mjs`,`sd.config.ts`],Xe=`**/*.{${Je}}`,Ze=/^(light|dark|dim|high-contrast|hc|default|base|theme)([._-].+)?$/i,Qe={color:`color`,colours:`color`,colors:`color`,colour:`color`,palette:`color`,bg:`color`,background:`color`,foreground:`color`,fg:`color`,border:`color`,fill:`color`,stroke:`color`,spacing:`dimension`,space:`dimension`,size:`dimension`,sizes:`dimension`,sizing:`dimension`,gap:`dimension`,radius:`dimension`,radii:`dimension`,rounded:`dimension`,width:`dimension`,height:`dimension`,dimension:`dimension`,dimensions:`dimension`,duration:`duration`,durations:`duration`,time:`duration`,delay:`duration`,animation:`duration`,motion:`duration`,transition:`duration`,font:`fontFamily`,fonts:`fontFamily`,fontfamily:`fontFamily`,"font-family":`fontFamily`,typeface:`fontFamily`,fontweight:`fontWeight`,"font-weight":`fontWeight`,weight:`fontWeight`,opacity:`number`,opacities:`number`,zindex:`number`,"z-index":`number`,lineheight:`number`,"line-height":`number`,letterspacing:`dimension`,"letter-spacing":`dimension`,shadow:`shadow`,shadows:`shadow`,elevation:`shadow`,gradient:`gradient`,gradients:`gradient`,typography:`typography`,text:`typography`,cubicbezier:`cubicBezier`,easing:`cubicBezier`,ease:`cubicBezier`},$e=/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,et=/^rgba?\(\s*([+\d.]+%?)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+%?)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+%?)(?:\s*[,/]\s*([+\d.]+%?))?\s*\)$/i,tt=/^hsla?\(\s*([+\d.]+)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+)%[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+)%(?:\s*[,/]\s*([+\d.]+%?))?\s*\)$/i,nt=/^oklch\(\s*([+\d.]+%?|none)\s+([+\d.]+|none)\s+([+\d.]+|none)(?:\s*\/\s*([+\d.]+%?))?\s*\)$/i,rt=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(px|rem|em|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc)$/i,it=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(ms|s)$/i,at=/^cubic-bezier\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*\)$/i,ot=/^var\(\s*(--[\w-]+)\s*(?:,\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))?\)\s*$/i,st=/^\{[^{}]+\}$/,ct={thin:100,hairline:100,extralight:200,"extra-light":200,ultralight:200,light:300,normal:400,regular:400,book:400,medium:500,semibold:600,"semi-bold":600,demibold:600,bold:700,extrabold:800,"extra-bold":800,ultrabold:800,black:900,heavy:900},B=new Set([`px`,`rem`]);function V(e){return Math.min(1,Math.max(0,e))}function H(e,t=100){let n=e.trim();if(n.endsWith(`%`))return V(Number.parseFloat(n)/t);let r=Number.parseFloat(n);return V(r>1?r/255:r)}function lt(e){let t=e.slice(1);return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:(e.length===7||e.length,e)}function ut(e){let t=lt(e.toLowerCase()).slice(1),n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255,a=t.length===8?Number.parseInt(t.slice(6,8),16)/255:void 0;return{colorSpace:`srgb`,components:[n,r,i],...a===void 0||a===1?{}:{alpha:a},hex:`#${t.slice(0,6)}`}}function dt(e){return`{${e.replace(/^--/,``).split(`-`).filter(Boolean).join(`.`)}}`}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function G(e){for(let t=e.length-1;t>=0;t--){let n=e[t]?.toLowerCase();if(!n)continue;let r=Qe[n];if(r)return r}}function K(e,t=[]){let n=G(t);if(typeof e==`string`){let r=e.trim();if(st.test(r))return{value:r,type:n};let i=r.match(ot);if(i?.[1])return{value:dt(i[1]),type:n};if($e.test(r))return{value:ut(r),type:`color`};let a=r.match(et);if(a){let e=[H(a[1]),H(a[2]),H(a[3])],t=a[4]?a[4].endsWith(`%`)?V(Number.parseFloat(a[4])/100):V(Number.parseFloat(a[4])):void 0;return{value:{colorSpace:`srgb`,components:e,...t===void 0||Number.isNaN(t)?{}:{alpha:t}},type:`color`}}let o=r.match(tt);if(o)return{value:{colorSpace:`hsl`,components:[Number.parseFloat(o[1]),Number.parseFloat(o[2]),Number.parseFloat(o[3])],...o[4]?{alpha:o[4].endsWith(`%`)?V(Number.parseFloat(o[4])/100):V(Number.parseFloat(o[4]))}:{}},type:`color`};let s=r.match(nt);if(s){let e=e=>e===`none`?`none`:e.endsWith(`%`)?Number.parseFloat(e)/100:Number.parseFloat(e);return{value:{colorSpace:`oklch`,components:[e(s[1]),e(s[2]),e(s[3])],...s[4]?{alpha:s[4].endsWith(`%`)?V(Number.parseFloat(s[4])/100):V(Number.parseFloat(s[4]))}:{}},type:`color`}}let c=r.match(rt);if(c){let e=c[2].toLowerCase(),t=Number.parseFloat(c[1]);return B.has(e)?{value:{value:t,unit:e},type:`dimension`}:{value:r,type:n===`dimension`?void 0:n}}let l=r.match(it);if(l)return{value:{value:Number.parseFloat(l[1]),unit:l[2].toLowerCase()},type:`duration`};let u=r.match(at);if(u)return{value:[Number.parseFloat(u[1]),Number.parseFloat(u[2]),Number.parseFloat(u[3]),Number.parseFloat(u[4])],type:`cubicBezier`};let d=ct[r.toLowerCase()];return d===void 0?n===`fontFamily`||/family|font|typeface/i.test(t.at(-1)??``)?r.includes(`,`)?{value:r.split(`,`).map(e=>e.trim().replace(/^["']|["']$/g,``)),type:`fontFamily`}:{value:r.replace(/^["']|["']$/g,``),type:`fontFamily`}:n===`color`&&!r.startsWith(`{`)?{value:r,type:void 0}:{value:r,type:n}:{value:d,type:`fontWeight`}}if(typeof e==`number`)return n===`fontWeight`?{value:e,type:`fontWeight`}:n===`duration`?{value:{value:e,unit:`ms`},type:`duration`}:n===`dimension`?{value:{value:e,unit:`px`},type:`dimension`}:{value:e,type:n??`number`};if(Array.isArray(e))return e.length===4&&e.every(e=>typeof e==`number`)&&(n===`cubicBezier`||t.some(e=>/ease|bezier/i.test(e)))?{value:e,type:`cubicBezier`}:e.every(e=>typeof e==`string`)?{value:e,type:n??`fontFamily`}:{value:e,type:n};if(U(e)){if(`colorSpace`in e&&`components`in e)return{value:e,type:`color`};if(`value`in e&&`unit`in e){let t=String(e.unit).toLowerCase();return t===`ms`||t===`s`?{value:e,type:`duration`}:B.has(t)?{value:e,type:`dimension`}:{value:e,type:n}}}return{value:e,type:n}}function ft(e,t){let n={...e};if(`value`in n&&!(`$value`in n)&&(n.$value=n.value,delete n.value),`type`in n&&!(`$type`in n)&&(n.$type=n.type,delete n.type),`comment`in n&&!(`$description`in n)&&(n.$description=n.comment,delete n.comment),`description`in n&&!(`$description`in n)&&(n.$description=n.description,delete n.description),`ref`in n&&!(`$ref`in n)&&(n.$ref=n.ref,delete n.ref),`$value`in n){let e=K(n.$value,t);n.$value=e.value,!(`$type`in n)&&e.type&&(n.$type=e.type)}return n}function q(e,t=[]){if(Array.isArray(e))return e.map((e,n)=>q(e,[...t,String(n)]));if(!U(e))return e;if(W(e))return ft(e,t);let n={};for(let[r,i]of Object.entries(e)){if(r.startsWith(`$`)){n[r]=i;continue}n[r]=q(i,[...t,r])}if(!(`$type`in n)){let e=G(t);e&&t.length>0&&(n.$type=e)}return n}function J(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.replace(/^--/,``).split(/[-./]/).filter(Boolean);if(e.length===0)continue;let i=t;for(let t=0;t<e.length-1;t++){let n=e[t],r=i[n];U(r)?W(r)&&(i[n]={DEFAULT:r}):i[n]={},i=i[n]}let a=e.at(-1),o=K(r,e),s={$value:o.value,...o.type?{$type:o.type}:{}},c=i[a];U(c)&&!W(c)?c.DEFAULT=s:i[a]=s}return q(t)}const pt=/(--[A-Z_][\w-]*)\s*:\s*([^;}{]+?)(?=\s*(?:;|\}|$))/gi;function mt(e){let t={},n=e.replace(/\/\*[\s\S]*?\*\//g,``);for(let e of n.matchAll(pt)){let n=e[1],r=e[2]?.trim();!n||!r||(t[n]=r)}return J(t)}const Y=`razorwind-infer`;function X(e){if(e==null)return{};if(typeof e!=`object`||Array.isArray(e))throw TypeError(`Token file must parse to a plain object.`);return q(e)}function ht(e){try{return X(T.default.parse(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse JSON token file: ${t}`)}}function gt(e){try{return X((0,oe.parse)(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse YAML token file: ${t}`)}}function _t(e){try{return X((0,ae.parse)(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse TOML token file: ${t}`)}}const vt=[{name:`razorwind-json`,pattern:/\.json[c5]?$/i,parser:({contents:e})=>ht(e)},{name:`razorwind-yaml`,pattern:/\.ya?ml$/i,parser:({contents:e})=>gt(e)},{name:`razorwind-toml`,pattern:/\.toml$/i,parser:({contents:e})=>_t(e)},{name:`razorwind-css`,pattern:/\.css$/i,parser:({contents:e})=>q(mt(e))}];function yt(){return Object.fromEntries(vt.map(({name:e,pattern:t,parser:n})=>[e,{pattern:t,parser:n}]))}function bt(e){return q(e)}function xt(){return{[Y]:bt}}function St(e=d.default){for(let t of vt)e.registerParser(t);e.registerPreprocessor({name:Y,preprocessor:bt})}function Z(e,t){return(0,g.isAbsolute)(t)?t:(0,g.resolve)(e,t)}function Q(e){return/\.([^.]+)$/.exec(e)?.[1]?.toLowerCase()??``}function Ct(e){return z.includes(Q(e))}function wt(e){let t=e.split(/[/\\]/).pop()?.toLowerCase()??``;return t.startsWith(`style-dictionary.config.`)||t.startsWith(`sd.config.`)}function Tt(e){return(0,p.joinPaths)(e,Xe)}function Et(e){let{cwd:t,tokensPath:n,fallbackPaths:r=[]}=e;if(n){let e=Z(t,n);if(!(0,w.existsSync)(e))throw Error(`tokensPath "${n}" does not exist (resolved: ${e}).`);return(0,E.isDirectory)(e)?{resolvedPath:e,source:[Tt(e)],origin:`tokensPath`}:wt(e)?{resolvedPath:e,source:[],origin:`tokensPath`}:{resolvedPath:e,source:[e],origin:`tokensPath`}}for(let e of Ye){let n=Z(t,e);if((0,w.existsSync)(n)){if((0,E.isDirectory)(n))return{resolvedPath:n,source:[Tt(n)],origin:`default`};if(wt(n))return{resolvedPath:n,source:[],origin:`default`};if(Ct(n))return{resolvedPath:n,source:[n],origin:`default`}}}for(let e of r){if(!e)continue;let n=Z(t,e);if(!(!(0,w.existsSync)(n)||(0,E.isDirectory)(n))&&(Ct(n)||Q(n)===`css`))return{resolvedPath:n,source:[n],origin:`fallback`}}return{source:[],origin:`none`}}function Dt(e){return(e.split(/[/\\]/).pop()??``).replace(/\.[^.]+$/,``).match(Ze)?.[1]?.toLowerCase()}let Ot=!1;function kt(){Ot||=(St(d.default),!0)}function At(e){return!e||typeof e!=`object`||Object.keys(e).length===0}async function jt(e){let t=await(0,ie.importModule)(e);return t&&typeof t==`object`&&`default`in t&&t.default?t.default:t}async function Mt(e){kt();let t=new d.default({...e,parsers:[...qe,...e.parsers??[]],preprocessors:[Y,...e.preprocessors??[]],hooks:{...e.hooks,parsers:{...yt(),...e.hooks?.parsers},preprocessors:{...xt(),...e.hooks?.preprocessors}},usesDtcg:e.usesDtcg??!0,platforms:e.platforms??{}});return await t.hasInitialized,t}async function $(e){return e.length===0?{}:(await Mt({source:e})).tokens}async function Nt(e){return(await(0,h.default)(e,{absolute:!0,onlyFiles:!0,unique:!0})).sort()}async function Pt(e){let t=await Nt(e);if(t.length===0)return{};let n=new Map,r=[];for(let e of t){let t=Dt(e);if(t){let r=n.get(t)??[];r.push(e),n.set(t,r)}else r.push(e)}if(n.size<2)return $(e);let i={};if(r.length>0){let e=await $(r);At(e)||(i.base=e)}for(let[e,t]of n)i[e]=await $(t);return i}async function Ft(e){let{splitThemes:t=!0,...n}=e,r=Et(n);return r.resolvedPath&&(0,w.existsSync)(r.resolvedPath)&&/(?:^|[/\\])(?:style-dictionary|sd)\.config\./i.test((0,g.basename)(r.resolvedPath))?(await Mt(await jt(r.resolvedPath))).tokens:r.source.length===0?{}:t?Pt(r.source):$(r.source)}async function It(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function Lt(e,t){return(0,g.isAbsolute)(t)?t:(0,g.resolve)(e,t)}async function Rt(e,t){let n=await he(e,{configCssFile:t??void 0});if(n?.tailwindVersion)return{configured:!!n.tailwindCssFile,version:n.tailwindVersion,cssFile:n.tailwindCssFile,configFile:n.tailwindConfigFile};let[r,i]=await Promise.all([F(e),_e(e,t??void 0)]);return{configured:!!(r&&i),version:r,cssFile:i,configFile:null}}function zt(e,t){for(let n of t){if(!(0,u.isSetString)(n))continue;let t=Lt(e,n);if((0,w.existsSync)(t))return t}return null}async function Bt(e){let{cwd:t,cssPath:n,omitDefaults:r=!1}=e,i=await Rt(t,n);if(!i.configured||i.version!==`v4`)return null;let a=zt(t,[n,i.cssFile]);if(!a)return null;let o=await(0,y.readFile)(a),s=await(await It()).__unstable__loadDesignSystem(o,{base:(0,g.dirname)(a)}),c={};for(let[e,t]of s.theme.entries())r&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(c[e]=t.value);return Object.keys(c).length===0?null:J(c)}function Vt(e){return!e||typeof e!=`object`||Object.keys(e).length===0}var Ht=(0,c.defineGenerator)({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`1.0`,tags:[`razorwind`,`dtcg`]},schema:Ke,input:async e=>{let{registryPath:t,tokensPath:n}=e,{cwd:r}=(0,c.useExecution)(),i=(0,u.isSetString)(t)?(0,l.findFilePath)(t):r,a=await Re(i)??He({resolvedPaths:{cwd:i}});St(d.default);let o=[a.resolvedPaths?.tailwindCss,a.tailwind?.css],s;if((0,u.isSetString)(n))s=await Ft({cwd:r,tokensPath:n});else{let e=await Rt(r,a.tailwind?.css);e.configured&&e.version===`v4`&&(s=await Bt({cwd:r,cssPath:a.resolvedPaths?.tailwindCss??a.tailwind?.css??e.cssFile})),Vt(s)&&(s=await Ft({cwd:r,fallbackPaths:o}))}return{registry:a,tokens:s??{}}},generator:async(e,t)=>({})});module.exports=Ht;
@@ -0,0 +1,13 @@
1
+ import { t as Config } from "./config-CJi9Fu8b.cjs";
2
+ import { t as Schema } from "./index-UbhspNdK.cjs";
3
+ //#region src/generator.d.ts
4
+ /**
5
+ * A Power Plant generator for Razorwind.
6
+ *
7
+ * @param spec - The Razorwind schema to generate from.
8
+ * @param options - Razorwind config (plugins, outDir, lint, …).
9
+ * @returns Generated documents keyed by output filename.
10
+ */
11
+ declare const _default: import("@power-plant/core").GeneratorConfigObject<Schema, Config, void>;
12
+ export = _default;
13
+ //# sourceMappingURL=generator.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.ts"],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { t as Config } from "./config-CJi9Fu8b.mjs";
2
+ import { t as Schema } from "./index-DUwzPMW3.mjs";
3
+ //#region src/generator.d.ts
4
+ /**
5
+ * A Power Plant generator for Razorwind.
6
+ *
7
+ * @param spec - The Razorwind schema to generate from.
8
+ * @param options - Razorwind config (plugins, outDir, lint, …).
9
+ * @returns Generated documents keyed by output filename.
10
+ */
11
+ declare const _default: import("@power-plant/core").GeneratorConfigObject<Schema, Config, void>;
12
+ //#endregion
13
+ export { _default as default };
14
+ //# sourceMappingURL=generator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.mts","names":[],"sources":["../src/generator.ts"],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import{defineGenerator as e,useExecution as t}from"@power-plant/core";import{findFilePath as n}from"@stryke/path/find";import{isSetString as r}from"@stryke/type-checks/is-set-string";import i from"style-dictionary";import{loadTsConfig as a}from"@stryke/fs/tsconfig";import{joinPaths as o}from"@stryke/path/join";import s from"chalk";import{cosmiconfig as c}from"cosmiconfig";import l from"fast-glob";import u,{basename as d,dirname as f,isAbsolute as p,resolve as m}from"node:path";import{configSchema as h,rawConfigSchema as ee}from"shadcn/schema";import"shadcn/preset";import{readJsonFile as g}from"@stryke/fs/json";import{readFile as _}from"@stryke/fs/read-file";import{existsSync as v}from"node:fs";import{access as te}from"node:fs/promises";import y,{z as b}from"zod";import"@stryke/http/fetch";import"@stryke/url/helpers";import{getWorkspaceRoot as x}from"@stryke/fs/get-workspace-root";import{createMatchPath as ne}from"tsconfig-paths";import{isAbsolute as re}from"@stryke/path/is-type";import{tokensSchema as S}from"@power-plant/dtcg-schema";import{existsSync as C}from"@stryke/fs/exists";import{importModule as ie}from"@stryke/fs/resolve";import ae from"json5";import{parse as oe}from"smol-toml";import{parse as se}from"yaml";import{isDirectory as w}from"@stryke/fs/is-file";const T=process.env.REGISTRY_URL??`https://ui.shadcn.com/r`,E=T.replace(/\/r\/?$/,``),D={"next-app":{name:`next-app`,label:`Next.js`,links:{installation:`${E}/docs/installation/next`,tailwind:`https://tailwindcss.com/docs/guides/nextjs`}},"next-pages":{name:`next-pages`,label:`Next.js`,links:{installation:`${E}/docs/installation/next`,tailwind:`https://tailwindcss.com/docs/guides/nextjs`}},remix:{name:`remix`,label:`Remix`,links:{installation:`${E}/docs/installation/remix`,tailwind:`https://tailwindcss.com/docs/guides/remix`}},"react-router":{name:`react-router`,label:`React Router`,links:{installation:`${E}/docs/installation/react-router`,tailwind:`https://tailwindcss.com/docs/installation/framework-guides/react-router`}},vite:{name:`vite`,label:`Vite`,links:{installation:`${E}/docs/installation/vite`,tailwind:`https://tailwindcss.com/docs/guides/vite`}},astro:{name:`astro`,label:`Astro`,links:{installation:`${E}/docs/installation/astro`,tailwind:`https://tailwindcss.com/docs/guides/astro`}},laravel:{name:`laravel`,label:`Laravel`,links:{installation:`${E}/docs/installation/laravel`,tailwind:`https://tailwindcss.com/docs/guides/laravel`}},"tanstack-start":{name:`tanstack-start`,label:`TanStack Start`,links:{installation:`${E}/docs/installation/tanstack`,tailwind:`https://tailwindcss.com/docs/installation/using-postcss`}},gatsby:{name:`gatsby`,label:`Gatsby`,links:{installation:`${E}/docs/installation/gatsby`,tailwind:`https://tailwindcss.com/docs/guides/gatsby`}},expo:{name:`expo`,label:`Expo`,links:{installation:`${E}/docs/installation/expo`,tailwind:`https://www.nativewind.dev/docs/getting-started/installation`}},manual:{name:`manual`,label:`Manual`,links:{installation:`${E}/docs/installation/manual`,tailwind:`https://tailwindcss.com/docs/installation`}}};function ce(e){let t=[e];for(;t.length;){let e=t.shift();if(typeof e==`string`){if(e.startsWith(`./`))return e;continue}if(Array.isArray(e)){t.unshift(...e);continue}e&&typeof e==`object`&&t.unshift(...Object.values(e))}return null}function le(e){if(!e.includes(`*`))return`strip_extension`;let t=e.slice(e.indexOf(`*`)+1);return t&&/^\.[^/]+$/.test(t)?`strip_extension`:`preserve_extension`}function O(e,t){let n=t.find(t=>!t.hasWildcard&&t.key===e);if(n)return{path:u.resolve(n.rootDir,n.target),matchedAlias:n.key,matchedTarget:n.target,emitMode:n.emitMode};let r=t.filter(e=>e.hasWildcard).sort((e,t)=>t.key.length-e.key.length);for(let t of r){let n=k(e,t.key,{allowBareAliasBase:!0});if(n!==null)return{path:u.resolve(t.rootDir,ue(t.target,n)),matchedAlias:t.key,matchedTarget:t.target,emitMode:t.emitMode}}return null}function k(e,t,n={}){if(!t.includes(`*`))return e===t?``:null;let[r,i=``]=t.split(`*`);return r&&e.startsWith(r)&&e.endsWith(i)?i?e.slice(r.length,-i.length):e.slice(r.length):n.allowBareAliasBase&&i===``&&r&&r.endsWith(`/`)&&e===r.slice(0,-1)?``:null}function ue(e,t){if(!e.includes(`*`))return e;let[n,r=``]=e.split(`*`);return t?n?`${n}${t}${r}`:t:n?n.replace(/\/$/,``):``}const A=new Map;async function j(e){let t=u.resolve(e),n=A.get(t);if(n)return n;let r=(await M(e))?.imports;if(!r||typeof r!=`object`||Array.isArray(r))return A.set(t,[]),[];let i=[];for(let[e,n]of Object.entries(r)){if(!e.startsWith(`#`))continue;let r=ce(n);r&&i.push({key:e,aliasBase:e===`#*`?`#`:e.endsWith(`/*`)?e.slice(0,-2):e,target:r,emitMode:le(r),hasWildcard:e.includes(`*`),rootDir:t})}return A.set(t,i),i}async function de(e){let t=(await j(e)).map(e=>e.aliasBase);return t.length?pe(t):null}async function fe(e,t){return O(e,await j(t))}function pe(e){let t=e.map(e=>e.slice(1).split(`/`).filter(Boolean)).reduce((e,t,n)=>n?e.filter((e,n)=>t[n]===e):t,[]);return t.length?`#${t.join(`/`)}`:`#`}async function M(e=``){return g(u.join(e,`package.json`))}const N=[`**/node_modules/**`,`.next`,`public`,`dist`,`build`],me=b.object({compilerOptions:b.object({paths:b.record(b.string(),b.string().or(b.array(b.string())))})});async function he(e,t){let[n,r,i,a,s,c,u,d]=await Promise.all([l.glob(`**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*`,{cwd:e,deep:3,ignore:N}),te(o(e,`src`)).then(()=>!0).catch(()=>!1),be(e),_e(e),F(e,t?.configCssFile),P(e),ye(e),M(e)]),f=v(o(e,`${r?`src/`:``}app`)),p={framework:D.manual,isSrcDir:r,isRSC:!1,isTsx:i,tailwindConfigFile:a,tailwindCssFile:s,tailwindVersion:c,frameworkVersion:null,aliasPrefix:u.prefix};if(n.find(e=>e.startsWith(`next.config.`))?.length)return p.framework=f?D[`next-app`]:D[`next-pages`],p.isRSC=f,p.frameworkVersion=await ge(p.framework,d),p;if(n.find(e=>e.startsWith(`astro.config.`))?.length)return p.framework=D.astro,p;if(n.find(e=>e.startsWith(`gatsby-config.`))?.length)return p.framework=D.gatsby,p;if(n.find(e=>e.startsWith(`composer.json`))?.length)return p.framework=D.laravel,p;if(Object.keys(d?.dependencies??{}).find(e=>e.startsWith(`@remix-run/`)))return p.framework=D.remix,p;if([...Object.keys(d?.dependencies??{}),...Object.keys(d?.devDependencies??{})].find(e=>e.startsWith(`@tanstack/react-start`)))return p.framework=D[`tanstack-start`],p;if(n.find(e=>e.startsWith(`react-router.config.`))?.length)return p.framework=D[`react-router`],p;if(n.find(e=>e.startsWith(`vite.config.`))?.length)return p.framework=D.vite,p;let m=n.find(e=>e.startsWith(`app.config`));return m?.length&&(await _(o(e,m))).includes(`defineConfig`)?(p.framework=D.vite,p):(d?.dependencies?.expo&&(p.framework=D.expo),p)}async function ge(e,t){if(!t||![`next-app`,`next-pages`].includes(e.name))return null;let n=t.dependencies?.next||t.devDependencies?.next;if(!n)return null;let r=n.match(/^[\^~]?(\d+\.\d+\.\d+)/);if(r)return r[1]??null;let i=n.match(/(\d+\.\d+\.\d+)/);return i?i[1]??null:n}async function P(e){let[t,n]=await Promise.all([M(e),Le(e)]);return n?.tailwind?.config===``?`v4`:!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function F(e,t){if(t&&v(u.resolve(e,t)))return t;let[n]=await Promise.all([l.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:N}),P(e)]);if(!n.length)return null;for(let t of n){let n=await _(o(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function _e(e){let t=await l.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:N});return t.length?t[0]??null:null}async function ve(e){let t=await xe(e),n=Object.entries(t?.compilerOptions.paths??{}).length?t?.compilerOptions.paths:null;if(!n||!Object.entries(n).length)return null;for(let[e,t]of Object.entries(n)){let n=Array.isArray(t)?t:[t];if(n.includes(`./*`)||n.includes(`./src/*`)||n.includes(`./app/*`)||n.includes(`./resources/js/*`))return e.replace(/\/\*$/,``)??null}return Object.keys(n)?.[0]?.replace(/\/\*$/,``)??null}async function ye(e){let t=await ve(e),n=await de(e);return n&&t?.startsWith(`#`)?{prefix:n,source:`package_imports`}:t?{prefix:t,source:`tsconfig_paths`}:n?{prefix:n,source:`package_imports`}:{prefix:null,source:null}}async function be(e){return(await l.glob(`tsconfig.*`,{cwd:e,deep:1,ignore:N})).length>0}async function xe(e){for(let t of[`tsconfig.json`,`tsconfig.web.json`,`tsconfig.app.json`]){let n=u.resolve(e,t);if(!v(n))continue;let r=await _(n),i;try{i=JSON.parse(Se(r))}catch{continue}let a=me.safeParse(i);if(!a.error)return a.data}return null}function Se(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];if(n){if(t+=a,r){r=!1;continue}if(a===`\\`){r=!0;continue}a===`"`&&(n=!1);continue}if(a===`"`){n=!0,t+=a;continue}if(a===`/`&&o===`/`){for(;i<e.length&&e[i]!==`
2
+ `;)i++;i<e.length&&(t+=e[i]);continue}if(a===`/`&&o===`*`){for(i+=2;i<e.length;){if(e[i]===`*`&&e[i+1]===`/`){i++;break}e[i]===`
3
+ `&&(t+=`
4
+ `),i++}continue}if(a===`,`){let t=i+1;for(;t<e.length;){for(;/\s/.test(e[t]??``);)t++;if(e[t]===`/`&&e[t+1]===`/`){for(t+=2;t<e.length&&e[t]!==`
5
+ `&&e[t]!==`\r`;)t++;continue}if(e[t]===`/`&&e[t+1]===`*`){for(t+=2;t<e.length&&(e[t]!==`*`||e[t+1]!==`/`);)t++;t+=2;continue}break}if(e[t]===`}`||e[t]===`]`)continue}t+=a}return t}function Ce(e){if(e.startsWith(`#`)||e.startsWith(`.`)||re(e))return null;let t=e.split(`/`);return e.startsWith(`@`)?t.length<2?null:{packageName:`${t[0]}/${t[1]}`}:{packageName:t[0]}}const we=new Map,I=new Map;function Te(e){let t=[],n=!1,r=0;for(let i of e.split(`
6
+ `)){let e=i.trim();if(!e||e.startsWith(`#`))continue;let a=i.match(/^(\s*)([\w-]+)\s*:/);if(a){r=a[1]?.length??0,n=a[2]===`packages`;continue}if(!n)continue;let o=i.match(/^(\s*)-\s*(.+?)\s*(?:#.*)?$/);((!o||o[1]?.length)??r>=0)||t.push(o[2]?.trim().replace(/^["']|["']$/g,``)??``)}return t}async function Ee(e){let t=[],n=u.resolve(e,`pnpm-workspace.yaml`);if(v(n)){let e=await _(n);t.push(...Te(e))}let r=o(e,`package.json`);if(v(r))try{let e=await g(r),n=Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages;Array.isArray(n)&&t.push(...n.filter(e=>!e.startsWith(`!`)))}catch{}return Array.from(new Set(t))}async function De(e){let t=await Ee(e),n=new Map;if(!t.length)return n;let r=await l(t.map(e=>u.posix.join(e.split(u.sep).join(`/`),`package.json`)),{cwd:e,ignore:[`**/node_modules/**`]});for(let t of r){let r=u.resolve(e,u.dirname(t)),i=(await M(r))?.name;i&&n.set(i,{packageName:i,packageRoot:r})}return n}async function Oe(e,t){let n=x(e);if(!n)return null;let r=we.get(n);if(r?.has(t))return r.get(t)??null;let i=await De(n);return we.set(n,i),i.get(t)??null}function ke(e,t){if(t===`.`)return e;let n=t.slice(2).replace(/\/\*$/,``);return n?`${e}/${n}`:e}async function Ae(e){let t=`${e.packageRoot}:${e.packageName}`,n=I.get(t);if(n)return n;let r=(await M(e.packageRoot))?.exports;if(!r||typeof r!=`object`||Array.isArray(r))return I.set(t,[]),[];let i=[];for(let[t,n]of Object.entries(r)){if(t!==`.`&&!t.startsWith(`./`))continue;let r=ce(n);if(!r)continue;let a=ke(e.packageName,t);i.push({key:t.includes(`*`)?`${a}/*`:a,aliasBase:a,target:r,emitMode:le(r),hasWildcard:t.includes(`*`),rootDir:e.packageRoot})}return I.set(t,i),i}async function je(e,t){let n=Ce(e);if(!n?.packageName)return null;let r=await Oe(t,n.packageName);return r?O(e,await Ae(r)):null}async function Me(e,t){let n=t.cwd??t.baseUrl??x();if(e.startsWith(`#`)){let t=await fe(e,n);if(t)return{path:t.path,source:`package_imports`,matchedAlias:t.matchedAlias,matchedTarget:t.matchedTarget,emitMode:t.emitMode}}let r=await je(e,n);return r?{path:r.path,source:`workspace_package_exports`,matchedAlias:r.matchedAlias,matchedTarget:r.matchedTarget,emitMode:r.emitMode}:Pe(e,t)}function Ne(e){return/^@[^/]+\/[^/]+(?:\/.*)?$/.test(e)}function Pe(e,t){let n=ne(t.baseUrl||t.cwd||x(),t.paths??{})(e,void 0,()=>!0,[`.ts`,`.tsx`,`.jsx`,`.js`,`.css`]);if(!n)return null;let r=Fe(e,t.paths??{});return!r&&Ne(e)?null:{path:n,source:`tsconfig_paths`,matchedAlias:r?.key??e,matchedTarget:r?.target??n,emitMode:`strip_extension`}}function Fe(e,t){for(let[n,r]of Object.entries(t)){let t=Array.isArray(r)?r:[r],i=k(e,n);if(i!==null)return{key:n,target:t[0]?.includes(`*`)&&i!==null?t[0].replace(/\*/g,i):t[0]}}return null}const Ie=c(`components`,{searchPlaces:[`components.json`]});async function Le(e){let t=await Be(e);return t?(t.iconLibrary||=t.style===`new-york`?`radix`:`lucide`,Re(e,t)):null}const L={"@shadcn":`${T}/styles/{style}/{name}.json`};async function Re(e,t){t.registries={...L,...t.registries??{}};let n=await a(e);if(!n)throw Error(`Failed to load tsconfig.json.`);let r=await R(`utils`,t.aliases.utils,e,n),i=await R(`components`,t.aliases.components,e,n),o=t.aliases.ui?await R(`ui`,t.aliases.ui,e,n):u.resolve(i??e,`ui`),s=t.aliases.lib?await R(`lib`,t.aliases.lib,e,n):u.resolve(r??e,`..`),c=t.aliases.hooks?await R(`hooks`,t.aliases.hooks,e,n):u.resolve(i??e,`..`,`hooks`);return ze(e,{components:i,utils:r,ui:o,lib:s,hooks:c}),h.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?u.resolve(e,t.tailwind.config):``,tailwindCss:u.resolve(e,t.tailwind.css),utils:r,components:i,ui:o,lib:s,hooks:c}})}async function R(e,t,n,r){let i=await Me(t,{...r,cwd:n});if(!i?.path||t.startsWith(`#`)&&i.path===o(n,t))return null;if(e!==`utils`&&(i.source===`package_imports`||i.source===`workspace_package_exports`)){if(!i.matchedAlias.includes(`*`)&&/\/index\.[^/]+$/.test(i.path))return u.dirname(i.path);if(i.matchedAlias.includes(`*`)&&/\.[^/]+$/.test(i.path))return i.path.replace(/\.[^/]+$/,``)}return i.path}function ze(e,t){let n=[`components`,`ui`,`lib`,`hooks`,`utils`].filter(e=>!t[e]);if(n.length)throw Error([`Could not resolve the following aliases in ${s.cyan(e)}: ${s.cyan(n.join(`, `))}.`,`Configure path aliases in ${s.cyan(`tsconfig.json`)} or imports in ${s.cyan(`package.json`)} for this workspace and try again.`].join(`
7
+ `))}async function Be(e){try{let t=await Ie.search(e);if(!t)return null;let n=ee.parse(t.config);if(n.registries){for(let e of Object.keys(n.registries))if(e in L)throw Error(`"${e}" is a built-in registry and cannot be overridden.`)}return n}catch(t){let n=`${e}/components.json`;throw t instanceof Error&&t.message.includes(`reserved registry`)?t:Error(`Invalid configuration found in ${s.cyan(n)}.`)}}function Ve(e){let t={resolvedPaths:{cwd:process.cwd(),tailwindConfig:``,tailwindCss:``,utils:``,components:``,ui:``,lib:``,hooks:``},style:``,tailwind:{config:``,css:``,baseColor:``,cssVariables:!1},rsc:!1,tsx:!0,aliases:{components:``,utils:``},registries:{...L}};return e?{...t,...e,resolvedPaths:{...t.resolvedPaths,...e.resolvedPaths??{}},tailwind:{...t.tailwind,...e.tailwind??{}},aliases:{...t.aliases,...e.aliases??{}},registries:{...t.registries,...e.registries??{}}}:t}const He=b.object({category:b.enum([`block`,`component`,`ui`,`page`]),name:b.string(),title:b.string(),description:b.string().optional(),tags:b.array(b.string()).optional(),related:b.array(b.string()).optional(),since:b.string().optional(),version:b.string().optional(),repository:b.string().optional(),homepage:b.string().optional(),dependencies:b.record(b.string(),b.string()).optional(),registryDependencies:b.record(b.string(),b.string()).optional(),files:b.array(b.string()).optional()});b.record(b.string(),He);function Ue(e){return y.unknown().transform((t,n)=>{let r=e.safeParse(t);if(!r.success){for(let e of r.error.issues)n.addIssue({code:`custom`,message:e.message,path:e.path});return y.NEVER}return r.data})}const We=y.union([S,y.record(y.string(),S)]),Ge=y.object({registry:Ue(h),tokens:We}),Ke=[`razorwind-json`,`razorwind-yaml`,`razorwind-toml`,`razorwind-css`],z=[`json`,`json5`,`jsonc`,`yaml`,`yml`,`toml`,`css`,`js`,`mjs`,`cjs`,`ts`,`mts`,`cts`],qe=z.join(`,`),Je=[`tokens.json`,`tokens.json5`,`tokens.jsonc`,`tokens.yaml`,`tokens.yml`,`tokens.toml`,`tokens.css`,`design-tokens.json`,`design-tokens.yaml`,`design-tokens.yml`,`tokens`,`design-tokens`,`src/tokens`,`src/design-tokens`,`packages/tokens`,`style-dictionary.config.js`,`style-dictionary.config.mjs`,`style-dictionary.config.ts`,`sd.config.js`,`sd.config.mjs`,`sd.config.ts`],Ye=`**/*.{${qe}}`,Xe=/^(light|dark|dim|high-contrast|hc|default|base|theme)([._-].+)?$/i,Ze={color:`color`,colours:`color`,colors:`color`,colour:`color`,palette:`color`,bg:`color`,background:`color`,foreground:`color`,fg:`color`,border:`color`,fill:`color`,stroke:`color`,spacing:`dimension`,space:`dimension`,size:`dimension`,sizes:`dimension`,sizing:`dimension`,gap:`dimension`,radius:`dimension`,radii:`dimension`,rounded:`dimension`,width:`dimension`,height:`dimension`,dimension:`dimension`,dimensions:`dimension`,duration:`duration`,durations:`duration`,time:`duration`,delay:`duration`,animation:`duration`,motion:`duration`,transition:`duration`,font:`fontFamily`,fonts:`fontFamily`,fontfamily:`fontFamily`,"font-family":`fontFamily`,typeface:`fontFamily`,fontweight:`fontWeight`,"font-weight":`fontWeight`,weight:`fontWeight`,opacity:`number`,opacities:`number`,zindex:`number`,"z-index":`number`,lineheight:`number`,"line-height":`number`,letterspacing:`dimension`,"letter-spacing":`dimension`,shadow:`shadow`,shadows:`shadow`,elevation:`shadow`,gradient:`gradient`,gradients:`gradient`,typography:`typography`,text:`typography`,cubicbezier:`cubicBezier`,easing:`cubicBezier`,ease:`cubicBezier`},Qe=/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,$e=/^rgba?\(\s*([+\d.]+%?)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+%?)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+%?)(?:\s*[,/]\s*([+\d.]+%?))?\s*\)$/i,et=/^hsla?\(\s*([+\d.]+)[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+)%[\x09-\x0D\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?: |(?: \s*)?,)\s*([+\d.]+)%(?:\s*[,/]\s*([+\d.]+%?))?\s*\)$/i,tt=/^oklch\(\s*([+\d.]+%?|none)\s+([+\d.]+|none)\s+([+\d.]+|none)(?:\s*\/\s*([+\d.]+%?))?\s*\)$/i,nt=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(px|rem|em|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc)$/i,rt=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(ms|s)$/i,it=/^cubic-bezier\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*\)$/i,at=/^var\(\s*(--[\w-]+)\s*(?:,\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))?\)\s*$/i,ot=/^\{[^{}]+\}$/,st={thin:100,hairline:100,extralight:200,"extra-light":200,ultralight:200,light:300,normal:400,regular:400,book:400,medium:500,semibold:600,"semi-bold":600,demibold:600,bold:700,extrabold:800,"extra-bold":800,ultrabold:800,black:900,heavy:900},B=new Set([`px`,`rem`]);function V(e){return Math.min(1,Math.max(0,e))}function H(e,t=100){let n=e.trim();if(n.endsWith(`%`))return V(Number.parseFloat(n)/t);let r=Number.parseFloat(n);return V(r>1?r/255:r)}function ct(e){let t=e.slice(1);return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:(e.length===7||e.length,e)}function lt(e){let t=ct(e.toLowerCase()).slice(1),n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255,a=t.length===8?Number.parseInt(t.slice(6,8),16)/255:void 0;return{colorSpace:`srgb`,components:[n,r,i],...a===void 0||a===1?{}:{alpha:a},hex:`#${t.slice(0,6)}`}}function ut(e){return`{${e.replace(/^--/,``).split(`-`).filter(Boolean).join(`.`)}}`}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function G(e){for(let t=e.length-1;t>=0;t--){let n=e[t]?.toLowerCase();if(!n)continue;let r=Ze[n];if(r)return r}}function K(e,t=[]){let n=G(t);if(typeof e==`string`){let r=e.trim();if(ot.test(r))return{value:r,type:n};let i=r.match(at);if(i?.[1])return{value:ut(i[1]),type:n};if(Qe.test(r))return{value:lt(r),type:`color`};let a=r.match($e);if(a){let e=[H(a[1]),H(a[2]),H(a[3])],t=a[4]?a[4].endsWith(`%`)?V(Number.parseFloat(a[4])/100):V(Number.parseFloat(a[4])):void 0;return{value:{colorSpace:`srgb`,components:e,...t===void 0||Number.isNaN(t)?{}:{alpha:t}},type:`color`}}let o=r.match(et);if(o)return{value:{colorSpace:`hsl`,components:[Number.parseFloat(o[1]),Number.parseFloat(o[2]),Number.parseFloat(o[3])],...o[4]?{alpha:o[4].endsWith(`%`)?V(Number.parseFloat(o[4])/100):V(Number.parseFloat(o[4]))}:{}},type:`color`};let s=r.match(tt);if(s){let e=e=>e===`none`?`none`:e.endsWith(`%`)?Number.parseFloat(e)/100:Number.parseFloat(e);return{value:{colorSpace:`oklch`,components:[e(s[1]),e(s[2]),e(s[3])],...s[4]?{alpha:s[4].endsWith(`%`)?V(Number.parseFloat(s[4])/100):V(Number.parseFloat(s[4]))}:{}},type:`color`}}let c=r.match(nt);if(c){let e=c[2].toLowerCase(),t=Number.parseFloat(c[1]);return B.has(e)?{value:{value:t,unit:e},type:`dimension`}:{value:r,type:n===`dimension`?void 0:n}}let l=r.match(rt);if(l)return{value:{value:Number.parseFloat(l[1]),unit:l[2].toLowerCase()},type:`duration`};let u=r.match(it);if(u)return{value:[Number.parseFloat(u[1]),Number.parseFloat(u[2]),Number.parseFloat(u[3]),Number.parseFloat(u[4])],type:`cubicBezier`};let d=st[r.toLowerCase()];return d===void 0?n===`fontFamily`||/family|font|typeface/i.test(t.at(-1)??``)?r.includes(`,`)?{value:r.split(`,`).map(e=>e.trim().replace(/^["']|["']$/g,``)),type:`fontFamily`}:{value:r.replace(/^["']|["']$/g,``),type:`fontFamily`}:n===`color`&&!r.startsWith(`{`)?{value:r,type:void 0}:{value:r,type:n}:{value:d,type:`fontWeight`}}if(typeof e==`number`)return n===`fontWeight`?{value:e,type:`fontWeight`}:n===`duration`?{value:{value:e,unit:`ms`},type:`duration`}:n===`dimension`?{value:{value:e,unit:`px`},type:`dimension`}:{value:e,type:n??`number`};if(Array.isArray(e))return e.length===4&&e.every(e=>typeof e==`number`)&&(n===`cubicBezier`||t.some(e=>/ease|bezier/i.test(e)))?{value:e,type:`cubicBezier`}:e.every(e=>typeof e==`string`)?{value:e,type:n??`fontFamily`}:{value:e,type:n};if(U(e)){if(`colorSpace`in e&&`components`in e)return{value:e,type:`color`};if(`value`in e&&`unit`in e){let t=String(e.unit).toLowerCase();return t===`ms`||t===`s`?{value:e,type:`duration`}:B.has(t)?{value:e,type:`dimension`}:{value:e,type:n}}}return{value:e,type:n}}function dt(e,t){let n={...e};if(`value`in n&&!(`$value`in n)&&(n.$value=n.value,delete n.value),`type`in n&&!(`$type`in n)&&(n.$type=n.type,delete n.type),`comment`in n&&!(`$description`in n)&&(n.$description=n.comment,delete n.comment),`description`in n&&!(`$description`in n)&&(n.$description=n.description,delete n.description),`ref`in n&&!(`$ref`in n)&&(n.$ref=n.ref,delete n.ref),`$value`in n){let e=K(n.$value,t);n.$value=e.value,!(`$type`in n)&&e.type&&(n.$type=e.type)}return n}function q(e,t=[]){if(Array.isArray(e))return e.map((e,n)=>q(e,[...t,String(n)]));if(!U(e))return e;if(W(e))return dt(e,t);let n={};for(let[r,i]of Object.entries(e)){if(r.startsWith(`$`)){n[r]=i;continue}n[r]=q(i,[...t,r])}if(!(`$type`in n)){let e=G(t);e&&t.length>0&&(n.$type=e)}return n}function J(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.replace(/^--/,``).split(/[-./]/).filter(Boolean);if(e.length===0)continue;let i=t;for(let t=0;t<e.length-1;t++){let n=e[t],r=i[n];U(r)?W(r)&&(i[n]={DEFAULT:r}):i[n]={},i=i[n]}let a=e.at(-1),o=K(r,e),s={$value:o.value,...o.type?{$type:o.type}:{}},c=i[a];U(c)&&!W(c)?c.DEFAULT=s:i[a]=s}return q(t)}const ft=/(--[A-Z_][\w-]*)\s*:\s*([^;}{]+?)(?=\s*(?:;|\}|$))/gi;function pt(e){let t={},n=e.replace(/\/\*[\s\S]*?\*\//g,``);for(let e of n.matchAll(ft)){let n=e[1],r=e[2]?.trim();!n||!r||(t[n]=r)}return J(t)}const Y=`razorwind-infer`;function X(e){if(e==null)return{};if(typeof e!=`object`||Array.isArray(e))throw TypeError(`Token file must parse to a plain object.`);return q(e)}function mt(e){try{return X(ae.parse(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse JSON token file: ${t}`)}}function ht(e){try{return X(se(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse YAML token file: ${t}`)}}function gt(e){try{return X(oe(e))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse TOML token file: ${t}`)}}const _t=[{name:`razorwind-json`,pattern:/\.json[c5]?$/i,parser:({contents:e})=>mt(e)},{name:`razorwind-yaml`,pattern:/\.ya?ml$/i,parser:({contents:e})=>ht(e)},{name:`razorwind-toml`,pattern:/\.toml$/i,parser:({contents:e})=>gt(e)},{name:`razorwind-css`,pattern:/\.css$/i,parser:({contents:e})=>q(pt(e))}];function vt(){return Object.fromEntries(_t.map(({name:e,pattern:t,parser:n})=>[e,{pattern:t,parser:n}]))}function yt(e){return q(e)}function bt(){return{[Y]:yt}}function xt(e=i){for(let t of _t)e.registerParser(t);e.registerPreprocessor({name:Y,preprocessor:yt})}function Z(e,t){return p(t)?t:m(e,t)}function St(e){return/\.([^.]+)$/.exec(e)?.[1]?.toLowerCase()??``}function Ct(e){return z.includes(St(e))}function Q(e){let t=e.split(/[/\\]/).pop()?.toLowerCase()??``;return t.startsWith(`style-dictionary.config.`)||t.startsWith(`sd.config.`)}function wt(e){return o(e,Ye)}function Tt(e){let{cwd:t,tokensPath:n,fallbackPaths:r=[]}=e;if(n){let e=Z(t,n);if(!C(e))throw Error(`tokensPath "${n}" does not exist (resolved: ${e}).`);return w(e)?{resolvedPath:e,source:[wt(e)],origin:`tokensPath`}:Q(e)?{resolvedPath:e,source:[],origin:`tokensPath`}:{resolvedPath:e,source:[e],origin:`tokensPath`}}for(let e of Je){let n=Z(t,e);if(C(n)){if(w(n))return{resolvedPath:n,source:[wt(n)],origin:`default`};if(Q(n))return{resolvedPath:n,source:[],origin:`default`};if(Ct(n))return{resolvedPath:n,source:[n],origin:`default`}}}for(let e of r){if(!e)continue;let n=Z(t,e);if(!(!C(n)||w(n))&&(Ct(n)||St(n)===`css`))return{resolvedPath:n,source:[n],origin:`fallback`}}return{source:[],origin:`none`}}function Et(e){return(e.split(/[/\\]/).pop()??``).replace(/\.[^.]+$/,``).match(Xe)?.[1]?.toLowerCase()}let Dt=!1;function Ot(){Dt||=(xt(i),!0)}function kt(e){return!e||typeof e!=`object`||Object.keys(e).length===0}async function At(e){let t=await ie(e);return t&&typeof t==`object`&&`default`in t&&t.default?t.default:t}async function jt(e){Ot();let t=new i({...e,parsers:[...Ke,...e.parsers??[]],preprocessors:[Y,...e.preprocessors??[]],hooks:{...e.hooks,parsers:{...vt(),...e.hooks?.parsers},preprocessors:{...bt(),...e.hooks?.preprocessors}},usesDtcg:e.usesDtcg??!0,platforms:e.platforms??{}});return await t.hasInitialized,t}async function $(e){return e.length===0?{}:(await jt({source:e})).tokens}async function Mt(e){return(await l(e,{absolute:!0,onlyFiles:!0,unique:!0})).sort()}async function Nt(e){let t=await Mt(e);if(t.length===0)return{};let n=new Map,r=[];for(let e of t){let t=Et(e);if(t){let r=n.get(t)??[];r.push(e),n.set(t,r)}else r.push(e)}if(n.size<2)return $(e);let i={};if(r.length>0){let e=await $(r);kt(e)||(i.base=e)}for(let[e,t]of n)i[e]=await $(t);return i}async function Pt(e){let{splitThemes:t=!0,...n}=e,r=Tt(n);return r.resolvedPath&&C(r.resolvedPath)&&/(?:^|[/\\])(?:style-dictionary|sd)\.config\./i.test(d(r.resolvedPath))?(await jt(await At(r.resolvedPath))).tokens:r.source.length===0?{}:t?Nt(r.source):$(r.source)}async function Ft(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function It(e,t){return p(t)?t:m(e,t)}async function Lt(e,t){let n=await he(e,{configCssFile:t??void 0});if(n?.tailwindVersion)return{configured:!!n.tailwindCssFile,version:n.tailwindVersion,cssFile:n.tailwindCssFile,configFile:n.tailwindConfigFile};let[r,i]=await Promise.all([P(e),F(e,t??void 0)]);return{configured:!!(r&&i),version:r,cssFile:i,configFile:null}}function Rt(e,t){for(let n of t){if(!r(n))continue;let t=It(e,n);if(C(t))return t}return null}async function zt(e){let{cwd:t,cssPath:n,omitDefaults:r=!1}=e,i=await Lt(t,n);if(!i.configured||i.version!==`v4`)return null;let a=Rt(t,[n,i.cssFile]);if(!a)return null;let o=await _(a),s=await(await Ft()).__unstable__loadDesignSystem(o,{base:f(a)}),c={};for(let[e,t]of s.theme.entries())r&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(c[e]=t.value);return Object.keys(c).length===0?null:J(c)}function Bt(e){return!e||typeof e!=`object`||Object.keys(e).length===0}var Vt=e({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`1.0`,tags:[`razorwind`,`dtcg`]},schema:Ge,input:async e=>{let{registryPath:a,tokensPath:o}=e,{cwd:s}=t(),c=r(a)?n(a):s,l=await Le(c)??Ve({resolvedPaths:{cwd:c}});xt(i);let u=[l.resolvedPaths?.tailwindCss,l.tailwind?.css],d;if(r(o))d=await Pt({cwd:s,tokensPath:o});else{let e=await Lt(s,l.tailwind?.css);e.configured&&e.version===`v4`&&(d=await zt({cwd:s,cssPath:l.resolvedPaths?.tailwindCss??l.tailwind?.css??e.cssFile})),Bt(d)&&(d=await Pt({cwd:s,fallbackPaths:u}))}return{registry:l,tokens:d??{}}},generator:async(e,t)=>({})});export{Vt as default};
8
+ //# sourceMappingURL=generator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { configSchema, rawConfigSchema } from "shadcn/schema";
2
+ import z, { z as z$1 } from "zod";
3
+ import { Tokens } from "@power-plant/dtcg-schema";
4
+ //#region src/registry/shadcn-types.d.ts
5
+ type ShadcnConfig = (typeof configSchema)["_output"];
6
+ //#endregion
7
+ //#region src/schema/schema.d.ts
8
+ interface Schema {
9
+ registry: ShadcnConfig;
10
+ tokens: Tokens | Record<string, Tokens>;
11
+ }
12
+ //#endregion
13
+ export { Schema as t };
14
+ //# sourceMappingURL=index-DUwzPMW3.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DUwzPMW3.d.mts","names":[],"sources":["../src/registry/shadcn-types.ts","../src/schema/schema.ts"],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import "zod";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
+ import { configSchema } from "shadcn/schema";
4
+ //#region src/registry/shadcn-types.d.ts
5
+ type ShadcnConfig = (typeof configSchema)["_output"];
6
+ //#endregion
7
+ //#region src/schema/schema.d.ts
8
+ interface Schema {
9
+ registry: ShadcnConfig;
10
+ tokens: Tokens | Record<string, Tokens>;
11
+ }
12
+ //#endregion
13
+ export { Schema as t };
14
+ //# sourceMappingURL=index-UbhspNdK.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-UbhspNdK.d.cts","names":[],"sources":["../src/registry/shadcn-types.ts","../src/schema/schema.ts"],"mappings":";;;;KA0BY,uBAAuB;;;UCwBlB;EACf,UAAU;EACV,QAAQ,SAAS,eAAe"}
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs");exports.defineConfig=e.defineConfig;
@@ -0,0 +1,18 @@
1
+ import { a as UserConfigFn, c as UserConfigParams, i as UserConfigExport, n as InputOptions, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config } from "./config-CJi9Fu8b.cjs";
2
+ import { defineConfig } from "./config.cjs";
3
+ import { t as Schema } from "./index-UbhspNdK.cjs";
4
+ import { GeneratorConfig } from "@power-plant/core";
5
+ //#region src/types/base.d.ts
6
+ type Generator<TOptions extends object = object> = GeneratorConfig<Schema, TOptions> & {
7
+ name: string;
8
+ version: string;
9
+ description: string;
10
+ author: string;
11
+ license: string;
12
+ repository: string;
13
+ homepage: string;
14
+ tags: string[];
15
+ };
16
+ //#endregion
17
+ export { type Config, type Generator, type InputOptions, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
18
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/base.ts"],"mappings":";;;;;KAqBY,UAAU,oCAAoC,gBACxD,QACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
@@ -0,0 +1,18 @@
1
+ import { a as UserConfigFn, c as UserConfigParams, i as UserConfigExport, n as InputOptions, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config } from "./config-CJi9Fu8b.mjs";
2
+ import { defineConfig } from "./config.mjs";
3
+ import { t as Schema } from "./index-DUwzPMW3.mjs";
4
+ import { GeneratorConfig } from "@power-plant/core";
5
+ //#region src/types/base.d.ts
6
+ type Generator<TOptions extends object = object> = GeneratorConfig<Schema, TOptions> & {
7
+ name: string;
8
+ version: string;
9
+ description: string;
10
+ author: string;
11
+ license: string;
12
+ repository: string;
13
+ homepage: string;
14
+ tags: string[];
15
+ };
16
+ //#endregion
17
+ export { type Config, type Generator, type InputOptions, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
18
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/base.ts"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{defineConfig as e}from"./config.mjs";export{e as defineConfig};
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@razorwind/core",
3
+ "version": "0.0.5",
4
+ "private": false,
5
+ "description": "💨 Razorwind is a unified set of tools that make creating design systems a breeze.",
6
+ "keywords": ["razorwind", "storm-software"],
7
+ "homepage": "https://stormsoftware.com",
8
+ "bugs": {
9
+ "url": "https://stormsoftware.com/support",
10
+ "email": "support@stormsoftware.com"
11
+ },
12
+ "repository": {
13
+ "type": "github",
14
+ "url": "https://github.com/storm-software/razorwind.git",
15
+ "directory": "packages/core"
16
+ },
17
+ "funding": {
18
+ "type": "github",
19
+ "url": "https://github.com/sponsors/storm-software"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "author": {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ },
27
+ "maintainers": [
28
+ {
29
+ "name": "Storm Software",
30
+ "email": "contact@stormsoftware.com",
31
+ "url": "https://stormsoftware.com"
32
+ }
33
+ ],
34
+ "contributors": [
35
+ {
36
+ "name": "Storm Software",
37
+ "email": "contact@stormsoftware.com",
38
+ "url": "https://stormsoftware.com"
39
+ }
40
+ ],
41
+ "type": "module",
42
+ "exports": {
43
+ ".": {
44
+ "require": {
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
47
+ },
48
+ "import": {
49
+ "types": "./dist/index.d.mts",
50
+ "default": "./dist/index.mjs"
51
+ },
52
+ "default": {
53
+ "types": "./dist/index.d.mts",
54
+ "default": "./dist/index.mjs"
55
+ }
56
+ },
57
+ "./config": {
58
+ "require": {
59
+ "types": "./dist/config.d.cts",
60
+ "default": "./dist/config.cjs"
61
+ },
62
+ "import": {
63
+ "types": "./dist/config.d.mts",
64
+ "default": "./dist/config.mjs"
65
+ },
66
+ "default": {
67
+ "types": "./dist/config.d.mts",
68
+ "default": "./dist/config.mjs"
69
+ }
70
+ },
71
+ "./generator": {
72
+ "require": {
73
+ "types": "./dist/generator.d.cts",
74
+ "default": "./dist/generator.cjs"
75
+ },
76
+ "import": {
77
+ "types": "./dist/generator.d.mts",
78
+ "default": "./dist/generator.mjs"
79
+ },
80
+ "default": {
81
+ "types": "./dist/generator.d.mts",
82
+ "default": "./dist/generator.mjs"
83
+ }
84
+ },
85
+ "./package.json": "./package.json"
86
+ },
87
+ "main": "./dist/index.cjs",
88
+ "module": "./dist/index.mjs",
89
+ "types": "./dist/index.d.cts",
90
+ "typings": "dist/index.d.mts",
91
+ "files": ["dist"],
92
+ "dependencies": {
93
+ "@power-plant/core": "catalog:",
94
+ "@power-plant/dtcg-schema": "catalog:",
95
+ "@power-plant/schema": "catalog:",
96
+ "@power-plant/style-dictionary": "catalog:",
97
+ "@power-plant/terrazzo": "catalog:",
98
+ "@stryke/fs": "catalog:",
99
+ "@stryke/path": "catalog:",
100
+ "@stryke/type-checks": "catalog:",
101
+ "@stryke/types": "catalog:",
102
+ "@stryke/url": "catalog:",
103
+ "@tailwindcss/node": "catalog:",
104
+ "chalk": "catalog:",
105
+ "fast-glob": "catalog:",
106
+ "json5": "catalog:",
107
+ "lightningcss": "^1.33.0",
108
+ "shadcn": "catalog:",
109
+ "smol-toml": "catalog:",
110
+ "style-dictionary": "catalog:",
111
+ "tailwindcss": "catalog:",
112
+ "yaml": "catalog:",
113
+ "zod": "catalog:"
114
+ },
115
+ "devDependencies": {
116
+ "@powerlines/plugin-tsdown": "catalog:",
117
+ "@types/node": "catalog:",
118
+ "typescript": "^6.0.3"
119
+ },
120
+ "publishConfig": { "access": "public" }
121
+ }