@sugarcube-org/postcss 0.0.1-alpha.3 → 0.0.1-alpha.4

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/LICENSE.md CHANGED
@@ -1,9 +1,31 @@
1
- # Proprietary Software
1
+ # Sugarcube Private Alpha License
2
2
 
3
- This software is proprietary and confidential. All rights reserved.
3
+ Copyright © 2025 Mark Tomlinson. All rights reserved.
4
4
 
5
- Copyright (c) 2025 Mark Tomlinson
5
+ **Version 1.0 December 2025**
6
6
 
7
- This software is provided "as is" without warranty of any kind, either express or implied.
7
+ This software is provided under a temporary, non-exclusive, non-transferable
8
+ license for private evaluation and internal use as part of the Sugarcube
9
+ Private Alpha Program.
8
10
 
9
- Unauthorized copying, distribution, or use of this software is strictly prohibited.
11
+ ## Permitted
12
+
13
+ - Use in internal and client projects for the purpose of evaluating Sugarcube
14
+ - Reporting bugs, performance issues, and usability feedback
15
+
16
+ ## Not Permitted
17
+
18
+ - Redistribution of the software or any derivative works
19
+ - Public hosting of the source code
20
+ - Sublicensing, resale, or commercial distribution of Sugarcube itself
21
+ - Reverse engineering for the purpose of creating a competing product
22
+
23
+ ## Disclaimer
24
+
25
+ This software is provided "as is", without warranty of any kind, express or
26
+ implied. The author assumes no liability for damages arising from its use.
27
+
28
+ ## Future Licensing
29
+
30
+ This license will be replaced by an open-source license at public beta or
31
+ general availability.
package/README.md CHANGED
@@ -1,41 +1,7 @@
1
1
  # @sugarcube-org/postcss
2
2
 
3
- PostCSS plugin for sugarcube CSS generation.
3
+ > ⚠️ **Private Alpha** — This package is under active development and not yet ready for public use.
4
4
 
5
- ## What it does
5
+ ## License
6
6
 
7
- - Generates CSS variables and utilities as part of PostCSS processing
8
- - Integrates with any build tool that supports PostCSS
9
- - Provides flexible CSS generation for sugarcube projects
10
-
11
- ## Installation
12
-
13
- ```bash
14
- npm install @sugarcube-org/postcss
15
- ```
16
-
17
- ## Usage
18
-
19
- ```js
20
- // postcss.config.js
21
- module.exports = {
22
- plugins: [
23
- require('@sugarcube-org/postcss')
24
- ]
25
- }
26
- ```
27
-
28
- ## Features
29
-
30
- - **Build tool agnostic** - Works with any PostCSS-compatible setup
31
- - **Configurable** - Uses your sugarcube.config.json settings
32
- - **Efficient** - Generates CSS during build process
33
- - **Flexible** - Integrates with existing PostCSS workflows
34
-
35
- ## Development
36
-
37
- ```bash
38
- pnpm install
39
- pnpm build
40
- pnpm test
41
- ```
7
+ See [LICENSE.md](./LICENSE.md) for terms.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var E=Object.defineProperty;var c=(e,s)=>E(e,"name",{value:s,configurable:!0});var v=require("node:fs"),f=require("node:path"),g=require("@sugarcube-org/core"),P=c((e,s)=>(s=Symbol[e])?s:Symbol.for("Symbol."+e),"__knownSymbol"),C=c(e=>{throw TypeError(e)},"__typeError"),y=c((e,s,l)=>{if(s!=null){typeof s!="object"&&typeof s!="function"&&C("Object expected");var t,u;t===void 0&&(t=s[P("dispose")]),typeof t!="function"&&C("Object not disposable"),u&&(t=c(function(){try{u.call(this)}catch(p){return Promise.reject(p)}},"dispose")),e.push([l,t,s])}return s},"__using"),b=c((e,s,l)=>{var t=typeof SuppressedError=="function"?SuppressedError:function(n,d,i,o){return o=Error(i),o.name="SuppressedError",o.error=n,o.suppressed=d,o},u=c(n=>s=l?new t(n,s,"An error was suppressed during disposal"):(l=!0,n),"fail"),p=c(n=>{for(;n=e.pop();)try{var d=n[1]&&n[1].call(n[2]);if(n[0])return Promise.resolve(d).then(p,i=>(u(i),p()))}catch(i){u(i)}if(l)throw s},"next");return p()},"__callDispose");const a=process.env.DEBUG==="true";function U(e){return e&&"source"in e&&Array.isArray(e.source)}c(U,"isSingleCollection");function h(e,s,l=new Set){for(const t of e)if(!t.includes("*")&&v.existsSync(t)){const u=f.resolve(process.cwd(),t);l.has(u)||s.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:u})}else if(t.includes("*")){const u=f.dirname(t),p=f.basename(t);v.existsSync(u)&&s.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:f.resolve(process.cwd(),u),glob:p})}}c(h,"processTokenSources");function A(e,s){if(s.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:f.resolve(process.cwd(),g.SUGARCUBE_CONFIG_FILE)}),!e.tokens)return;const l=e.output?.css||"./src/styles",t=new Set;if(e.output?.separate?t.add(f.resolve(process.cwd(),`${l}/global/variables/colors.variables.css`)):t.add(f.resolve(process.cwd(),`${l}/tokens.css`)),U(e.tokens))h(e.tokens.source,s,t);else for(const[u,p]of Object.entries(e.tokens))p&&"source"in p&&Array.isArray(p.source)&&h(p.source,s,t)}c(A,"registerDependencies");const w=c((e,s,l)=>{const t=l instanceof Error?l.message:String(l);e.warn(`[sugarcube] ${s}${t}`,{plugin:"postcss-sugarcube",word:"error"})},"reportError"),k=c(()=>(console.log("\u{1F3AF} PostCSS Sugarcube plugin is initializing"),{postcssPlugin:"postcss-sugarcube",prepare(e){console.log("\u26A1 PostCSS Sugarcube plugin is preparing..."),e.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:f.resolve(process.cwd(),g.SUGARCUBE_CONFIG_FILE)}),e.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:f.resolve(process.cwd(),"src/design-tokens"),glob:"*.json"});let s=null;const l=c(async()=>{var n=[];try{const o=y(n,new g.Instrumentation);if(a&&o.start("Process Tokens"),!s)throw new Error("Sugarcube config not initialized");a&&o.start("Token Processing Pipeline");const r=await g.tokenProcessingPipeline({type:"files",config:s.config}),S=[...r.errors.load,...r.errors.flatten,...r.errors.validation,...r.errors.resolution];return S.length>0&&w(e,`Token processing issues found:
2
- `,S.map(m=>` - ${m.message}`).join(`
3
- `)),a&&o.end("Token Processing Pipeline"),a&&o.end("Process Tokens"),{resolved:r.resolved,trees:r.trees}}catch(o){var d=o,i=!0}finally{b(n,d,i)}},"processTokens"),t=c(async n=>{var d=[];try{const r=y(d,new g.Instrumentation);if(a&&r.start("Generate and Write CSS Variables"),!s)throw new Error("Sugarcube config not initialized");a&&r.start("CSS Variables Pipeline");const S=await g.generateCSSVariables(n.trees,n.resolved,s.config);a&&r.end("CSS Variables Pipeline"),a&&r.start("Write CSS Variables to Disk"),await g.writeCSSVariablesToDisk(S.output),a&&r.end("Write CSS Variables to Disk"),a&&r.end("Generate and Write CSS Variables")}catch(r){var i=r,o=!0}finally{b(d,i,o)}},"generateAndWriteCSSVariables"),u=c(async n=>{var d=[];try{const r=y(d,new g.Instrumentation);if(a&&r.start("Generate and Write Utilities"),!s)throw new Error("Sugarcube config not initialized");a&&r.start("Generate Utility CSS");const{output:S}=g.generateCSSUtilityClasses(n.resolved,s.config);a&&r.end("Generate Utility CSS"),a&&r.start("Write CSS Utilities to Disk"),await g.writeCSSUtilitiesToDisk(S),a&&r.end("Write CSS Utilities to Disk"),a&&r.end("Generate and Write Utilities")}catch(r){var i=r,o=!0}finally{b(d,i,o)}},"generateAndWriteUtilities"),p=c(async()=>{var n=[];try{const o=y(n,new g.Instrumentation);a&&o.start("Process and Update");try{const r=await l();await t(r),await u(r)}catch(r){w(e,"Sugarcube processing failed",r)}a&&o.end("Process and Update")}catch(o){var d=o,i=!0}finally{b(n,d,i)}},"processAndUpdate");return{async Once(n){if(console.log(" Once called for file:",e.opts.from),!e.opts.from){e.warn("No input file provided to postcss-sugarcube");return}try{const i=n.nodes[0];if(i&&i.type==="comment"&&i.text.includes("AUTOMATICALLY GENERATED FILE"))return;s=await g.loadConfig(),A(s.config,e),await p()}catch(i){w(e,"Sugarcube processing failed",i)}}}}}),"sugarcubePlugin");k.postcss=!0,module.exports=k;
1
+ "use strict";var P=Object.defineProperty;var l=(e,r)=>P(e,"name",{value:r,configurable:!0});var h=require("node:fs"),S=require("node:path"),f=require("@sugarcube-org/core"),A=l((e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),"__knownSymbol"),m=l(e=>{throw TypeError(e)},"__typeError"),b=l((e,r,t)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&m("Object expected");var n,a;n===void 0&&(n=r[A("dispose")]),typeof n!="function"&&m("Object not disposable"),a&&(n=l(function(){try{a.call(this)}catch(g){return Promise.reject(g)}},"dispose")),e.push([t,n,r])}return r},"__using"),v=l((e,r,t)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(c,p,u,i){return i=Error(u),i.name="SuppressedError",i.error=c,i.suppressed=p,i},a=l(c=>r=t?new n(c,r,"An error was suppressed during disposal"):(t=!0,c),"fail"),g=l(c=>{for(;c=e.pop();)try{var p=c[1]&&c[1].call(c[2]);if(c[0])return Promise.resolve(p).then(g,u=>(a(u),g()))}catch(u){a(u)}if(t)throw r},"next");return g()},"__callDispose");const o=process.env.DEBUG==="true";function T(e){return e&&"source"in e&&Array.isArray(e.source)}l(T,"isSingleCollection");function C(e,r,t=new Set){for(const n of e)if(!n.includes("*")&&h.existsSync(n)){const a=S.resolve(process.cwd(),n);t.has(a)||r.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:a})}else if(n.includes("*")){const a=S.dirname(n),g=S.basename(n);h.existsSync(a)&&r.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:S.resolve(process.cwd(),a),glob:g})}}l(C,"processTokenSources");function D(e,r){const t=f.findConfigFile();if(t&&r.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:t}),!e.tokens)return;const n=e.output?.css||"./src/styles",a=new Set;if(e.output?.separate?a.add(S.resolve(process.cwd(),`${n}/global/variables/colors.variables.gen.css`)):a.add(S.resolve(process.cwd(),`${n}/global/variables/tokens.variables.gen.css`)),T(e.tokens))C(e.tokens.source,r,a);else for(const[g,c]of Object.entries(e.tokens))c&&"source"in c&&Array.isArray(c.source)&&C(c.source,r,a)}l(D,"registerDependencies");const k=l((e,r,t)=>{const n=t instanceof Error?t.message:String(t);e.warn(`[sugarcube] ${r}${n}`,{plugin:"postcss-sugarcube",word:"error"})},"reportError"),E=l(()=>(console.log("\u{1F3AF} PostCSS Sugarcube plugin is initializing"),{postcssPlugin:"postcss-sugarcube",prepare(e){console.log("\u26A1 PostCSS Sugarcube plugin is preparing...");const r=f.findConfigFile();r&&e.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:r}),e.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:S.resolve(process.cwd(),"src/design-tokens"),glob:"*.json"});let t=null;const n=l(async()=>{var p=[];try{const d=b(p,new f.Instrumentation);if(o&&d.start("Process Tokens"),!t)throw new Error("Sugarcube config not initialized");o&&d.start("Token Processing Pipeline");const s=await f.loadAndResolveTokens({type:"files",config:t.config}),y=[...s.errors.load,...s.errors.flatten,...s.errors.validation,...s.errors.resolution];return y.length>0&&k(e,`Token processing issues found:
2
+ `,y.map(w=>` - ${w.message}`).join(`
3
+ `)),o&&d.end("Token Processing Pipeline"),o&&d.end("Process Tokens"),{resolved:s.resolved,trees:s.trees}}catch(d){var u=d,i=!0}finally{v(p,u,i)}},"processTokens"),a=l(async p=>{var u=[];try{const s=b(u,new f.Instrumentation);if(o&&s.start("Generate and Write CSS Variables"),!t)throw new Error("Sugarcube config not initialized");o&&s.start("CSS Variables Pipeline");const y=await f.processAndConvertTokens(p.trees,p.resolved,t.config),w=await f.generateCSSVariables(y,t.config);o&&s.end("CSS Variables Pipeline"),o&&s.start("Write CSS Variables to Disk"),await f.writeCSSVariablesToDisk(w),o&&s.end("Write CSS Variables to Disk"),o&&s.end("Generate and Write CSS Variables")}catch(s){var i=s,d=!0}finally{v(u,i,d)}},"generateAndWriteCSSVariables"),g=l(async p=>{var u=[];try{const s=b(u,new f.Instrumentation);if(o&&s.start("Generate and Write Utilities"),!t)throw new Error("Sugarcube config not initialized");o&&s.start("Scan for used classes"),o&&s.end("Scan for used classes"),o&&s.start("Generate Utility CSS"),o&&s.end("Generate Utility CSS"),o&&s.start("Write CSS Utilities to Disk"),o&&s.end("Write CSS Utilities to Disk"),o&&s.end("Generate and Write Utilities")}catch(s){var i=s,d=!0}finally{v(u,i,d)}},"generateAndWriteUtilities"),c=l(async()=>{var p=[];try{const d=b(p,new f.Instrumentation);o&&d.start("Process and Update");try{const s=await n();await a(s),await g(s)}catch(s){k(e,"Sugarcube processing failed",s)}o&&d.end("Process and Update")}catch(d){var u=d,i=!0}finally{v(p,u,i)}},"processAndUpdate");return{async Once(p){if(console.log(" Once called for file:",e.opts.from),!e.opts.from){e.warn("No input file provided to postcss-sugarcube");return}try{const i=p.nodes[0];if(i&&i.type==="comment"&&i.text.includes("AUTOMATICALLY GENERATED FILE"))return;t=await f.loadInternalConfig(),D(t.config,e),await c()}catch(i){k(e,"Sugarcube processing failed",i)}}}}}),"sugarcubePlugin");E.postcss=!0,module.exports=E;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- var U=Object.defineProperty;var c=(s,e)=>U(s,"name",{value:e,configurable:!0});var A=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);import v from"node:fs";import f from"node:path";import{SUGARCUBE_CONFIG_FILE as m,loadConfig as _,Instrumentation as S,tokenProcessingPipeline as D,generateCSSVariables as T,writeCSSVariablesToDisk as G,generateCSSUtilityClasses as W,writeCSSUtilitiesToDisk as I}from"@sugarcube-org/core";var O=A((z,E)=>{var V=c((s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s),"__knownSymbol"),h=c(s=>{throw TypeError(s)},"__typeError"),y=c((s,e,l)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&h("Object expected");var t,u;t===void 0&&(t=e[V("dispose")]),typeof t!="function"&&h("Object not disposable"),u&&(t=c(function(){try{u.call(this)}catch(p){return Promise.reject(p)}},"dispose")),s.push([l,t,e])}return e},"__using"),b=c((s,e,l)=>{var t=typeof SuppressedError=="function"?SuppressedError:function(n,d,i,o){return o=Error(i),o.name="SuppressedError",o.error=n,o.suppressed=d,o},u=c(n=>e=l?new t(n,e,"An error was suppressed during disposal"):(l=!0,n),"fail"),p=c(n=>{for(;n=s.pop();)try{var d=n[1]&&n[1].call(n[2]);if(n[0])return Promise.resolve(d).then(p,i=>(u(i),p()))}catch(i){u(i)}if(l)throw e},"next");return p()},"__callDispose");const a=process.env.DEBUG==="true";function F(s){return s&&"source"in s&&Array.isArray(s.source)}c(F,"isSingleCollection");function k(s,e,l=new Set){for(const t of s)if(!t.includes("*")&&v.existsSync(t)){const u=f.resolve(process.cwd(),t);l.has(u)||e.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:u})}else if(t.includes("*")){const u=f.dirname(t),p=f.basename(t);v.existsSync(u)&&e.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:f.resolve(process.cwd(),u),glob:p})}}c(k,"processTokenSources");function j(s,e){if(e.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:f.resolve(process.cwd(),m)}),!s.tokens)return;const l=s.output?.css||"./src/styles",t=new Set;if(s.output?.separate?t.add(f.resolve(process.cwd(),`${l}/global/variables/colors.variables.css`)):t.add(f.resolve(process.cwd(),`${l}/tokens.css`)),F(s.tokens))k(s.tokens.source,e,t);else for(const[u,p]of Object.entries(s.tokens))p&&"source"in p&&Array.isArray(p.source)&&k(p.source,e,t)}c(j,"registerDependencies");const w=c((s,e,l)=>{const t=l instanceof Error?l.message:String(l);s.warn(`[sugarcube] ${e}${t}`,{plugin:"postcss-sugarcube",word:"error"})},"reportError"),C=c(()=>(console.log("\u{1F3AF} PostCSS Sugarcube plugin is initializing"),{postcssPlugin:"postcss-sugarcube",prepare(s){console.log("\u26A1 PostCSS Sugarcube plugin is preparing..."),s.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:f.resolve(process.cwd(),m)}),s.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:f.resolve(process.cwd(),"src/design-tokens"),glob:"*.json"});let e=null;const l=c(async()=>{var n=[];try{const o=y(n,new S);if(a&&o.start("Process Tokens"),!e)throw new Error("Sugarcube config not initialized");a&&o.start("Token Processing Pipeline");const r=await D({type:"files",config:e.config}),g=[...r.errors.load,...r.errors.flatten,...r.errors.validation,...r.errors.resolution];return g.length>0&&w(s,`Token processing issues found:
2
- `,g.map(P=>` - ${P.message}`).join(`
3
- `)),a&&o.end("Token Processing Pipeline"),a&&o.end("Process Tokens"),{resolved:r.resolved,trees:r.trees}}catch(o){var d=o,i=!0}finally{b(n,d,i)}},"processTokens"),t=c(async n=>{var d=[];try{const r=y(d,new S);if(a&&r.start("Generate and Write CSS Variables"),!e)throw new Error("Sugarcube config not initialized");a&&r.start("CSS Variables Pipeline");const g=await T(n.trees,n.resolved,e.config);a&&r.end("CSS Variables Pipeline"),a&&r.start("Write CSS Variables to Disk"),await G(g.output),a&&r.end("Write CSS Variables to Disk"),a&&r.end("Generate and Write CSS Variables")}catch(r){var i=r,o=!0}finally{b(d,i,o)}},"generateAndWriteCSSVariables"),u=c(async n=>{var d=[];try{const r=y(d,new S);if(a&&r.start("Generate and Write Utilities"),!e)throw new Error("Sugarcube config not initialized");a&&r.start("Generate Utility CSS");const{output:g}=W(n.resolved,e.config);a&&r.end("Generate Utility CSS"),a&&r.start("Write CSS Utilities to Disk"),await I(g),a&&r.end("Write CSS Utilities to Disk"),a&&r.end("Generate and Write Utilities")}catch(r){var i=r,o=!0}finally{b(d,i,o)}},"generateAndWriteUtilities"),p=c(async()=>{var n=[];try{const o=y(n,new S);a&&o.start("Process and Update");try{const r=await l();await t(r),await u(r)}catch(r){w(s,"Sugarcube processing failed",r)}a&&o.end("Process and Update")}catch(o){var d=o,i=!0}finally{b(n,d,i)}},"processAndUpdate");return{async Once(n){if(console.log(" Once called for file:",s.opts.from),!s.opts.from){s.warn("No input file provided to postcss-sugarcube");return}try{const i=n.nodes[0];if(i&&i.type==="comment"&&i.text.includes("AUTOMATICALLY GENERATED FILE"))return;e=await _(),j(e.config,s),await p()}catch(i){w(s,"Sugarcube processing failed",i)}}}}}),"sugarcubePlugin");C.postcss=!0,E.exports=C});export default O();
1
+ var T=Object.defineProperty;var l=(e,s)=>T(e,"name",{value:s,configurable:!0});var D=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports);import k from"node:fs";import g from"node:path";import{findConfigFile as h,loadInternalConfig as U,Instrumentation as y,loadAndResolveTokens as _,processAndConvertTokens as W,generateCSSVariables as F,writeCSSVariablesToDisk as G}from"@sugarcube-org/core";var x=D((N,A)=>{var V=l((e,s)=>(s=Symbol[e])?s:Symbol.for("Symbol."+e),"__knownSymbol"),C=l(e=>{throw TypeError(e)},"__typeError"),b=l((e,s,t)=>{if(s!=null){typeof s!="object"&&typeof s!="function"&&C("Object expected");var n,a;n===void 0&&(n=s[V("dispose")]),typeof n!="function"&&C("Object not disposable"),a&&(n=l(function(){try{a.call(this)}catch(f){return Promise.reject(f)}},"dispose")),e.push([t,n,s])}return s},"__using"),w=l((e,s,t)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(c,p,u,i){return i=Error(u),i.name="SuppressedError",i.error=c,i.suppressed=p,i},a=l(c=>s=t?new n(c,s,"An error was suppressed during disposal"):(t=!0,c),"fail"),f=l(c=>{for(;c=e.pop();)try{var p=c[1]&&c[1].call(c[2]);if(c[0])return Promise.resolve(p).then(f,u=>(a(u),f()))}catch(u){a(u)}if(t)throw s},"next");return f()},"__callDispose");const o=process.env.DEBUG==="true";function I(e){return e&&"source"in e&&Array.isArray(e.source)}l(I,"isSingleCollection");function E(e,s,t=new Set){for(const n of e)if(!n.includes("*")&&k.existsSync(n)){const a=g.resolve(process.cwd(),n);t.has(a)||s.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:a})}else if(n.includes("*")){const a=g.dirname(n),f=g.basename(n);k.existsSync(a)&&s.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:g.resolve(process.cwd(),a),glob:f})}}l(E,"processTokenSources");function j(e,s){const t=h();if(t&&s.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:t}),!e.tokens)return;const n=e.output?.css||"./src/styles",a=new Set;if(e.output?.separate?a.add(g.resolve(process.cwd(),`${n}/global/variables/colors.variables.gen.css`)):a.add(g.resolve(process.cwd(),`${n}/global/variables/tokens.variables.gen.css`)),I(e.tokens))E(e.tokens.source,s,a);else for(const[f,c]of Object.entries(e.tokens))c&&"source"in c&&Array.isArray(c.source)&&E(c.source,s,a)}l(j,"registerDependencies");const m=l((e,s,t)=>{const n=t instanceof Error?t.message:String(t);e.warn(`[sugarcube] ${s}${n}`,{plugin:"postcss-sugarcube",word:"error"})},"reportError"),P=l(()=>(console.log("\u{1F3AF} PostCSS Sugarcube plugin is initializing"),{postcssPlugin:"postcss-sugarcube",prepare(e){console.log("\u26A1 PostCSS Sugarcube plugin is preparing...");const s=h();s&&e.messages.push({type:"dependency",plugin:"postcss-sugarcube",file:s}),e.messages.push({type:"dir-dependency",plugin:"postcss-sugarcube",dir:g.resolve(process.cwd(),"src/design-tokens"),glob:"*.json"});let t=null;const n=l(async()=>{var p=[];try{const d=b(p,new y);if(o&&d.start("Process Tokens"),!t)throw new Error("Sugarcube config not initialized");o&&d.start("Token Processing Pipeline");const r=await _({type:"files",config:t.config}),S=[...r.errors.load,...r.errors.flatten,...r.errors.validation,...r.errors.resolution];return S.length>0&&m(e,`Token processing issues found:
2
+ `,S.map(v=>` - ${v.message}`).join(`
3
+ `)),o&&d.end("Token Processing Pipeline"),o&&d.end("Process Tokens"),{resolved:r.resolved,trees:r.trees}}catch(d){var u=d,i=!0}finally{w(p,u,i)}},"processTokens"),a=l(async p=>{var u=[];try{const r=b(u,new y);if(o&&r.start("Generate and Write CSS Variables"),!t)throw new Error("Sugarcube config not initialized");o&&r.start("CSS Variables Pipeline");const S=await W(p.trees,p.resolved,t.config),v=await F(S,t.config);o&&r.end("CSS Variables Pipeline"),o&&r.start("Write CSS Variables to Disk"),await G(v),o&&r.end("Write CSS Variables to Disk"),o&&r.end("Generate and Write CSS Variables")}catch(r){var i=r,d=!0}finally{w(u,i,d)}},"generateAndWriteCSSVariables"),f=l(async p=>{var u=[];try{const r=b(u,new y);if(o&&r.start("Generate and Write Utilities"),!t)throw new Error("Sugarcube config not initialized");o&&r.start("Scan for used classes"),o&&r.end("Scan for used classes"),o&&r.start("Generate Utility CSS"),o&&r.end("Generate Utility CSS"),o&&r.start("Write CSS Utilities to Disk"),o&&r.end("Write CSS Utilities to Disk"),o&&r.end("Generate and Write Utilities")}catch(r){var i=r,d=!0}finally{w(u,i,d)}},"generateAndWriteUtilities"),c=l(async()=>{var p=[];try{const d=b(p,new y);o&&d.start("Process and Update");try{const r=await n();await a(r),await f(r)}catch(r){m(e,"Sugarcube processing failed",r)}o&&d.end("Process and Update")}catch(d){var u=d,i=!0}finally{w(p,u,i)}},"processAndUpdate");return{async Once(p){if(console.log(" Once called for file:",e.opts.from),!e.opts.from){e.warn("No input file provided to postcss-sugarcube");return}try{const i=p.nodes[0];if(i&&i.type==="comment"&&i.text.includes("AUTOMATICALLY GENERATED FILE"))return;t=await U(),j(t.config,e),await c()}catch(i){m(e,"Sugarcube processing failed",i)}}}}}),"sugarcubePlugin");P.postcss=!0,A.exports=P});export default x();
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@sugarcube-org/postcss",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.4",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "provenance": false
7
+ },
4
8
  "description": "PostCSS plugin for sugarcube",
5
- "license": "UNLICENSED",
9
+ "license": "SEE LICENSE IN LICENSE.md",
6
10
  "author": "Mark Tomlinson",
7
11
  "repository": {
8
12
  "type": "git",
@@ -19,18 +23,20 @@
19
23
  }
20
24
  },
21
25
  "files": [
22
- "dist/"
26
+ "dist/",
27
+ "README.md",
28
+ "LICENSE.md"
23
29
  ],
24
30
  "dependencies": {
25
- "@sugarcube-org/core": "0.0.1-alpha.6"
31
+ "@sugarcube-org/core": "0.0.1-alpha.7"
26
32
  },
27
33
  "peerDependencies": {
28
34
  "postcss": "^8.4.0"
29
35
  },
30
36
  "devDependencies": {
31
- "pkgroll": "^2.5.1",
32
- "postcss": "^8.4.31",
33
- "tsx": "^4.19.2"
37
+ "pkgroll": "2.5.1",
38
+ "postcss": "8.4.31",
39
+ "tsx": "4.19.2"
34
40
  },
35
41
  "scripts": {
36
42
  "build": "pkgroll --minify",