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

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 ADDED
@@ -0,0 +1,9 @@
1
+ # Proprietary Software
2
+
3
+ This software is proprietary and confidential. All rights reserved.
4
+
5
+ Copyright (c) 2025 Mark Tomlinson
6
+
7
+ This software is provided "as is" without warranty of any kind, either express or implied.
8
+
9
+ Unauthorized copying, distribution, or use of this software is strictly prohibited.
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @sugarcube-org/postcss
2
+
3
+ PostCSS plugin for sugarcube CSS generation.
4
+
5
+ ## What it does
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
+ ```
package/dist/index.cjs CHANGED
@@ -1,133 +1,3 @@
1
- 'use strict';
2
-
3
- var fs = require('node:fs');
4
- var path = require('node:path');
5
- var core = require('@sugarcube-org/core');
6
-
7
- function isSingleCollection(tokens) {
8
- return tokens && "source" in tokens && Array.isArray(tokens.source);
9
- }
10
- function processTokenSources(sources, result, outputFiles = /* @__PURE__ */ new Set()) {
11
- for (const source of sources) {
12
- if (!source.includes("*") && fs.existsSync(source)) {
13
- const resolvedPath = path.resolve(process.cwd(), source);
14
- if (!outputFiles.has(resolvedPath)) {
15
- result.messages.push({
16
- type: "dependency",
17
- plugin: "postcss-sugarcube",
18
- file: resolvedPath
19
- });
20
- }
21
- } else if (source.includes("*")) {
22
- const sourceDir = path.dirname(source);
23
- const pattern = path.basename(source);
24
- if (fs.existsSync(sourceDir)) {
25
- result.messages.push({
26
- type: "dir-dependency",
27
- plugin: "postcss-sugarcube",
28
- dir: path.resolve(process.cwd(), sourceDir),
29
- glob: pattern
30
- });
31
- }
32
- }
33
- }
34
- }
35
- function registerDependencies(config, result) {
36
- result.messages.push({
37
- type: "dependency",
38
- plugin: "postcss-sugarcube",
39
- file: path.resolve(process.cwd(), "sugarcube.config.json")
40
- });
41
- if (!config.tokens) return;
42
- const outputDir = config.output?.directories?.css || "./src/styles";
43
- const outputFiles = /* @__PURE__ */ new Set();
44
- if (config.output?.css?.separate) {
45
- outputFiles.add(
46
- path.resolve(process.cwd(), `${outputDir}/global/variables/colors.variables.css`)
47
- );
48
- } else {
49
- outputFiles.add(path.resolve(process.cwd(), `${outputDir}/tokens.css`));
50
- }
51
- if (isSingleCollection(config.tokens)) {
52
- processTokenSources(config.tokens.source, result, outputFiles);
53
- } else {
54
- for (const [collectionName, collection] of Object.entries(config.tokens)) {
55
- if (collection && "source" in collection && Array.isArray(collection.source)) {
56
- processTokenSources(collection.source, result, outputFiles);
57
- }
58
- }
59
- }
60
- }
61
- function formatErrors(errors) {
62
- const fileErrors = errors.filter((err) => err.file || err.source?.sourcePath);
63
- const otherErrors = errors.filter(
64
- (err) => !err.file && (!err.source || !err.source.sourcePath)
65
- );
66
- const messages = [];
67
- for (const err of fileErrors) {
68
- const file = err.file || err.source?.sourcePath;
69
- if (!file) continue;
70
- const relativeFile = path.relative(process.cwd(), file);
71
- const errMessage = err.message.replace(file, relativeFile);
72
- messages.push(errMessage);
73
- }
74
- for (const err of otherErrors) {
75
- messages.push(err.message);
76
- }
77
- return messages.join("\n - ");
78
- }
79
- let lastMessageTime = 0;
80
- const sugarcubePlugin = (opts = {}) => {
81
- return {
82
- postcssPlugin: "postcss-sugarcube",
83
- async Once(root, { result }) {
84
- const currentFile = result.opts.from;
85
- if (!currentFile) {
86
- result.warn("No input file provided to postcss-sugarcube");
87
- return;
88
- }
89
- try {
90
- const firstNode = root.nodes[0];
91
- if (firstNode && firstNode.type === "comment" && firstNode.text.includes("AUTOMATICALLY GENERATED FILE")) {
92
- return;
93
- }
94
- const config = await core.loadConfig();
95
- registerDependencies(config, result);
96
- const pipelineResult = await core.tokensToCSSPipeline(config);
97
- const allErrors = [
98
- ...pipelineResult.errors.load,
99
- ...pipelineResult.errors.flatten,
100
- ...pipelineResult.errors.validation,
101
- ...pipelineResult.errors.resolution
102
- ];
103
- if (allErrors.length > 0) {
104
- result.warn(`Token validation failed:
105
- - ${formatErrors(allErrors)}`, {
106
- plugin: "postcss-sugarcube",
107
- word: "error"
108
- });
109
- return;
110
- }
111
- const tokenPaths = core.getTokenPathsFromConfig(config);
112
- await core.writeCSSFilesToDisk(pipelineResult.output, true, tokenPaths);
113
- const now = Date.now();
114
- if (!opts.silent && now - lastMessageTime > 1e3) {
115
- result.messages.push({
116
- type: "log",
117
- plugin: "postcss-sugarcube",
118
- text: "\u2728 Generated CSS files from tokens"
119
- });
120
- lastMessageTime = now;
121
- }
122
- } catch (error) {
123
- result.warn(error instanceof Error ? error.message : String(error), {
124
- plugin: "postcss-sugarcube",
125
- word: "error"
126
- });
127
- }
128
- }
129
- };
130
- };
131
- sugarcubePlugin.postcss = true;
132
-
133
- module.exports = sugarcubePlugin;
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;
package/dist/index.d.cts CHANGED
@@ -5,6 +5,6 @@ interface PostcssSugarcubeOptions {
5
5
  validateOnly?: boolean;
6
6
  checkSync?: boolean;
7
7
  }
8
- declare const sugarcubePlugin: PluginCreator<PostcssSugarcubeOptions>;
8
+ declare const sugarcubePlugin: PluginCreator<Record<string, unknown>>;
9
9
 
10
10
  export { type PostcssSugarcubeOptions, sugarcubePlugin as default };
package/dist/index.d.mts CHANGED
@@ -5,6 +5,6 @@ interface PostcssSugarcubeOptions {
5
5
  validateOnly?: boolean;
6
6
  checkSync?: boolean;
7
7
  }
8
- declare const sugarcubePlugin: PluginCreator<PostcssSugarcubeOptions>;
8
+ declare const sugarcubePlugin: PluginCreator<Record<string, unknown>>;
9
9
 
10
10
  export { type PostcssSugarcubeOptions, sugarcubePlugin as default };
package/dist/index.mjs CHANGED
@@ -1,131 +1,3 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { loadConfig, tokensToCSSPipeline, getTokenPathsFromConfig, writeCSSFilesToDisk } from '@sugarcube-org/core';
4
-
5
- function isSingleCollection(tokens) {
6
- return tokens && "source" in tokens && Array.isArray(tokens.source);
7
- }
8
- function processTokenSources(sources, result, outputFiles = /* @__PURE__ */ new Set()) {
9
- for (const source of sources) {
10
- if (!source.includes("*") && fs.existsSync(source)) {
11
- const resolvedPath = path.resolve(process.cwd(), source);
12
- if (!outputFiles.has(resolvedPath)) {
13
- result.messages.push({
14
- type: "dependency",
15
- plugin: "postcss-sugarcube",
16
- file: resolvedPath
17
- });
18
- }
19
- } else if (source.includes("*")) {
20
- const sourceDir = path.dirname(source);
21
- const pattern = path.basename(source);
22
- if (fs.existsSync(sourceDir)) {
23
- result.messages.push({
24
- type: "dir-dependency",
25
- plugin: "postcss-sugarcube",
26
- dir: path.resolve(process.cwd(), sourceDir),
27
- glob: pattern
28
- });
29
- }
30
- }
31
- }
32
- }
33
- function registerDependencies(config, result) {
34
- result.messages.push({
35
- type: "dependency",
36
- plugin: "postcss-sugarcube",
37
- file: path.resolve(process.cwd(), "sugarcube.config.json")
38
- });
39
- if (!config.tokens) return;
40
- const outputDir = config.output?.directories?.css || "./src/styles";
41
- const outputFiles = /* @__PURE__ */ new Set();
42
- if (config.output?.css?.separate) {
43
- outputFiles.add(
44
- path.resolve(process.cwd(), `${outputDir}/global/variables/colors.variables.css`)
45
- );
46
- } else {
47
- outputFiles.add(path.resolve(process.cwd(), `${outputDir}/tokens.css`));
48
- }
49
- if (isSingleCollection(config.tokens)) {
50
- processTokenSources(config.tokens.source, result, outputFiles);
51
- } else {
52
- for (const [collectionName, collection] of Object.entries(config.tokens)) {
53
- if (collection && "source" in collection && Array.isArray(collection.source)) {
54
- processTokenSources(collection.source, result, outputFiles);
55
- }
56
- }
57
- }
58
- }
59
- function formatErrors(errors) {
60
- const fileErrors = errors.filter((err) => err.file || err.source?.sourcePath);
61
- const otherErrors = errors.filter(
62
- (err) => !err.file && (!err.source || !err.source.sourcePath)
63
- );
64
- const messages = [];
65
- for (const err of fileErrors) {
66
- const file = err.file || err.source?.sourcePath;
67
- if (!file) continue;
68
- const relativeFile = path.relative(process.cwd(), file);
69
- const errMessage = err.message.replace(file, relativeFile);
70
- messages.push(errMessage);
71
- }
72
- for (const err of otherErrors) {
73
- messages.push(err.message);
74
- }
75
- return messages.join("\n - ");
76
- }
77
- let lastMessageTime = 0;
78
- const sugarcubePlugin = (opts = {}) => {
79
- return {
80
- postcssPlugin: "postcss-sugarcube",
81
- async Once(root, { result }) {
82
- const currentFile = result.opts.from;
83
- if (!currentFile) {
84
- result.warn("No input file provided to postcss-sugarcube");
85
- return;
86
- }
87
- try {
88
- const firstNode = root.nodes[0];
89
- if (firstNode && firstNode.type === "comment" && firstNode.text.includes("AUTOMATICALLY GENERATED FILE")) {
90
- return;
91
- }
92
- const config = await loadConfig();
93
- registerDependencies(config, result);
94
- const pipelineResult = await tokensToCSSPipeline(config);
95
- const allErrors = [
96
- ...pipelineResult.errors.load,
97
- ...pipelineResult.errors.flatten,
98
- ...pipelineResult.errors.validation,
99
- ...pipelineResult.errors.resolution
100
- ];
101
- if (allErrors.length > 0) {
102
- result.warn(`Token validation failed:
103
- - ${formatErrors(allErrors)}`, {
104
- plugin: "postcss-sugarcube",
105
- word: "error"
106
- });
107
- return;
108
- }
109
- const tokenPaths = getTokenPathsFromConfig(config);
110
- await writeCSSFilesToDisk(pipelineResult.output, true, tokenPaths);
111
- const now = Date.now();
112
- if (!opts.silent && now - lastMessageTime > 1e3) {
113
- result.messages.push({
114
- type: "log",
115
- plugin: "postcss-sugarcube",
116
- text: "\u2728 Generated CSS files from tokens"
117
- });
118
- lastMessageTime = now;
119
- }
120
- } catch (error) {
121
- result.warn(error instanceof Error ? error.message : String(error), {
122
- plugin: "postcss-sugarcube",
123
- word: "error"
124
- });
125
- }
126
- }
127
- };
128
- };
129
- sugarcubePlugin.postcss = true;
130
-
131
- module.exports = sugarcubePlugin;
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();
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@sugarcube-org/postcss",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.3",
4
+ "description": "PostCSS plugin for sugarcube",
5
+ "license": "UNLICENSED",
6
+ "author": "Mark Tomlinson",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/sugarcube-org/sugarcube"
10
+ },
4
11
  "exports": {
5
12
  "require": {
6
13
  "types": "./dist/index.d.cts",
@@ -15,7 +22,7 @@
15
22
  "dist/"
16
23
  ],
17
24
  "dependencies": {
18
- "@sugarcube-org/core": "0.0.1-alpha.4"
25
+ "@sugarcube-org/core": "0.0.1-alpha.6"
19
26
  },
20
27
  "peerDependencies": {
21
28
  "postcss": "^8.4.0"
@@ -26,7 +33,7 @@
26
33
  "tsx": "^4.19.2"
27
34
  },
28
35
  "scripts": {
29
- "build": "pkgroll",
36
+ "build": "pkgroll --minify",
30
37
  "dev": "pkgroll --watch",
31
38
  "type-check": "tsc --noEmit"
32
39
  }