yummacss 3.4.3 → 3.5.0

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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/dist/index.js +1 -155
  3. package/package.json +10 -12
package/README.md CHANGED
@@ -25,12 +25,14 @@ npx yummacss init
25
25
 
26
26
  ## Documentation
27
27
 
28
- Head over to the [Yumma CSS docs](https://www.yummacss.com) to learn more.
28
+ Learn more at [yummacss.com](https://yummacss.com)
29
29
 
30
30
  ## Built with
31
31
 
32
- - [@yummacss/api](https://www.npmjs.com/package/@yummacss/api)
32
+ - [@yummacss/nitro](https://www.npmjs.com/package/@yummacss/nitro)
33
+ - [biome](https://www.npmjs.com/package/@biomejs/biome)
33
34
  - [lightningcss](https://www.npmjs.com/package/lightningcss)
35
+ - [tsdown](https://www.npmjs.com/package/tsdown)
34
36
  - [typescript](https://www.npmjs.com/package/typescript)
35
37
 
36
38
  ## License
package/dist/index.js CHANGED
@@ -1,156 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{Command as e}from"commander";import{existsSync as t,readFileSync as n,writeFileSync as r}from"fs";import{globby as i}from"globby";import{coreUtils as a}from"@yummacss/api";import{z as o}from"zod";import s from"ora";import{join as c}from"path";import{pathToFileURL as l}from"url";import{transform as u}from"lightningcss";import d from"stringify-object";import f from"chokidar";let p={};function m(){return p}function h(e){p=e}function g(e){let t=JSON.stringify(e);return p.configHash!==t}async function _(e){let t=await i(e),r=new Set;for(let e of t)try{let t=n(e,`utf-8`);v(t).forEach(e=>r.add(e))}catch{continue}return r}function v(e){let t=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g],r=[/`[^`]*\b([a-z]+-[a-z0-9-]+)\b[^`]*`/g,/"[^"]*\b([a-z]+-[a-z0-9-]+)\b[^"]*"/g,/'[^']*\b([a-z]+-[a-z0-9-]+)\b[^']*'/g],i=[...n,...r];for(let n of i){let r;for(;(r=n.exec(e))!==null;){let e=r[1];e&&e.split(/\s+/).filter(e=>e&&/^[a-z]/.test(e)&&e.includes(`-`)).forEach(e=>t.add(e))}}return Array.from(t)}function y(e,t){let n=[];t.buildOptions.reset&&n.push(`*,
3
- *::before,
4
- *::after {
5
- box-sizing: border-box;
6
- border: 0 solid;
7
- }
8
-
9
- * {
10
- margin: 0;
11
- padding: 0;
12
- }
13
-
14
- html {
15
- font-family: system-ui, sans-serif;
16
- }
17
-
18
- body {
19
- -webkit-font-smoothing: antialiased;
20
- font-family: inherit;
21
- line-height: 1.5;
22
- }
23
-
24
- canvas,
25
- img,
26
- picture,
27
- svg,
28
- video {
29
- display: block;
30
- max-width: 100%;
31
- }
32
-
33
- button,
34
- input,
35
- optgroup,
36
- select,
37
- textarea {
38
- background-color: transparent;
39
- font-family: inherit;
40
- padding: .5rem;
41
- }
42
-
43
- button:not([class]),
44
- input:not([class]),
45
- optgroup:not([class]),
46
- select:not([class]),
47
- textarea:not([class]) {
48
- border: 1px solid #bfc2c7;
49
- }
50
-
51
- a,
52
- button,
53
- input,
54
- select,
55
- summary,
56
- textarea {
57
- &:focus {
58
- outline: 2px solid transparent;
59
- }
60
- }
61
-
62
- textarea:not([rows]) {
63
- min-height: 10em;
64
- }
65
-
66
- button {
67
- cursor: pointer;
68
- }
69
-
70
- button:disabled,
71
- input:disabled,
72
- select:disabled,
73
- textarea:disabled {
74
- cursor: not-allowed;
75
- opacity: .5;
76
- }
77
-
78
- h1,
79
- h2,
80
- h3,
81
- h4,
82
- h5,
83
- h6,
84
- p {
85
- overflow-wrap: break-word;
86
- }
87
-
88
- h1,
89
- h2,
90
- h3,
91
- h4,
92
- h5,
93
- h6 {
94
- font-size: 1rem;
95
- font-weight: 600;
96
- text-wrap: balance;
97
- }
98
-
99
- p {
100
- text-wrap: pretty;
101
- }
102
-
103
- b,
104
- strong {
105
- font-weight: 700;
106
- }
107
-
108
- small {
109
- font-size: 80%;
110
- line-height: 1.4;
111
- }
112
-
113
- pre,
114
- code,
115
- kbd,
116
- samp {
117
- font-family: monospace;
118
- font-size: 1em;
119
- }
120
-
121
- a {
122
- color: inherit;
123
- text-decoration: none;
124
- }
125
-
126
- ol,
127
- ul {
128
- list-style: none;
129
- padding: 0;
130
- }
131
-
132
- th {
133
- font-size: 1rem;
134
- font-weight: 600;
135
- }
136
-
137
- hr {
138
- border-top: 1px solid #bfc2c7;
139
- height: 0;
140
- margin: 1em 0;
141
- }
142
-
143
- details {
144
- display: block;
145
- }
146
-
147
- summary {
148
- display: list-item;
149
- }`);let r=b(e);return r&&n.push(r),n.join(`
150
-
151
- `)}function b(e){let t=a(),n=[],r=new Map,i=new Set,o=Array.from(e).sort();for(let e of o){if(i.has(e))continue;let a=w(e,t);if(a){if(a.mediaQuery){let e=r.get(a.mediaQuery)||[];e.push(a.rule),r.set(a.mediaQuery,e)}else n.push(a.rule);i.add(e)}}let s=Array.from(r.entries()).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of s)n.push(`${e} {\n${t.join(`
152
- `)}\n}`);return n.join(`
153
- `)}function x(e,t){let{properties:n,variants:r}=t;if(r?.mediaQueries){for(let i of r.mediaQueries)if(e.startsWith(`${i.prefix}:`)){let r=e.slice(i.prefix.length+1),a=S(r,t);if(a){let t=n.map(e=>`${e}: ${a.cssValue};`).join(`
154
- `);return{rule:`.${C(e)} {\n ${t}\n }`,mediaQuery:i.value}}}}if(r?.pseudoClasses){for(let i of r.pseudoClasses)if(e.startsWith(`${i.prefix}:`)){let r=e.slice(i.prefix.length+1),a=S(r,t);if(a){let t=n.map(e=>`${e}: ${a.cssValue};`).join(`
155
- `);return{rule:`.${C(e)}${i.value} {\n${t}\n}`}}}}let i=S(e,t);if(i){let t=n.map(e=>`${e}: ${i.cssValue};`).join(`
156
- `);return{rule:`.${C(e)} {\n${t}\n}`}}return null}function S(e,t){let{prefix:n,values:r}=t;if(!e.startsWith(n+`-`))return null;let i=e.slice(n.length+1),a=r[i];return a?{cssValue:a}:null}function C(e){return e.replace(/:/g,`\\:`).replace(/\//g,`\\/`)}function w(e,t){for(let[n,r]of Object.entries(t)){let t=x(e,r);if(t)return t}return null}async function T(e){let t=await _(e.source);return{css:y(t,e),dependencies:e.source}}const E=`yumma.config.mjs`,D=o.object({source:o.array(o.string()).default([``]),output:o.string().default(``),buildOptions:o.object({reset:o.boolean().default(!0),minify:o.boolean().default(!1)}).default({reset:!0,minify:!1})}),O={build:{start:`Building...`,success:(e,t)=>`Build done in ${e}ms. (${t})`,fail:`Build failed.`},init:{fail:`Config failed.`,invalid:`Invalid config.`,notFound:`Config not found.`,success:`Config created.`},watch:{start:`Watching...`,fail:`Watch failed.`},common:{unknownError:`Something went wrong, and we don't know what.`}},k={error:e=>s().fail(e),info:e=>s().info(e),progress:e=>s({spinner:`sand`,color:`white`}).start(e),success:e=>s().succeed(e),warn:e=>s().warn(e)};async function A(){let e=c(process.cwd(),E),n=l(e).href;try{let{default:e}=await import(n);return D.parse(e)}catch(e){throw t(E)?e instanceof o.ZodError&&(k.progress(O.init.invalid).fail(O.init.invalid),process.exit(1)):(k.progress(O.init.notFound).warn(O.init.notFound),process.exit(1)),e}}function j(e,t){return u({filename:`style.css`,code:Buffer.from(e),minify:t.buildOptions.minify,sourceMap:!1}).code.toString()}async function M(e,t=!1){let n=k.progress(O.build.start),i=Date.now();try{let a=e||await A(),o=m(),s=g(a),c;if(t||s||!o.css){let e=await T(a);c=e.css,h({configHash:JSON.stringify(a),css:e.css,dependencies:e.dependencies})}else c=o.css;let l=j(c,a);r(a.output,l),n.succeed(O.build.success(Date.now()-i,a.output))}catch{n.fail(O.build.fail),process.exit(1)}}function N(){let e=D.parse({});return{filename:E,content:`export default ${d(e,{indent:` `,singleQuotes:!1})};`}}function P(){let e=k.progress(`Initializing config...`);try{let{filename:t,content:n}=N();r(t,n),e.succeed(O.init.success)}catch{e.fail(O.init.fail),process.exit(1)}}let F,I=null,L=new Set;function R(e,t){L.add(e),I&&clearTimeout(I),I=setTimeout(async()=>{L.size>0&&(await M(F,!0),L.clear()),I=null},500)}async function z(){try{F=await A(),await M(F,!0),k.info(O.watch.start);let e=await i(F.source);f.watch(e,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:200},ignored:/(^|[/\\])\../,ignoreInitial:!0,persistent:!0}).on(`add`,e=>R(e,`added`)).on(`change`,e=>R(e,`changed`)).on(`unlink`,e=>R(e,`removed`))}catch{k.error(O.watch.fail),process.exit(1)}}const B=new e;B.name(`yummacss`).description(`Main command`),B.command(`init`).action(P).alias(`i`).description(`Initialize config`),B.command(`build`).action(()=>M().catch(()=>process.exit(1))).alias(`b`).description(`Build styles once`),B.command(`watch`).action(()=>z().catch(()=>process.exit(1))).alias(`w`).description(`Build styles continuously`),B.parse(process.argv);export{};
2
+ import{Command as e}from"commander";import{ConfigSchema as t,configName as n,extractor as r,generator as i}from"@yummacss/nitro";import a from"ora";import{existsSync as o,writeFileSync as s}from"fs";import{join as c}from"path";import{pathToFileURL as l}from"url";import{transform as u}from"lightningcss";import d from"stringify-object";import f from"chokidar";import{globby as p}from"globby";let m={};function h(){return m}function g(e){m=e}function _(e){let t=JSON.stringify(e);return m.configHash!==t}async function v(e){return{css:i(await r(e.source),e),dependencies:e.source}}const y={build:{start:`Building...`,success:(e,t)=>`Build done in ${e}ms. (${t})`,fail:`Build failed.`},init:{fail:`Config failed.`,invalid:`Invalid config.`,notFound:`Config not found.`,success:`Config created.`},watch:{start:`Watching...`,fail:`Watch failed.`},common:{unknownError:`Something went wrong, and we don't know what.`}},b={fail:e=>a().fail(e),info:e=>a().info(e),progress:e=>a({spinner:`sand`,color:`white`}).start(e),success:e=>a().succeed(e),warn:e=>a().warn(e)};Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}function S(e,t){return typeof t==`bigint`?t.toString():t}`captureStackTrace`in Error&&Error.captureStackTrace,-Number.MAX_VALUE,Number.MAX_VALUE;const C=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,S,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},w=x(`$ZodError`,C);x(`$ZodError`,C,{Parent:Error});function T(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function E(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const D=(e,t)=>{w.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>E(e,t)},flatten:{value:t=>T(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,S,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,S,2)}},isEmpty:{get(){return e.issues.length===0}}})},O=x(`ZodError`,D);x(`ZodError`,D,{Parent:Error});async function k(){let e=l(c(process.cwd(),n)).href;try{let{default:n}=await import(e);return t.parse(n)}catch(e){throw o(n)?e instanceof O&&(b.progress(y.init.invalid).fail(y.init.invalid),process.exit(1)):(b.progress(y.init.notFound).warn(y.init.notFound),process.exit(1)),e}}function A(e,t){return u({code:Buffer.from(e),filename:`style.css`,minify:t.buildOptions.minify,sourceMap:!1}).code.toString()}async function j(e,t=!1){let n=b.progress(y.build.start),r=Date.now();try{let i=e||await k(),a=h(),o=_(i),c;if(t||o||!a.css){let e=await v(i);c=e.css,g({configHash:JSON.stringify(i),css:e.css,dependencies:e.dependencies})}else c=a.css;let l=A(c,i);s(i.output,l),n.succeed(y.build.success(Date.now()-r,i.output))}catch(e){n.fail(`${y.build.fail} ${e instanceof Error?e.message:String(e)}`),process.exit(1)}}function M(){return{filename:n,content:`export default ${d(t.parse({}),{indent:` `,singleQuotes:!1})};`}}function N(){let e=b.progress(`Initializing config...`);try{let{filename:t,content:n}=M();s(t,n),e.succeed(y.init.success)}catch{e.fail(y.init.fail),process.exit(1)}}let P,F=null;const I=new Set;function L(e,t){I.add(e),F&&clearTimeout(F),F=setTimeout(async()=>{I.size>0&&(await j(P,!0),I.clear()),F=null},500)}async function R(){try{P=await k(),await j(P,!0),b.info(y.watch.start);let e=await p(P.source);f.watch(e,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:200},ignored:/(^|[/\\])\../,ignoreInitial:!0,persistent:!0}).on(`add`,e=>L(e,`added`)).on(`change`,e=>L(e,`changed`)).on(`unlink`,e=>L(e,`removed`))}catch{b.fail(y.watch.fail),process.exit(1)}}var z=`3.5.0`;const B=new e;B.name(`yummacss`).description(`Yumma CSS main command`).version(z),B.command(`init`).action(N).alias(`i`).description(`Initialize config`),B.command(`build`).action(()=>j().catch(()=>process.exit(1))).alias(`b`).description(`Build styles once`),B.command(`watch`).action(()=>R().catch(()=>process.exit(1))).alias(`w`).description(`Build styles continuously`),B.parse(process.argv);export{};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yummacss",
3
- "version": "3.4.3",
4
- "description": "A CSS framework for the web with abbreviated styles.",
3
+ "version": "3.5.0",
4
+ "description": "A CLI-first CSS framework for the web with abbreviated styles.",
5
5
  "keywords": [
6
6
  "css-framework",
7
7
  "typescript",
@@ -25,22 +25,21 @@
25
25
  "url": "git+https://github.com/yumma-lib/yumma-css.git"
26
26
  },
27
27
  "dependencies": {
28
- "@yummacss/api": "^1.6.2",
28
+ "@yummacss/nitro": "^0.1.0",
29
29
  "chokidar": "^4.0.3",
30
30
  "commander": "^14.0.0",
31
- "globby": "^14.1.0",
32
- "lightningcss": "^1.30.1",
31
+ "globby": "^15.0.0",
32
+ "lightningcss": "^1.30.2",
33
33
  "ora": "^8.2.0",
34
- "stringify-object": "^6.0.0",
35
- "zod": "^4.0.17"
34
+ "stringify-object": "^6.0.0"
36
35
  },
37
36
  "devDependencies": {
37
+ "@biomejs/biome": "2.2.5",
38
38
  "@types/node": "^24.2.0",
39
39
  "@types/stringify-object": "^4.0.5",
40
- "prettier": "^3.6.2",
41
- "prettier-plugin-organize-imports": "^4.2.0",
42
40
  "tsdown": "^0.15.0",
43
- "typescript": "^5.9.2"
41
+ "typescript": "^5.9.2",
42
+ "zod": "^4.1.12"
44
43
  },
45
44
  "publishConfig": {
46
45
  "access": "public",
@@ -49,7 +48,6 @@
49
48
  "scripts": {
50
49
  "build": "tsdown",
51
50
  "dev": "tsdown --watch",
52
- "format:cli": "prettier --write cli",
53
- "format": "prettier --write ."
51
+ "lint": "biome check --write"
54
52
  }
55
53
  }