@razorwind/core 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{config-CdWp8VAJ.d.mts → config-B-9DV8mT.d.cts} +12 -5
- package/dist/config-B-9DV8mT.d.cts.map +1 -0
- package/dist/{config-DBWJv6wm.d.cts → config-BIIL6BJa.d.mts} +12 -5
- package/dist/config-BIIL6BJa.d.mts.map +1 -0
- package/dist/{index-CH__zCuk.d.cts → index-BGy8EkAJ.d.mts} +5 -5
- package/dist/{index-DLV7_d-V.d.mts.map → index-BGy8EkAJ.d.mts.map} +1 -1
- package/dist/{index-DW51mcvl.d.cts → index-BzsWyssi.d.cts} +1 -1
- package/dist/{index-DLV7_d-V.d.mts → index-Di8KVEql.d.cts} +5 -5
- package/dist/{index-CH__zCuk.d.cts.map → index-Di8KVEql.d.cts.map} +1 -1
- package/dist/{index-BhVvIILv.d.mts → index-dMv2FZkj.d.mts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +18 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/tokens/index.d.cts +1 -1
- package/dist/lib/tokens/index.d.mts +1 -1
- package/dist/{plugin-BRsuaaQR.d.mts → plugin-49itXF3F.d.mts} +2 -2
- package/dist/plugin-49itXF3F.d.mts.map +1 -0
- package/dist/{plugin-C6HpaHMi.d.cts → plugin-D9baACxf.d.cts} +2 -2
- package/dist/{plugin-C6HpaHMi.d.cts.map → plugin-D9baACxf.d.cts.map} +1 -1
- package/dist/plugin.d.cts +2 -2
- package/dist/plugin.d.mts +2 -2
- package/dist/schema/index.cjs +1 -1
- package/dist/schema/index.d.cts +3 -3
- package/dist/schema/index.d.mts +3 -3
- package/dist/schema/index.mjs +1 -1
- package/dist/schema-D_QQto0V.d.cts +257 -0
- package/dist/schema-D_QQto0V.d.cts.map +1 -0
- package/dist/schema-D_QQto0V.d.mts +257 -0
- package/dist/schema-D_QQto0V.d.mts.map +1 -0
- package/dist/schema-jfwKMfbW.mjs +2 -0
- package/dist/schema-jfwKMfbW.mjs.map +1 -0
- package/dist/schema-r6H4qZHJ.cjs +1 -0
- package/package.json +6 -6
- package/dist/config-CdWp8VAJ.d.mts.map +0 -1
- package/dist/config-DBWJv6wm.d.cts.map +0 -1
- package/dist/plugin-BRsuaaQR.d.mts.map +0 -1
- package/dist/schema-C6-umW1r.d.cts +0 -115
- package/dist/schema-C6-umW1r.d.cts.map +0 -1
- package/dist/schema-C6-umW1r.d.mts +0 -115
- package/dist/schema-C6-umW1r.d.mts.map +0 -1
- package/dist/schema-CzpHs4s7.mjs +0 -2
- package/dist/schema-CzpHs4s7.mjs.map +0 -1
- package/dist/schema-DWEhLYz4.cjs +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as Components, t as Schema } from "./schema-
|
|
2
|
-
import { GeneratedDocument } from "@power-plant/core";
|
|
1
|
+
import { a as Icons, f as Components, t as Schema } from "./schema-D_QQto0V.cjs";
|
|
3
2
|
import { PreprocessedTokens } from "style-dictionary";
|
|
4
|
-
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
5
3
|
import { Tokens } from "@power-plant/dtcg-schema";
|
|
4
|
+
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
6
5
|
import { MaybePromise, RequiredKeys } from "@stryke/types/base";
|
|
6
|
+
import { GeneratedDocument } from "@power-plant/core";
|
|
7
7
|
import { DesignTokens } from "style-dictionary/types";
|
|
8
8
|
//#region src/types/plugin.d.ts
|
|
9
9
|
/**
|
|
@@ -95,6 +95,12 @@ interface Options {
|
|
|
95
95
|
* The path(s) to directories containing component directories or files.
|
|
96
96
|
*/
|
|
97
97
|
componentsPath?: string | string[];
|
|
98
|
+
/**
|
|
99
|
+
* The path(s) to directories containing icon assets or icon directories.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue "assets/icons"
|
|
102
|
+
*/
|
|
103
|
+
iconsPath?: string | string[];
|
|
98
104
|
/**
|
|
99
105
|
* The directory(ies) or file(s) containing the tokens.
|
|
100
106
|
*
|
|
@@ -162,6 +168,7 @@ interface UserConfig extends Options {
|
|
|
162
168
|
tags?: string[];
|
|
163
169
|
tokens?: Tokens | Record<string, Tokens>;
|
|
164
170
|
components?: Components;
|
|
171
|
+
icons?: Icons;
|
|
165
172
|
plugins?: Plugin[];
|
|
166
173
|
}
|
|
167
174
|
interface UserConfigParams {
|
|
@@ -172,7 +179,7 @@ type UserConfigFnObject = (config: UserConfig) => UserConfig;
|
|
|
172
179
|
type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
|
|
173
180
|
type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
|
|
174
181
|
type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
175
|
-
type Config = RequiredKeys<UserConfig, "componentsPath" | "plugins"> & {
|
|
182
|
+
type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins"> & {
|
|
176
183
|
cwd: string;
|
|
177
184
|
envPaths: EnvPaths & {
|
|
178
185
|
home: string;
|
|
@@ -180,4 +187,4 @@ type Config = RequiredKeys<UserConfig, "componentsPath" | "plugins"> & {
|
|
|
180
187
|
};
|
|
181
188
|
//#endregion
|
|
182
189
|
export { UserConfigFn as a, UserConfigParams as c, TokensPreprocessor as d, UserConfigExport as i, Plugin as l, Options as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t, TokensParser as u };
|
|
183
|
-
//# sourceMappingURL=config-
|
|
190
|
+
//# sourceMappingURL=config-B-9DV8mT.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-B-9DV8mT.d.cts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;;;;;;UAgCiB;EACf;EACA,SAAS;EACT,SAAS,qBAAqB;;;;;;;;;KAUpB;EAEN;EACA,eAAe,YAAY,uBAAuB;MAElD,YAAY,uBAAuB;;;;;;;;;UAUxB;;;;;;;EAOf;;;;;;EAOA,UAAU;;;;;;EAOV,gBAAgB;;;;;;;;EAShB,WAAW,MAAM,QAAQ,QAAQ,WAAW,aAAa;;;;;;;;EASzD,YACE,MAAM,QACN,QAAQ,WACL,aAAa,eAAe;;;;;;;;EASjC,YAAY,MAAM,QAAQ,QAAQ,WAAW;;;;UCtF9B;;;;;;EAMf;;;;EAKA;;;;;;EAOA;;;;;;;;EASA;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA;;UAGe,mBAAmB;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,SAAS,eAAe;EACjC,aAAa;EACb,QAAQ;EACR,UAAU;;UAGK;EACf;EACA;;KAGU,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;KAEQ,SAAS,aACnB;EAGA;EACA,UAAU;IACR"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as Components, t as Schema } from "./schema-
|
|
1
|
+
import { a as Icons, f as Components, t as Schema } from "./schema-D_QQto0V.mjs";
|
|
2
|
+
import { GeneratedDocument } from "@power-plant/core";
|
|
2
3
|
import { PreprocessedTokens } from "style-dictionary";
|
|
3
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
4
4
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
5
|
+
import { Tokens } from "@power-plant/dtcg-schema";
|
|
5
6
|
import { MaybePromise, RequiredKeys } from "@stryke/types/base";
|
|
6
|
-
import { GeneratedDocument } from "@power-plant/core";
|
|
7
7
|
import { DesignTokens } from "style-dictionary/types";
|
|
8
8
|
//#region src/types/plugin.d.ts
|
|
9
9
|
/**
|
|
@@ -95,6 +95,12 @@ interface Options {
|
|
|
95
95
|
* The path(s) to directories containing component directories or files.
|
|
96
96
|
*/
|
|
97
97
|
componentsPath?: string | string[];
|
|
98
|
+
/**
|
|
99
|
+
* The path(s) to directories containing icon assets or icon directories.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue "assets/icons"
|
|
102
|
+
*/
|
|
103
|
+
iconsPath?: string | string[];
|
|
98
104
|
/**
|
|
99
105
|
* The directory(ies) or file(s) containing the tokens.
|
|
100
106
|
*
|
|
@@ -162,6 +168,7 @@ interface UserConfig extends Options {
|
|
|
162
168
|
tags?: string[];
|
|
163
169
|
tokens?: Tokens | Record<string, Tokens>;
|
|
164
170
|
components?: Components;
|
|
171
|
+
icons?: Icons;
|
|
165
172
|
plugins?: Plugin[];
|
|
166
173
|
}
|
|
167
174
|
interface UserConfigParams {
|
|
@@ -172,7 +179,7 @@ type UserConfigFnObject = (config: UserConfig) => UserConfig;
|
|
|
172
179
|
type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
|
|
173
180
|
type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
|
|
174
181
|
type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
175
|
-
type Config = RequiredKeys<UserConfig, "componentsPath" | "plugins"> & {
|
|
182
|
+
type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins"> & {
|
|
176
183
|
cwd: string;
|
|
177
184
|
envPaths: EnvPaths & {
|
|
178
185
|
home: string;
|
|
@@ -180,4 +187,4 @@ type Config = RequiredKeys<UserConfig, "componentsPath" | "plugins"> & {
|
|
|
180
187
|
};
|
|
181
188
|
//#endregion
|
|
182
189
|
export { UserConfigFn as a, UserConfigParams as c, TokensPreprocessor as d, UserConfigExport as i, Plugin as l, Options as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t, TokensParser as u };
|
|
183
|
-
//# sourceMappingURL=config-
|
|
190
|
+
//# sourceMappingURL=config-BIIL6BJa.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BIIL6BJa.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { l as Plugin, t as Config } from "./config-
|
|
4
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
1
|
+
import { t as Schema } from "./schema-D_QQto0V.mjs";
|
|
2
|
+
import "./index-dMv2FZkj.mjs";
|
|
3
|
+
import { l as Plugin, t as Config } from "./config-BIIL6BJa.mjs";
|
|
5
4
|
import { ExecutionContext } from "@power-plant/core";
|
|
5
|
+
import { Tokens } from "@power-plant/dtcg-schema";
|
|
6
6
|
import { Hooks, Parser, PreprocessedTokens } from "style-dictionary/types";
|
|
7
7
|
//#region src/lib/tokens/constants.d.ts
|
|
8
8
|
/** Style Dictionary parser hook names registered by Razorwind. */
|
|
@@ -166,4 +166,4 @@ declare function registerRazorwindHooks(plugins?: Plugin[], target?: StyleDictio
|
|
|
166
166
|
declare const registerRazorwindParsers: typeof registerRazorwindHooks;
|
|
167
167
|
//#endregion
|
|
168
168
|
export { RazorwindParserName as C, TOKEN_PARSER_NAMES as D, TOKEN_FILE_EXTENSIONS as E, TYPE_PATH_HINTS as O, DEFAULT_TOKEN_PATH_CANDIDATES as S, TOKEN_DIRECTORY_GLOB as T, inferTypeFromPath as _, razorwindInferPreprocessor as a, normalizeTokenTree as b, LoadTokensOptions as c, loadTokensOrThrow as d, ResolveTokensPathOptions as f, InferredTokenType as g, themeKeyFromPath as h, getRazorwindPreprocessorHooks as i, LoadedTokens as l, resolveTokensSource as m, StyleDictionaryRegisterTarget as n, registerRazorwindHooks as o, ResolvedTokensSource as p, getRazorwindParserHooks as r, registerRazorwindParsers as s, RAZORWIND_INFER_PREPROCESSOR as t, loadTokens as u, inferValue as v, THEME_BASENAME_PATTERN as w, parseCssCustomProperties as x, nestFlatTokens as y };
|
|
169
|
-
//# sourceMappingURL=index-
|
|
169
|
+
//# sourceMappingURL=index-BGy8EkAJ.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BGy8EkAJ.d.mts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/parsers.ts"],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { l as Plugin, t as Config } from "./config-
|
|
4
|
-
import { ExecutionContext } from "@power-plant/core";
|
|
1
|
+
import { t as Schema } from "./schema-D_QQto0V.cjs";
|
|
2
|
+
import "./index-BzsWyssi.cjs";
|
|
3
|
+
import { l as Plugin, t as Config } from "./config-B-9DV8mT.cjs";
|
|
5
4
|
import { Tokens } from "@power-plant/dtcg-schema";
|
|
5
|
+
import { ExecutionContext } from "@power-plant/core";
|
|
6
6
|
import { Hooks, Parser, PreprocessedTokens } from "style-dictionary/types";
|
|
7
7
|
//#region src/lib/tokens/constants.d.ts
|
|
8
8
|
/** Style Dictionary parser hook names registered by Razorwind. */
|
|
@@ -166,4 +166,4 @@ declare function registerRazorwindHooks(plugins?: Plugin[], target?: StyleDictio
|
|
|
166
166
|
declare const registerRazorwindParsers: typeof registerRazorwindHooks;
|
|
167
167
|
//#endregion
|
|
168
168
|
export { RazorwindParserName as C, TOKEN_PARSER_NAMES as D, TOKEN_FILE_EXTENSIONS as E, TYPE_PATH_HINTS as O, DEFAULT_TOKEN_PATH_CANDIDATES as S, TOKEN_DIRECTORY_GLOB as T, inferTypeFromPath as _, razorwindInferPreprocessor as a, normalizeTokenTree as b, LoadTokensOptions as c, loadTokensOrThrow as d, ResolveTokensPathOptions as f, InferredTokenType as g, themeKeyFromPath as h, getRazorwindPreprocessorHooks as i, LoadedTokens as l, resolveTokensSource as m, StyleDictionaryRegisterTarget as n, registerRazorwindHooks as o, ResolvedTokensSource as p, getRazorwindParserHooks as r, registerRazorwindParsers as s, RAZORWIND_INFER_PREPROCESSOR as t, loadTokens as u, inferValue as v, THEME_BASENAME_PATTERN as w, parseCssCustomProperties as x, nestFlatTokens as y };
|
|
169
|
-
//# sourceMappingURL=index-
|
|
169
|
+
//# sourceMappingURL=index-Di8KVEql.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Di8KVEql.d.cts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/parsers.ts"],"mappings":";;;;;;;;cAmBa;KAOD,8BAA8B;;cAG7B;;;;;cAsBA;;cAyBA;;cAGA,wBAAsB;;cAItB,iBAAiB;;;;;;;iBCvDd,yBACd,mBACC;;;KCgCS;;;;iBAmEI,kBACd,iBACC;;;;iBAiBa,WACd,cACA;EACG;EAAgB,OAAO;;;;;iBAsPZ,mBACd,gBACA;;;;;;;;iBA2Cc,eACd,MAAM,0BACL;;;UC9Zc;;;;EAIf;;;;EAKA;;;;EAKA,gBAAgB;;UAGD;;;;;;;EAOf;;;;EAKA;;;;EAKA;;;;;;;;;iBAyFc,oBACd,SAAS,2BACR;;;;iBAqFa,iBAAiB;;;UCzMhB,0BAA0B;;;;;;EAMzC;;KAGU,eAAe,SAAS,eAAe;;;;;;;;;iBA2I7B,WACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;iBAsCW,kBACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;cClME;;UAGI;EACf,iBAAiB,QAAQ;EACzB,uBAAuB;IACrB;IACA,qBAAqB;;;;iBAyET,2BAA2B,YAAY;;;;;iBAavC,2BACd,YAAY,qBACX;;iBAKa,iCAAiC,YAC/C;;;;;;;;;;iBAgBc,uBACd,UAAS,UACT,SAAQ;;;;cA6CG,iCAAwB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./schema-DWEhLYz4.cjs"),n=require("./tokens-B2J7nfiw.cjs"),r=require("./plugin.cjs");let i=require("@power-plant/core"),a=require("@stryke/type-checks/is-empty-object"),o=require("defu"),s=require("style-dictionary");s=e.t(s,1);let c=require("@stryke/fs/exists"),l=require("@stryke/fs/is-file"),u=require("@stryke/fs/json"),d=require("@stryke/fs/list-files"),f=require("@stryke/path/append"),p=require("@stryke/path/file-path-fns"),m=require("@stryke/path/join"),h=require("@stryke/string-format/title-case"),g=require("@stryke/type-checks/is-set-object"),_=require("@stryke/type-checks/is-set-string"),v=require("node:fs/promises"),y=require("node:path"),b=require("@stryke/env/get-env-paths"),x=require("@stryke/path/find"),S=require("@stryke/path/replace"),C=require("@stryke/type-checks/is-function"),w=require("c12"),T=require("jiti"),E=require("node:fs"),D=require("node:os");D=e.t(D,1);var O=`0.0.26`;const k=t.r.partial(),A=(0,o.createDefu)((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function j(e,t){return(0,y.isAbsolute)(t)?t:(0,y.resolve)(e,t)}function M(e){return Array.isArray(e)?e.filter(_.isSetString):(0,_.isSetString)(e)?[e]:[]}function N(e){if((0,_.isSetString)(e))return e;if((0,g.isSetObject)(e)&&`url`in e&&(0,_.isSetString)(e.url))return e.url}function P(e){if(!e)return;let n=t.n.safeParse(e);if(n.success)return[n.data];if(!Array.isArray(e))return;let r=[];for(let n of e){let e=t.n.safeParse(n);e.success&&r.push(e.data)}return r.length>0?r:void 0}function F(e){if(!(0,g.isSetObject)(e))return;let t=k.safeParse(e);if(t.success)return Object.keys(t.data).length>0?t.data:void 0}function I(e){return(0,g.isSetObject)(e)&&`path`in e}async function L(e){let t=(0,m.joinPaths)(e,`package.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}let r={};(0,_.isSetString)(n.name)&&(r.name=n.name,r.title=n.name),(0,_.isSetString)(n.description)&&(r.description=n.description),(0,_.isSetString)(n.version)&&(r.version=n.version),(0,_.isSetString)(n.homepage)&&(r.homepage=n.homepage);let i=N(n.repository);if(i&&(r.repository=i),(0,g.isSetObject)(n.dependencies)&&(r.dependencies=n.dependencies),(0,g.isSetObject)(n.devDependencies)&&(r.devDependencies=n.devDependencies),Array.isArray(n.keywords)){let e=n.keywords.filter(_.isSetString);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s;I(a)?s=P(a):(0,g.isSetObject)(a)&&(o=F(a),`files`in a&&(s=P(a.files)));let l=A(o??{},r);return s?.length&&(l.files=s),Object.keys(l).length>0?l:void 0}async function R(e){let t=(0,m.joinPaths)(e,`component.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}if(I(n)||Array.isArray(n)){let e=P(n);if(e)return{files:e}}return F(n)}async function z(e){let n=await L(e),r=await R(e);if(!n&&!r)return;let i=A(r??{},n??{}),a=(0,_.isSetString)(i.name)?i.name:(0,p.findFolderName)(e),o=(0,_.isSetString)(i.title)?i.title:(0,h.titleCase)(a),s=t.r.safeParse({...i,name:a,title:o});if(s.success)return{...s.data,files:await Promise.all((s.data.files??(await(0,d.listFiles)(e)).filter(e=>(0,p.findFileName)(e,{withExtension:!1})===`index`))?.filter(Boolean)?.map(async t=>typeof t==`string`?{type:/[tj]sx$/.test((0,p.findFileExtensionSafe)(t))?`component`:`file`,path:t,content:await(0,v.readFile)((0,f.appendPath)(t,e),`utf8`)}:{type:/[tj]sx$/.test((0,p.findFileExtensionSafe)(t.path))?`component`:`file`,...t,content:t.content?t.content:t.path?await(0,v.readFile)((0,f.appendPath)(t.path,e),`utf8`):void 0,path:(0,f.appendPath)(t.path,e)}))}}async function B(e){let t={},n=M(e.options.componentsPath);for(let r of n){let n=j(e.cwd,r);if(!(!(0,c.existsSync)(n)||!(0,l.isDirectory)(n)))try{let e=await(0,v.readdir)(n,{withFileTypes:!0});for(let r of e){if(!r.isDirectory()||r.name.startsWith(`.`))continue;let e=await z((0,m.joinPaths)(n,r.name));e&&(t[e.name]=e)}}catch{continue}}return t}const V=D.default.homedir();async function H(e,t){let n=t.configFile&&(0,E.existsSync)((0,S.replacePath)(t.configFile,e))?(0,S.replacePath)(t.configFile,e):t.configFile&&(0,E.existsSync)(t.configFile)?t.configFile:(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.ts`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.ts`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.js`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.js`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.mts`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.mts`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.mjs`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.mjs`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.config.ts`))?(0,m.joinPaths)(e,`razorwind.config.ts`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.config.js`))?(0,m.joinPaths)(e,`razorwind.config.js`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.config.mts`))?(0,m.joinPaths)(e,`razorwind.config.mts`):(0,E.existsSync)((0,m.joinPaths)(e,`razorwind.config.mjs`))?(0,m.joinPaths)(e,`razorwind.config.mjs`):void 0,r=(0,b.getEnvPaths)({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:e}),i={fsCache:r.cache},a=(0,T.createJiti)(e,i),s={};if(n){let r=await a.import(a.esmResolve(n));if(r?.default){let i={};(0,C.isFunction)(r.default)?i=await Promise.resolve(r.default({cwd:e,mode:t.mode??`development`})):((0,g.isSetObject)(r.default)||Array.isArray(r.default))&&(i=r.default),((0,g.isSetObject)(i)||Array.isArray(i))&&(s={...i,configFile:n})}}let[c,l,u]=await Promise.all([(0,w.loadConfig)({cwd:e,name:`razorwind`,envName:t.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:i}),(0,w.loadConfig)({cwd:r.config,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i}),(0,w.loadConfig)({cwd:V,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i})]),d=(0,o.defu)({cwd:e,envPaths:{...r,home:V}},t,s,(0,g.isSetObject)(c?.config)?{...c.config}:{},(0,g.isSetObject)(l?.config)?{...l.config}:{},(0,g.isSetObject)(u?.config)?{...u.config}:{},{componentsPath:e,plugins:[]});if(Array.isArray(d.componentsPath)){let t=d.componentsPath.filter(_.isSetString).map(e=>(0,x.findFilePath)(e));d.componentsPath=t.length>0?t:e}else d.componentsPath=(0,_.isSetString)(d.componentsPath)?(0,x.findFilePath)(d.componentsPath):e;return Array.isArray(d.plugins)||(d.plugins=[]),d}function U(e){return e}const W=(0,i.defineGenerator)({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:O,tags:[`razorwind`,`dtcg`]},schema:(0,i.defineSchema)({schema:t.t}),input:async e=>{let t=(0,i.useExecution)();if(t.options=await H(t.cwd,e),t.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);n.l(t.options.plugins,s.default);let r=t.options.tokens;(!r||(0,a.isEmptyObject)(r))&&(r=await n.t(t));let c={tokens:r??{},components:(0,o.defu)(t.options.components??{},await B(t)??{})};for(let e of t.options.plugins.filter(e=>e.extract))c=await e.extract(c,t.options);if(!c.tokens||(0,a.isEmptyObject)(c.tokens))throw Error(`Unable to load design tokens for the current workspace. Please ensure that Razorwind is configured correctly and that the tokens are available.`);for(let e of t.options.plugins.filter(e=>e.validate))await e.validate(c,t.options);return c},generator:async e=>{let t=(0,i.useExecution)(),n={};for(let r of t.options.plugins.filter(e=>e.generate)){let i=await r.generate(e,t.options);n=(0,o.defu)(i,n)}return n}});exports.DEFAULT_TOKEN_PATH_CANDIDATES=n.g,exports.RAZORWIND_INFER_PREPROCESSOR=n.a,exports.THEME_BASENAME_PATTERN=n._,exports.TOKEN_DIRECTORY_GLOB=n.v,exports.TOKEN_FILE_EXTENSIONS=n.y,exports.TYPE_PATH_HINTS=n.x,exports.WINDIE_PARSERS=n.b,exports.razorwindParsers=n.b,exports.defineConfig=U,exports.definePlugin=r.definePlugin,exports.generator=W,exports.getRazorwindParserHooks=n.o,exports.getRazorwindPreprocessorHooks=n.s,exports.inferTypeFromPath=n.f,exports.inferValue=n.p,exports.loadComponents=B,exports.loadTokens=n.t,exports.loadTokensOrThrow=n.n,exports.nestFlatTokens=n.m,exports.normalizeTokenTree=n.h,exports.parseCssCustomProperties=n.d,exports.razorwindInferPreprocessor=n.c,exports.registerRazorwindHooks=n.l,exports.registerRazorwindParsers=n.u,exports.resolveConfig=H,exports.resolveTokensSource=n.r,exports.themeKeyFromPath=n.i;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./schema-r6H4qZHJ.cjs"),n=require("./tokens-B2J7nfiw.cjs"),r=require("./plugin.cjs");let i=require("@power-plant/core"),a=require("@stryke/type-checks/is-empty-object"),o=require("defu"),s=require("style-dictionary");s=e.t(s,1);let c=require("@stryke/fs/exists"),l=require("@stryke/fs/is-file"),u=require("@stryke/fs/json"),d=require("@stryke/fs/list-files"),f=require("@stryke/path/append"),p=require("@stryke/path/file-path-fns"),m=require("@stryke/path/join"),h=require("@stryke/string-format/title-case"),g=require("@stryke/type-checks/is-set-object"),_=require("@stryke/type-checks/is-set-string"),v=require("node:fs/promises"),y=require("node:path"),ee=require("@stryke/env/get-env-paths"),b=require("@stryke/path/find"),x=require("@stryke/path/replace"),te=require("@stryke/type-checks/is-function"),S=require("c12"),ne=require("jiti"),C=require("node:fs"),w=require("node:os");w=e.t(w,1);var re=`0.0.28`;const ie=t.o.partial(),T=new Set([`tsx`,`jsx`,`ts`,`js`,`mdx`,`md`,`css`,`html`,`txt`]),E=(0,o.createDefu)((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function D(e,t){return(0,y.isAbsolute)(t)?t:(0,y.resolve)(e,t)}function O(e){return Array.isArray(e)?e.filter(_.isSetString):(0,_.isSetString)(e)?[e]:[]}function k(e){if((0,_.isSetString)(e))return e;if((0,g.isSetObject)(e)&&`url`in e&&(0,_.isSetString)(e.url))return e.url}function A(e){let t=e.toLowerCase();if(T.has(t))return t}function ae(e){let t=(0,p.findFileExtensionSafe)(e)?.toLowerCase();return!!(t&&T.has(t))}function j(e){if(!e)return;let n=t.a.safeParse(e);if(n.success)return[n.data];if(!Array.isArray(e))return;let r=[];for(let n of e){let e=t.a.safeParse(n);e.success&&r.push(e.data)}return r.length>0?r:void 0}function M(e){if(!e)return;let n=t.s.safeParse(e);if(n.success)return[n.data];if(!Array.isArray(e))return;let r=[];for(let n of e){if((0,_.isSetString)(n)){let e=(0,p.findFileName)(n,{withExtension:!1})||n,i=t.s.safeParse({name:e,path:n});i.success&&r.push(i.data);continue}let e=t.s.safeParse(n);e.success&&r.push(e.data)}return r.length>0?r:void 0}function N(e){if(!(0,g.isSetObject)(e))return;let{files:t,usage:n,...r}=e,i=ie.safeParse(r);if(i.success)return Object.keys(i.data).length>0?i.data:void 0}function P(e){return(0,g.isSetObject)(e)&&`path`in e}async function oe(e){let t=(0,m.joinPaths)(e,`package.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}let r={};(0,_.isSetString)(n.name)&&(r.name=n.name,r.title=n.name),(0,_.isSetString)(n.description)&&(r.description=n.description),(0,_.isSetString)(n.version)&&(r.version=n.version),(0,_.isSetString)(n.homepage)&&(r.homepage=n.homepage);let i=k(n.repository);if(i&&(r.repository=i),(0,g.isSetObject)(n.dependencies)&&(r.dependencies=n.dependencies),(0,g.isSetObject)(n.devDependencies)&&(r.devDependencies=n.devDependencies),Array.isArray(n.keywords)){let e=n.keywords.filter(_.isSetString);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s,l;P(a)?s=j(a):(0,g.isSetObject)(a)&&(o=N(a),`files`in a&&(s=j(a.files)),`usage`in a&&(l=M(a.usage)));let d=E(o??{},r);return s?.length&&(d.files=s),l?.length&&(d.usage=l),Object.keys(d).length>0?d:void 0}async function se(e){let t=(0,m.joinPaths)(e,`component.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}if(P(n)||Array.isArray(n)){let e=j(n);if(e)return{files:e}}if(!(0,g.isSetObject)(n))return;let r=N(n)??{},i=`files`in n?j(n.files):void 0,a=`usage`in n?M(n.usage):void 0;return i?.length&&(r.files=i),a?.length&&(r.usage=a),Object.keys(r).length>0?r:void 0}async function ce(e){try{return(await(0,v.readdir)(e,{withFileTypes:!0})).filter(e=>e.isFile()&&!e.name.startsWith(`.`)&&ae(e.name)).map(e=>e.name).toSorted((e,t)=>e.localeCompare(t))}catch{return[]}}async function le(e,t){if(t?.length)return Promise.all(t.map(async t=>{let n=(0,f.appendPath)(t.path,e),r=(0,p.findFileExtensionSafe)(t.path)??``,i=t.language??A(r),a=t.name||(0,p.findFileName)(t.path,{withExtension:!1})||t.path,o=t.content===void 0?(0,c.existsSync)(n)?await(0,v.readFile)(n,`utf8`):void 0:t.content;return{...t,name:a,path:n,...i?{language:i}:{},...o===void 0?{}:{content:o}}}));let n=(0,m.joinPaths)(e,`usage`);if(!(0,c.existsSync)(n)||!(0,l.isDirectory)(n))return;let r=await ce(n);if(r.length!==0)return Promise.all(r.map(async e=>{let t=(0,m.joinPaths)(n,e),r=A((0,p.findFileExtensionSafe)(e)??``),i=(0,p.findFileName)(e,{withExtension:!1})||e;return{name:i,title:(0,h.titleCase)(i),path:t,content:await(0,v.readFile)(t,`utf8`),...r?{language:r}:{}}}))}async function ue(e,t){let n=t??(await(0,d.listFiles)(e)).filter(e=>(0,p.findFileName)(e,{withExtension:!1})===`index`);return Promise.all(n.filter(Boolean).map(async t=>typeof t==`string`?{type:/[tj]sx$/.test((0,p.findFileExtensionSafe)(t))?`component`:`file`,path:t,content:await(0,v.readFile)((0,f.appendPath)(t,e),`utf8`)}:{type:/[tj]sx$/.test((0,p.findFileExtensionSafe)(t.path))?`component`:`file`,...t,content:t.content?t.content:t.path?await(0,v.readFile)((0,f.appendPath)(t.path,e),`utf8`):void 0,path:(0,f.appendPath)(t.path,e)}))}async function de(e){let n=await oe(e),r=await se(e);if(!n&&!r)return;let i=E(r??{},n??{}),a=(0,_.isSetString)(i.name)?i.name:(0,p.findFolderName)(e),o=(0,_.isSetString)(i.title)?i.title:(0,h.titleCase)(a),s=t.o.safeParse({...i,name:a,title:o});if(!s.success)return;let c=await le(e,s.data.usage);return{...s.data,files:await ue(e,s.data.files),...c?.length?{usage:c}:{}}}async function F(e){let t={},n=O(e.options.componentsPath);for(let r of n){let n=D(e.cwd,r);if(!(!(0,c.existsSync)(n)||!(0,l.isDirectory)(n)))try{let e=await(0,v.readdir)(n,{withFileTypes:!0});for(let r of e){if(!r.isDirectory()||r.name.startsWith(`.`))continue;let e=await de((0,m.joinPaths)(n,r.name));e&&(t[e.name]=e)}}catch{continue}}return t}const I=t.r.partial(),L=new Set([`svg`,`png`,`webp`,`jpg`,`jpeg`,`gif`,`ico`]),R=(0,o.createDefu)((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function z(e,t){return(0,y.isAbsolute)(t)?t:(0,y.resolve)(e,t)}function B(e){return Array.isArray(e)?e.filter(_.isSetString):(0,_.isSetString)(e)?[e]:[]}function V(e){if((0,_.isSetString)(e))return e;if((0,g.isSetObject)(e)&&`url`in e&&(0,_.isSetString)(e.url))return e.url}function H(e){let t=e.toLowerCase();if(L.has(t))return t}function U(e){let t=(0,p.findFileExtensionSafe)(e)?.toLowerCase();return!!(t&&L.has(t))}function fe(e){return n._.test(e)}async function W(e){try{return(await(0,v.readdir)(e,{withFileTypes:!0})).filter(e=>e.isFile()&&U(e.name)).map(e=>e.name)}catch{return[]}}function G(e){if(!e)return;let n=t.n.safeParse(e);if(n.success)return[n.data];if(!Array.isArray(e))return;let r=[];for(let n of e){let e=t.n.safeParse(n);e.success&&r.push(e.data)}return r.length>0?r:void 0}function K(e){if(!(0,g.isSetObject)(e))return;let t=I.safeParse(e);if(t.success)return Object.keys(t.data).length>0?t.data:void 0}function q(e){return(0,g.isSetObject)(e)&&`path`in e}async function J(e,t,n){let r=(0,f.appendPath)(e,t),i=H((0,p.findFileExtensionSafe)(e)??``)??`file`,a=i===`svg`?await(0,v.readFile)(r,`utf8`):void 0;return{path:r,type:i,...n?{theme:n}:{},...a===void 0?{}:{content:a}}}async function pe(e){let t=(0,m.joinPaths)(e,`package.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}let r={};(0,_.isSetString)(n.name)&&(r.name=n.name,r.title=n.name),(0,_.isSetString)(n.description)&&(r.description=n.description),(0,_.isSetString)(n.version)&&(r.version=n.version),(0,_.isSetString)(n.homepage)&&(r.homepage=n.homepage);let i=V(n.repository);if(i&&(r.repository=i),Array.isArray(n.keywords)){let e=n.keywords.filter(_.isSetString);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s;q(a)?s=G(a):(0,g.isSetObject)(a)&&(o=K(a),`files`in a&&(s=G(a.files)));let l=R(o??{},r);return s?.length&&(l.files=s),Object.keys(l).length>0?l:void 0}async function me(e){let t=(0,m.joinPaths)(e,`icon.json`);if(!(0,c.existsSync)(t))return;let n;try{n=await(0,u.readJsonFile)(t)}catch{return}if(q(n)||Array.isArray(n)){let e=G(n);if(e)return{files:e}}return K(n)}async function he(e,t){if(t?.length)return Promise.all(t.map(async t=>{let n=(0,f.appendPath)(t.path,e),r=(0,p.findFileExtensionSafe)(t.path)??``,i=t.type??H(r)??`file`,a=t.content===void 0?i===`svg`?await(0,v.readFile)(n,`utf8`):void 0:t.content;return{...t,type:i,path:n,...a===void 0?{}:{content:a}}}));let n=await W(e);return Promise.all(n.map(t=>J(t,e)))}async function ge(e){let n=await pe(e),r=await me(e),i=await W(e);if(!n&&!r&&i.length===0)return;let a=R(r??{},n??{}),o=(0,_.isSetString)(a.name)?a.name:(0,p.findFolderName)(e),s=(0,_.isSetString)(a.title)?a.title:(0,h.titleCase)(o),c=t.r.safeParse({...a,name:o,title:s});if(c.success)return{...c.data,files:await he(e,c.data.files)}}function Y(e,t,n){let r=e[t];if(!r){e[t]={name:t,title:(0,h.titleCase)(t),files:[n]};return}let i=[...r.files??[]],a=i.findIndex(e=>e.path===n.path&&e.theme===n.theme);a>=0?i[a]=n:i.push(n),e[t]={...r,files:i}}async function X(e,t,n){let r=await W(e);for(let i of r){let r=(0,p.findFileName)(i,{withExtension:!1});r&&Y(n,r,await J(i,e,t))}}async function Z(e){let t={},n=B(e.options.iconsPath);for(let r of n){let n=z(e.cwd,r);if(!(!(0,c.existsSync)(n)||!(0,l.isDirectory)(n)))try{let e=await(0,v.readdir)(n,{withFileTypes:!0});for(let r of e){if(r.name.startsWith(`.`))continue;let e=(0,m.joinPaths)(n,r.name);if(r.isDirectory()){if(fe(r.name)){await X(e,r.name,t);continue}let n=await ge(e);if(n){let e=t[n.name];t[n.name]=e?R(n,e):n}continue}if(r.isFile()&&U(r.name)){let e=(0,p.findFileName)(r.name,{withExtension:!1});if(!e)continue;Y(t,e,await J(r.name,n))}}}catch{continue}}return t}const Q=w.default.homedir();async function $(e,t){let n=t.configFile&&(0,C.existsSync)((0,x.replacePath)(t.configFile,e))?(0,x.replacePath)(t.configFile,e):t.configFile&&(0,C.existsSync)(t.configFile)?t.configFile:(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.ts`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.ts`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.js`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.js`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.mts`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.mts`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.${t.mode}.config.mjs`))?(0,m.joinPaths)(e,`razorwind.${t.mode}.config.mjs`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.config.ts`))?(0,m.joinPaths)(e,`razorwind.config.ts`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.config.js`))?(0,m.joinPaths)(e,`razorwind.config.js`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.config.mts`))?(0,m.joinPaths)(e,`razorwind.config.mts`):(0,C.existsSync)((0,m.joinPaths)(e,`razorwind.config.mjs`))?(0,m.joinPaths)(e,`razorwind.config.mjs`):void 0,r=(0,ee.getEnvPaths)({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:e}),i={fsCache:r.cache},a=(0,ne.createJiti)(e,i),s={};if(n){let r=await a.import(a.esmResolve(n));if(r?.default){let i={};(0,te.isFunction)(r.default)?i=await Promise.resolve(r.default({cwd:e,mode:t.mode??`development`})):((0,g.isSetObject)(r.default)||Array.isArray(r.default))&&(i=r.default),((0,g.isSetObject)(i)||Array.isArray(i))&&(s={...i,configFile:n})}}let[c,l,u]=await Promise.all([(0,S.loadConfig)({cwd:e,name:`razorwind`,envName:t.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:i}),(0,S.loadConfig)({cwd:r.config,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i}),(0,S.loadConfig)({cwd:Q,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i})]),d=(0,o.defu)({cwd:e,envPaths:{...r,home:Q}},t,s,(0,g.isSetObject)(c?.config)?{...c.config}:{},(0,g.isSetObject)(l?.config)?{...l.config}:{},(0,g.isSetObject)(u?.config)?{...u.config}:{},{componentsPath:e,iconsPath:(0,m.joinPaths)(e,`assets/icons`),plugins:[]});if(Array.isArray(d.componentsPath)){let t=d.componentsPath.filter(_.isSetString).map(e=>(0,b.findFilePath)(e));d.componentsPath=t.length>0?t:e}else d.componentsPath=(0,_.isSetString)(d.componentsPath)?(0,b.findFilePath)(d.componentsPath):e;if(Array.isArray(d.iconsPath)){let t=d.iconsPath.filter(_.isSetString).map(e=>(0,b.findFilePath)(e));d.iconsPath=t.length>0?t:(0,m.joinPaths)(e,`assets/icons`)}else d.iconsPath=(0,_.isSetString)(d.iconsPath)?(0,b.findFilePath)(d.iconsPath):(0,m.joinPaths)(e,`assets/icons`);return Array.isArray(d.plugins)||(d.plugins=[]),d}function _e(e){return e}const ve=(0,i.defineGenerator)({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens, components, and icons.`,version:re,tags:[`razorwind`,`dtcg`]},schema:(0,i.defineSchema)({schema:t.t}),input:async e=>{let t=(0,i.useExecution)();if(t.options=await $(t.cwd,e),t.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);n.l(t.options.plugins,s.default);let r=t.options.tokens;(!r||(0,a.isEmptyObject)(r))&&(r=await n.t(t));let c={tokens:r??{},components:(0,o.defu)(t.options.components??{},await F(t)??{}),icons:(0,o.defu)(t.options.icons??{},await Z(t)??{})};for(let e of t.options.plugins.filter(e=>e.extract))c=await e.extract(c,t.options);if(!c.tokens||(0,a.isEmptyObject)(c.tokens))throw Error(`Unable to load design tokens for the current workspace. Please ensure that Razorwind is configured correctly and that the tokens are available.`);for(let e of t.options.plugins.filter(e=>e.validate))await e.validate(c,t.options);return c},generator:async e=>{let t=(0,i.useExecution)(),n={};for(let r of t.options.plugins.filter(e=>e.generate)){let i=await r.generate(e,t.options);n=(0,o.defu)(i,n)}return n}});exports.DEFAULT_TOKEN_PATH_CANDIDATES=n.g,exports.RAZORWIND_INFER_PREPROCESSOR=n.a,exports.THEME_BASENAME_PATTERN=n._,exports.TOKEN_DIRECTORY_GLOB=n.v,exports.TOKEN_FILE_EXTENSIONS=n.y,exports.TYPE_PATH_HINTS=n.x,exports.WINDIE_PARSERS=n.b,exports.razorwindParsers=n.b,exports.defineConfig=_e,exports.definePlugin=r.definePlugin,exports.generator=ve,exports.getRazorwindParserHooks=n.o,exports.getRazorwindPreprocessorHooks=n.s,exports.inferTypeFromPath=n.f,exports.inferValue=n.p,exports.loadComponents=F,exports.loadIcons=Z,exports.loadTokens=n.t,exports.loadTokensOrThrow=n.n,exports.nestFlatTokens=n.m,exports.normalizeTokenTree=n.h,exports.parseCssCustomProperties=n.d,exports.razorwindInferPreprocessor=n.c,exports.registerRazorwindHooks=n.l,exports.registerRazorwindParsers=n.u,exports.resolveConfig=$,exports.resolveTokensSource=n.r,exports.themeKeyFromPath=n.i;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as Components, t as Schema } from "./schema-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { a as UserConfigFn, c as UserConfigParams, d as TokensPreprocessor, i as UserConfigExport, l as Plugin, n as Options, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config, u as TokensParser } from "./config-
|
|
4
|
-
import { t as definePlugin } from "./plugin-
|
|
5
|
-
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "./index-
|
|
1
|
+
import { a as Icons, f as Components, t as Schema } from "./schema-D_QQto0V.cjs";
|
|
2
|
+
import "./index-BzsWyssi.cjs";
|
|
3
|
+
import { a as UserConfigFn, c as UserConfigParams, d as TokensPreprocessor, i as UserConfigExport, l as Plugin, n as Options, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config, u as TokensParser } from "./config-B-9DV8mT.cjs";
|
|
4
|
+
import { t as definePlugin } from "./plugin-D9baACxf.cjs";
|
|
5
|
+
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "./index-Di8KVEql.cjs";
|
|
6
6
|
import StyleDictionary from "style-dictionary";
|
|
7
7
|
import { ExecutionContext, GeneratorConfig } from "@power-plant/core";
|
|
8
8
|
//#region src/lib/resolve-config.d.ts
|
|
@@ -52,11 +52,23 @@ declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
|
52
52
|
* For each configured path that is a directory, every direct child directory is inspected for:
|
|
53
53
|
* 1. `package.json` — npm fields and/or a `razorwind` object (including `componentFileSchema` file entries)
|
|
54
54
|
* 2. `component.json` — component metadata or `componentFileSchema` values
|
|
55
|
+
* 3. `usage/` — optional example source files (also declareable via `usage` in metadata)
|
|
55
56
|
*
|
|
56
57
|
* When both resolve values, `component.json` overlays `package.json`.
|
|
57
58
|
*/
|
|
58
59
|
declare function loadComponents(context: ExecutionContext<Schema, Config, void>): Promise<Components>;
|
|
59
60
|
//#endregion
|
|
61
|
+
//#region src/lib/icons/load.d.ts
|
|
62
|
+
/**
|
|
63
|
+
* Load icons from `iconsPath` directories.
|
|
64
|
+
*
|
|
65
|
+
* Supports:
|
|
66
|
+
* 1. Theme folders (`light` / `dark` / …) containing icon assets
|
|
67
|
+
* 2. Per-icon directories with `package.json` / `icon.json` metadata
|
|
68
|
+
* 3. Flat icon asset files at the icons path root
|
|
69
|
+
*/
|
|
70
|
+
declare function loadIcons(context: ExecutionContext<Schema, Config, void>): Promise<Icons>;
|
|
71
|
+
//#endregion
|
|
60
72
|
//#region src/types/base.d.ts
|
|
61
73
|
type Generator<TOptions extends object = object> = GeneratorConfig<Schema, TOptions> & {
|
|
62
74
|
name: string;
|
|
@@ -83,5 +95,5 @@ declare module "@power-plant/core" {
|
|
|
83
95
|
*/
|
|
84
96
|
declare const generator: import("@power-plant/core").GeneratorConfigObject<Schema, Options, any>;
|
|
85
97
|
//#endregion
|
|
86
|
-
export { type Config, DEFAULT_TOKEN_PATH_CANDIDATES, type Generator, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, type Options, type Plugin, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, defineConfig, definePlugin, generator, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadComponents, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveConfig, resolveTokensSource, themeKeyFromPath };
|
|
98
|
+
export { type Config, DEFAULT_TOKEN_PATH_CANDIDATES, type Generator, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, type Options, type Plugin, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, defineConfig, definePlugin, generator, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadComponents, loadIcons, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveConfig, resolveTokensSource, themeKeyFromPath };
|
|
87
99
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.ts","../src/lib/components/load.ts","../src/types/base.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;iBA8CsB,cACpB,aACA,SAAS,UACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;iBCEK,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
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.ts","../src/lib/components/load.ts","../src/lib/icons/load.ts","../src/types/base.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;iBA8CsB,cACpB,aACA,SAAS,UACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;iBCEK,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;;;;;;;;;;;;;iBCoblC,eACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;;iBCjGW,UACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;KC9XC,UAAU,oCAAoC,gBACxD,QACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;YCIU;IACR,IAAI;;;;;;;;;cAcK,uCAAS,sBAAA,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as Components, t as Schema } from "./schema-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { a as UserConfigFn, c as UserConfigParams, d as TokensPreprocessor, i as UserConfigExport, l as Plugin, n as Options, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config, u as TokensParser } from "./config-
|
|
4
|
-
import { t as definePlugin } from "./plugin-
|
|
5
|
-
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "./index-
|
|
1
|
+
import { a as Icons, f as Components, t as Schema } from "./schema-D_QQto0V.mjs";
|
|
2
|
+
import "./index-dMv2FZkj.mjs";
|
|
3
|
+
import { a as UserConfigFn, c as UserConfigParams, d as TokensPreprocessor, i as UserConfigExport, l as Plugin, n as Options, o as UserConfigFnObject, r as UserConfig, s as UserConfigFnPromise, t as Config, u as TokensParser } from "./config-BIIL6BJa.mjs";
|
|
4
|
+
import { t as definePlugin } from "./plugin-49itXF3F.mjs";
|
|
5
|
+
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "./index-BGy8EkAJ.mjs";
|
|
6
6
|
import { ExecutionContext, GeneratorConfig } from "@power-plant/core";
|
|
7
7
|
import StyleDictionary from "style-dictionary";
|
|
8
8
|
//#region src/lib/resolve-config.d.ts
|
|
@@ -52,11 +52,23 @@ declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
|
52
52
|
* For each configured path that is a directory, every direct child directory is inspected for:
|
|
53
53
|
* 1. `package.json` — npm fields and/or a `razorwind` object (including `componentFileSchema` file entries)
|
|
54
54
|
* 2. `component.json` — component metadata or `componentFileSchema` values
|
|
55
|
+
* 3. `usage/` — optional example source files (also declareable via `usage` in metadata)
|
|
55
56
|
*
|
|
56
57
|
* When both resolve values, `component.json` overlays `package.json`.
|
|
57
58
|
*/
|
|
58
59
|
declare function loadComponents(context: ExecutionContext<Schema, Config, void>): Promise<Components>;
|
|
59
60
|
//#endregion
|
|
61
|
+
//#region src/lib/icons/load.d.ts
|
|
62
|
+
/**
|
|
63
|
+
* Load icons from `iconsPath` directories.
|
|
64
|
+
*
|
|
65
|
+
* Supports:
|
|
66
|
+
* 1. Theme folders (`light` / `dark` / …) containing icon assets
|
|
67
|
+
* 2. Per-icon directories with `package.json` / `icon.json` metadata
|
|
68
|
+
* 3. Flat icon asset files at the icons path root
|
|
69
|
+
*/
|
|
70
|
+
declare function loadIcons(context: ExecutionContext<Schema, Config, void>): Promise<Icons>;
|
|
71
|
+
//#endregion
|
|
60
72
|
//#region src/types/base.d.ts
|
|
61
73
|
type Generator<TOptions extends object = object> = GeneratorConfig<Schema, TOptions> & {
|
|
62
74
|
name: string;
|
|
@@ -83,5 +95,5 @@ declare module "@power-plant/core" {
|
|
|
83
95
|
*/
|
|
84
96
|
declare const generator: import("@power-plant/core").GeneratorConfigObject<Schema, Options, any>;
|
|
85
97
|
//#endregion
|
|
86
|
-
export { type Config, DEFAULT_TOKEN_PATH_CANDIDATES, type Generator, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, type Options, type Plugin, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, defineConfig, definePlugin, generator, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadComponents, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveConfig, resolveTokensSource, themeKeyFromPath };
|
|
98
|
+
export { type Config, DEFAULT_TOKEN_PATH_CANDIDATES, type Generator, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, type Options, type Plugin, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, defineConfig, definePlugin, generator, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadComponents, loadIcons, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveConfig, resolveTokensSource, themeKeyFromPath };
|
|
87
99
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.ts","../src/lib/components/load.ts","../src/types/base.ts","../src/index.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.ts","../src/lib/components/load.ts","../src/lib/icons/load.ts","../src/types/base.ts","../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,i as t,r as n}from"./schema-CzpHs4s7.mjs";import{_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as ee,n as p,o as te,p as ne,r as re,s as m,t as h,u as g,v as _,x as v,y}from"./tokens-krMC_bzy.mjs";import{definePlugin as b}from"./plugin.mjs";import{defineGenerator as x,defineSchema as S,useExecution as C}from"@power-plant/core";import{isEmptyObject as w}from"@stryke/type-checks/is-empty-object";import{createDefu as ie,defu as T}from"defu";import ae from"style-dictionary";import{existsSync as E}from"@stryke/fs/exists";import{isDirectory as oe}from"@stryke/fs/is-file";import{readJsonFile as D}from"@stryke/fs/json";import{listFiles as se}from"@stryke/fs/list-files";import{appendPath as O}from"@stryke/path/append";import{findFileExtensionSafe as k,findFileName as A,findFolderName as j}from"@stryke/path/file-path-fns";import{joinPaths as M}from"@stryke/path/join";import{titleCase as N}from"@stryke/string-format/title-case";import{isSetObject as P}from"@stryke/type-checks/is-set-object";import{isSetString as F}from"@stryke/type-checks/is-set-string";import{readFile as I,readdir as L}from"node:fs/promises";import{isAbsolute as R,resolve as z}from"node:path";import{getEnvPaths as B}from"@stryke/env/get-env-paths";import{findFilePath as V}from"@stryke/path/find";import{replacePath as H}from"@stryke/path/replace";import{isFunction as U}from"@stryke/type-checks/is-function";import{loadConfig as W}from"c12";import{createJiti as G}from"jiti";import{existsSync as K}from"node:fs";import ce from"node:os";var le=`0.0.26`;const ue=e.partial(),q=ie((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function de(e,t){return R(t)?t:z(e,t)}function fe(e){return Array.isArray(e)?e.filter(F):F(e)?[e]:[]}function pe(e){if(F(e))return e;if(P(e)&&`url`in e&&F(e.url))return e.url}function J(e){if(!e)return;let n=t.safeParse(e);if(n.success)return[n.data];if(!Array.isArray(e))return;let r=[];for(let n of e){let e=t.safeParse(n);e.success&&r.push(e.data)}return r.length>0?r:void 0}function Y(e){if(!P(e))return;let t=ue.safeParse(e);if(t.success)return Object.keys(t.data).length>0?t.data:void 0}function X(e){return P(e)&&`path`in e}async function me(e){let t=M(e,`package.json`);if(!E(t))return;let n;try{n=await D(t)}catch{return}let r={};F(n.name)&&(r.name=n.name,r.title=n.name),F(n.description)&&(r.description=n.description),F(n.version)&&(r.version=n.version),F(n.homepage)&&(r.homepage=n.homepage);let i=pe(n.repository);if(i&&(r.repository=i),P(n.dependencies)&&(r.dependencies=n.dependencies),P(n.devDependencies)&&(r.devDependencies=n.devDependencies),Array.isArray(n.keywords)){let e=n.keywords.filter(F);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s;X(a)?s=J(a):P(a)&&(o=Y(a),`files`in a&&(s=J(a.files)));let c=q(o??{},r);return s?.length&&(c.files=s),Object.keys(c).length>0?c:void 0}async function he(e){let t=M(e,`component.json`);if(!E(t))return;let n;try{n=await D(t)}catch{return}if(X(n)||Array.isArray(n)){let e=J(n);if(e)return{files:e}}return Y(n)}async function ge(t){let n=await me(t),r=await he(t);if(!n&&!r)return;let i=q(r??{},n??{}),a=F(i.name)?i.name:j(t),o=F(i.title)?i.title:N(a),s=e.safeParse({...i,name:a,title:o});if(s.success)return{...s.data,files:await Promise.all((s.data.files??(await se(t)).filter(e=>A(e,{withExtension:!1})===`index`))?.filter(Boolean)?.map(async e=>typeof e==`string`?{type:/[tj]sx$/.test(k(e))?`component`:`file`,path:e,content:await I(O(e,t),`utf8`)}:{type:/[tj]sx$/.test(k(e.path))?`component`:`file`,...e,content:e.content?e.content:e.path?await I(O(e.path,t),`utf8`):void 0,path:O(e.path,t)}))}}async function Z(e){let t={},n=fe(e.options.componentsPath);for(let r of n){let n=de(e.cwd,r);if(!(!E(n)||!oe(n)))try{let e=await L(n,{withFileTypes:!0});for(let r of e){if(!r.isDirectory()||r.name.startsWith(`.`))continue;let e=await ge(M(n,r.name));e&&(t[e.name]=e)}}catch{continue}}return t}const Q=ce.homedir();async function $(e,t){let n=t.configFile&&K(H(t.configFile,e))?H(t.configFile,e):t.configFile&&K(t.configFile)?t.configFile:K(M(e,`razorwind.${t.mode}.config.ts`))?M(e,`razorwind.${t.mode}.config.ts`):K(M(e,`razorwind.${t.mode}.config.js`))?M(e,`razorwind.${t.mode}.config.js`):K(M(e,`razorwind.${t.mode}.config.mts`))?M(e,`razorwind.${t.mode}.config.mts`):K(M(e,`razorwind.${t.mode}.config.mjs`))?M(e,`razorwind.${t.mode}.config.mjs`):K(M(e,`razorwind.config.ts`))?M(e,`razorwind.config.ts`):K(M(e,`razorwind.config.js`))?M(e,`razorwind.config.js`):K(M(e,`razorwind.config.mts`))?M(e,`razorwind.config.mts`):K(M(e,`razorwind.config.mjs`))?M(e,`razorwind.config.mjs`):void 0,r=B({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:e}),i={fsCache:r.cache},a=G(e,i),o={};if(n){let r=await a.import(a.esmResolve(n));if(r?.default){let i={};U(r.default)?i=await Promise.resolve(r.default({cwd:e,mode:t.mode??`development`})):(P(r.default)||Array.isArray(r.default))&&(i=r.default),(P(i)||Array.isArray(i))&&(o={...i,configFile:n})}}let[s,c,l]=await Promise.all([W({cwd:e,name:`razorwind`,envName:t.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:i}),W({cwd:r.config,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i}),W({cwd:Q,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i})]),u=T({cwd:e,envPaths:{...r,home:Q}},t,o,P(s?.config)?{...s.config}:{},P(c?.config)?{...c.config}:{},P(l?.config)?{...l.config}:{},{componentsPath:e,plugins:[]});if(Array.isArray(u.componentsPath)){let t=u.componentsPath.filter(F).map(e=>V(e));u.componentsPath=t.length>0?t:e}else u.componentsPath=F(u.componentsPath)?V(u.componentsPath):e;return Array.isArray(u.plugins)||(u.plugins=[]),u}function _e(e){return e}const ve=x({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:le,tags:[`razorwind`,`dtcg`]},schema:S({schema:n}),input:async e=>{let t=C();if(t.options=await $(t.cwd,e),t.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);f(t.options.plugins,ae);let n=t.options.tokens;(!n||w(n))&&(n=await h(t));let r={tokens:n??{},components:T(t.options.components??{},await Z(t)??{})};for(let e of t.options.plugins.filter(e=>e.extract))r=await e.extract(r,t.options);if(!r.tokens||w(r.tokens))throw Error(`Unable to load design tokens for the current workspace. Please ensure that Razorwind is configured correctly and that the tokens are available.`);for(let e of t.options.plugins.filter(e=>e.validate))await e.validate(r,t.options);return r},generator:async e=>{let t=C(),n={};for(let r of t.options.plugins.filter(e=>e.generate)){let i=await r.generate(e,t.options);n=T(i,n)}return n}});export{l as DEFAULT_TOKEN_PATH_CANDIDATES,i as RAZORWIND_INFER_PREPROCESSOR,r as THEME_BASENAME_PATTERN,_ as TOKEN_DIRECTORY_GLOB,y as TOKEN_FILE_EXTENSIONS,v as TYPE_PATH_HINTS,a as WINDIE_PARSERS,a as razorwindParsers,_e as defineConfig,b as definePlugin,ve as generator,te as getRazorwindParserHooks,m as getRazorwindPreprocessorHooks,c as inferTypeFromPath,ne as inferValue,Z as loadComponents,h as loadTokens,p as loadTokensOrThrow,ee as nestFlatTokens,u as normalizeTokenTree,s as parseCssCustomProperties,o as razorwindInferPreprocessor,f as registerRazorwindHooks,g as registerRazorwindParsers,$ as resolveConfig,re as resolveTokensSource,d as themeKeyFromPath};
|
|
1
|
+
import{a as e,c as t,i as n,l as r,r as i,s as a}from"./schema-jfwKMfbW.mjs";import{_ as o,a as s,b as c,c as l,d as u,f as ee,g as te,h as ne,i as re,l as d,m as ie,n as ae,o as oe,p as se,r as ce,s as le,t as f,u as ue,v as de,x as fe,y as pe}from"./tokens-krMC_bzy.mjs";import{definePlugin as me}from"./plugin.mjs";import{defineGenerator as he,defineSchema as ge,useExecution as p}from"@power-plant/core";import{isEmptyObject as m}from"@stryke/type-checks/is-empty-object";import{createDefu as h,defu as g}from"defu";import _e from"style-dictionary";import{existsSync as _}from"@stryke/fs/exists";import{isDirectory as v}from"@stryke/fs/is-file";import{readJsonFile as y}from"@stryke/fs/json";import{listFiles as ve}from"@stryke/fs/list-files";import{appendPath as b}from"@stryke/path/append";import{findFileExtensionSafe as x,findFileName as S,findFolderName as C}from"@stryke/path/file-path-fns";import{joinPaths as w}from"@stryke/path/join";import{titleCase as T}from"@stryke/string-format/title-case";import{isSetObject as E}from"@stryke/type-checks/is-set-object";import{isSetString as D}from"@stryke/type-checks/is-set-string";import{readFile as O,readdir as k}from"node:fs/promises";import{isAbsolute as A,resolve as j}from"node:path";import{getEnvPaths as ye}from"@stryke/env/get-env-paths";import{findFilePath as M}from"@stryke/path/find";import{replacePath as N}from"@stryke/path/replace";import{isFunction as be}from"@stryke/type-checks/is-function";import{loadConfig as P}from"c12";import{createJiti as xe}from"jiti";import{existsSync as F}from"node:fs";import Se from"node:os";var Ce=`0.0.28`;const we=t.partial(),I=new Set([`tsx`,`jsx`,`ts`,`js`,`mdx`,`md`,`css`,`html`,`txt`]),L=h((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function Te(e,t){return A(t)?t:j(e,t)}function Ee(e){return Array.isArray(e)?e.filter(D):D(e)?[e]:[]}function De(e){if(D(e))return e;if(E(e)&&`url`in e&&D(e.url))return e.url}function R(e){let t=e.toLowerCase();if(I.has(t))return t}function Oe(e){let t=x(e)?.toLowerCase();return!!(t&&I.has(t))}function z(e){if(!e)return;let t=a.safeParse(e);if(t.success)return[t.data];if(!Array.isArray(e))return;let n=[];for(let t of e){let e=a.safeParse(t);e.success&&n.push(e.data)}return n.length>0?n:void 0}function B(e){if(!e)return;let t=r.safeParse(e);if(t.success)return[t.data];if(!Array.isArray(e))return;let n=[];for(let t of e){if(D(t)){let e=S(t,{withExtension:!1})||t,i=r.safeParse({name:e,path:t});i.success&&n.push(i.data);continue}let e=r.safeParse(t);e.success&&n.push(e.data)}return n.length>0?n:void 0}function V(e){if(!E(e))return;let{files:t,usage:n,...r}=e,i=we.safeParse(r);if(i.success)return Object.keys(i.data).length>0?i.data:void 0}function H(e){return E(e)&&`path`in e}async function ke(e){let t=w(e,`package.json`);if(!_(t))return;let n;try{n=await y(t)}catch{return}let r={};D(n.name)&&(r.name=n.name,r.title=n.name),D(n.description)&&(r.description=n.description),D(n.version)&&(r.version=n.version),D(n.homepage)&&(r.homepage=n.homepage);let i=De(n.repository);if(i&&(r.repository=i),E(n.dependencies)&&(r.dependencies=n.dependencies),E(n.devDependencies)&&(r.devDependencies=n.devDependencies),Array.isArray(n.keywords)){let e=n.keywords.filter(D);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s,c;H(a)?s=z(a):E(a)&&(o=V(a),`files`in a&&(s=z(a.files)),`usage`in a&&(c=B(a.usage)));let l=L(o??{},r);return s?.length&&(l.files=s),c?.length&&(l.usage=c),Object.keys(l).length>0?l:void 0}async function Ae(e){let t=w(e,`component.json`);if(!_(t))return;let n;try{n=await y(t)}catch{return}if(H(n)||Array.isArray(n)){let e=z(n);if(e)return{files:e}}if(!E(n))return;let r=V(n)??{},i=`files`in n?z(n.files):void 0,a=`usage`in n?B(n.usage):void 0;return i?.length&&(r.files=i),a?.length&&(r.usage=a),Object.keys(r).length>0?r:void 0}async function je(e){try{return(await k(e,{withFileTypes:!0})).filter(e=>e.isFile()&&!e.name.startsWith(`.`)&&Oe(e.name)).map(e=>e.name).toSorted((e,t)=>e.localeCompare(t))}catch{return[]}}async function Me(e,t){if(t?.length)return Promise.all(t.map(async t=>{let n=b(t.path,e),r=x(t.path)??``,i=t.language??R(r),a=t.name||S(t.path,{withExtension:!1})||t.path,o=t.content===void 0?_(n)?await O(n,`utf8`):void 0:t.content;return{...t,name:a,path:n,...i?{language:i}:{},...o===void 0?{}:{content:o}}}));let n=w(e,`usage`);if(!_(n)||!v(n))return;let r=await je(n);if(r.length!==0)return Promise.all(r.map(async e=>{let t=w(n,e),r=R(x(e)??``),i=S(e,{withExtension:!1})||e;return{name:i,title:T(i),path:t,content:await O(t,`utf8`),...r?{language:r}:{}}}))}async function Ne(e,t){let n=t??(await ve(e)).filter(e=>S(e,{withExtension:!1})===`index`);return Promise.all(n.filter(Boolean).map(async t=>typeof t==`string`?{type:/[tj]sx$/.test(x(t))?`component`:`file`,path:t,content:await O(b(t,e),`utf8`)}:{type:/[tj]sx$/.test(x(t.path))?`component`:`file`,...t,content:t.content?t.content:t.path?await O(b(t.path,e),`utf8`):void 0,path:b(t.path,e)}))}async function Pe(e){let n=await ke(e),r=await Ae(e);if(!n&&!r)return;let i=L(r??{},n??{}),a=D(i.name)?i.name:C(e),o=D(i.title)?i.title:T(a),s=t.safeParse({...i,name:a,title:o});if(!s.success)return;let c=await Me(e,s.data.usage);return{...s.data,files:await Ne(e,s.data.files),...c?.length?{usage:c}:{}}}async function U(e){let t={},n=Ee(e.options.componentsPath);for(let r of n){let n=Te(e.cwd,r);if(!(!_(n)||!v(n)))try{let e=await k(n,{withFileTypes:!0});for(let r of e){if(!r.isDirectory()||r.name.startsWith(`.`))continue;let e=await Pe(w(n,r.name));e&&(t[e.name]=e)}}catch{continue}}return t}const Fe=e.partial(),W=new Set([`svg`,`png`,`webp`,`jpg`,`jpeg`,`gif`,`ico`]),G=h((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function Ie(e,t){return A(t)?t:j(e,t)}function Le(e){return Array.isArray(e)?e.filter(D):D(e)?[e]:[]}function Re(e){if(D(e))return e;if(E(e)&&`url`in e&&D(e.url))return e.url}function K(e){let t=e.toLowerCase();if(W.has(t))return t}function q(e){let t=x(e)?.toLowerCase();return!!(t&&W.has(t))}function ze(e){return o.test(e)}async function J(e){try{return(await k(e,{withFileTypes:!0})).filter(e=>e.isFile()&&q(e.name)).map(e=>e.name)}catch{return[]}}function Y(e){if(!e)return;let t=n.safeParse(e);if(t.success)return[t.data];if(!Array.isArray(e))return;let r=[];for(let t of e){let e=n.safeParse(t);e.success&&r.push(e.data)}return r.length>0?r:void 0}function X(e){if(!E(e))return;let t=Fe.safeParse(e);if(t.success)return Object.keys(t.data).length>0?t.data:void 0}function Z(e){return E(e)&&`path`in e}async function Q(e,t,n){let r=b(e,t),i=K(x(e)??``)??`file`,a=i===`svg`?await O(r,`utf8`):void 0;return{path:r,type:i,...n?{theme:n}:{},...a===void 0?{}:{content:a}}}async function Be(e){let t=w(e,`package.json`);if(!_(t))return;let n;try{n=await y(t)}catch{return}let r={};D(n.name)&&(r.name=n.name,r.title=n.name),D(n.description)&&(r.description=n.description),D(n.version)&&(r.version=n.version),D(n.homepage)&&(r.homepage=n.homepage);let i=Re(n.repository);if(i&&(r.repository=i),Array.isArray(n.keywords)){let e=n.keywords.filter(D);e.length>0&&(r.tags=e)}let a=n.razorwind,o,s;Z(a)?s=Y(a):E(a)&&(o=X(a),`files`in a&&(s=Y(a.files)));let c=G(o??{},r);return s?.length&&(c.files=s),Object.keys(c).length>0?c:void 0}async function Ve(e){let t=w(e,`icon.json`);if(!_(t))return;let n;try{n=await y(t)}catch{return}if(Z(n)||Array.isArray(n)){let e=Y(n);if(e)return{files:e}}return X(n)}async function He(e,t){if(t?.length)return Promise.all(t.map(async t=>{let n=b(t.path,e),r=x(t.path)??``,i=t.type??K(r)??`file`,a=t.content===void 0?i===`svg`?await O(n,`utf8`):void 0:t.content;return{...t,type:i,path:n,...a===void 0?{}:{content:a}}}));let n=await J(e);return Promise.all(n.map(t=>Q(t,e)))}async function Ue(t){let n=await Be(t),r=await Ve(t),i=await J(t);if(!n&&!r&&i.length===0)return;let a=G(r??{},n??{}),o=D(a.name)?a.name:C(t),s=D(a.title)?a.title:T(o),c=e.safeParse({...a,name:o,title:s});if(c.success)return{...c.data,files:await He(t,c.data.files)}}function $(e,t,n){let r=e[t];if(!r){e[t]={name:t,title:T(t),files:[n]};return}let i=[...r.files??[]],a=i.findIndex(e=>e.path===n.path&&e.theme===n.theme);a>=0?i[a]=n:i.push(n),e[t]={...r,files:i}}async function We(e,t,n){let r=await J(e);for(let i of r){let r=S(i,{withExtension:!1});r&&$(n,r,await Q(i,e,t))}}async function Ge(e){let t={},n=Le(e.options.iconsPath);for(let r of n){let n=Ie(e.cwd,r);if(!(!_(n)||!v(n)))try{let e=await k(n,{withFileTypes:!0});for(let r of e){if(r.name.startsWith(`.`))continue;let e=w(n,r.name);if(r.isDirectory()){if(ze(r.name)){await We(e,r.name,t);continue}let n=await Ue(e);if(n){let e=t[n.name];t[n.name]=e?G(n,e):n}continue}if(r.isFile()&&q(r.name)){let e=S(r.name,{withExtension:!1});if(!e)continue;$(t,e,await Q(r.name,n))}}}catch{continue}}return t}const Ke=Se.homedir();async function qe(e,t){let n=t.configFile&&F(N(t.configFile,e))?N(t.configFile,e):t.configFile&&F(t.configFile)?t.configFile:F(w(e,`razorwind.${t.mode}.config.ts`))?w(e,`razorwind.${t.mode}.config.ts`):F(w(e,`razorwind.${t.mode}.config.js`))?w(e,`razorwind.${t.mode}.config.js`):F(w(e,`razorwind.${t.mode}.config.mts`))?w(e,`razorwind.${t.mode}.config.mts`):F(w(e,`razorwind.${t.mode}.config.mjs`))?w(e,`razorwind.${t.mode}.config.mjs`):F(w(e,`razorwind.config.ts`))?w(e,`razorwind.config.ts`):F(w(e,`razorwind.config.js`))?w(e,`razorwind.config.js`):F(w(e,`razorwind.config.mts`))?w(e,`razorwind.config.mts`):F(w(e,`razorwind.config.mjs`))?w(e,`razorwind.config.mjs`):void 0,r=ye({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:e}),i={fsCache:r.cache},a=xe(e,i),o={};if(n){let r=await a.import(a.esmResolve(n));if(r?.default){let i={};be(r.default)?i=await Promise.resolve(r.default({cwd:e,mode:t.mode??`development`})):(E(r.default)||Array.isArray(r.default))&&(i=r.default),(E(i)||Array.isArray(i))&&(o={...i,configFile:n})}}let[s,c,l]=await Promise.all([P({cwd:e,name:`razorwind`,envName:t.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:i}),P({cwd:r.config,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i}),P({cwd:Ke,name:`razorwind`,envName:t.mode,dotenv:!0,jitiOptions:i})]),u=g({cwd:e,envPaths:{...r,home:Ke}},t,o,E(s?.config)?{...s.config}:{},E(c?.config)?{...c.config}:{},E(l?.config)?{...l.config}:{},{componentsPath:e,iconsPath:w(e,`assets/icons`),plugins:[]});if(Array.isArray(u.componentsPath)){let t=u.componentsPath.filter(D).map(e=>M(e));u.componentsPath=t.length>0?t:e}else u.componentsPath=D(u.componentsPath)?M(u.componentsPath):e;if(Array.isArray(u.iconsPath)){let t=u.iconsPath.filter(D).map(e=>M(e));u.iconsPath=t.length>0?t:w(e,`assets/icons`)}else u.iconsPath=D(u.iconsPath)?M(u.iconsPath):w(e,`assets/icons`);return Array.isArray(u.plugins)||(u.plugins=[]),u}function Je(e){return e}const Ye=he({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens, components, and icons.`,version:Ce,tags:[`razorwind`,`dtcg`]},schema:ge({schema:i}),input:async e=>{let t=p();if(t.options=await qe(t.cwd,e),t.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);d(t.options.plugins,_e);let n=t.options.tokens;(!n||m(n))&&(n=await f(t));let r={tokens:n??{},components:g(t.options.components??{},await U(t)??{}),icons:g(t.options.icons??{},await Ge(t)??{})};for(let e of t.options.plugins.filter(e=>e.extract))r=await e.extract(r,t.options);if(!r.tokens||m(r.tokens))throw Error(`Unable to load design tokens for the current workspace. Please ensure that Razorwind is configured correctly and that the tokens are available.`);for(let e of t.options.plugins.filter(e=>e.validate))await e.validate(r,t.options);return r},generator:async e=>{let t=p(),n={};for(let r of t.options.plugins.filter(e=>e.generate)){let i=await r.generate(e,t.options);n=g(i,n)}return n}});export{te as DEFAULT_TOKEN_PATH_CANDIDATES,s as RAZORWIND_INFER_PREPROCESSOR,o as THEME_BASENAME_PATTERN,de as TOKEN_DIRECTORY_GLOB,pe as TOKEN_FILE_EXTENSIONS,fe as TYPE_PATH_HINTS,c as WINDIE_PARSERS,c as razorwindParsers,Je as defineConfig,me as definePlugin,Ye as generator,oe as getRazorwindParserHooks,le as getRazorwindPreprocessorHooks,ee as inferTypeFromPath,se as inferValue,U as loadComponents,Ge as loadIcons,f as loadTokens,ae as loadTokensOrThrow,ie as nestFlatTokens,ne as normalizeTokenTree,u as parseCssCustomProperties,l as razorwindInferPreprocessor,d as registerRazorwindHooks,ue as registerRazorwindParsers,qe as resolveConfig,ce as resolveTokensSource,re as themeKeyFromPath};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "../../index-
|
|
1
|
+
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "../../index-Di8KVEql.cjs";
|
|
2
2
|
export { DEFAULT_TOKEN_PATH_CANDIDATES, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveTokensSource, themeKeyFromPath };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "../../index-
|
|
1
|
+
import { C as RazorwindParserName, D as TOKEN_PARSER_NAMES, E as TOKEN_FILE_EXTENSIONS, O as TYPE_PATH_HINTS, S as DEFAULT_TOKEN_PATH_CANDIDATES, T as TOKEN_DIRECTORY_GLOB, _ as inferTypeFromPath, a as razorwindInferPreprocessor, b as normalizeTokenTree, c as LoadTokensOptions, d as loadTokensOrThrow, f as ResolveTokensPathOptions, g as InferredTokenType, h as themeKeyFromPath, i as getRazorwindPreprocessorHooks, l as LoadedTokens, m as resolveTokensSource, n as StyleDictionaryRegisterTarget, o as registerRazorwindHooks, p as ResolvedTokensSource, r as getRazorwindParserHooks, s as registerRazorwindParsers, t as RAZORWIND_INFER_PREPROCESSOR, u as loadTokens, v as inferValue, w as THEME_BASENAME_PATTERN, x as parseCssCustomProperties, y as nestFlatTokens } from "../../index-BGy8EkAJ.mjs";
|
|
2
2
|
export { DEFAULT_TOKEN_PATH_CANDIDATES, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, type StyleDictionaryRegisterTarget, THEME_BASENAME_PATTERN, TOKEN_DIRECTORY_GLOB, TOKEN_FILE_EXTENSIONS, TYPE_PATH_HINTS, TOKEN_PARSER_NAMES as WINDIE_PARSERS, TOKEN_PARSER_NAMES as razorwindParsers, getRazorwindParserHooks, getRazorwindPreprocessorHooks, inferTypeFromPath, inferValue, loadTokens, loadTokensOrThrow, nestFlatTokens, normalizeTokenTree, parseCssCustomProperties, razorwindInferPreprocessor, registerRazorwindHooks, registerRazorwindParsers, resolveTokensSource, themeKeyFromPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Plugin } from "./config-
|
|
1
|
+
import { l as Plugin } from "./config-BIIL6BJa.mjs";
|
|
2
2
|
//#region src/plugin.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Type helper for Razorwind plugins (`parsers` / `preprocessors` + `extract` / `validate` / `generate`).
|
|
@@ -46,4 +46,4 @@ declare function definePlugin<TOptions>(factory: (options: TOptions) => Plugin,
|
|
|
46
46
|
declare function definePlugin(plugin: Plugin, overrides?: Partial<Plugin>): Plugin;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { definePlugin as t };
|
|
49
|
-
//# sourceMappingURL=plugin-
|
|
49
|
+
//# sourceMappingURL=plugin-49itXF3F.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-49itXF3F.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Plugin } from "./config-
|
|
1
|
+
import { l as Plugin } from "./config-B-9DV8mT.cjs";
|
|
2
2
|
//#region src/plugin.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Type helper for Razorwind plugins (`parsers` / `preprocessors` + `extract` / `validate` / `generate`).
|
|
@@ -46,4 +46,4 @@ declare function definePlugin<TOptions>(factory: (options: TOptions) => Plugin,
|
|
|
46
46
|
declare function definePlugin(plugin: Plugin, overrides?: Partial<Plugin>): Plugin;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { definePlugin as t };
|
|
49
|
-
//# sourceMappingURL=plugin-
|
|
49
|
+
//# sourceMappingURL=plugin-D9baACxf.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-
|
|
1
|
+
{"version":3,"file":"plugin-D9baACxf.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEgB,aAAa,UAC3B,UAAU,SAAS,aAAa,QAChC,YAAY,QAAQ,WAClB,UAAU,aAAa;iBACX,aACd,QAAQ,QACR,YAAY,QAAQ,UACnB"}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as TokensPreprocessor, l as Plugin, u as TokensParser } from "./config-
|
|
2
|
-
import { t as definePlugin } from "./plugin-
|
|
1
|
+
import { d as TokensPreprocessor, l as Plugin, u as TokensParser } from "./config-B-9DV8mT.cjs";
|
|
2
|
+
import { t as definePlugin } from "./plugin-D9baACxf.cjs";
|
|
3
3
|
export { type Plugin, type TokensParser, type TokensPreprocessor, definePlugin };
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as TokensPreprocessor, l as Plugin, u as TokensParser } from "./config-
|
|
2
|
-
import { t as definePlugin } from "./plugin-
|
|
1
|
+
import { d as TokensPreprocessor, l as Plugin, u as TokensParser } from "./config-BIIL6BJa.mjs";
|
|
2
|
+
import { t as definePlugin } from "./plugin-49itXF3F.mjs";
|
|
3
3
|
export { type Plugin, type TokensParser, type TokensPreprocessor, definePlugin };
|
package/dist/schema/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../schema-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../schema-r6H4qZHJ.cjs");let t=require("@power-plant/dtcg-schema");exports.componentFileSchema=e.a,exports.componentSchema=e.o,exports.componentUsageSchema=e.s,exports.componentsSchema=e.c,exports.iconFileSchema=e.n,exports.iconSchema=e.r,exports.iconsSchema=e.i,exports.schema=e.t,Object.defineProperty(exports,"tokenSchema",{enumerable:!0,get:function(){return t.tokenSchema}}),Object.defineProperty(exports,"tokensSchema",{enumerable:!0,get:function(){return t.tokensSchema}});
|
package/dist/schema/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-
|
|
3
|
-
export { type Component, type ComponentFile, type Components, type Schema, type Token, type Tokens, componentFileSchema, componentSchema, componentsSchema, schema, tokenSchema, tokensSchema };
|
|
1
|
+
import { a as Icons, c as iconsSchema, d as ComponentUsage, f as Components, g as componentsSchema, h as componentUsageSchema, i as IconFile, l as Component, m as componentSchema, n as schema, o as iconFileSchema, p as componentFileSchema, r as Icon, s as iconSchema, t as Schema, u as ComponentFile } from "../schema-D_QQto0V.cjs";
|
|
2
|
+
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-BzsWyssi.cjs";
|
|
3
|
+
export { type Component, type ComponentFile, type ComponentUsage, type Components, type Icon, type IconFile, type Icons, type Schema, type Token, type Tokens, componentFileSchema, componentSchema, componentUsageSchema, componentsSchema, iconFileSchema, iconSchema, iconsSchema, schema, tokenSchema, tokensSchema };
|
package/dist/schema/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-
|
|
3
|
-
export { type Component, type ComponentFile, type Components, type Schema, type Token, type Tokens, componentFileSchema, componentSchema, componentsSchema, schema, tokenSchema, tokensSchema };
|
|
1
|
+
import { a as Icons, c as iconsSchema, d as ComponentUsage, f as Components, g as componentsSchema, h as componentUsageSchema, i as IconFile, l as Component, m as componentSchema, n as schema, o as iconFileSchema, p as componentFileSchema, r as Icon, s as iconSchema, t as Schema, u as ComponentFile } from "../schema-D_QQto0V.mjs";
|
|
2
|
+
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-dMv2FZkj.mjs";
|
|
3
|
+
export { type Component, type ComponentFile, type ComponentUsage, type Components, type Icon, type IconFile, type Icons, type Schema, type Token, type Tokens, componentFileSchema, componentSchema, componentUsageSchema, componentsSchema, iconFileSchema, iconSchema, iconsSchema, schema, tokenSchema, tokensSchema };
|
package/dist/schema/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../schema-jfwKMfbW.mjs";export{s as componentFileSchema,t as componentSchema,r as componentUsageSchema,l as componentsSchema,n as iconFileSchema,e as iconSchema,a as iconsSchema,o as schema,c as tokenSchema,i as tokensSchema};
|