@razorwind/style-dictionary 0.0.15 → 0.0.18

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.cjs CHANGED
@@ -1 +1,33 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});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,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@razorwind/core/plugin"),l=require("@razorwind/core/utils"),u=require("@stryke/type-checks/is-string"),d=require("node:path"),f=require("style-dictionary");f=s(f,1);function p(e){if((0,u.isString)(e))return e;if(typeof e==`object`&&e&&`toString`in e&&typeof e.toString==`function`){let t=e.toString();if(t!==`[object Object]`)return t}return JSON.stringify(e)}function m(e,t){if(e)return e.map(e=>(0,d.isAbsolute)(e)?e:(0,d.resolve)(t,e))}function h(e){return!e||typeof e!=`object`?{}:e}async function g(e,t={},n=process.cwd()){let{source:r,include:i,usesDtcg:a,platforms:o,...s}=t;if(!o||Object.keys(o).length===0)return{};let c=await new f.default({...s,source:m(r,n),include:m(i,n),tokens:h(e.tokens),platforms:o,usesDtcg:a??!0}).formatAllPlatforms(),u={};for(let[e,t]of Object.entries(c))for(let n of t){let t=n.destination??`${e}.output`;u[t]=(0,l.createDocument)(t,p(n.output),{name:e})}return u}var _=(0,c.definePlugin)(e=>({name:`style-dictionary`,generate:async(t,n)=>g(t,e??{},n.cwd)}));exports.default=_,exports.generateStyleDictionary=g;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});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,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@razorwind/core/plugin"),l=require("@razorwind/core/utils"),u=require("@stryke/type-checks/is-string"),d=require("node:path"),f=require("style-dictionary");f=s(f,1);function p(e){let t=e.files.map(e=>`- \`${e}\``).join(`
2
+ `),n=e.files[0]??`build/output.css`;return`# Installing Style Dictionary Output
3
+
4
+ Generated by \`@razorwind/style-dictionary\`.
5
+
6
+ ## Files
7
+
8
+ ${t}
9
+
10
+ ## Setup
11
+
12
+ 1. Import or copy generated files into your app.
13
+
14
+ CSS example:
15
+
16
+ \`\`\`ts
17
+ import "./${n}";
18
+ \`\`\`
19
+
20
+ SCSS example:
21
+
22
+ \`\`\`scss
23
+ @import "${n}";
24
+ \`\`\`
25
+
26
+ 2. Reference token variables from the generated file names above (e.g. CSS custom properties or SCSS variables).
27
+
28
+ 3. Re-run Razorwind generate when tokens change.
29
+
30
+ ## Regenerate
31
+
32
+ Platform outputs are build artifacts — adjust tokens or Style Dictionary platform config in Razorwind, not hand-edit generated files.
33
+ `}function m(e){if((0,u.isString)(e))return e;if(typeof e==`object`&&e&&`toString`in e&&typeof e.toString==`function`){let t=e.toString();if(t!==`[object Object]`)return t}return JSON.stringify(e)}function h(e,t){if(e)return e.map(e=>(0,d.isAbsolute)(e)?e:(0,d.resolve)(t,e))}function g(e){return!e||typeof e!=`object`?{}:e}function _(e){let t=e[0];if(!t)return`INSTALL.md`;let n=(0,d.dirname)(t);return n===`.`?`INSTALL.md`:(0,d.join)(n,`INSTALL.md`)}async function v(e,t={},n=process.cwd()){let{source:r,include:i,usesDtcg:a,platforms:o,...s}=t;if(!o||Object.keys(o).length===0)return{};let c=await new f.default({...s,source:h(r,n),include:h(i,n),tokens:g(e.tokens),platforms:o,usesDtcg:a??!0}).formatAllPlatforms(),u={};for(let[e,t]of Object.entries(c))for(let n of t){let t=n.destination??`${e}.output`;u[t]=(0,l.createDocument)(t,m(n.output),{name:e})}if(Object.keys(u).length>0){let e=Object.keys(u).sort(),n=t.installPath??_(e),r=t.installGuide??p({files:e});u[n]=(0,l.createDocument)(n,r,{name:`razorwind-style-dictionary`},`markdown`)}return u}var y=(0,c.definePlugin)(e=>({name:`style-dictionary`,generate:async(t,n)=>v(t,e??{},n.cwd)}));exports.default=y,exports.generateStyleDictionary=v,exports.renderInstallMd=p;
package/dist/index.d.cts CHANGED
@@ -24,7 +24,29 @@ import { Schema } from "@razorwind/core/schema";
24
24
  * }
25
25
  * ```
26
26
  */
27
- type StyleDictionaryPluginOptions = Omit<Config, "tokens">;
27
+ type StyleDictionaryPluginOptions = Omit<Config, "tokens"> & {
28
+ /**
29
+ * Override body for generated `INSTALL.md`. When omitted, platform output
30
+ * wiring steps are generated from emitted file paths.
31
+ */
32
+ installGuide?: string;
33
+ /**
34
+ * Path for generated `INSTALL.md` relative to cwd.
35
+ *
36
+ * @defaultValue parent directory of the first emitted file, or `"INSTALL.md"`
37
+ */
38
+ installPath?: string;
39
+ };
40
+ //#endregion
41
+ //#region src/install.d.ts
42
+ /**
43
+ * Build Style Dictionary INSTALL.md for generated platform files.
44
+ *
45
+ * @see https://styledictionary.com/
46
+ */
47
+ declare function renderInstallMd(options: {
48
+ files: string[];
49
+ }): string;
28
50
  //#endregion
29
51
  //#region src/generate.d.ts
30
52
  /**
@@ -72,5 +94,5 @@ declare function generateStyleDictionary(spec: Schema, options?: StyleDictionary
72
94
  */
73
95
  declare const _default: (options?: StyleDictionaryPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
74
96
  //#endregion
75
- export { type PlatformConfig, type StyleDictionaryPluginOptions, _default as default, generateStyleDictionary };
97
+ export { type PlatformConfig, type StyleDictionaryPluginOptions, _default as default, generateStyleDictionary, renderInstallMd };
76
98
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KA0CY,+BAA+B,KAAK;;;;;;;;;iBCoC1B,wBACpB,MAAM,QACN,UAAS,8BACT,eACC,QAAQ,eAAe"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KA0CY,+BAA+B,KAAK;;;;;EAK9C;;;;;;EAOA;;;;;;;;;iBC/Bc,gBAAgB;EAC9B;;;;;;;;;;iBCkEoB,wBACpB,MAAM,QACN,UAAS,8BACT,eACC,QAAQ,eAAe"}
package/dist/index.d.mts CHANGED
@@ -24,7 +24,29 @@ import { Schema } from "@razorwind/core/schema";
24
24
  * }
25
25
  * ```
26
26
  */
27
- type StyleDictionaryPluginOptions = Omit<Config, "tokens">;
27
+ type StyleDictionaryPluginOptions = Omit<Config, "tokens"> & {
28
+ /**
29
+ * Override body for generated `INSTALL.md`. When omitted, platform output
30
+ * wiring steps are generated from emitted file paths.
31
+ */
32
+ installGuide?: string;
33
+ /**
34
+ * Path for generated `INSTALL.md` relative to cwd.
35
+ *
36
+ * @defaultValue parent directory of the first emitted file, or `"INSTALL.md"`
37
+ */
38
+ installPath?: string;
39
+ };
40
+ //#endregion
41
+ //#region src/install.d.ts
42
+ /**
43
+ * Build Style Dictionary INSTALL.md for generated platform files.
44
+ *
45
+ * @see https://styledictionary.com/
46
+ */
47
+ declare function renderInstallMd(options: {
48
+ files: string[];
49
+ }): string;
28
50
  //#endregion
29
51
  //#region src/generate.d.ts
30
52
  /**
@@ -72,5 +94,5 @@ declare function generateStyleDictionary(spec: Schema, options?: StyleDictionary
72
94
  */
73
95
  declare const _default: (options?: StyleDictionaryPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
74
96
  //#endregion
75
- export { type PlatformConfig, type StyleDictionaryPluginOptions, _default as default, generateStyleDictionary };
97
+ export { type PlatformConfig, type StyleDictionaryPluginOptions, _default as default, generateStyleDictionary, renderInstallMd };
76
98
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
package/dist/index.mjs CHANGED
@@ -1,2 +1,34 @@
1
- import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t}from"@razorwind/core/utils";import{isString as n}from"@stryke/type-checks/is-string";import{isAbsolute as r,resolve as i}from"node:path";import a from"style-dictionary";function o(e){if(n(e))return e;if(typeof e==`object`&&e&&`toString`in e&&typeof e.toString==`function`){let t=e.toString();if(t!==`[object Object]`)return t}return JSON.stringify(e)}function s(e,t){if(e)return e.map(e=>r(e)?e:i(t,e))}function c(e){return!e||typeof e!=`object`?{}:e}async function l(e,n={},r=process.cwd()){let{source:i,include:l,usesDtcg:u,platforms:d,...f}=n;if(!d||Object.keys(d).length===0)return{};let p=await new a({...f,source:s(i,r),include:s(l,r),tokens:c(e.tokens),platforms:d,usesDtcg:u??!0}).formatAllPlatforms(),m={};for(let[e,n]of Object.entries(p))for(let r of n){let n=r.destination??`${e}.output`;m[n]=t(n,o(r.output),{name:e})}return m}var u=e(e=>({name:`style-dictionary`,generate:async(t,n)=>l(t,e??{},n.cwd)}));export{u as default,l as generateStyleDictionary};
1
+ import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t}from"@razorwind/core/utils";import{isString as n}from"@stryke/type-checks/is-string";import{dirname as r,isAbsolute as i,join as a,resolve as o}from"node:path";import s from"style-dictionary";function c(e){let t=e.files.map(e=>`- \`${e}\``).join(`
2
+ `),n=e.files[0]??`build/output.css`;return`# Installing Style Dictionary Output
3
+
4
+ Generated by \`@razorwind/style-dictionary\`.
5
+
6
+ ## Files
7
+
8
+ ${t}
9
+
10
+ ## Setup
11
+
12
+ 1. Import or copy generated files into your app.
13
+
14
+ CSS example:
15
+
16
+ \`\`\`ts
17
+ import "./${n}";
18
+ \`\`\`
19
+
20
+ SCSS example:
21
+
22
+ \`\`\`scss
23
+ @import "${n}";
24
+ \`\`\`
25
+
26
+ 2. Reference token variables from the generated file names above (e.g. CSS custom properties or SCSS variables).
27
+
28
+ 3. Re-run Razorwind generate when tokens change.
29
+
30
+ ## Regenerate
31
+
32
+ Platform outputs are build artifacts — adjust tokens or Style Dictionary platform config in Razorwind, not hand-edit generated files.
33
+ `}function l(e){if(n(e))return e;if(typeof e==`object`&&e&&`toString`in e&&typeof e.toString==`function`){let t=e.toString();if(t!==`[object Object]`)return t}return JSON.stringify(e)}function u(e,t){if(e)return e.map(e=>i(e)?e:o(t,e))}function d(e){return!e||typeof e!=`object`?{}:e}function f(e){let t=e[0];if(!t)return`INSTALL.md`;let n=r(t);return n===`.`?`INSTALL.md`:a(n,`INSTALL.md`)}async function p(e,n={},r=process.cwd()){let{source:i,include:a,usesDtcg:o,platforms:p,...m}=n;if(!p||Object.keys(p).length===0)return{};let h=await new s({...m,source:u(i,r),include:u(a,r),tokens:d(e.tokens),platforms:p,usesDtcg:o??!0}).formatAllPlatforms(),g={};for(let[e,n]of Object.entries(h))for(let r of n){let n=r.destination??`${e}.output`;g[n]=t(n,l(r.output),{name:e})}if(Object.keys(g).length>0){let e=Object.keys(g).sort(),r=n.installPath??f(e),i=n.installGuide??c({files:e});g[r]=t(r,i,{name:`razorwind-style-dictionary`},`markdown`)}return g}var m=e(e=>({name:`style-dictionary`,generate:async(t,n)=>p(t,e??{},n.cwd)}));export{m as default,p as generateStyleDictionary,c as renderInstallMd};
2
34
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/style-dictionary",
3
- "version": "0.0.15",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "description": "Razorwind plugin that uses Style Dictionary to generate code from Razorwind design tokens.",
6
6
  "repository": {
@@ -83,16 +83,15 @@
83
83
  "types": "./dist/index.d.cts",
84
84
  "typings": "dist/index.d.mts",
85
85
  "dependencies": {
86
- "@power-plant/core": "^0.0.75",
87
- "@razorwind/core": "0.0.29",
88
- "@stryke/type-checks": "^0.6.35",
89
- "style-dictionary": "^5.5.0"
86
+ "@power-plant/core": "catalog:",
87
+ "@razorwind/core": "workspace:*",
88
+ "@stryke/type-checks": "catalog:",
89
+ "style-dictionary": "catalog:"
90
90
  },
91
91
  "devDependencies": {
92
- "@powerlines/plugin-tsdown": "^0.1.589",
93
- "@types/node": "^25.9.5",
92
+ "@powerlines/plugin-tsdown": "catalog:",
93
+ "@types/node": "catalog:",
94
94
  "typescript": "^6.0.3"
95
95
  },
96
- "publishConfig": { "access": "public" },
97
- "gitHead": "a861c6938501ed645ccdcd3970fc1164d110b4ed"
96
+ "publishConfig": { "access": "public" }
98
97
  }