@razorwind/core 0.0.10 → 0.0.12
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/{index-COAOe8bR.d.cts → index-CjW7STaT.d.cts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +58 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +58 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-CUtxHXKj.d.cts +291 -0
- package/dist/plugin-CUtxHXKj.d.cts.map +1 -0
- package/dist/plugin-DNLmSRnE.d.mts +291 -0
- package/dist/plugin-DNLmSRnE.d.mts.map +1 -0
- package/dist/plugin.d.cts +2 -43
- package/dist/plugin.d.mts +2 -43
- package/dist/schema/index.cjs +1 -1
- package/dist/schema/index.d.cts +2 -2
- package/dist/{schema-1EWJvc56.d.cts → schema-BNfl9Tsw.d.cts} +2 -2
- package/dist/{schema-1EWJvc56.d.cts.map → schema-BNfl9Tsw.d.cts.map} +1 -1
- package/dist/schema-CkRpPBAO.cjs +1 -0
- package/package.json +8 -50
- package/dist/config-DQHHeicR.d.mts +0 -85
- package/dist/config-DQHHeicR.d.mts.map +0 -1
- package/dist/config-Dj6RrLde.d.cts +0 -85
- package/dist/config-Dj6RrLde.d.cts.map +0 -1
- package/dist/config.cjs +0 -1
- package/dist/config.d.cts +0 -44
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts +0 -44
- package/dist/config.d.mts.map +0 -1
- package/dist/config.mjs +0 -2
- package/dist/config.mjs.map +0 -1
- package/dist/generator-BkJo8-9K.mjs +0 -2
- package/dist/generator-BkJo8-9K.mjs.map +0 -1
- package/dist/generator-CET31dZP.cjs +0 -1
- package/dist/generator-CG0-YTJ5.cjs +0 -1
- package/dist/generator-DKDFwgVG.mjs +0 -2
- package/dist/generator-DKDFwgVG.mjs.map +0 -1
- package/dist/generator.cjs +0 -1
- package/dist/generator.d.cts +0 -13
- package/dist/generator.d.cts.map +0 -1
- package/dist/generator.d.mts +0 -13
- package/dist/generator.d.mts.map +0 -1
- package/dist/generator.mjs +0 -1
- package/dist/lib/tokens/index.cjs +0 -1
- package/dist/lib/tokens/index.d.cts +0 -150
- package/dist/lib/tokens/index.d.cts.map +0 -1
- package/dist/lib/tokens/index.d.mts +0 -150
- package/dist/lib/tokens/index.d.mts.map +0 -1
- package/dist/lib/tokens/index.mjs +0 -1
- package/dist/plugin.d.cts.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/resolve-config-C0Xj31QL.cjs +0 -1
- package/dist/resolve-config-YvpQAnbu.mjs +0 -2
- package/dist/resolve-config-YvpQAnbu.mjs.map +0 -1
- package/dist/rolldown-runtime-CMqjfN_6.cjs +0 -1
- package/dist/schema-CLeH9GGy.cjs +0 -1
- package/dist/tokens-BZCCzjCR.mjs +0 -2
- package/dist/tokens-BZCCzjCR.mjs.map +0 -1
- package/dist/tokens-txKZtsDn.cjs +0 -1
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-1EWJvc56.cjs";
|
|
2
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
3
|
-
import { EnvPaths } from "@stryke/env";
|
|
4
|
-
import { MaybePromise, RequiredKeys } from "@stryke/types/base";
|
|
5
|
-
import { GeneratedDocument } from "@power-plant/core";
|
|
6
|
-
import { PreprocessedTokens } from "style-dictionary";
|
|
7
|
-
import { DesignTokens } from "style-dictionary/types";
|
|
8
|
-
//#region src/types/plugin.d.ts
|
|
9
|
-
interface TokensParser {
|
|
10
|
-
name?: string;
|
|
11
|
-
pattern: RegExp;
|
|
12
|
-
parser: (contents: string) => DesignTokens;
|
|
13
|
-
}
|
|
14
|
-
type TokensPreprocessor = {
|
|
15
|
-
name?: string;
|
|
16
|
-
preprocessor: (dictionary: PreprocessedTokens) => PreprocessedTokens;
|
|
17
|
-
} | ((dictionary: PreprocessedTokens) => PreprocessedTokens);
|
|
18
|
-
interface Plugin {
|
|
19
|
-
name: string;
|
|
20
|
-
parsers?: TokensParser[];
|
|
21
|
-
preprocessors?: TokensPreprocessor[];
|
|
22
|
-
extract?: (spec: Schema, config: Config) => MaybePromise<Schema>;
|
|
23
|
-
generate?: (spec: Schema, config: Config) => MaybePromise<Record<string, GeneratedDocument>>;
|
|
24
|
-
validate?: (spec: Schema, config: Config) => MaybePromise<void>;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/types/config.d.ts
|
|
28
|
-
interface Options {
|
|
29
|
-
/**
|
|
30
|
-
* The directory or file containing a Razorwind configuration file.
|
|
31
|
-
*
|
|
32
|
-
* @defaultValue "razorwind.config.ts"
|
|
33
|
-
*/
|
|
34
|
-
configFile?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The path to the registry.json file.
|
|
37
|
-
*
|
|
38
|
-
* @see https://shadcn.com/docs/registry
|
|
39
|
-
*/
|
|
40
|
-
registryPath?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The directory or file containing the tokens.
|
|
43
|
-
*
|
|
44
|
-
* @see https://styledictionary.com/info/tokens/
|
|
45
|
-
*
|
|
46
|
-
* @defaultValue "tokens.json" (or "tokens" directory)
|
|
47
|
-
*/
|
|
48
|
-
tokensPath?: string;
|
|
49
|
-
/**
|
|
50
|
-
* The mode to use for the configuration.
|
|
51
|
-
*
|
|
52
|
-
* @defaultValue "production"
|
|
53
|
-
*/
|
|
54
|
-
mode?: "development" | "test" | "production";
|
|
55
|
-
}
|
|
56
|
-
interface UserConfig extends Options {
|
|
57
|
-
name?: string;
|
|
58
|
-
title?: string;
|
|
59
|
-
version?: string;
|
|
60
|
-
description?: string;
|
|
61
|
-
author?: string;
|
|
62
|
-
license?: string;
|
|
63
|
-
repository?: string;
|
|
64
|
-
homepage?: string;
|
|
65
|
-
tags?: string[];
|
|
66
|
-
tokens?: Tokens | Record<string, Tokens>;
|
|
67
|
-
plugins?: Plugin[];
|
|
68
|
-
}
|
|
69
|
-
interface UserConfigParams {
|
|
70
|
-
cwd: string;
|
|
71
|
-
mode: string;
|
|
72
|
-
}
|
|
73
|
-
type UserConfigFnObject = (config: UserConfig) => UserConfig;
|
|
74
|
-
type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
|
|
75
|
-
type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
|
|
76
|
-
type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
77
|
-
type Config = RequiredKeys<UserConfig, "registryPath" | "plugins"> & {
|
|
78
|
-
cwd: string;
|
|
79
|
-
envPaths: EnvPaths & {
|
|
80
|
-
home: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
//#endregion
|
|
84
|
-
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 };
|
|
85
|
-
//# sourceMappingURL=config-Dj6RrLde.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-Dj6RrLde.d.cts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":";;;;;;;;UAyBiB;EACf;EACA,SAAS;EACT,SAAS,qBAAqB;;KAGpB;EAEN;EACA,eAAe,YAAY,uBAAuB;MAElD,YAAY,uBAAuB;UAExB;EACf;EACA,UAAU;EACV,gBAAgB;EAChB,WAAW,MAAM,QAAQ,QAAQ,WAAW,aAAa;EACzD,YACE,MAAM,QACN,QAAQ,WACL,aAAa,eAAe;EACjC,YAAY,MAAM,QAAQ,QAAQ,WAAW;;;;UCxB9B;;;;;;EAMf;;;;;;EAOA;;;;;;;;EASA;;;;;;EAOA;;UAGe,mBAAmB;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,SAAS,eAAe;EACjC,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,aAAa;EAChC;EACA,UAAU;IACR"}
|
package/dist/config.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./plugin.cjs"),t=require("./resolve-config-C0Xj31QL.cjs");function n(e){return e}exports.defineConfig=n,exports.definePlugin=e.definePlugin,exports.resolveConfig=t.t;
|
package/dist/config.d.cts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
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-Dj6RrLde.cjs";
|
|
2
|
-
import { definePlugin } from "./plugin.cjs";
|
|
3
|
-
//#region src/lib/resolve-config.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads the user configuration file for the project.
|
|
6
|
-
*
|
|
7
|
-
* @param cwd - The current working directory.
|
|
8
|
-
* @param options - The options for the configuration.
|
|
9
|
-
* @returns The resolved configuration.
|
|
10
|
-
*/
|
|
11
|
-
declare function resolveConfig(cwd: string, options: Options): Promise<Config>;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/config.d.ts
|
|
14
|
-
/**
|
|
15
|
-
* 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.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* import { defineConfig } from '@razorwind/core';
|
|
20
|
-
*
|
|
21
|
-
* export default defineConfig({
|
|
22
|
-
* // Your configuration here
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Or with a function
|
|
26
|
-
* export default defineConfig((env) => {
|
|
27
|
-
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
28
|
-
* return {
|
|
29
|
-
* // Your configuration here
|
|
30
|
-
* };
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
declare function defineConfig(config: UserConfig): UserConfig;
|
|
35
|
-
declare function defineConfig(config: UserConfig[]): UserConfig[];
|
|
36
|
-
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
37
|
-
declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
|
|
38
|
-
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
39
|
-
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
40
|
-
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
41
|
-
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
42
|
-
//#endregion
|
|
43
|
-
export { type Config, type Options, type Plugin, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig, definePlugin, resolveConfig };
|
|
44
|
-
//# sourceMappingURL=config.d.cts.map
|
package/dist/config.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.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"}
|
package/dist/config.d.mts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
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-DQHHeicR.mjs";
|
|
2
|
-
import { definePlugin } from "./plugin.mjs";
|
|
3
|
-
//#region src/lib/resolve-config.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Loads the user configuration file for the project.
|
|
6
|
-
*
|
|
7
|
-
* @param cwd - The current working directory.
|
|
8
|
-
* @param options - The options for the configuration.
|
|
9
|
-
* @returns The resolved configuration.
|
|
10
|
-
*/
|
|
11
|
-
declare function resolveConfig(cwd: string, options: Options): Promise<Config>;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/config.d.ts
|
|
14
|
-
/**
|
|
15
|
-
* 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.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* import { defineConfig } from '@razorwind/core';
|
|
20
|
-
*
|
|
21
|
-
* export default defineConfig({
|
|
22
|
-
* // Your configuration here
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Or with a function
|
|
26
|
-
* export default defineConfig((env) => {
|
|
27
|
-
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
28
|
-
* return {
|
|
29
|
-
* // Your configuration here
|
|
30
|
-
* };
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
declare function defineConfig(config: UserConfig): UserConfig;
|
|
35
|
-
declare function defineConfig(config: UserConfig[]): UserConfig[];
|
|
36
|
-
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
37
|
-
declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
|
|
38
|
-
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
39
|
-
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
40
|
-
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
41
|
-
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
42
|
-
//#endregion
|
|
43
|
-
export { type Config, type Options, type Plugin, type TokensParser, type TokensPreprocessor, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig, definePlugin, resolveConfig };
|
|
44
|
-
//# sourceMappingURL=config.d.mts.map
|
package/dist/config.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/lib/resolve-config.ts","../src/config.ts"],"mappings":""}
|
package/dist/config.mjs
DELETED
package/dist/config.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./resolve-config-YvpQAnbu.mjs";import{l as t,t as n}from"./tokens-BZCCzjCR.mjs";import{r}from"./schema-Bxzw_P4l.mjs";import{isSetString as i}from"@stryke/type-checks/is-set-string";import{defu as a}from"defu";import{defineGenerator as o,defineSchema as s,useExecution as c}from"@power-plant/core";import{isEmptyObject as l}from"@stryke/type-checks/is-empty-object";import u from"style-dictionary";const d=o({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`0.0.10`,tags:[`razorwind`,`dtcg`]},schema:s({schema:r}),input:async r=>{let a=c();if(a.options=await e(a.cwd,r),a.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);t(a.options.plugins,u);let o=a.options.tokens;(!o||l(o))&&(o=await n(a.options,{cwd:a.cwd,tokensPath:i(a.options.tokensPath)?a.options.tokensPath:void 0}));let s={tokens:o??{},components:{}};for(let e of a.options.plugins.filter(e=>e.extract))s=await e.extract(s,a.options);if(!s.tokens||l(s.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 a.options.plugins.filter(e=>e.validate))await e.validate(s,a.options);return s},generator:async e=>{let t=c(),n={};for(let r of t.options.plugins.filter(e=>e.generate))n=a(await r.generate(e,t.options),n);return n}});export{d as t};
|
|
2
|
-
//# sourceMappingURL=generator-BkJo8-9K.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator-BkJo8-9K.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./resolve-config-C0Xj31QL.cjs"),n=require("./tokens-txKZtsDn.cjs"),r=require("./schema-CLeH9GGy.cjs");let i=require("@stryke/type-checks/is-set-string"),a=require("defu"),o=require("@power-plant/core"),s=require("@stryke/type-checks/is-empty-object"),c=require("style-dictionary");c=e.t(c,1);const l=(0,o.defineGenerator)({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`0.0.9`,tags:[`razorwind`,`dtcg`]},schema:(0,o.defineSchema)({schema:r.t}),input:async e=>{let r=(0,o.useExecution)();if(r.options=await t.t(r.cwd,e),r.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(r.options.plugins,c.default);let a=r.options.tokens;(!a||(0,s.isEmptyObject)(a))&&(a=await n.t(r.options,{cwd:r.cwd,tokensPath:(0,i.isSetString)(r.options.tokensPath)?r.options.tokensPath:void 0}));let l={tokens:a??{},components:{}};for(let e of r.options.plugins.filter(e=>e.extract))l=await e.extract(l,r.options);if(!l.tokens||(0,s.isEmptyObject)(l.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 r.options.plugins.filter(e=>e.validate))await e.validate(l,r.options);return l},generator:async e=>{let t=(0,o.useExecution)(),n={};for(let r of t.options.plugins.filter(e=>e.generate))n=(0,a.defu)(await r.generate(e,t.options),n);return n}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./resolve-config-C0Xj31QL.cjs"),n=require("./tokens-txKZtsDn.cjs"),r=require("./schema-CLeH9GGy.cjs");let i=require("@stryke/type-checks/is-set-string"),a=require("defu"),o=require("@power-plant/core"),s=require("@stryke/type-checks/is-empty-object"),c=require("style-dictionary");c=e.t(c,1);const l=(0,o.defineGenerator)({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`0.0.10`,tags:[`razorwind`,`dtcg`]},schema:(0,o.defineSchema)({schema:r.t}),input:async e=>{let r=(0,o.useExecution)();if(r.options=await t.t(r.cwd,e),r.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(r.options.plugins,c.default);let a=r.options.tokens;(!a||(0,s.isEmptyObject)(a))&&(a=await n.t(r.options,{cwd:r.cwd,tokensPath:(0,i.isSetString)(r.options.tokensPath)?r.options.tokensPath:void 0}));let l={tokens:a??{},components:{}};for(let e of r.options.plugins.filter(e=>e.extract))l=await e.extract(l,r.options);if(!l.tokens||(0,s.isEmptyObject)(l.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 r.options.plugins.filter(e=>e.validate))await e.validate(l,r.options);return l},generator:async e=>{let t=(0,o.useExecution)(),n={};for(let r of t.options.plugins.filter(e=>e.generate))n=(0,a.defu)(await r.generate(e,t.options),n);return n}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./resolve-config-YvpQAnbu.mjs";import{l as t,t as n}from"./tokens-BZCCzjCR.mjs";import{r}from"./schema-Bxzw_P4l.mjs";import{isSetString as i}from"@stryke/type-checks/is-set-string";import{defu as a}from"defu";import{defineGenerator as o,defineSchema as s,useExecution as c}from"@power-plant/core";import{isEmptyObject as l}from"@stryke/type-checks/is-empty-object";import u from"style-dictionary";const d=o({meta:{name:`razorwind`,title:`Razorwind`,description:`A generator that uses Razorwind to generate design system code from design tokens and components.`,version:`0.0.9`,tags:[`razorwind`,`dtcg`]},schema:s({schema:r}),input:async r=>{let a=c();if(a.options=await e(a.cwd,r),a.options.plugins.length===0)throw Error(`Razorwind will not generate any code - no plugins configured. Please add at least one plugin to the configuration.`);t(a.options.plugins,u);let o=a.options.tokens;(!o||l(o))&&(o=await n(a.options,{cwd:a.cwd,tokensPath:i(a.options.tokensPath)?a.options.tokensPath:void 0}));let s={tokens:o??{},components:{}};for(let e of a.options.plugins.filter(e=>e.extract))s=await e.extract(s,a.options);if(!s.tokens||l(s.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 a.options.plugins.filter(e=>e.validate))await e.validate(s,a.options);return s},generator:async e=>{let t=c(),n={};for(let r of t.options.plugins.filter(e=>e.generate))n=a(await r.generate(e,t.options),n);return n}});export{d as t};
|
|
2
|
-
//# sourceMappingURL=generator-DKDFwgVG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator-DKDFwgVG.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/generator.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./generator-CG0-YTJ5.cjs");exports.generator=e.t;
|
package/dist/generator.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-1EWJvc56.cjs";
|
|
2
|
-
import { n as Options } from "./config-Dj6RrLde.cjs";
|
|
3
|
-
import "./index-COAOe8bR.cjs";
|
|
4
|
-
//#region src/generator.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* A Power Plant generator for Razorwind.
|
|
7
|
-
*
|
|
8
|
-
* Orchestrates configured {@link Plugin}s: Style Dictionary parsers / preprocessors, then `extract` → `validate` on input, then `generate`.
|
|
9
|
-
*/
|
|
10
|
-
declare const generator: import("@power-plant/core").GeneratorConfigObject<Schema, Options, void>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { generator };
|
|
13
|
-
//# sourceMappingURL=generator.d.cts.map
|
package/dist/generator.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.ts"],"mappings":";;;;;;;;;cAuCa,uCAAS,sBAAA,QAAA"}
|
package/dist/generator.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-BNfl9Tsw.mjs";
|
|
2
|
-
import { n as Options } from "./config-DQHHeicR.mjs";
|
|
3
|
-
import "./index--y-fo2Lr.mjs";
|
|
4
|
-
//#region src/generator.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* A Power Plant generator for Razorwind.
|
|
7
|
-
*
|
|
8
|
-
* Orchestrates configured {@link Plugin}s: Style Dictionary parsers / preprocessors, then `extract` → `validate` on input, then `generate`.
|
|
9
|
-
*/
|
|
10
|
-
declare const generator: import("@power-plant/core").GeneratorConfigObject<Schema, Options, void>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { generator };
|
|
13
|
-
//# sourceMappingURL=generator.d.mts.map
|
package/dist/generator.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.mts","names":[],"sources":["../src/generator.ts"],"mappings":""}
|
package/dist/generator.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./generator-BkJo8-9K.mjs";export{e as generator};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../tokens-txKZtsDn.cjs");exports.DEFAULT_TOKEN_PATH_CANDIDATES=e.h,exports.RAZORWIND_INFER_PREPROCESSOR=e.a,exports.THEME_BASENAME_PATTERN=e.g,exports.TOKEN_DIRECTORY_GLOB=e._,exports.TOKEN_FILE_EXTENSIONS=e.v,exports.TYPE_PATH_HINTS=e.b,exports.WINDIE_PARSERS=e.y,exports.razorwindParsers=e.y,exports.getRazorwindParserHooks=e.o,exports.getRazorwindPreprocessorHooks=e.s,exports.inferTypeFromPath=e.d,exports.inferValue=e.f,exports.loadTokens=e.t,exports.loadTokensOrThrow=e.n,exports.nestFlatTokens=e.p,exports.normalizeTokenTree=e.m,exports.parseCssCustomProperties=e.u,exports.razorwindInferPreprocessor=e.c,exports.registerRazorwindParsers=e.l,exports.resolveTokensSource=e.r,exports.themeKeyFromPath=e.i;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { l as Plugin, t as Config } from "../../config-Dj6RrLde.cjs";
|
|
2
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
3
|
-
import { Hooks, Parser, PreprocessedTokens } from "style-dictionary/types";
|
|
4
|
-
//#region src/lib/tokens/constants.d.ts
|
|
5
|
-
/** Style Dictionary parser hook names registered by Razorwind. */
|
|
6
|
-
declare const TOKEN_PARSER_NAMES: readonly ["razorwind-json", "razorwind-yaml", "razorwind-toml", "razorwind-css"];
|
|
7
|
-
type RazorwindParserName = (typeof TOKEN_PARSER_NAMES)[number];
|
|
8
|
-
/** File extensions treated as design-token sources. */
|
|
9
|
-
declare const TOKEN_FILE_EXTENSIONS: readonly ["json", "json5", "jsonc", "yaml", "yml", "toml", "css", "js", "mjs", "cjs", "ts", "mts", "cts"];
|
|
10
|
-
/**
|
|
11
|
-
* Candidate paths checked when `tokensPath` is omitted.
|
|
12
|
-
* First existing file or directory wins.
|
|
13
|
-
*/
|
|
14
|
-
declare const DEFAULT_TOKEN_PATH_CANDIDATES: readonly ["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"];
|
|
15
|
-
/** Glob appended when a tokens directory is resolved. */
|
|
16
|
-
declare const TOKEN_DIRECTORY_GLOB: string;
|
|
17
|
-
/** Theme-like basename patterns used to split multi-file sources into a record. */
|
|
18
|
-
declare const THEME_BASENAME_PATTERN: RegExp;
|
|
19
|
-
/** Path segment hints used when inferring `$type`. */
|
|
20
|
-
declare const TYPE_PATH_HINTS: Record<string, string>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/lib/tokens/css.d.ts
|
|
23
|
-
/**
|
|
24
|
-
* Extract CSS custom properties from stylesheet text into a nested token tree.
|
|
25
|
-
* Handles `:root`, `[data-theme]`, and Tailwind v4 `@theme` blocks alike.
|
|
26
|
-
*/
|
|
27
|
-
declare function parseCssCustomProperties(contents: string): Record<string, unknown>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/lib/tokens/infer.d.ts
|
|
30
|
-
type InferredTokenType = "color" | "dimension" | "duration" | "fontFamily" | "fontWeight" | "number" | "cubicBezier" | "shadow" | "gradient" | "typography" | "strokeStyle" | "border" | "transition";
|
|
31
|
-
/**
|
|
32
|
-
* Infer DTCG `$type` from a path segment chain (e.g. `color.primary`).
|
|
33
|
-
*/
|
|
34
|
-
declare function inferTypeFromPath(path: string[]): InferredTokenType | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Normalize a raw token value into DTCG-friendly shape + optional `$type`.
|
|
37
|
-
*/
|
|
38
|
-
declare function inferValue(raw: unknown, path?: string[]): {
|
|
39
|
-
value: unknown;
|
|
40
|
-
type?: InferredTokenType;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Walk a token tree: promote legacy keys to DTCG and infer `$type` / `$value` shapes.
|
|
44
|
-
*/
|
|
45
|
-
declare function normalizeTokenTree(input: unknown, path?: string[]): unknown;
|
|
46
|
-
/**
|
|
47
|
-
* Nest a flat map of dashed keys into a token tree.
|
|
48
|
-
* `--color-primary-500` / `color-primary-500` → `color.primary.500`.
|
|
49
|
-
*
|
|
50
|
-
* Scalar parents that also have children (e.g. `--radius` + `--radius-lg`) are
|
|
51
|
-
* preserved under `DEFAULT` so neither value is dropped.
|
|
52
|
-
*/
|
|
53
|
-
declare function nestFlatTokens(flat: Record<string, unknown>): Record<string, unknown>;
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/lib/tokens/resolve-path.d.ts
|
|
56
|
-
interface ResolveTokensPathOptions {
|
|
57
|
-
/**
|
|
58
|
-
* Working directory used to resolve relative paths.
|
|
59
|
-
*/
|
|
60
|
-
cwd: string;
|
|
61
|
-
/**
|
|
62
|
-
* Explicit tokens file or directory from config.
|
|
63
|
-
*/
|
|
64
|
-
tokensPath?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Extra fallback paths (e.g. registry `tailwind.css`).
|
|
67
|
-
*/
|
|
68
|
-
fallbackPaths?: Array<string | null | undefined>;
|
|
69
|
-
}
|
|
70
|
-
interface ResolvedTokensSource {
|
|
71
|
-
/**
|
|
72
|
-
* Absolute path to the resolved file or directory (if any).
|
|
73
|
-
*/
|
|
74
|
-
resolvedPath?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Style Dictionary `source` globs.
|
|
77
|
-
*/
|
|
78
|
-
source: string[];
|
|
79
|
-
/**
|
|
80
|
-
* How the path was discovered.
|
|
81
|
-
*/
|
|
82
|
-
origin: "tokensPath" | "default" | "fallback" | "none";
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Resolve Style Dictionary source globs from `tokensPath` or common defaults.
|
|
86
|
-
*/
|
|
87
|
-
declare function resolveTokensSource(options: ResolveTokensPathOptions): ResolvedTokensSource;
|
|
88
|
-
/**
|
|
89
|
-
* Detect theme-like basenames for splitting multi-file token sets.
|
|
90
|
-
*/
|
|
91
|
-
declare function themeKeyFromPath(filePath: string): string | undefined;
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/lib/tokens/load.d.ts
|
|
94
|
-
interface LoadTokensOptions extends ResolveTokensPathOptions {
|
|
95
|
-
/**
|
|
96
|
-
* When true, split theme-named files into a record keyed by theme.
|
|
97
|
-
*
|
|
98
|
-
* @defaultValue true
|
|
99
|
-
*/
|
|
100
|
-
splitThemes?: boolean;
|
|
101
|
-
}
|
|
102
|
-
type LoadedTokens = Tokens | Record<string, Tokens>;
|
|
103
|
-
/**
|
|
104
|
-
* Load design tokens via Style Dictionary parser hooks.
|
|
105
|
-
*
|
|
106
|
-
* Resolution order:
|
|
107
|
-
* 1. Explicit `tokensPath` (file, directory, or SD config)
|
|
108
|
-
* 2. Common default paths (`tokens.json`, `tokens/`, …)
|
|
109
|
-
* 3. Fallback paths (e.g. registry Tailwind CSS)
|
|
110
|
-
*/
|
|
111
|
-
declare function loadTokens(config: Config, options: LoadTokensOptions): Promise<LoadedTokens>;
|
|
112
|
-
/**
|
|
113
|
-
* Convenience: load tokens or throw when nothing usable is found.
|
|
114
|
-
*
|
|
115
|
-
* @param config - The configuration object.
|
|
116
|
-
* @param options - The options for loading the tokens.
|
|
117
|
-
* @returns The loaded tokens.
|
|
118
|
-
* @throws An error if no design tokens are found.
|
|
119
|
-
* @throws An error if the tokens are not valid.
|
|
120
|
-
*/
|
|
121
|
-
declare function loadTokensOrThrow(config: Config, options: LoadTokensOptions): Promise<LoadedTokens>;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/lib/tokens/parsers.d.ts
|
|
124
|
-
/** Preprocessor name applied after all sources merge. */
|
|
125
|
-
declare const RAZORWIND_INFER_PREPROCESSOR = "razorwind-infer";
|
|
126
|
-
/** Inline `hooks.parsers` map for Style Dictionary config. */
|
|
127
|
-
declare function getRazorwindParserHooks(): NonNullable<Hooks["parsers"]>;
|
|
128
|
-
/**
|
|
129
|
-
* Infer DTCG `$type` / normalize legacy keys after sources merge.
|
|
130
|
-
* Covers JS/TS modules that bypass custom file parsers.
|
|
131
|
-
*/
|
|
132
|
-
declare function razorwindInferPreprocessor(dictionary: PreprocessedTokens): PreprocessedTokens;
|
|
133
|
-
/** Inline `hooks.preprocessors` map for Style Dictionary config. */
|
|
134
|
-
declare function getRazorwindPreprocessorHooks(): NonNullable<Hooks["preprocessors"]>;
|
|
135
|
-
/**
|
|
136
|
-
* Register Razorwind parsers + infer preprocessor on Style Dictionary,
|
|
137
|
-
* then register any parsers / preprocessors contributed by plugins.
|
|
138
|
-
*
|
|
139
|
-
* @see https://styledictionary.com/reference/hooks/parsers/
|
|
140
|
-
*/
|
|
141
|
-
declare function registerRazorwindParsers(plugins?: Plugin[], target?: {
|
|
142
|
-
registerParser: (parser: Parser) => unknown;
|
|
143
|
-
registerPreprocessor: (preprocessor: {
|
|
144
|
-
name: string;
|
|
145
|
-
preprocessor: typeof razorwindInferPreprocessor;
|
|
146
|
-
}) => unknown;
|
|
147
|
-
}): void;
|
|
148
|
-
//#endregion
|
|
149
|
-
export { DEFAULT_TOKEN_PATH_CANDIDATES, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, 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, registerRazorwindParsers, resolveTokensSource, themeKeyFromPath };
|
|
150
|
-
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.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;;;UC/Zc;;;;EAIf;;;;EAKA;;;;EAKA,gBAAgB;;UAGD;;;;EAIf;;;;EAKA;;;;EAKA;;;;;iBAkCc,oBACd,SAAS,2BACR;;;;iBAyFa,iBAAiB;;;UCpJhB,0BAA0B;;;;;;EAMzC;;KAGU,eAAe,SAAS,eAAe;;;;;;;;;iBA2I7B,WACpB,QAAQ,QACR,SAAS,oBACR,QAAQ;;;;;;;;;;iBAuCW,kBACpB,QAAQ,QACR,SAAS,oBACR,QAAQ;;;;cCnME;;iBAuEG,2BAA2B,YAAY;;;;;iBAavC,2BACd,YAAY,qBACX;;iBAKa,iCAAiC,YAC/C;;;;;;;iBAac,yBACd,UAAS,UACT;EACE,iBAAiB,QAAQ;EACzB,uBAAuB;IACrB;IACA,qBAAqB"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { l as Plugin, t as Config } from "../../config-DQHHeicR.mjs";
|
|
2
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
3
|
-
import { Hooks, Parser, PreprocessedTokens } from "style-dictionary/types";
|
|
4
|
-
//#region src/lib/tokens/constants.d.ts
|
|
5
|
-
/** Style Dictionary parser hook names registered by Razorwind. */
|
|
6
|
-
declare const TOKEN_PARSER_NAMES: readonly ["razorwind-json", "razorwind-yaml", "razorwind-toml", "razorwind-css"];
|
|
7
|
-
type RazorwindParserName = (typeof TOKEN_PARSER_NAMES)[number];
|
|
8
|
-
/** File extensions treated as design-token sources. */
|
|
9
|
-
declare const TOKEN_FILE_EXTENSIONS: readonly ["json", "json5", "jsonc", "yaml", "yml", "toml", "css", "js", "mjs", "cjs", "ts", "mts", "cts"];
|
|
10
|
-
/**
|
|
11
|
-
* Candidate paths checked when `tokensPath` is omitted.
|
|
12
|
-
* First existing file or directory wins.
|
|
13
|
-
*/
|
|
14
|
-
declare const DEFAULT_TOKEN_PATH_CANDIDATES: readonly ["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"];
|
|
15
|
-
/** Glob appended when a tokens directory is resolved. */
|
|
16
|
-
declare const TOKEN_DIRECTORY_GLOB: string;
|
|
17
|
-
/** Theme-like basename patterns used to split multi-file sources into a record. */
|
|
18
|
-
declare const THEME_BASENAME_PATTERN: RegExp;
|
|
19
|
-
/** Path segment hints used when inferring `$type`. */
|
|
20
|
-
declare const TYPE_PATH_HINTS: Record<string, string>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/lib/tokens/css.d.ts
|
|
23
|
-
/**
|
|
24
|
-
* Extract CSS custom properties from stylesheet text into a nested token tree.
|
|
25
|
-
* Handles `:root`, `[data-theme]`, and Tailwind v4 `@theme` blocks alike.
|
|
26
|
-
*/
|
|
27
|
-
declare function parseCssCustomProperties(contents: string): Record<string, unknown>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/lib/tokens/infer.d.ts
|
|
30
|
-
type InferredTokenType = "color" | "dimension" | "duration" | "fontFamily" | "fontWeight" | "number" | "cubicBezier" | "shadow" | "gradient" | "typography" | "strokeStyle" | "border" | "transition";
|
|
31
|
-
/**
|
|
32
|
-
* Infer DTCG `$type` from a path segment chain (e.g. `color.primary`).
|
|
33
|
-
*/
|
|
34
|
-
declare function inferTypeFromPath(path: string[]): InferredTokenType | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Normalize a raw token value into DTCG-friendly shape + optional `$type`.
|
|
37
|
-
*/
|
|
38
|
-
declare function inferValue(raw: unknown, path?: string[]): {
|
|
39
|
-
value: unknown;
|
|
40
|
-
type?: InferredTokenType;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Walk a token tree: promote legacy keys to DTCG and infer `$type` / `$value` shapes.
|
|
44
|
-
*/
|
|
45
|
-
declare function normalizeTokenTree(input: unknown, path?: string[]): unknown;
|
|
46
|
-
/**
|
|
47
|
-
* Nest a flat map of dashed keys into a token tree.
|
|
48
|
-
* `--color-primary-500` / `color-primary-500` → `color.primary.500`.
|
|
49
|
-
*
|
|
50
|
-
* Scalar parents that also have children (e.g. `--radius` + `--radius-lg`) are
|
|
51
|
-
* preserved under `DEFAULT` so neither value is dropped.
|
|
52
|
-
*/
|
|
53
|
-
declare function nestFlatTokens(flat: Record<string, unknown>): Record<string, unknown>;
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/lib/tokens/resolve-path.d.ts
|
|
56
|
-
interface ResolveTokensPathOptions {
|
|
57
|
-
/**
|
|
58
|
-
* Working directory used to resolve relative paths.
|
|
59
|
-
*/
|
|
60
|
-
cwd: string;
|
|
61
|
-
/**
|
|
62
|
-
* Explicit tokens file or directory from config.
|
|
63
|
-
*/
|
|
64
|
-
tokensPath?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Extra fallback paths (e.g. registry `tailwind.css`).
|
|
67
|
-
*/
|
|
68
|
-
fallbackPaths?: Array<string | null | undefined>;
|
|
69
|
-
}
|
|
70
|
-
interface ResolvedTokensSource {
|
|
71
|
-
/**
|
|
72
|
-
* Absolute path to the resolved file or directory (if any).
|
|
73
|
-
*/
|
|
74
|
-
resolvedPath?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Style Dictionary `source` globs.
|
|
77
|
-
*/
|
|
78
|
-
source: string[];
|
|
79
|
-
/**
|
|
80
|
-
* How the path was discovered.
|
|
81
|
-
*/
|
|
82
|
-
origin: "tokensPath" | "default" | "fallback" | "none";
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Resolve Style Dictionary source globs from `tokensPath` or common defaults.
|
|
86
|
-
*/
|
|
87
|
-
declare function resolveTokensSource(options: ResolveTokensPathOptions): ResolvedTokensSource;
|
|
88
|
-
/**
|
|
89
|
-
* Detect theme-like basenames for splitting multi-file token sets.
|
|
90
|
-
*/
|
|
91
|
-
declare function themeKeyFromPath(filePath: string): string | undefined;
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/lib/tokens/load.d.ts
|
|
94
|
-
interface LoadTokensOptions extends ResolveTokensPathOptions {
|
|
95
|
-
/**
|
|
96
|
-
* When true, split theme-named files into a record keyed by theme.
|
|
97
|
-
*
|
|
98
|
-
* @defaultValue true
|
|
99
|
-
*/
|
|
100
|
-
splitThemes?: boolean;
|
|
101
|
-
}
|
|
102
|
-
type LoadedTokens = Tokens | Record<string, Tokens>;
|
|
103
|
-
/**
|
|
104
|
-
* Load design tokens via Style Dictionary parser hooks.
|
|
105
|
-
*
|
|
106
|
-
* Resolution order:
|
|
107
|
-
* 1. Explicit `tokensPath` (file, directory, or SD config)
|
|
108
|
-
* 2. Common default paths (`tokens.json`, `tokens/`, …)
|
|
109
|
-
* 3. Fallback paths (e.g. registry Tailwind CSS)
|
|
110
|
-
*/
|
|
111
|
-
declare function loadTokens(config: Config, options: LoadTokensOptions): Promise<LoadedTokens>;
|
|
112
|
-
/**
|
|
113
|
-
* Convenience: load tokens or throw when nothing usable is found.
|
|
114
|
-
*
|
|
115
|
-
* @param config - The configuration object.
|
|
116
|
-
* @param options - The options for loading the tokens.
|
|
117
|
-
* @returns The loaded tokens.
|
|
118
|
-
* @throws An error if no design tokens are found.
|
|
119
|
-
* @throws An error if the tokens are not valid.
|
|
120
|
-
*/
|
|
121
|
-
declare function loadTokensOrThrow(config: Config, options: LoadTokensOptions): Promise<LoadedTokens>;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/lib/tokens/parsers.d.ts
|
|
124
|
-
/** Preprocessor name applied after all sources merge. */
|
|
125
|
-
declare const RAZORWIND_INFER_PREPROCESSOR = "razorwind-infer";
|
|
126
|
-
/** Inline `hooks.parsers` map for Style Dictionary config. */
|
|
127
|
-
declare function getRazorwindParserHooks(): NonNullable<Hooks["parsers"]>;
|
|
128
|
-
/**
|
|
129
|
-
* Infer DTCG `$type` / normalize legacy keys after sources merge.
|
|
130
|
-
* Covers JS/TS modules that bypass custom file parsers.
|
|
131
|
-
*/
|
|
132
|
-
declare function razorwindInferPreprocessor(dictionary: PreprocessedTokens): PreprocessedTokens;
|
|
133
|
-
/** Inline `hooks.preprocessors` map for Style Dictionary config. */
|
|
134
|
-
declare function getRazorwindPreprocessorHooks(): NonNullable<Hooks["preprocessors"]>;
|
|
135
|
-
/**
|
|
136
|
-
* Register Razorwind parsers + infer preprocessor on Style Dictionary,
|
|
137
|
-
* then register any parsers / preprocessors contributed by plugins.
|
|
138
|
-
*
|
|
139
|
-
* @see https://styledictionary.com/reference/hooks/parsers/
|
|
140
|
-
*/
|
|
141
|
-
declare function registerRazorwindParsers(plugins?: Plugin[], target?: {
|
|
142
|
-
registerParser: (parser: Parser) => unknown;
|
|
143
|
-
registerPreprocessor: (preprocessor: {
|
|
144
|
-
name: string;
|
|
145
|
-
preprocessor: typeof razorwindInferPreprocessor;
|
|
146
|
-
}) => unknown;
|
|
147
|
-
}): void;
|
|
148
|
-
//#endregion
|
|
149
|
-
export { DEFAULT_TOKEN_PATH_CANDIDATES, type InferredTokenType, type LoadTokensOptions, type LoadedTokens, RAZORWIND_INFER_PREPROCESSOR, type RazorwindParserName, type ResolveTokensPathOptions, type ResolvedTokensSource, 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, registerRazorwindParsers, resolveTokensSource, themeKeyFromPath };
|
|
150
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.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 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v,y}from"../../tokens-BZCCzjCR.mjs";export{s as DEFAULT_TOKEN_PATH_CANDIDATES,t as RAZORWIND_INFER_PREPROCESSOR,o as THEME_BASENAME_PATTERN,e as TOKEN_DIRECTORY_GLOB,v as TOKEN_FILE_EXTENSIONS,n as TYPE_PATH_HINTS,y as WINDIE_PARSERS,y as razorwindParsers,f as getRazorwindParserHooks,h as getRazorwindPreprocessorHooks,i as inferTypeFromPath,a as inferValue,g as loadTokens,d as loadTokensOrThrow,p as nestFlatTokens,u as normalizeTokenTree,_ as parseCssCustomProperties,r as razorwindInferPreprocessor,l as registerRazorwindParsers,m as resolveTokensSource,c as themeKeyFromPath};
|
package/dist/plugin.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0DgB,aACd,UAAU,iBAAiB,UACzB,iBAAiB;iBACL,aAAa,QAAQ,SAAS"}
|
package/dist/plugin.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-CMqjfN_6.cjs");let t=require("@stryke/env"),n=require("@stryke/path/find"),r=require("@stryke/path/join"),i=require("@stryke/path/replace"),a=require("@stryke/type-checks/is-function"),o=require("@stryke/type-checks/is-set-object"),s=require("@stryke/type-checks/is-set-string"),c=require("c12"),l=require("defu"),u=require("jiti"),d=require("node:fs"),f=require("node:os");f=e.t(f,1);const p=f.default.homedir();async function m(e,f){let m=f.configFile&&(0,d.existsSync)((0,i.replacePath)(f.configFile,e))?(0,i.replacePath)(f.configFile,e):f.configFile&&(0,d.existsSync)(f.configFile)?f.configFile:(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.${f.mode}.config.ts`))?(0,r.joinPaths)(e,`razorwind.${f.mode}.config.ts`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.${f.mode}.config.js`))?(0,r.joinPaths)(e,`razorwind.${f.mode}.config.js`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.${f.mode}.config.mts`))?(0,r.joinPaths)(e,`razorwind.${f.mode}.config.mts`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.${f.mode}.config.mjs`))?(0,r.joinPaths)(e,`razorwind.${f.mode}.config.mjs`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.config.ts`))?(0,r.joinPaths)(e,`razorwind.config.ts`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.config.js`))?(0,r.joinPaths)(e,`razorwind.config.js`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.config.mts`))?(0,r.joinPaths)(e,`razorwind.config.mts`):(0,d.existsSync)((0,r.joinPaths)(e,`razorwind.config.mjs`))?(0,r.joinPaths)(e,`razorwind.config.mjs`):void 0,h=(0,t.getEnvPaths)({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:e}),g={fsCache:h.cache},_=(0,u.createJiti)(e,g),v={};if(m){let t=await _.import(_.esmResolve(m));if(t?.default){let n={};(0,a.isFunction)(t.default)?n=await Promise.resolve(t.default({cwd:e,mode:f.mode??`development`})):((0,o.isSetObject)(t.default)||Array.isArray(t.default))&&(n=t.default),((0,o.isSetObject)(n)||Array.isArray(n))&&(v={...n,configFile:m})}}let[y,b,x]=await Promise.all([(0,c.loadConfig)({cwd:e,name:`razorwind`,envName:f.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:g}),(0,c.loadConfig)({cwd:h.config,name:`razorwind`,envName:f.mode,dotenv:!0,jitiOptions:g}),(0,c.loadConfig)({cwd:p,name:`razorwind`,envName:f.mode,dotenv:!0,jitiOptions:g})]),S=(0,l.defu)({cwd:e,envPaths:{...h,home:p}},f,v,(0,o.isSetObject)(y?.config)?{...y.config}:{},(0,o.isSetObject)(b?.config)?{...b.config}:{},(0,o.isSetObject)(x?.config)?{...x.config}:{},{registryPath:(0,s.isSetString)(f.registryPath)?(0,n.findFilePath)(f.registryPath):e,plugins:[]});return Array.isArray(S.plugins)||(S.plugins=[]),S}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{getEnvPaths as e}from"@stryke/env";import{findFilePath as t}from"@stryke/path/find";import{joinPaths as n}from"@stryke/path/join";import{replacePath as r}from"@stryke/path/replace";import{isFunction as i}from"@stryke/type-checks/is-function";import{isSetObject as a}from"@stryke/type-checks/is-set-object";import{isSetString as o}from"@stryke/type-checks/is-set-string";import{loadConfig as s}from"c12";import{defu as c}from"defu";import{createJiti as l}from"jiti";import{existsSync as u}from"node:fs";import d from"node:os";const f=d.homedir();async function p(d,p){let m=p.configFile&&u(r(p.configFile,d))?r(p.configFile,d):p.configFile&&u(p.configFile)?p.configFile:u(n(d,`razorwind.${p.mode}.config.ts`))?n(d,`razorwind.${p.mode}.config.ts`):u(n(d,`razorwind.${p.mode}.config.js`))?n(d,`razorwind.${p.mode}.config.js`):u(n(d,`razorwind.${p.mode}.config.mts`))?n(d,`razorwind.${p.mode}.config.mts`):u(n(d,`razorwind.${p.mode}.config.mjs`))?n(d,`razorwind.${p.mode}.config.mjs`):u(n(d,`razorwind.config.ts`))?n(d,`razorwind.config.ts`):u(n(d,`razorwind.config.js`))?n(d,`razorwind.config.js`):u(n(d,`razorwind.config.mts`))?n(d,`razorwind.config.mts`):u(n(d,`razorwind.config.mjs`))?n(d,`razorwind.config.mjs`):void 0,h=e({orgId:`storm-software`,appId:`razorwind`,workspaceRoot:d}),g={fsCache:h.cache},_=l(d,g),v={};if(m){let e=await _.import(_.esmResolve(m));if(e?.default){let t={};i(e.default)?t=await Promise.resolve(e.default({cwd:d,mode:p.mode??`development`})):(a(e.default)||Array.isArray(e.default))&&(t=e.default),(a(t)||Array.isArray(t))&&(v={...t,configFile:m})}}let[y,b,x]=await Promise.all([s({cwd:d,name:`razorwind`,envName:p.mode,globalRc:!0,packageJson:`razorwind`,dotenv:!0,jitiOptions:g}),s({cwd:h.config,name:`razorwind`,envName:p.mode,dotenv:!0,jitiOptions:g}),s({cwd:f,name:`razorwind`,envName:p.mode,dotenv:!0,jitiOptions:g})]),S=c({cwd:d,envPaths:{...h,home:f}},p,v,a(y?.config)?{...y.config}:{},a(b?.config)?{...b.config}:{},a(x?.config)?{...x.config}:{},{registryPath:o(p.registryPath)?t(p.registryPath):d,plugins:[]});return Array.isArray(S.plugins)||(S.plugins=[]),S}export{p as t};
|
|
2
|
-
//# sourceMappingURL=resolve-config-YvpQAnbu.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config-YvpQAnbu.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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));Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
package/dist/schema-CLeH9GGy.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-CMqjfN_6.cjs");let t=require("zod");t=e.t(t,1);let n=require("@power-plant/dtcg-schema");const r=t.z.object({path:t.z.string(),type:t.z.enum([`lib`,`block`,`component`,`ui`,`hook`,`theme`,`page`,`file`,`style`,`base`,`font`,`item`]),content:t.z.string().optional(),target:t.z.string().optional().describe(`The target path of the file. This is the path to the file in the project. Supports registry target placeholders @components/, @ui/, @lib/, and @hooks/, which resolve to the corresponding aliases configured in components.json. These placeholders are independent of the project's import prefix.`)}),i=t.z.object({name:t.z.string(),title:t.z.string(),type:t.z.enum([`block`,`component`,`ui`,`page`]).optional(),category:t.z.string().optional(),description:t.z.string().optional(),tags:t.z.array(t.z.string()).optional(),related:t.z.array(t.z.string()).optional(),since:t.z.string().optional(),version:t.z.string().optional(),repository:t.z.string().optional(),homepage:t.z.string().optional(),dependencies:t.z.record(t.z.string(),t.z.string()).optional(),devDependencies:t.z.record(t.z.string(),t.z.string()).optional(),registryDependencies:t.z.record(t.z.string(),t.z.string()).optional(),files:t.z.array(r).optional()}),a=t.z.record(t.z.string(),i),o=t.default.union([n.tokensSchema,t.default.record(t.default.string(),n.tokensSchema)]),s=t.default.object({tokens:o,components:a});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|