kist 0.1.45 → 0.1.58

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 (38) hide show
  1. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +2 -2
  2. package/js/actions/SvgPackagerAction/SvgPackagerAction.js +2 -2
  3. package/js/actions/TemplateRenderAction/TemplateRenderAction.js +1 -1
  4. package/js/actions/VersionWriteAction/VersionWriteAction.js +2 -2
  5. package/js/config/actions.config.d.ts +35 -0
  6. package/js/config/actions.config.js +119 -0
  7. package/js/core/config/ConfigLoader.js +1 -30
  8. package/js/core/pipeline/Action.d.ts +1 -1
  9. package/js/core/pipeline/Action.js +1 -1
  10. package/js/core/pipeline/ActionRegistry.d.ts +5 -1
  11. package/js/core/pipeline/ActionRegistry.js +18 -27
  12. package/js/core/pipeline/Step.js +1 -1
  13. package/js/core/plugin/PluginManager.d.ts +70 -0
  14. package/js/core/plugin/PluginManager.js +288 -0
  15. package/js/index.d.ts +7 -0
  16. package/js/index.js +14 -1
  17. package/js/interface/ActionPlugin.d.ts +43 -0
  18. package/js/interface/PluginMetadata.d.ts +33 -0
  19. package/js/interface/PluginMetadata.js +5 -0
  20. package/js/kist.js +25 -4
  21. package/package.json +17 -9
  22. package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +2 -2
  23. package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +0 -1
  24. package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +2 -2
  25. package/ts/actions/TemplateRenderAction/TemplateRenderAction.ts +1 -1
  26. package/ts/actions/VersionWriteAction/VersionWriteAction.ts +6 -2
  27. package/ts/config/actions.config.ts +137 -0
  28. package/ts/core/config/ConfigLoader.ts +1 -35
  29. package/ts/core/config/ConfigStore copy.ts +27 -1
  30. package/ts/core/pipeline/Action.ts +1 -1
  31. package/ts/core/pipeline/ActionRegistry.ts +22 -36
  32. package/ts/core/pipeline/Step.ts +1 -1
  33. package/ts/core/plugin/PluginManager.ts +310 -0
  34. package/ts/index.ts +25 -0
  35. package/ts/interface/ActionPlugin.ts +48 -1
  36. package/ts/interface/PluginMetadata.ts +43 -0
  37. package/ts/interface/SVG.ts +2 -0
  38. package/ts/kist.ts +25 -2
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.PluginManager = void 0;
49
+ const fs_1 = require("fs");
50
+ const path_1 = require("path");
51
+ const AbstractProcess_1 = require("../abstract/AbstractProcess");
52
+ // ============================================================================
53
+ // Class
54
+ // ============================================================================
55
+ /**
56
+ * PluginManager handles discovery, loading, and lifecycle of kist plugins.
57
+ * Supports both npm-installed plugins (@getkist/plugin-*) and local plugins.
58
+ */
59
+ class PluginManager extends AbstractProcess_1.AbstractProcess {
60
+ // Constructor
61
+ // ========================================================================
62
+ constructor() {
63
+ super();
64
+ this.loadedPlugins = new Map();
65
+ this.pluginActions = new Map();
66
+ this.logInfo("PluginManager initialized.");
67
+ }
68
+ // Singleton Methods
69
+ // ========================================================================
70
+ static getInstance() {
71
+ if (!PluginManager.instance) {
72
+ PluginManager.instance = new PluginManager();
73
+ }
74
+ return PluginManager.instance;
75
+ }
76
+ static resetInstance() {
77
+ PluginManager.instance = null;
78
+ }
79
+ // Plugin Discovery
80
+ // ========================================================================
81
+ /**
82
+ * Discovers and loads all available plugins from:
83
+ * - node_modules/@getkist/plugin-*
84
+ * - node_modules/kist-plugin-*
85
+ * - Local plugins directory (if configured)
86
+ */
87
+ discoverPlugins(options) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ this.logInfo("Starting plugin discovery...");
90
+ const prefixes = (options === null || options === void 0 ? void 0 : options.pluginPrefixes) || [
91
+ "@getkist/action-",
92
+ "kist-plugin-",
93
+ ];
94
+ // Discover npm plugins
95
+ yield this.discoverNpmPlugins(prefixes);
96
+ // Discover local plugins if path provided
97
+ if (options === null || options === void 0 ? void 0 : options.localPluginsPath) {
98
+ yield this.discoverLocalPlugins(options.localPluginsPath);
99
+ }
100
+ this.logInfo(`Plugin discovery complete. Loaded ${this.loadedPlugins.size} plugins.`);
101
+ });
102
+ }
103
+ /**
104
+ * Discovers plugins installed via npm with specified prefixes
105
+ */
106
+ discoverNpmPlugins(prefixes) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ const nodeModulesPath = (0, path_1.join)(process.cwd(), "node_modules");
109
+ try {
110
+ const directories = (0, fs_1.readdirSync)(nodeModulesPath, {
111
+ withFileTypes: true,
112
+ });
113
+ for (const dir of directories) {
114
+ // Check for scoped packages (@getkist/plugin-*)
115
+ if (dir.isDirectory() && dir.name.startsWith("@")) {
116
+ yield this.discoverScopedPlugins((0, path_1.join)(nodeModulesPath, dir.name), prefixes);
117
+ }
118
+ // Check for non-scoped packages (kist-plugin-*)
119
+ for (const prefix of prefixes) {
120
+ if (dir.isDirectory() &&
121
+ !prefix.startsWith("@") &&
122
+ dir.name.startsWith(prefix)) {
123
+ yield this.loadPlugin((0, path_1.join)(nodeModulesPath, dir.name), dir.name);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ catch (error) {
129
+ this.logError("Failed to discover npm plugins.", error);
130
+ }
131
+ });
132
+ }
133
+ /**
134
+ * Discovers plugins in scoped packages (@getkist/*)
135
+ */
136
+ discoverScopedPlugins(scopePath, prefixes) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ try {
139
+ const packages = (0, fs_1.readdirSync)(scopePath, { withFileTypes: true });
140
+ for (const pkg of packages) {
141
+ for (const prefix of prefixes) {
142
+ const scopePrefix = prefix.split("/")[1]; // Extract "plugin-" from "@getkist/plugin-"
143
+ if (pkg.isDirectory() &&
144
+ scopePrefix &&
145
+ pkg.name.startsWith(scopePrefix)) {
146
+ const fullName = `${scopePath.split("/").pop()}/${pkg.name}`;
147
+ yield this.loadPlugin((0, path_1.join)(scopePath, pkg.name), fullName);
148
+ }
149
+ }
150
+ }
151
+ }
152
+ catch (_error) {
153
+ this.logDebug(`No scoped plugins found in ${scopePath}`);
154
+ }
155
+ });
156
+ }
157
+ /**
158
+ * Discovers plugins from a local directory
159
+ */
160
+ discoverLocalPlugins(localPath) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ try {
163
+ const pluginPath = (0, path_1.join)(process.cwd(), localPath);
164
+ const directories = (0, fs_1.readdirSync)(pluginPath, {
165
+ withFileTypes: true,
166
+ });
167
+ for (const dir of directories) {
168
+ if (dir.isDirectory()) {
169
+ yield this.loadPlugin((0, path_1.join)(pluginPath, dir.name), `local:${dir.name}`);
170
+ }
171
+ }
172
+ }
173
+ catch (_error) {
174
+ this.logDebug(`No local plugins found at ${localPath}`);
175
+ }
176
+ });
177
+ }
178
+ // Plugin Loading
179
+ // ========================================================================
180
+ /**
181
+ * Loads a single plugin from the specified path
182
+ */
183
+ loadPlugin(pluginPath, pluginName) {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ try {
186
+ this.logDebug(`Loading plugin: ${pluginName}`);
187
+ const pluginModule = yield Promise.resolve(`${pluginPath}`).then(s => __importStar(require(s)));
188
+ const plugin = pluginModule.default || pluginModule;
189
+ if (!plugin || typeof plugin.registerActions !== "function") {
190
+ this.logWarn(`Plugin ${pluginName} does not implement ActionPlugin interface.`);
191
+ return;
192
+ }
193
+ // Get plugin metadata if available
194
+ const metadata = {
195
+ name: pluginName,
196
+ version: typeof plugin.version === "string"
197
+ ? plugin.version
198
+ : "unknown",
199
+ description: typeof plugin.description === "string"
200
+ ? plugin.description
201
+ : undefined,
202
+ actions: [],
203
+ };
204
+ // Register actions from the plugin
205
+ const actions = plugin.registerActions();
206
+ for (const [actionName, actionClass] of Object.entries(actions)) {
207
+ this.pluginActions.set(actionName, actionClass);
208
+ metadata.actions.push(actionName);
209
+ this.logDebug(` - Registered action: ${actionName}`);
210
+ }
211
+ this.loadedPlugins.set(pluginName, metadata);
212
+ this.logInfo(`Plugin "${pluginName}" loaded successfully with ${metadata.actions.length} actions.`);
213
+ }
214
+ catch (error) {
215
+ this.logError(`Failed to load plugin ${pluginName}:`, error);
216
+ }
217
+ });
218
+ }
219
+ /**
220
+ * Manually register a plugin programmatically
221
+ */
222
+ registerPlugin(plugin, name) {
223
+ this.logInfo(`Manually registering plugin: ${name}`);
224
+ const metadata = {
225
+ name,
226
+ version: typeof plugin.version === "string"
227
+ ? plugin.version
228
+ : "unknown",
229
+ description: typeof plugin.description === "string"
230
+ ? plugin.description
231
+ : undefined,
232
+ actions: [],
233
+ };
234
+ const actions = plugin.registerActions();
235
+ for (const [actionName, actionClass] of Object.entries(actions)) {
236
+ this.pluginActions.set(actionName, actionClass);
237
+ metadata.actions.push(actionName);
238
+ }
239
+ this.loadedPlugins.set(name, metadata);
240
+ this.logInfo(`Plugin "${name}" registered with ${metadata.actions.length} actions.`);
241
+ }
242
+ // Plugin Queries
243
+ // ========================================================================
244
+ /**
245
+ * Gets all actions from loaded plugins
246
+ */
247
+ getPluginActions() {
248
+ return new Map(this.pluginActions);
249
+ }
250
+ /**
251
+ * Gets metadata for all loaded plugins
252
+ */
253
+ getLoadedPlugins() {
254
+ return Array.from(this.loadedPlugins.values());
255
+ }
256
+ /**
257
+ * Gets metadata for a specific plugin
258
+ */
259
+ getPluginMetadata(name) {
260
+ return this.loadedPlugins.get(name);
261
+ }
262
+ /**
263
+ * Checks if a specific plugin is loaded
264
+ */
265
+ isPluginLoaded(name) {
266
+ return this.loadedPlugins.has(name);
267
+ }
268
+ /**
269
+ * Lists all action names from plugins
270
+ */
271
+ listPluginActions() {
272
+ return Array.from(this.pluginActions.keys());
273
+ }
274
+ // Cleanup
275
+ // ========================================================================
276
+ /**
277
+ * Clears all loaded plugins and their actions
278
+ */
279
+ clearPlugins() {
280
+ this.loadedPlugins.clear();
281
+ this.pluginActions.clear();
282
+ this.logInfo("All plugins cleared.");
283
+ }
284
+ }
285
+ exports.PluginManager = PluginManager;
286
+ // Parameters
287
+ // ========================================================================
288
+ PluginManager.instance = null;
package/js/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
1
  export { Kist } from "./kist";
2
2
  export * from "./types";
3
3
  export * from "./cli.js";
4
+ export { ActionInterface } from "./interface/ActionInterface";
5
+ export { ActionPlugin } from "./interface/ActionPlugin";
6
+ export { PluginMetadata } from "./interface/PluginMetadata";
7
+ export { PluginManager } from "./core/plugin/PluginManager";
8
+ export { Action } from "./core/pipeline/Action";
9
+ export { ActionRegistry } from "./core/pipeline/ActionRegistry";
10
+ export { CORE_ACTIONS, PLUGIN_ACTIONS, PLUGIN_PACKAGES, type CoreActionName, type PluginActionName, } from "./config/actions.config";
package/js/index.js CHANGED
@@ -17,7 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Kist = void 0;
20
+ exports.PLUGIN_PACKAGES = exports.PLUGIN_ACTIONS = exports.CORE_ACTIONS = exports.ActionRegistry = exports.Action = exports.PluginManager = exports.Kist = void 0;
21
21
  // Core Modules
22
22
  // export { Pipeline } from "./core/Pipeline";
23
23
  // export { ConfigLoader } from "./core/ConfigLoader";
@@ -34,3 +34,16 @@ Object.defineProperty(exports, "Kist", { enumerable: true, get: function () { re
34
34
  __exportStar(require("./types"), exports);
35
35
  // CLI Functions (if required programmatically)
36
36
  __exportStar(require("./cli.js"), exports);
37
+ // Plugin management
38
+ var PluginManager_1 = require("./core/plugin/PluginManager");
39
+ Object.defineProperty(exports, "PluginManager", { enumerable: true, get: function () { return PluginManager_1.PluginManager; } });
40
+ // Action system
41
+ var Action_1 = require("./core/pipeline/Action");
42
+ Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Action_1.Action; } });
43
+ var ActionRegistry_1 = require("./core/pipeline/ActionRegistry");
44
+ Object.defineProperty(exports, "ActionRegistry", { enumerable: true, get: function () { return ActionRegistry_1.ActionRegistry; } });
45
+ // Configuration for plugin developers
46
+ var actions_config_1 = require("./config/actions.config");
47
+ Object.defineProperty(exports, "CORE_ACTIONS", { enumerable: true, get: function () { return actions_config_1.CORE_ACTIONS; } });
48
+ Object.defineProperty(exports, "PLUGIN_ACTIONS", { enumerable: true, get: function () { return actions_config_1.PLUGIN_ACTIONS; } });
49
+ Object.defineProperty(exports, "PLUGIN_PACKAGES", { enumerable: true, get: function () { return actions_config_1.PLUGIN_PACKAGES; } });
@@ -1,4 +1,47 @@
1
1
  import { ActionInterface } from "./ActionInterface";
2
+ /**
3
+ * ActionPlugin defines the contract for kist plugins.
4
+ * Plugins can provide one or more actions to extend kist's functionality.
5
+ *
6
+ * Example plugin structure:
7
+ * ```typescript
8
+ * import { ActionPlugin, ActionInterface } from 'kist';
9
+ *
10
+ * export default {
11
+ * version: '1.0.0',
12
+ * description: 'My custom kist plugin',
13
+ * registerActions() {
14
+ * return {
15
+ * 'MyCustomAction': MyCustomAction
16
+ * };
17
+ * }
18
+ * } as ActionPlugin;
19
+ * ```
20
+ */
2
21
  export interface ActionPlugin {
22
+ /**
23
+ * Returns a record of action classes provided by this plugin.
24
+ * Keys are action names, values are action class constructors.
25
+ */
3
26
  registerActions(): Record<string, new () => ActionInterface>;
27
+ /**
28
+ * Optional: Plugin version (semantic versioning recommended)
29
+ */
30
+ version?: string;
31
+ /**
32
+ * Optional: Plugin description
33
+ */
34
+ description?: string;
35
+ /**
36
+ * Optional: Plugin author information
37
+ */
38
+ author?: string;
39
+ /**
40
+ * Optional: Plugin repository URL
41
+ */
42
+ repository?: string;
43
+ /**
44
+ * Optional: Keywords for plugin discoverability
45
+ */
46
+ keywords?: string[];
4
47
  }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Metadata for a loaded plugin
3
+ */
4
+ export interface PluginMetadata {
5
+ /**
6
+ * The unique name of the plugin
7
+ */
8
+ name: string;
9
+ /**
10
+ * The version of the plugin
11
+ */
12
+ version: string;
13
+ /**
14
+ * Optional description of the plugin
15
+ */
16
+ description?: string;
17
+ /**
18
+ * List of action names provided by this plugin
19
+ */
20
+ actions: string[];
21
+ /**
22
+ * Optional author information
23
+ */
24
+ author?: string;
25
+ /**
26
+ * Optional repository URL
27
+ */
28
+ repository?: string;
29
+ /**
30
+ * Optional keywords for discoverability
31
+ */
32
+ keywords?: string[];
33
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Interface
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
package/js/kist.js CHANGED
@@ -17,6 +17,7 @@ const AbstractProcess_1 = require("./core/abstract/AbstractProcess");
17
17
  const ConfigStore_1 = require("./core/config/ConfigStore");
18
18
  const ActionRegistry_1 = require("./core/pipeline/ActionRegistry");
19
19
  const PipelineManager_1 = require("./core/pipeline/PipelineManager");
20
+ const PluginManager_1 = require("./core/plugin/PluginManager");
20
21
  const LiveServer_1 = require("./live/LiveServer");
21
22
  const LiveWatcher_1 = require("./live/LiveWatcher");
22
23
  // ============================================================================
@@ -56,7 +57,7 @@ class Kist extends AbstractProcess_1.AbstractProcess {
56
57
  this.logInfo("Starting Kist workflow...");
57
58
  try {
58
59
  // Initialize the ActionRegistry with available actions
59
- this.initializeActionRegistry();
60
+ yield this.initializeActionRegistry();
60
61
  // Create and run the PipelineManager
61
62
  const liveReloadEnabled = ConfigStore_1.ConfigStore.getInstance().get("options.live.enabled");
62
63
  const liveReloadServer = liveReloadEnabled
@@ -79,9 +80,29 @@ class Kist extends AbstractProcess_1.AbstractProcess {
79
80
  * Automatically registers core actions and discovers external plugins.
80
81
  */
81
82
  initializeActionRegistry() {
82
- this.logInfo("Initializing ActionRegistry...");
83
- ActionRegistry_1.ActionRegistry.initialize();
84
- this.logInfo("ActionRegistry initialized successfully.");
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ this.logInfo("Initializing plugin system...");
85
+ // Initialize and discover plugins first
86
+ const pluginManager = PluginManager_1.PluginManager.getInstance();
87
+ yield pluginManager.discoverPlugins({
88
+ pluginPrefixes: ["@getkist/action-", "kist-plugin-"],
89
+ });
90
+ // Log loaded plugins
91
+ const plugins = pluginManager.getLoadedPlugins();
92
+ if (plugins.length > 0) {
93
+ this.logInfo(`Loaded ${plugins.length} plugin(s):`);
94
+ plugins.forEach((plugin) => {
95
+ this.logInfo(` - ${plugin.name} v${plugin.version} (${plugin.actions.length} actions)`);
96
+ });
97
+ }
98
+ else {
99
+ this.logDebug("No external plugins found.");
100
+ }
101
+ // Initialize ActionRegistry (will register core + plugin actions)
102
+ this.logInfo("Initializing ActionRegistry...");
103
+ ActionRegistry_1.ActionRegistry.initialize();
104
+ this.logInfo("ActionRegistry initialized successfully.");
105
+ });
85
106
  }
86
107
  /**
87
108
  * Sets up live reload functionality.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kist",
3
- "version": "0.1.45",
4
- "description": "Package Pipeline Processor",
3
+ "version": "0.1.58",
4
+ "description": "Lightweight Package Pipeline Processor with Plugin Architecture",
5
5
  "keywords": [
6
6
  "kist",
7
7
  "package",
@@ -11,7 +11,11 @@
11
11
  "compile",
12
12
  "compiler",
13
13
  "framework",
14
- "web"
14
+ "web",
15
+ "plugin-architecture",
16
+ "pipeline",
17
+ "build-tool",
18
+ "automation"
15
19
  ],
16
20
  "license": "MIT",
17
21
  "homepage": "https://www.getkist.com/",
@@ -53,9 +57,7 @@
53
57
  "url": "https://github.com/sponsors/scape-foundation"
54
58
  }
55
59
  ],
56
- "bin": {
57
- "kist": "js/cli.js"
58
- },
60
+ "bin": "js/cli.js",
59
61
  "dependencies": {
60
62
  "@babel/core": "^7.28.3",
61
63
  "@babel/preset-env": "^7.28.3",
@@ -76,9 +78,9 @@
76
78
  "express-rate-limit": "^8.0.1",
77
79
  "fantasticon": "^3.0.0",
78
80
  "fs-extra": "^11.3.1",
79
- "glob": "^11.0.3",
81
+ "glob": "^13.0.0",
80
82
  "js-yaml": "^4.1.0",
81
- "jsdom": "^26.1.0",
83
+ "jsdom": "^27.2.0",
82
84
  "lodash": "^4.17.21",
83
85
  "nunjucks": "^3.2.4",
84
86
  "postcss": "^8.5.6",
@@ -90,5 +92,11 @@
90
92
  "svgo": "^4.0.0",
91
93
  "terser": "^5.43.1",
92
94
  "ws": "^8.18.3"
95
+ },
96
+ "exports": {
97
+ ".": {
98
+ "types": "./dist/js/index.d.ts",
99
+ "import": "./dist/js/index.js"
100
+ }
93
101
  }
94
- }
102
+ }
@@ -87,7 +87,7 @@ export class DirectoryCleanAction extends Action {
87
87
  const stat = await fs.promises.lstat(curPath);
88
88
  if (stat.isDirectory()) {
89
89
  // Recursively clean subdirectory
90
- await fs.promises.rmdir(curPath, { recursive: true });
90
+ await fs.promises.rm(curPath, { recursive: true });
91
91
  this.logInfo(`Deleted directory: ${relativePath}`);
92
92
  } else {
93
93
  // Delete file
@@ -105,7 +105,7 @@ export class DirectoryCleanAction extends Action {
105
105
  * @returns A string description of the action.
106
106
  */
107
107
  describe(): string {
108
- let description = `
108
+ const description = `
109
109
  Cleans a directory by deleting all its contents while retaining
110
110
  files and directories matching specified glob patterns. If the
111
111
  directory does not exist, the action will skip gracefully.
@@ -3,7 +3,6 @@
3
3
  // ============================================================================
4
4
 
5
5
  import autoprefixer from "autoprefixer"; // Automatically adds vendor prefixes to CSS rules
6
- import cssnano from "cssnano";
7
6
  // import postcssSimpleVars from 'postcss-simple-vars'; // Plugin to handle CSS variables
8
7
  // import postcssNested from 'postcss-nested'; // Plugin to allow nesting of CSS rules
9
8
  // import postcssImport from 'postcss-import'; // Plugin to inline import CSS files into a single CSS
@@ -5,7 +5,7 @@
5
5
  import * as fs from "fs/promises";
6
6
  import * as glob from "glob";
7
7
  import * as path from "path";
8
- import SVGO, { loadConfig } from "svgo";
8
+ import { loadConfig, optimize } from "svgo";
9
9
  import { Action } from "../../core/pipeline/Action";
10
10
  import { ActionOptionsType } from "../../types/ActionOptionsType";
11
11
 
@@ -101,7 +101,7 @@ export class SvgPackagerAction extends Action {
101
101
  svgContent: string,
102
102
  ): Promise<string> {
103
103
  const config = await loadConfig(svgoConfigPath);
104
- const result = await SVGO.optimize(svgContent, { ...config });
104
+ const result = await optimize(svgContent, { ...config });
105
105
  return result.data.trim();
106
106
  }
107
107
 
@@ -84,7 +84,7 @@ export class TemplateRenderAction extends Action {
84
84
  template: string,
85
85
  outputFile: string,
86
86
  context: Record<string, any>,
87
- templatesDir: string,
87
+ _templatesDir: string,
88
88
  ): Promise<void> {
89
89
  this.logInfo(`Rendering: ${template} → ${outputFile}`);
90
90
 
@@ -141,7 +141,11 @@ export class VersionWriteAction extends Action {
141
141
  return line;
142
142
  });
143
143
 
144
- await fs.writeFile(filePath, updatedLines.join("\n"), "utf8");
144
+ await fs.writeFile(
145
+ filePath,
146
+ updatedLines.join("\n") + "\n",
147
+ "utf8",
148
+ );
145
149
  this.logInfo(
146
150
  `Version replaced in file "${filePath}" for key "${key}".`,
147
151
  );
@@ -158,7 +162,7 @@ export class VersionWriteAction extends Action {
158
162
  * @returns A string description of the action.
159
163
  */
160
164
  describe(): string {
161
- let description = `
165
+ const description = `
162
166
  Replaces a version string in one or more specified files based on
163
167
  a key and pattern. Can retrieve the version from package.json or
164
168
  set it manually.