@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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { a as Components, t as Schema } from "./schema-BNfl9Tsw.mjs";
|
|
2
|
+
import { GeneratedDocument } from "@power-plant/core";
|
|
3
|
+
import { PreprocessedTokens } from "style-dictionary";
|
|
4
|
+
import { EnvPaths } from "@stryke/env";
|
|
5
|
+
import { Tokens } from "@power-plant/dtcg-schema";
|
|
6
|
+
import { MaybePromise, RequiredKeys } from "@stryke/types/base";
|
|
7
|
+
import { Action, DesignTokens, FileHeader, Filter, Format, Transform } from "style-dictionary/types";
|
|
8
|
+
//#region src/types/plugin.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Style Dictionary parser hook contributed by a plugin.
|
|
11
|
+
*
|
|
12
|
+
* @see https://styledictionary.com/reference/hooks/parsers/
|
|
13
|
+
*/
|
|
14
|
+
interface TokensParser {
|
|
15
|
+
name?: string;
|
|
16
|
+
pattern: RegExp;
|
|
17
|
+
parser: (contents: string) => DesignTokens;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Style Dictionary preprocessor hook contributed by a plugin.
|
|
21
|
+
*
|
|
22
|
+
* @see https://styledictionary.com/reference/hooks/preprocessors/
|
|
23
|
+
*/
|
|
24
|
+
type TokensPreprocessor = {
|
|
25
|
+
name?: string;
|
|
26
|
+
preprocessor: (dictionary: PreprocessedTokens) => PreprocessedTokens;
|
|
27
|
+
} | ((dictionary: PreprocessedTokens) => PreprocessedTokens);
|
|
28
|
+
/**
|
|
29
|
+
* Style Dictionary transform hook contributed by a plugin.
|
|
30
|
+
*
|
|
31
|
+
* @see https://styledictionary.com/reference/hooks/transforms/
|
|
32
|
+
*/
|
|
33
|
+
type TokensTransform = Omit<Transform, "name"> & {
|
|
34
|
+
name?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Style Dictionary transform group hook contributed by a plugin.
|
|
38
|
+
*
|
|
39
|
+
* @see https://styledictionary.com/reference/hooks/transform-groups/
|
|
40
|
+
*/
|
|
41
|
+
interface TokensTransformGroup {
|
|
42
|
+
name?: string;
|
|
43
|
+
transforms: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Style Dictionary format hook contributed by a plugin.
|
|
47
|
+
*
|
|
48
|
+
* @see https://styledictionary.com/reference/hooks/formats/
|
|
49
|
+
*/
|
|
50
|
+
type TokensFormat = Omit<Format, "name"> & {
|
|
51
|
+
name?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Style Dictionary filter hook contributed by a plugin.
|
|
55
|
+
*
|
|
56
|
+
* @see https://styledictionary.com/reference/hooks/filters/
|
|
57
|
+
*/
|
|
58
|
+
type TokensFilter = (Omit<Filter, "name"> & {
|
|
59
|
+
name?: string;
|
|
60
|
+
}) | Filter["filter"];
|
|
61
|
+
/**
|
|
62
|
+
* Style Dictionary file header hook contributed by a plugin.
|
|
63
|
+
*
|
|
64
|
+
* @see https://styledictionary.com/reference/hooks/file-headers/
|
|
65
|
+
*/
|
|
66
|
+
type TokensFileHeader = {
|
|
67
|
+
name?: string;
|
|
68
|
+
fileHeader: FileHeader;
|
|
69
|
+
} | FileHeader;
|
|
70
|
+
/**
|
|
71
|
+
* Style Dictionary action hook contributed by a plugin.
|
|
72
|
+
*
|
|
73
|
+
* @see https://styledictionary.com/reference/hooks/actions/
|
|
74
|
+
*/
|
|
75
|
+
type TokensAction = Omit<Action, "name"> & {
|
|
76
|
+
name?: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Razorwind plugin: Style Dictionary hooks plus extract / generate / validate.
|
|
80
|
+
*
|
|
81
|
+
* @see https://styledictionary.com/reference/api/
|
|
82
|
+
*/
|
|
83
|
+
interface Plugin {
|
|
84
|
+
/**
|
|
85
|
+
* The name of the plugin.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* The name of the plugin is used to identify the plugin in the configuration and to generate the plugin's documentation.
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
/**
|
|
92
|
+
* Custom file parsers registered with Style Dictionary to load token sources.
|
|
93
|
+
*
|
|
94
|
+
* @see https://styledictionary.com/reference/hooks/parsers/
|
|
95
|
+
*/
|
|
96
|
+
parsers?: TokensParser[];
|
|
97
|
+
/**
|
|
98
|
+
* Preprocessors that run on the merged token dictionary before transforms.
|
|
99
|
+
*
|
|
100
|
+
* @see https://styledictionary.com/reference/hooks/preprocessors/
|
|
101
|
+
*/
|
|
102
|
+
preprocessors?: TokensPreprocessor[];
|
|
103
|
+
/**
|
|
104
|
+
* Transforms that modify token names, attributes, or values per platform.
|
|
105
|
+
*
|
|
106
|
+
* @see https://styledictionary.com/reference/hooks/transforms/
|
|
107
|
+
*/
|
|
108
|
+
transforms?: TokensTransform[];
|
|
109
|
+
/**
|
|
110
|
+
* Named groups of transforms applied together in platform configuration.
|
|
111
|
+
*
|
|
112
|
+
* @see https://styledictionary.com/reference/hooks/transform-groups/
|
|
113
|
+
*/
|
|
114
|
+
transformGroups?: TokensTransformGroup[];
|
|
115
|
+
/**
|
|
116
|
+
* Output formats that turn the transformed dictionary into file contents.
|
|
117
|
+
*
|
|
118
|
+
* @see https://styledictionary.com/reference/hooks/formats/
|
|
119
|
+
*/
|
|
120
|
+
formats?: TokensFormat[];
|
|
121
|
+
/**
|
|
122
|
+
* Filters that decide which tokens are included in a platform or format.
|
|
123
|
+
*
|
|
124
|
+
* @see https://styledictionary.com/reference/hooks/filters/
|
|
125
|
+
*/
|
|
126
|
+
filters?: TokensFilter[];
|
|
127
|
+
/**
|
|
128
|
+
* File header generators that add build metadata comments to output files.
|
|
129
|
+
*
|
|
130
|
+
* @see https://styledictionary.com/reference/hooks/file-headers/
|
|
131
|
+
*/
|
|
132
|
+
fileHeaders?: TokensFileHeader[];
|
|
133
|
+
/**
|
|
134
|
+
* Post-build actions such as copying assets or running follow-up scripts.
|
|
135
|
+
*
|
|
136
|
+
* @see https://styledictionary.com/reference/hooks/actions/
|
|
137
|
+
*/
|
|
138
|
+
actions?: TokensAction[];
|
|
139
|
+
/**
|
|
140
|
+
* Extract the design tokens from the source files.
|
|
141
|
+
*
|
|
142
|
+
* @param spec - The schema of the design tokens.
|
|
143
|
+
* @param config - The configuration of the project.
|
|
144
|
+
* @returns The schema of the design tokens.
|
|
145
|
+
*/
|
|
146
|
+
extract?: (spec: Schema, config: Config) => MaybePromise<Schema>;
|
|
147
|
+
/**
|
|
148
|
+
* Generate the design system code from the design tokens.
|
|
149
|
+
*
|
|
150
|
+
* @param spec - The schema of the design tokens.
|
|
151
|
+
* @param config - The configuration of the project.
|
|
152
|
+
* @returns The generated code.
|
|
153
|
+
*/
|
|
154
|
+
generate?: (spec: Schema, config: Config) => MaybePromise<Record<string, GeneratedDocument>>;
|
|
155
|
+
/**
|
|
156
|
+
* Validate the design tokens.
|
|
157
|
+
*
|
|
158
|
+
* @param spec - The schema of the design tokens.
|
|
159
|
+
* @param config - The configuration of the project.
|
|
160
|
+
* @throws An error if the design tokens are invalid.
|
|
161
|
+
*/
|
|
162
|
+
validate?: (spec: Schema, config: Config) => MaybePromise<void>;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/types/config.d.ts
|
|
166
|
+
interface Options {
|
|
167
|
+
/**
|
|
168
|
+
* The directory or file containing a Razorwind configuration file.
|
|
169
|
+
*
|
|
170
|
+
* @defaultValue "razorwind.config.ts"
|
|
171
|
+
*/
|
|
172
|
+
configFile?: string;
|
|
173
|
+
/**
|
|
174
|
+
* The path(s) to directories containing component directories or files.
|
|
175
|
+
*/
|
|
176
|
+
componentsPath?: string | string[];
|
|
177
|
+
/**
|
|
178
|
+
* The directory(ies) or file(s) containing the tokens.
|
|
179
|
+
*
|
|
180
|
+
* @see https://styledictionary.com/info/tokens/
|
|
181
|
+
*
|
|
182
|
+
* @defaultValue "tokens.json" (or "tokens" directory)
|
|
183
|
+
*/
|
|
184
|
+
tokensPath?: string | string[];
|
|
185
|
+
/**
|
|
186
|
+
* The mode to use for the configuration.
|
|
187
|
+
*
|
|
188
|
+
* @defaultValue "production"
|
|
189
|
+
*/
|
|
190
|
+
mode?: "development" | "test" | "production";
|
|
191
|
+
/**
|
|
192
|
+
* Whether to split multi-file token sources into a record keyed by theme.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* When `true`, each resolved source file is inspected for a theme-like basename. The recognized names include (case-insensitive):
|
|
196
|
+
* - `light`
|
|
197
|
+
* - `dark`
|
|
198
|
+
* - `dim`
|
|
199
|
+
* - `dimmed`
|
|
200
|
+
* - `high-contrast`
|
|
201
|
+
* - `hc`
|
|
202
|
+
* - `default`
|
|
203
|
+
* - `base`
|
|
204
|
+
* - `theme`
|
|
205
|
+
*
|
|
206
|
+
* The basename is optionally followed by a suffix separated by `.`, `_`, or `-` (for example `light.json`, `dark-mode.tokens.json`, `theme.custom.yaml`).
|
|
207
|
+
*
|
|
208
|
+
* Files that match are grouped under that theme key. Non-theme files are merged into a shared `base` entry when at least two distinct themes are detected. If fewer than two themes are found, all sources are merged into a single {@link Tokens} object instead of a record.
|
|
209
|
+
*
|
|
210
|
+
* When `false`, every source file is merged into one flat {@link Tokens} object regardless of filename.
|
|
211
|
+
*
|
|
212
|
+
* Basename detection uses {@link ../lib/tokens/constants#THEME_BASENAME_PATTERN}.
|
|
213
|
+
*
|
|
214
|
+
* @defaultValue true
|
|
215
|
+
*/
|
|
216
|
+
splitThemes?: boolean;
|
|
217
|
+
}
|
|
218
|
+
interface UserConfig extends Options {
|
|
219
|
+
name?: string;
|
|
220
|
+
title?: string;
|
|
221
|
+
version?: string;
|
|
222
|
+
description?: string;
|
|
223
|
+
author?: string;
|
|
224
|
+
license?: string;
|
|
225
|
+
repository?: string;
|
|
226
|
+
homepage?: string;
|
|
227
|
+
tags?: string[];
|
|
228
|
+
tokens?: Tokens | Record<string, Tokens>;
|
|
229
|
+
components?: Components;
|
|
230
|
+
plugins?: Plugin[];
|
|
231
|
+
}
|
|
232
|
+
interface UserConfigParams {
|
|
233
|
+
cwd: string;
|
|
234
|
+
mode: string;
|
|
235
|
+
}
|
|
236
|
+
type UserConfigFnObject = (config: UserConfig) => UserConfig;
|
|
237
|
+
type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
|
|
238
|
+
type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
|
|
239
|
+
type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
240
|
+
type Config = RequiredKeys<UserConfig, "componentsPath" | "plugins"> & {
|
|
241
|
+
cwd: string;
|
|
242
|
+
envPaths: EnvPaths & {
|
|
243
|
+
home: string;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/plugin.d.ts
|
|
248
|
+
/**
|
|
249
|
+
* Type helper for Razorwind plugins (Style Dictionary hooks + `extract` / `validate` / `generate`).
|
|
250
|
+
*
|
|
251
|
+
* @see https://styledictionary.com/reference/api/
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* import { definePlugin } from "@razorwind/core";
|
|
256
|
+
*
|
|
257
|
+
* // As a plugin
|
|
258
|
+
* export default definePlugin({
|
|
259
|
+
* name: "my-plugin",
|
|
260
|
+
* transforms: [{ name: "size/px", type: "value", transform: (t) => t }],
|
|
261
|
+
* extract: async (spec) => {
|
|
262
|
+
* ...
|
|
263
|
+
* },
|
|
264
|
+
* validate: async () => {
|
|
265
|
+
* ...
|
|
266
|
+
* },
|
|
267
|
+
* generate: async () => {
|
|
268
|
+
* ...
|
|
269
|
+
* }
|
|
270
|
+
* });
|
|
271
|
+
*
|
|
272
|
+
* // As a plugin factory
|
|
273
|
+
* export default definePlugin((options) => ({
|
|
274
|
+
* name: "my-plugin",
|
|
275
|
+
* extract: async (spec) => {
|
|
276
|
+
* ...
|
|
277
|
+
* },
|
|
278
|
+
* validate: async () => {
|
|
279
|
+
* ...
|
|
280
|
+
* },
|
|
281
|
+
* generate: async () => {
|
|
282
|
+
* ...
|
|
283
|
+
* }
|
|
284
|
+
* }));
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
declare function definePlugin(factory: (options?: any) => Plugin): (options?: any) => Plugin;
|
|
288
|
+
declare function definePlugin(plugin: Plugin): Plugin;
|
|
289
|
+
//#endregion
|
|
290
|
+
export { TokensTransform as _, UserConfigExport as a, UserConfigFnPromise as c, TokensAction as d, TokensFileHeader as f, TokensPreprocessor as g, TokensParser as h, UserConfig as i, UserConfigParams as l, TokensFormat as m, Config as n, UserConfigFn as o, TokensFilter as p, Options as r, UserConfigFnObject as s, definePlugin as t, Plugin as u, TokensTransformGroup as v };
|
|
291
|
+
//# sourceMappingURL=plugin-DNLmSRnE.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-DNLmSRnE.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts","../src/plugin.ts"],"mappings":""}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import { d as TokensPreprocessor,
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type helper for Razorwind plugins (`extract` / `validate` / `generate`).
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { definePlugin } from "@razorwind/core";
|
|
9
|
-
*
|
|
10
|
-
* // As a plugin
|
|
11
|
-
* export default definePlugin({
|
|
12
|
-
* name: "my-plugin",
|
|
13
|
-
* extract: async (spec) => {
|
|
14
|
-
* ...
|
|
15
|
-
* },
|
|
16
|
-
* validate: async () => {
|
|
17
|
-
* ...
|
|
18
|
-
* },
|
|
19
|
-
* generate: async () => {
|
|
20
|
-
* ...
|
|
21
|
-
* }
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* // As a plugin factory
|
|
25
|
-
* export default definePlugin((options) => ({
|
|
26
|
-
* name: "my-plugin",
|
|
27
|
-
* extract: async (spec) => {
|
|
28
|
-
* ...
|
|
29
|
-
* },
|
|
30
|
-
* validate: async () => {
|
|
31
|
-
* ...
|
|
32
|
-
* },
|
|
33
|
-
* generate: async () => {
|
|
34
|
-
* ...
|
|
35
|
-
* }
|
|
36
|
-
* }));
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
declare function definePlugin(factory: (options: any) => Plugin): (options: any) => Plugin;
|
|
40
|
-
declare function definePlugin(plugin: Plugin): Plugin;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { type Plugin, type TokensParser, type TokensPreprocessor, definePlugin };
|
|
43
|
-
//# sourceMappingURL=plugin.d.cts.map
|
|
1
|
+
import { _ as TokensTransform, d as TokensAction, f as TokensFileHeader, g as TokensPreprocessor, h as TokensParser, m as TokensFormat, p as TokensFilter, t as definePlugin, u as Plugin, v as TokensTransformGroup } from "./plugin-CUtxHXKj.cjs";
|
|
2
|
+
export { type Plugin, type TokensAction, type TokensFileHeader, type TokensFilter, type TokensFormat, type TokensParser, type TokensPreprocessor, type TokensTransform, type TokensTransformGroup, definePlugin };
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import { d as TokensPreprocessor,
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type helper for Razorwind plugins (`extract` / `validate` / `generate`).
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { definePlugin } from "@razorwind/core";
|
|
9
|
-
*
|
|
10
|
-
* // As a plugin
|
|
11
|
-
* export default definePlugin({
|
|
12
|
-
* name: "my-plugin",
|
|
13
|
-
* extract: async (spec) => {
|
|
14
|
-
* ...
|
|
15
|
-
* },
|
|
16
|
-
* validate: async () => {
|
|
17
|
-
* ...
|
|
18
|
-
* },
|
|
19
|
-
* generate: async () => {
|
|
20
|
-
* ...
|
|
21
|
-
* }
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* // As a plugin factory
|
|
25
|
-
* export default definePlugin((options) => ({
|
|
26
|
-
* name: "my-plugin",
|
|
27
|
-
* extract: async (spec) => {
|
|
28
|
-
* ...
|
|
29
|
-
* },
|
|
30
|
-
* validate: async () => {
|
|
31
|
-
* ...
|
|
32
|
-
* },
|
|
33
|
-
* generate: async () => {
|
|
34
|
-
* ...
|
|
35
|
-
* }
|
|
36
|
-
* }));
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
declare function definePlugin(factory: (options: any) => Plugin): (options: any) => Plugin;
|
|
40
|
-
declare function definePlugin(plugin: Plugin): Plugin;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { type Plugin, type TokensParser, type TokensPreprocessor, definePlugin };
|
|
43
|
-
//# sourceMappingURL=plugin.d.mts.map
|
|
1
|
+
import { _ as TokensTransform, d as TokensAction, f as TokensFileHeader, g as TokensPreprocessor, h as TokensParser, m as TokensFormat, p as TokensFilter, t as definePlugin, u as Plugin, v as TokensTransformGroup } from "./plugin-DNLmSRnE.mjs";
|
|
2
|
+
export { type Plugin, type TokensAction, type TokensFileHeader, type TokensFilter, type TokensFormat, type TokensParser, type TokensPreprocessor, type TokensTransform, type TokensTransformGroup, 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-CkRpPBAO.cjs");let t=require("@power-plant/dtcg-schema");exports.componentFileSchema=e.n,exports.componentSchema=e.r,exports.componentsSchema=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 Components, c as componentsSchema, i as ComponentFile, n as schema, o as componentFileSchema, r as Component, s as componentSchema, t as Schema } from "../schema-
|
|
2
|
-
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-
|
|
1
|
+
import { a as Components, c as componentsSchema, i as ComponentFile, n as schema, o as componentFileSchema, r as Component, s as componentSchema, t as Schema } from "../schema-BNfl9Tsw.cjs";
|
|
2
|
+
import { i as tokensSchema, n as Tokens, r as tokenSchema, t as Token } from "../index-CjW7STaT.cjs";
|
|
3
3
|
export { type Component, type ComponentFile, type Components, type Schema, type Token, type Tokens, componentFileSchema, componentSchema, componentsSchema, schema, tokenSchema, tokensSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
2
1
|
import z, { z as z$1 } from "zod";
|
|
2
|
+
import { Tokens } from "@power-plant/dtcg-schema";
|
|
3
3
|
//#region src/schema/components.d.ts
|
|
4
4
|
declare const componentFileSchema: z$1.ZodObject<{
|
|
5
5
|
path: z$1.ZodString;
|
|
@@ -112,4 +112,4 @@ interface Schema {
|
|
|
112
112
|
declare const schema: z.ZodType<Schema>;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { Components as a, componentsSchema as c, ComponentFile as i, schema as n, componentFileSchema as o, Component as r, componentSchema as s, Schema as t };
|
|
115
|
-
//# sourceMappingURL=schema-
|
|
115
|
+
//# sourceMappingURL=schema-BNfl9Tsw.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-
|
|
1
|
+
{"version":3,"file":"schema-BNfl9Tsw.d.cts","names":[],"sources":["../src/schema/components.ts","../src/schema/schema.ts"],"mappings":";;;cAoBa,qBAAmB,IAAA;;;;;;;;;;;;;;;;;;GAuB9B,IAAA,KAAA;KAEU,gBAAgB,IAAE,aAAa;cAE9B,iBAAe,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgB1B,IAAA,KAAA;KAEU,YAAY,IAAE,aAAa;cAE1B,kBAAgB,IAAA,UAAA,IAAA,WAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwC,IAAA,KAAA;KAEzD,aAAa,IAAE,aAAa;;;UCtCvB;EACf,YAAY;EACZ,QAAQ,SAAS,eAAe;;cAGrB,QAAQ,EAAE,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("zod");c=s(c,1);let l=require("@power-plant/dtcg-schema");const u=c.z.object({path:c.z.string(),type:c.z.enum([`lib`,`block`,`component`,`ui`,`hook`,`theme`,`page`,`file`,`style`,`base`,`font`,`item`]),content:c.z.string().optional(),target:c.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.`)}),d=c.z.object({name:c.z.string(),title:c.z.string(),type:c.z.enum([`block`,`component`,`ui`,`page`]).optional(),category:c.z.string().optional(),description:c.z.string().optional(),tags:c.z.array(c.z.string()).optional(),related:c.z.array(c.z.string()).optional(),since:c.z.string().optional(),version:c.z.string().optional(),repository:c.z.string().optional(),homepage:c.z.string().optional(),dependencies:c.z.record(c.z.string(),c.z.string()).optional(),devDependencies:c.z.record(c.z.string(),c.z.string()).optional(),registryDependencies:c.z.record(c.z.string(),c.z.string()).optional(),files:c.z.array(u).optional()}),f=c.z.record(c.z.string(),d),p=c.default.union([l.tokensSchema,c.default.record(c.default.string(),l.tokensSchema)]),m=c.default.object({tokens:p,components:f});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "💨 Razorwind is a unified set of tools that make creating design systems a breeze.",
|
|
6
6
|
"keywords": ["razorwind", "storm-software"],
|
|
@@ -54,48 +54,6 @@
|
|
|
54
54
|
"default": "./dist/index.mjs"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"./config": {
|
|
58
|
-
"require": {
|
|
59
|
-
"types": "./dist/config.d.cts",
|
|
60
|
-
"default": "./dist/config.cjs"
|
|
61
|
-
},
|
|
62
|
-
"import": {
|
|
63
|
-
"types": "./dist/config.d.mts",
|
|
64
|
-
"default": "./dist/config.mjs"
|
|
65
|
-
},
|
|
66
|
-
"default": {
|
|
67
|
-
"types": "./dist/config.d.mts",
|
|
68
|
-
"default": "./dist/config.mjs"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"./generator": {
|
|
72
|
-
"require": {
|
|
73
|
-
"types": "./dist/generator.d.cts",
|
|
74
|
-
"default": "./dist/generator.cjs"
|
|
75
|
-
},
|
|
76
|
-
"import": {
|
|
77
|
-
"types": "./dist/generator.d.mts",
|
|
78
|
-
"default": "./dist/generator.mjs"
|
|
79
|
-
},
|
|
80
|
-
"default": {
|
|
81
|
-
"types": "./dist/generator.d.mts",
|
|
82
|
-
"default": "./dist/generator.mjs"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"./lib/tokens": {
|
|
86
|
-
"require": {
|
|
87
|
-
"types": "./dist/lib/tokens/index.d.cts",
|
|
88
|
-
"default": "./dist/lib/tokens/index.cjs"
|
|
89
|
-
},
|
|
90
|
-
"import": {
|
|
91
|
-
"types": "./dist/lib/tokens/index.d.mts",
|
|
92
|
-
"default": "./dist/lib/tokens/index.mjs"
|
|
93
|
-
},
|
|
94
|
-
"default": {
|
|
95
|
-
"types": "./dist/lib/tokens/index.d.mts",
|
|
96
|
-
"default": "./dist/lib/tokens/index.mjs"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
57
|
"./package.json": "./package.json",
|
|
100
58
|
"./plugin": {
|
|
101
59
|
"require": {
|
|
@@ -146,11 +104,11 @@
|
|
|
146
104
|
"typings": "dist/index.d.mts",
|
|
147
105
|
"files": ["dist"],
|
|
148
106
|
"dependencies": {
|
|
149
|
-
"@power-plant/core": "^0.0.
|
|
107
|
+
"@power-plant/core": "^0.0.52",
|
|
150
108
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
151
|
-
"@power-plant/schema": "^0.0.
|
|
152
|
-
"@power-plant/style-dictionary": "^0.0.
|
|
153
|
-
"@power-plant/utils": "^0.0.
|
|
109
|
+
"@power-plant/schema": "^0.0.50",
|
|
110
|
+
"@power-plant/style-dictionary": "^0.0.37",
|
|
111
|
+
"@power-plant/utils": "^0.0.38",
|
|
154
112
|
"@stryke/env": "^0.20.116",
|
|
155
113
|
"@stryke/fs": "^0.33.99",
|
|
156
114
|
"@stryke/path": "^0.29.25",
|
|
@@ -163,16 +121,16 @@
|
|
|
163
121
|
"fast-glob": "^3.3.3",
|
|
164
122
|
"jiti": "^2.7.0",
|
|
165
123
|
"json5": "^2.2.3",
|
|
166
|
-
"smol-toml": "^1.7.
|
|
124
|
+
"smol-toml": "^1.7.1",
|
|
167
125
|
"style-dictionary": "^5.5.0",
|
|
168
126
|
"yaml": "^2.9.0",
|
|
169
127
|
"zod": "^4.4.3"
|
|
170
128
|
},
|
|
171
129
|
"devDependencies": {
|
|
172
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
130
|
+
"@powerlines/plugin-tsdown": "^0.1.571",
|
|
173
131
|
"@types/node": "^25.9.5",
|
|
174
132
|
"typescript": "^6.0.3"
|
|
175
133
|
},
|
|
176
134
|
"publishConfig": { "access": "public" },
|
|
177
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "2c7a147ef95f662154e13be38137f629a71cff62"
|
|
178
136
|
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { t as Schema } from "./schema-BNfl9Tsw.mjs";
|
|
2
|
-
import { EnvPaths } from "@stryke/env";
|
|
3
|
-
import { GeneratedDocument } from "@power-plant/core";
|
|
4
|
-
import { PreprocessedTokens } from "style-dictionary";
|
|
5
|
-
import { Tokens } from "@power-plant/dtcg-schema";
|
|
6
|
-
import { MaybePromise, RequiredKeys } from "@stryke/types/base";
|
|
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-DQHHeicR.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-DQHHeicR.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":""}
|