@getkist/action-postcss 1.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kist
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # @getkist/action-postcss
2
+
3
+ PostCSS processing actions for kist with autoprefixer and cssnano support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @getkist/action-postcss
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### As a kist plugin
14
+
15
+ ```yaml
16
+ # kist.yml
17
+ plugins:
18
+ - "@getkist/action-postcss"
19
+
20
+ pipeline:
21
+ - action: PostCssAction
22
+ options:
23
+ inputPath: "dist/css/styles.css"
24
+ outputPath: "dist/css/styles.min.css"
25
+ autoprefixer: true
26
+ minify: true
27
+ ```
28
+
29
+ ### Standalone usage
30
+
31
+ ```typescript
32
+ import { PostCssAction } from "@getkist/action-postcss";
33
+
34
+ const action = new PostCssAction();
35
+ await action.execute({
36
+ inputPath: "dist/css/styles.css",
37
+ outputPath: "dist/css/styles.min.css",
38
+ autoprefixer: true,
39
+ browsers: ["> 1%", "last 2 versions", "not dead"],
40
+ minify: true,
41
+ sourcemap: true
42
+ });
43
+ ```
44
+
45
+ ## Actions
46
+
47
+ ### PostCssAction
48
+
49
+ Processes CSS files using PostCSS with autoprefixer and cssnano support.
50
+
51
+ #### Options
52
+
53
+ | Option | Type | Default | Description |
54
+ |--------|------|---------|-------------|
55
+ | `inputPath` | `string` | *required* | Path to the input CSS file |
56
+ | `outputPath` | `string` | *required* | Path where the processed CSS will be saved |
57
+ | `autoprefixer` | `boolean` | `true` | Enable autoprefixer |
58
+ | `browsers` | `string[]` | `["> 1%", "last 2 versions", "not dead"]` | Autoprefixer browser targets |
59
+ | `minify` | `boolean` | `false` | Enable minification with cssnano |
60
+ | `cssnanoPreset` | `"default" \| "lite" \| "advanced"` | `"default"` | cssnano preset |
61
+ | `sourcemap` | `boolean` | `false` | Generate sourcemap |
62
+ | `inlineSourcemap` | `boolean` | `false` | Inline sourcemap instead of external file |
63
+ | `plugins` | `AcceptedPlugin[]` | `[]` | Additional PostCSS plugins |
64
+
65
+ ## Configuration Examples
66
+
67
+ ### Add vendor prefixes only
68
+
69
+ ```yaml
70
+ - action: PostCssAction
71
+ options:
72
+ inputPath: "src/css/main.css"
73
+ outputPath: "dist/css/main.css"
74
+ autoprefixer: true
75
+ minify: false
76
+ ```
77
+
78
+ ### Minify CSS for production
79
+
80
+ ```yaml
81
+ - action: PostCssAction
82
+ options:
83
+ inputPath: "dist/css/styles.css"
84
+ outputPath: "dist/css/styles.min.css"
85
+ autoprefixer: true
86
+ minify: true
87
+ cssnanoPreset: "advanced"
88
+ ```
89
+
90
+ ### Generate external sourcemap
91
+
92
+ ```yaml
93
+ - action: PostCssAction
94
+ options:
95
+ inputPath: "src/css/app.css"
96
+ outputPath: "dist/css/app.css"
97
+ autoprefixer: true
98
+ minify: true
99
+ sourcemap: true
100
+ inlineSourcemap: false
101
+ ```
102
+
103
+ ### Custom browser targets
104
+
105
+ ```yaml
106
+ - action: PostCssAction
107
+ options:
108
+ inputPath: "src/css/modern.css"
109
+ outputPath: "dist/css/modern.css"
110
+ autoprefixer: true
111
+ browsers:
112
+ - "last 1 Chrome version"
113
+ - "last 1 Firefox version"
114
+ - "last 1 Safari version"
115
+ ```
116
+
117
+ ### Use with custom PostCSS plugins
118
+
119
+ ```typescript
120
+ import { PostCssAction } from "@getkist/action-postcss";
121
+ import postcssNested from "postcss-nested";
122
+ import postcssCustomProperties from "postcss-custom-properties";
123
+
124
+ const action = new PostCssAction();
125
+ await action.execute({
126
+ inputPath: "src/css/app.css",
127
+ outputPath: "dist/css/app.css",
128
+ plugins: [
129
+ postcssNested(),
130
+ postcssCustomProperties({ preserve: false })
131
+ ]
132
+ });
133
+ ```
134
+
135
+ ## License
136
+
137
+ MIT
@@ -0,0 +1,53 @@
1
+ import { AcceptedPlugin } from "postcss";
2
+ import { Action, ActionOptionsType } from "../../types/Action.js";
3
+ /**
4
+ * Options for the PostCssAction
5
+ */
6
+ export interface PostCssActionOptions extends ActionOptionsType {
7
+ /** Path to the input CSS file */
8
+ inputPath: string;
9
+ /** Path where the processed CSS will be saved */
10
+ outputPath: string;
11
+ /** Enable autoprefixer (default: true) */
12
+ autoprefixer?: boolean;
13
+ /** Autoprefixer browser targets */
14
+ browsers?: string[];
15
+ /** Enable minification with cssnano (default: false) */
16
+ minify?: boolean;
17
+ /** cssnano preset (default: default) */
18
+ cssnanoPreset?: "default" | "lite" | "advanced";
19
+ /** Generate sourcemap (default: false) */
20
+ sourcemap?: boolean;
21
+ /** Inline sourcemap instead of external file (default: false) */
22
+ inlineSourcemap?: boolean;
23
+ /** Additional PostCSS plugins */
24
+ plugins?: AcceptedPlugin[];
25
+ }
26
+ /**
27
+ * PostCssAction handles CSS processing using PostCSS.
28
+ * Supports autoprefixer, cssnano minification, and custom plugins.
29
+ */
30
+ export declare class PostCssAction extends Action<PostCssActionOptions> {
31
+ /**
32
+ * Validates the action options.
33
+ *
34
+ * @param options - The options to validate.
35
+ * @returns True if options are valid.
36
+ */
37
+ validateOptions(options: PostCssActionOptions): boolean;
38
+ /**
39
+ * Executes the PostCSS processing action.
40
+ *
41
+ * @param options - The options for CSS processing.
42
+ * @returns A Promise that resolves when processing completes.
43
+ * @throws {Error} If processing encounters an error.
44
+ */
45
+ execute(options: PostCssActionOptions): Promise<void>;
46
+ /**
47
+ * Provides a description of the action.
48
+ *
49
+ * @returns A string description of the action.
50
+ */
51
+ describe(): string;
52
+ }
53
+ //# sourceMappingURL=PostCssAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostCssAction.d.ts","sourceRoot":"","sources":["../../../src/actions/PostCssAction/PostCssAction.ts"],"names":[],"mappings":"AAMA,OAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMlE;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,aAAa,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IAChD,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iCAAiC;IACjC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAMD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,MAAM,CAAC,oBAAoB,CAAC;IAC3D;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO;IA2BvD;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6E3D;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
@@ -0,0 +1,121 @@
1
+ // ============================================================================
2
+ // Import
3
+ // ============================================================================
4
+ import { promises as fs } from "fs";
5
+ import path from "path";
6
+ import postcss from "postcss";
7
+ import autoprefixer from "autoprefixer";
8
+ import cssnano from "cssnano";
9
+ import { Action } from "../../types/Action.js";
10
+ // ============================================================================
11
+ // Classes
12
+ // ============================================================================
13
+ /**
14
+ * PostCssAction handles CSS processing using PostCSS.
15
+ * Supports autoprefixer, cssnano minification, and custom plugins.
16
+ */
17
+ export class PostCssAction extends Action {
18
+ /**
19
+ * Validates the action options.
20
+ *
21
+ * @param options - The options to validate.
22
+ * @returns True if options are valid.
23
+ */
24
+ validateOptions(options) {
25
+ if (!options.inputPath || typeof options.inputPath !== "string") {
26
+ this.logError("Invalid options: 'inputPath' is required and must be a string.");
27
+ return false;
28
+ }
29
+ if (!options.outputPath || typeof options.outputPath !== "string") {
30
+ this.logError("Invalid options: 'outputPath' is required and must be a string.");
31
+ return false;
32
+ }
33
+ if (options.autoprefixer !== undefined && typeof options.autoprefixer !== "boolean") {
34
+ this.logError("Invalid options: 'autoprefixer' must be a boolean.");
35
+ return false;
36
+ }
37
+ if (options.minify !== undefined && typeof options.minify !== "boolean") {
38
+ this.logError("Invalid options: 'minify' must be a boolean.");
39
+ return false;
40
+ }
41
+ if (options.cssnanoPreset !== undefined) {
42
+ const validPresets = ["default", "lite", "advanced"];
43
+ if (!validPresets.includes(options.cssnanoPreset)) {
44
+ this.logError(`Invalid options: 'cssnanoPreset' must be one of: ${validPresets.join(", ")}`);
45
+ return false;
46
+ }
47
+ }
48
+ return true;
49
+ }
50
+ /**
51
+ * Executes the PostCSS processing action.
52
+ *
53
+ * @param options - The options for CSS processing.
54
+ * @returns A Promise that resolves when processing completes.
55
+ * @throws {Error} If processing encounters an error.
56
+ */
57
+ async execute(options) {
58
+ if (!this.validateOptions(options)) {
59
+ throw new Error("Invalid options provided to PostCssAction.");
60
+ }
61
+ const { inputPath, outputPath, autoprefixer: useAutoprefixer = true, browsers = ["> 1%", "last 2 versions", "not dead"], minify = false, cssnanoPreset = "default", sourcemap = false, inlineSourcemap = false, plugins: customPlugins = [], } = options;
62
+ this.logInfo(`Processing CSS: ${inputPath} → ${outputPath}`);
63
+ try {
64
+ const resolvedInputPath = path.resolve(inputPath);
65
+ const resolvedOutputPath = path.resolve(outputPath);
66
+ // Read input CSS
67
+ const inputCss = await fs.readFile(resolvedInputPath, "utf8");
68
+ // Build plugin list
69
+ const plugins = [];
70
+ if (useAutoprefixer) {
71
+ plugins.push(autoprefixer({ overrideBrowserslist: browsers }));
72
+ }
73
+ if (minify) {
74
+ plugins.push(cssnano({ preset: cssnanoPreset }));
75
+ }
76
+ // Add custom plugins
77
+ plugins.push(...customPlugins);
78
+ // Process with PostCSS
79
+ const result = await postcss(plugins).process(inputCss, {
80
+ from: resolvedInputPath,
81
+ to: resolvedOutputPath,
82
+ map: sourcemap ? { inline: inlineSourcemap } : false,
83
+ });
84
+ // Ensure output directory exists
85
+ const outputDir = path.dirname(resolvedOutputPath);
86
+ await fs.mkdir(outputDir, { recursive: true });
87
+ // Write output CSS
88
+ await fs.writeFile(resolvedOutputPath, result.css, "utf8");
89
+ // Write sourcemap if external
90
+ if (sourcemap && !inlineSourcemap && result.map) {
91
+ await fs.writeFile(`${resolvedOutputPath}.map`, result.map.toString(), "utf8");
92
+ this.logDebug(`Sourcemap written to ${resolvedOutputPath}.map`);
93
+ }
94
+ // Log warnings
95
+ for (const warning of result.warnings()) {
96
+ this.logWarning(`${warning.plugin}: ${warning.text}`);
97
+ }
98
+ const features = [];
99
+ if (useAutoprefixer)
100
+ features.push("autoprefixer");
101
+ if (minify)
102
+ features.push("minify");
103
+ if (sourcemap)
104
+ features.push("sourcemap");
105
+ this.logInfo(`CSS processing completed: ${outputPath} (${features.join(", ") || "no transforms"})`);
106
+ }
107
+ catch (error) {
108
+ this.logError("PostCSS processing failed.", error);
109
+ throw error;
110
+ }
111
+ }
112
+ /**
113
+ * Provides a description of the action.
114
+ *
115
+ * @returns A string description of the action.
116
+ */
117
+ describe() {
118
+ return "Processes CSS files using PostCSS with autoprefixer and cssnano support.";
119
+ }
120
+ }
121
+ //# sourceMappingURL=PostCssAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostCssAction.js","sourceRoot":"","sources":["../../../src/actions/PostCssAction/PostCssAction.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAA2B,MAAM,SAAS,CAAC;AAClD,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAqB,MAAM,uBAAuB,CAAC;AA8BlE,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,MAA4B;IAC3D;;;;;OAKG;IACH,eAAe,CAAC,OAA6B;QACzC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC9D,IAAI,CAAC,QAAQ,CAAC,gEAAgE,CAAC,CAAC;YAChF,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE,C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PostCssActionOptions } from "./PostCssAction.js";
2
+ export { PostCssAction, PostCssActionOptions };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/PostCssAction/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAMzE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ // ============================================================================
2
+ // Import
3
+ // ============================================================================
4
+ import { PostCssAction } from "./PostCssAction.js";
5
+ // ============================================================================
6
+ // Export
7
+ // ============================================================================
8
+ export { PostCssAction };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/PostCssAction/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AAEzE,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,aAAa,EAAwB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ActionPlugin } from "./types/Action.js";
2
+ import { PostCssAction } from "./actions/PostCssAction/index.js";
3
+ declare const plugin: ActionPlugin;
4
+ export default plugin;
5
+ export type { PostCssActionOptions } from "./actions/PostCssAction/index.js";
6
+ export { PostCssAction };
7
+ export { Action, ActionPlugin, ActionOptionsType } from "./types/Action.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { PostCssAction } from "./actions/PostCssAction/index.js";
2
+ const plugin = {
3
+ name: "@getkist/action-postcss",
4
+ version: "1.0.0",
5
+ actions: { PostCssAction },
6
+ };
7
+ export default plugin;
8
+ export { PostCssAction };
9
+ export { Action } from "./types/Action.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,MAAM,MAAM,GAAiB;IACzB,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,EAAE,aAAa,EAAE;CAC7B,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,OAAO,EAAE,MAAM,EAAmC,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Base Action types for kist action plugins
3
+ * These types match the kist Action interface for compatibility
4
+ */
5
+ /**
6
+ * Action options type - a generic record of key-value pairs
7
+ */
8
+ export type ActionOptionsType = Record<string, unknown>;
9
+ /**
10
+ * Abstract base class for all kist actions
11
+ * Provides logging and execution interface
12
+ */
13
+ export declare abstract class Action<T extends ActionOptionsType = ActionOptionsType> {
14
+ /**
15
+ * Gets the unique name of the action.
16
+ */
17
+ get name(): string;
18
+ /**
19
+ * Validates options before execution
20
+ * Override in subclasses for specific validation
21
+ */
22
+ validateOptions(_options: T): boolean;
23
+ /**
24
+ * Execute the action with given options
25
+ * Must be implemented by subclasses
26
+ */
27
+ abstract execute(options: T): Promise<void>;
28
+ /**
29
+ * Provides a description of the action
30
+ */
31
+ describe(): string;
32
+ /**
33
+ * Log an info message
34
+ */
35
+ protected logInfo(message: string): void;
36
+ /**
37
+ * Log an error message
38
+ */
39
+ protected logError(message: string, error?: unknown): void;
40
+ /**
41
+ * Log a debug message
42
+ */
43
+ protected logDebug(message: string): void;
44
+ /**
45
+ * Log a warning message
46
+ */
47
+ protected logWarning(message: string): void;
48
+ }
49
+ /**
50
+ * Plugin interface for kist action packages
51
+ */
52
+ export interface ActionPlugin {
53
+ /** Plugin name */
54
+ name: string;
55
+ /** Plugin version */
56
+ version: string;
57
+ /** Map of action names to action classes */
58
+ actions: Record<string, new () => Action>;
59
+ }
60
+ //# sourceMappingURL=Action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD;;;GAGG;AACH,8BAAsB,MAAM,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACxE;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO;IAIrC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMzC;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG9C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,MAAM,CAAC,CAAC;CAC7C"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Base Action types for kist action plugins
3
+ * These types match the kist Action interface for compatibility
4
+ */
5
+ /**
6
+ * Abstract base class for all kist actions
7
+ * Provides logging and execution interface
8
+ */
9
+ export class Action {
10
+ /**
11
+ * Gets the unique name of the action.
12
+ */
13
+ get name() {
14
+ return this.constructor.name;
15
+ }
16
+ /**
17
+ * Validates options before execution
18
+ * Override in subclasses for specific validation
19
+ */
20
+ validateOptions(_options) {
21
+ return true;
22
+ }
23
+ /**
24
+ * Provides a description of the action
25
+ */
26
+ describe() {
27
+ return `${this.name} action`;
28
+ }
29
+ /**
30
+ * Log an info message
31
+ */
32
+ logInfo(message) {
33
+ console.log(`[${this.name}] ${message}`);
34
+ }
35
+ /**
36
+ * Log an error message
37
+ */
38
+ logError(message, error) {
39
+ console.error(`[${this.name}] ERROR: ${message}`, error || "");
40
+ }
41
+ /**
42
+ * Log a debug message
43
+ */
44
+ logDebug(message) {
45
+ if (process.env.DEBUG) {
46
+ console.debug(`[${this.name}] DEBUG: ${message}`);
47
+ }
48
+ }
49
+ /**
50
+ * Log a warning message
51
+ */
52
+ logWarning(message) {
53
+ console.warn(`[${this.name}] WARNING: ${message}`);
54
+ }
55
+ }
56
+ //# sourceMappingURL=Action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,MAAM,OAAgB,MAAM;IACxB;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,eAAe,CAAC,QAAW;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAQD;;OAEG;IACH,QAAQ;QACJ,OAAO,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED;;OAEG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@getkist/action-postcss",
3
+ "version": "1.0.1",
4
+ "description": "PostCSS processing actions for kist",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "keywords": [
16
+ "kist",
17
+ "kist-action",
18
+ "postcss",
19
+ "css",
20
+ "autoprefixer",
21
+ "cssnano",
22
+ "minify"
23
+ ],
24
+ "author": "kist",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/getkist/kist-action-postcss.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/getkist/kist-action-postcss/issues"
32
+ },
33
+ "homepage": "https://github.com/getkist/kist-action-postcss#readme",
34
+ "engines": {
35
+ "node": ">=20.0.0",
36
+ "npm": ">=10.0.0"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc",
40
+ "build:watch": "tsc --watch",
41
+ "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
42
+ "test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
43
+ "test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
44
+ "test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.test\\.ts$",
45
+ "test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.integration\\.test\\.ts$",
46
+ "lint": "eslint 'src/**/*.ts'",
47
+ "lint:fix": "eslint 'src/**/*.ts' --fix",
48
+ "format": "prettier --write 'src/**/*.ts'",
49
+ "docs": "typedoc",
50
+ "docs:watch": "typedoc --watch",
51
+ "clean": "rm -rf dist docs/api coverage",
52
+ "prepublishOnly": "npm run clean && npm run build && npm test"
53
+ },
54
+ "peerDependencies": {
55
+ "kist": ">=0.1.58"
56
+ },
57
+ "dependencies": {
58
+ "postcss": "^8.4.0",
59
+ "autoprefixer": "^10.4.0",
60
+ "cssnano": "^7.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "30.0.0",
64
+ "@types/node": "25.2.2",
65
+ "@typescript-eslint/eslint-plugin": "8.54.0",
66
+ "@typescript-eslint/parser": "8.54.0",
67
+ "eslint": "10.0.0",
68
+ "jest": "30.2.0",
69
+ "ts-jest": "^29.4.6",
70
+ "typedoc": "^0.28.0",
71
+ "typedoc-plugin-markdown": "^4.10.0",
72
+ "typescript": "^5.9.3"
73
+ },
74
+ "files": [
75
+ "dist",
76
+ "README.md",
77
+ "LICENSE"
78
+ ],
79
+ "sideEffects": false
80
+ }