@getkist/action-tsdown 1.0.4 → 1.0.6

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/dist/index.cjs ADDED
@@ -0,0 +1,216 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var child_process = require('child_process');
6
+
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+
14
+ // src/types/Action.ts
15
+ var Action = class {
16
+ /**
17
+ * Logs an informational message.
18
+ * @param message - The message to log
19
+ */
20
+ logInfo(message) {
21
+ console.log(`[${this.name}] ${message}`);
22
+ }
23
+ /**
24
+ * Logs a warning message.
25
+ * @param message - The message to log
26
+ */
27
+ logWarning(message) {
28
+ console.warn(`[${this.name}] WARNING: ${message}`);
29
+ }
30
+ /**
31
+ * Logs an error message.
32
+ * @param message - The message to log
33
+ * @param error - Optional error object
34
+ */
35
+ logError(message, error) {
36
+ console.error(`[${this.name}] ERROR: ${message}`, error || "");
37
+ }
38
+ /**
39
+ * Logs a debug message.
40
+ * @param message - The message to log
41
+ */
42
+ logDebug(message) {
43
+ if (process.env.DEBUG) {
44
+ console.debug(`[${this.name}] DEBUG: ${message}`);
45
+ }
46
+ }
47
+ };
48
+ var TsdownAction = class extends Action {
49
+ name = "TsdownAction";
50
+ describe() {
51
+ return "Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)";
52
+ }
53
+ validateOptions(options) {
54
+ if (!options.entry) {
55
+ this.logError("Invalid options: 'entry' is required");
56
+ return false;
57
+ }
58
+ if (Array.isArray(options.entry) && options.entry.length === 0) {
59
+ this.logError("Invalid options: 'entry' must have at least one entry point");
60
+ return false;
61
+ }
62
+ if (options.format) {
63
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
64
+ const validFormats = ["esm", "cjs", "iife"];
65
+ for (const format of formats) {
66
+ if (!validFormats.includes(format)) {
67
+ this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(", ")}`);
68
+ return false;
69
+ }
70
+ }
71
+ }
72
+ if (options.platform && !["node", "browser", "neutral"].includes(options.platform)) {
73
+ this.logError("Invalid options: 'platform' must be one of: node, browser, neutral");
74
+ return false;
75
+ }
76
+ if (options.sourcemap !== void 0 && typeof options.sourcemap !== "boolean" && options.sourcemap !== "inline") {
77
+ this.logError("Invalid options: 'sourcemap' must be boolean or 'inline'");
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ async execute(options) {
83
+ if (!this.validateOptions(options)) {
84
+ throw new Error("Invalid options provided to TsdownAction");
85
+ }
86
+ const args = this.buildArgs(options);
87
+ const cwd = options.cwd || process.cwd();
88
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
89
+ this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);
90
+ try {
91
+ await this.runTsdown(args, cwd, options.silent);
92
+ this.logInfo("Bundle completed successfully");
93
+ } catch (error) {
94
+ this.logError("tsdown bundling failed.", error);
95
+ throw error;
96
+ }
97
+ }
98
+ /**
99
+ * Build tsdown CLI arguments from options
100
+ */
101
+ buildArgs(options) {
102
+ const args = [];
103
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
104
+ args.push(...entries);
105
+ if (options.configPath) {
106
+ args.push("--config", options.configPath);
107
+ }
108
+ if (options.outDir) {
109
+ args.push("--out-dir", options.outDir);
110
+ }
111
+ if (options.format) {
112
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
113
+ args.push("--format", formats.join(","));
114
+ }
115
+ if (options.dts) {
116
+ args.push("--dts");
117
+ }
118
+ if (options.minify) {
119
+ args.push("--minify");
120
+ }
121
+ if (options.sourcemap !== void 0) {
122
+ if (options.sourcemap === true) {
123
+ args.push("--sourcemap");
124
+ } else if (options.sourcemap === "inline") {
125
+ args.push("--sourcemap", "inline");
126
+ }
127
+ }
128
+ if (options.clean) {
129
+ args.push("--clean");
130
+ }
131
+ if (options.external && options.external.length > 0) {
132
+ for (const ext of options.external) {
133
+ args.push("--external", ext);
134
+ }
135
+ }
136
+ if (options.globalName) {
137
+ args.push("--global-name", options.globalName);
138
+ }
139
+ if (options.target) {
140
+ args.push("--target", options.target);
141
+ }
142
+ if (options.tsconfig) {
143
+ args.push("--tsconfig", options.tsconfig);
144
+ }
145
+ if (options.watch) {
146
+ args.push("--watch");
147
+ }
148
+ if (options.treeshake === false) {
149
+ args.push("--no-treeshake");
150
+ }
151
+ if (options.define) {
152
+ for (const [key, value] of Object.entries(options.define)) {
153
+ args.push("--define", `${key}=${value}`);
154
+ }
155
+ }
156
+ if (options.platform) {
157
+ args.push("--platform", options.platform);
158
+ }
159
+ if (options.bundle === false) {
160
+ args.push("--no-bundle");
161
+ }
162
+ if (options.noExternal && options.noExternal.length > 0) {
163
+ for (const pkg of options.noExternal) {
164
+ args.push("--no-external", pkg);
165
+ }
166
+ }
167
+ return args;
168
+ }
169
+ /**
170
+ * Run tsdown with the given arguments
171
+ */
172
+ runTsdown(args, cwd, silent) {
173
+ return new Promise((resolve, reject) => {
174
+ let tsdownBin;
175
+ try {
176
+ tsdownBin = __require.resolve("tsdown/dist/cli.mjs");
177
+ } catch {
178
+ tsdownBin = "tsdown";
179
+ }
180
+ this.logDebug(`Running: tsdown ${args.join(" ")}`);
181
+ const isNpx = tsdownBin === "tsdown";
182
+ const command = isNpx ? "npx" : "node";
183
+ const spawnArgs = isNpx ? ["tsdown", ...args] : [tsdownBin, ...args];
184
+ const child = child_process.spawn(command, spawnArgs, {
185
+ cwd,
186
+ stdio: silent ? "ignore" : "inherit",
187
+ shell: isNpx
188
+ });
189
+ child.on("close", (code) => {
190
+ if (code === 0) {
191
+ resolve();
192
+ } else {
193
+ reject(new Error(`tsdown exited with code ${code}`));
194
+ }
195
+ });
196
+ child.on("error", (error) => {
197
+ reject(error);
198
+ });
199
+ });
200
+ }
201
+ };
202
+
203
+ // src/index.ts
204
+ var src_default = {
205
+ name: "@getkist/action-tsdown",
206
+ version: "1.0.0",
207
+ actions: {
208
+ TsdownAction: new TsdownAction()
209
+ }
210
+ };
211
+
212
+ exports.Action = Action;
213
+ exports.TsdownAction = TsdownAction;
214
+ exports.default = src_default;
215
+ //# sourceMappingURL=index.cjs.map
216
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/Action.ts","../src/actions/TsdownAction/TsdownAction.ts","../src/index.ts"],"names":["spawn"],"mappings":";;;;;;;;;;;;;;AAIO,IAAe,SAAf,MAA0D;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BnD,QAAQ,OAAA,EAAuB;AACrC,IAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAAI,IAAA,CAAK,IAAI,CAAA,EAAA,EAAK,OAAO,CAAA,CAAE,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMU,WAAW,OAAA,EAAuB;AACxC,IAAA,OAAA,CAAQ,KAAK,CAAA,CAAA,EAAI,IAAA,CAAK,IAAI,CAAA,WAAA,EAAc,OAAO,CAAA,CAAE,CAAA;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOU,QAAA,CAAS,SAAiB,KAAA,EAAuB;AACvD,IAAA,OAAA,CAAQ,KAAA,CAAM,IAAI,IAAA,CAAK,IAAI,YAAY,OAAO,CAAA,CAAA,EAAI,SAAS,EAAE,CAAA;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMU,SAAS,OAAA,EAAuB;AACtC,IAAA,IAAI,OAAA,CAAQ,IAAI,KAAA,EAAO;AACnB,MAAA,OAAA,CAAQ,MAAM,CAAA,CAAA,EAAI,IAAA,CAAK,IAAI,CAAA,SAAA,EAAY,OAAO,CAAA,CAAE,CAAA;AAA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IAAI,SAAS,CAAA,EAAG;AACZ,UAAA,OAAA,EAAQ;AAAA,QACZ,CAAA,MAAO;AACH,UAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,wBAAA,EAA2B,IAAI,EAAE,CAAC,CAAA;AAAA,QACvD;AAAA,MACJ,CAAC,CAAA;AAED,MAAA,KAAA,CAAM,EAAA,CAAG,OAAA,EAAS,CAAC,KAAA,KAAU;AACzB,QAAA,MAAA,CAAO,KAAK,CAAA;AAAA,MAChB,CAAC,CAAA;AAAA,IACL,CAAC,CAAA;AAAA,EACL;AACJ;;;ACpTA,IAAO,WAAA,GAAQ;AAAA,EACX,IAAA,EAAM,wBAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACL,YAAA,EAAc,IAAI,YAAA;AAAa;AAEvC","file":"index.cjs","sourcesContent":["/**\n * Base class for kist actions.\n * Provides common functionality for all action implementations.\n */\nexport abstract class Action<TOptions = Record<string, unknown>> {\n /**\n * The unique name of this action.\n */\n abstract readonly name: string;\n\n /**\n * Returns a human-readable description of what this action does.\n */\n abstract describe(): string;\n\n /**\n * Validates the provided options before execution.\n * @param options - The options to validate\n * @returns true if options are valid, false otherwise\n */\n abstract validateOptions(options: TOptions): boolean;\n\n /**\n * Executes the action with the provided options.\n * @param options - The options for this action\n * @returns A promise that resolves when the action completes\n */\n abstract execute(options: TOptions): Promise<void>;\n\n /**\n * Logs an informational message.\n * @param message - The message to log\n */\n protected logInfo(message: string): void {\n console.log(`[${this.name}] ${message}`);\n }\n\n /**\n * Logs a warning message.\n * @param message - The message to log\n */\n protected logWarning(message: string): void {\n console.warn(`[${this.name}] WARNING: ${message}`);\n }\n\n /**\n * Logs an error message.\n * @param message - The message to log\n * @param error - Optional error object\n */\n protected logError(message: string, error?: unknown): void {\n console.error(`[${this.name}] ERROR: ${message}`, error || \"\");\n }\n\n /**\n * Logs a debug message.\n * @param message - The message to log\n */\n protected logDebug(message: string): void {\n if (process.env.DEBUG) {\n console.debug(`[${this.name}] DEBUG: ${message}`);\n }\n }\n}\n","import { Action } from \"../../types/Action.js\";\nimport { spawn } from \"child_process\";\nimport path from \"path\";\n\n/**\n * Output format types supported by tsdown\n */\nexport type TsdownFormat = \"esm\" | \"cjs\" | \"iife\";\n\n/**\n * Options for the TsdownAction\n */\nexport interface TsdownActionOptions {\n /**\n * Entry point file(s) for the bundle\n */\n entry: string | string[];\n\n /**\n * Output directory for the bundle\n */\n outDir?: string;\n\n /**\n * Output format(s): esm, cjs, or iife\n */\n format?: TsdownFormat | TsdownFormat[];\n\n /**\n * Generate TypeScript declaration files\n */\n dts?: boolean;\n\n /**\n * Minify the output\n */\n minify?: boolean;\n\n /**\n * Generate sourcemaps\n */\n sourcemap?: boolean | \"inline\";\n\n /**\n * Clean output directory before build\n */\n clean?: boolean;\n\n /**\n * External packages to exclude from bundle\n */\n external?: string[];\n\n /**\n * Global variable names for external packages (for iife/umd)\n */\n globalName?: string;\n\n /**\n * Target environment\n */\n target?: string;\n\n /**\n * Path to tsconfig.json\n */\n tsconfig?: string;\n\n /**\n * Watch mode\n */\n watch?: boolean;\n\n /**\n * Enable tree shaking\n */\n treeshake?: boolean;\n\n /**\n * Define global constants\n */\n define?: Record<string, string>;\n\n /**\n * Environment variables to inline\n */\n env?: Record<string, string>;\n\n /**\n * Platform target: node or browser\n */\n platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Bundle packages from node_modules\n */\n bundle?: boolean;\n\n /**\n * Skip node_modules bundling (noExternal)\n */\n noExternal?: string[];\n\n /**\n * Working directory\n */\n cwd?: string;\n\n /**\n * Silence output\n */\n silent?: boolean;\n\n /**\n * Path to tsdown config file\n */\n configPath?: string;\n}\n\n/**\n * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).\n */\nexport class TsdownAction extends Action<TsdownActionOptions> {\n readonly name = \"TsdownAction\";\n\n describe(): string {\n return \"Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)\";\n }\n\n validateOptions(options: TsdownActionOptions): boolean {\n if (!options.entry) {\n this.logError(\"Invalid options: 'entry' is required\");\n return false;\n }\n\n if (Array.isArray(options.entry) && options.entry.length === 0) {\n this.logError(\"Invalid options: 'entry' must have at least one entry point\");\n return false;\n }\n\n if (options.format) {\n const formats = Array.isArray(options.format) ? options.format : [options.format];\n const validFormats: TsdownFormat[] = [\"esm\", \"cjs\", \"iife\"];\n for (const format of formats) {\n if (!validFormats.includes(format)) {\n this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(\", \")}`);\n return false;\n }\n }\n }\n\n if (options.platform && ![\"node\", \"browser\", \"neutral\"].includes(options.platform)) {\n this.logError(\"Invalid options: 'platform' must be one of: node, browser, neutral\");\n return false;\n }\n\n if (options.sourcemap !== undefined && \n typeof options.sourcemap !== \"boolean\" && \n options.sourcemap !== \"inline\") {\n this.logError(\"Invalid options: 'sourcemap' must be boolean or 'inline'\");\n return false;\n }\n\n return true;\n }\n\n async execute(options: TsdownActionOptions): Promise<void> {\n if (!this.validateOptions(options)) {\n throw new Error(\"Invalid options provided to TsdownAction\");\n }\n\n const args = this.buildArgs(options);\n const cwd = options.cwd || process.cwd();\n\n const entries = Array.isArray(options.entry) ? options.entry : [options.entry];\n this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);\n\n try {\n await this.runTsdown(args, cwd, options.silent);\n this.logInfo(\"Bundle completed successfully\");\n } catch (error) {\n this.logError(\"tsdown bundling failed.\", error);\n throw error;\n }\n }\n\n /**\n * Build tsdown CLI arguments from options\n */\n private buildArgs(options: TsdownActionOptions): string[] {\n const args: string[] = [];\n\n // Entry points\n const entries = Array.isArray(options.entry) ? options.entry : [options.entry];\n args.push(...entries);\n\n if (options.configPath) {\n args.push(\"--config\", options.configPath);\n }\n\n if (options.outDir) {\n args.push(\"--out-dir\", options.outDir);\n }\n\n if (options.format) {\n const formats = Array.isArray(options.format) ? options.format : [options.format];\n args.push(\"--format\", formats.join(\",\"));\n }\n\n if (options.dts) {\n args.push(\"--dts\");\n }\n\n if (options.minify) {\n args.push(\"--minify\");\n }\n\n if (options.sourcemap !== undefined) {\n if (options.sourcemap === true) {\n args.push(\"--sourcemap\");\n } else if (options.sourcemap === \"inline\") {\n args.push(\"--sourcemap\", \"inline\");\n }\n }\n\n if (options.clean) {\n args.push(\"--clean\");\n }\n\n if (options.external && options.external.length > 0) {\n for (const ext of options.external) {\n args.push(\"--external\", ext);\n }\n }\n\n if (options.globalName) {\n args.push(\"--global-name\", options.globalName);\n }\n\n if (options.target) {\n args.push(\"--target\", options.target);\n }\n\n if (options.tsconfig) {\n args.push(\"--tsconfig\", options.tsconfig);\n }\n\n if (options.watch) {\n args.push(\"--watch\");\n }\n\n if (options.treeshake === false) {\n args.push(\"--no-treeshake\");\n }\n\n if (options.define) {\n for (const [key, value] of Object.entries(options.define)) {\n args.push(\"--define\", `${key}=${value}`);\n }\n }\n\n if (options.platform) {\n args.push(\"--platform\", options.platform);\n }\n\n if (options.bundle === false) {\n args.push(\"--no-bundle\");\n }\n\n if (options.noExternal && options.noExternal.length > 0) {\n for (const pkg of options.noExternal) {\n args.push(\"--no-external\", pkg);\n }\n }\n\n return args;\n }\n\n /**\n * Run tsdown with the given arguments\n */\n private runTsdown(args: string[], cwd: string, silent?: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n // Try to find tsdown binary\n let tsdownBin: string;\n try {\n tsdownBin = require.resolve(\"tsdown/dist/cli.mjs\");\n } catch {\n // Fallback to npx\n tsdownBin = \"tsdown\";\n }\n\n this.logDebug(`Running: tsdown ${args.join(\" \")}`);\n\n const isNpx = tsdownBin === \"tsdown\";\n const command = isNpx ? \"npx\" : \"node\";\n const spawnArgs = isNpx ? [\"tsdown\", ...args] : [tsdownBin, ...args];\n\n const child = spawn(command, spawnArgs, {\n cwd,\n stdio: silent ? \"ignore\" : \"inherit\",\n shell: isNpx,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`tsdown exited with code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n }\n}\n","import { TsdownAction } from \"./actions/TsdownAction/index.js\";\n\nexport { TsdownAction } from \"./actions/TsdownAction/index.js\";\nexport type { TsdownActionOptions, TsdownFormat } from \"./actions/TsdownAction/index.js\";\nexport { Action } from \"./types/Action.js\";\n\n/**\n * Plugin definition for kist\n */\nexport default {\n name: \"@getkist/action-tsdown\",\n version: \"1.0.0\",\n actions: {\n TsdownAction: new TsdownAction(),\n },\n};\n"]}
@@ -1,12 +1,59 @@
1
- import { Action } from "../../types/Action.js";
1
+ /**
2
+ * Base class for kist actions.
3
+ * Provides common functionality for all action implementations.
4
+ */
5
+ declare abstract class Action<TOptions = Record<string, unknown>> {
6
+ /**
7
+ * The unique name of this action.
8
+ */
9
+ abstract readonly name: string;
10
+ /**
11
+ * Returns a human-readable description of what this action does.
12
+ */
13
+ abstract describe(): string;
14
+ /**
15
+ * Validates the provided options before execution.
16
+ * @param options - The options to validate
17
+ * @returns true if options are valid, false otherwise
18
+ */
19
+ abstract validateOptions(options: TOptions): boolean;
20
+ /**
21
+ * Executes the action with the provided options.
22
+ * @param options - The options for this action
23
+ * @returns A promise that resolves when the action completes
24
+ */
25
+ abstract execute(options: TOptions): Promise<void>;
26
+ /**
27
+ * Logs an informational message.
28
+ * @param message - The message to log
29
+ */
30
+ protected logInfo(message: string): void;
31
+ /**
32
+ * Logs a warning message.
33
+ * @param message - The message to log
34
+ */
35
+ protected logWarning(message: string): void;
36
+ /**
37
+ * Logs an error message.
38
+ * @param message - The message to log
39
+ * @param error - Optional error object
40
+ */
41
+ protected logError(message: string, error?: unknown): void;
42
+ /**
43
+ * Logs a debug message.
44
+ * @param message - The message to log
45
+ */
46
+ protected logDebug(message: string): void;
47
+ }
48
+
2
49
  /**
3
50
  * Output format types supported by tsdown
4
51
  */
5
- export type TsdownFormat = "esm" | "cjs" | "iife";
52
+ type TsdownFormat = "esm" | "cjs" | "iife";
6
53
  /**
7
54
  * Options for the TsdownAction
8
55
  */
9
- export interface TsdownActionOptions {
56
+ interface TsdownActionOptions {
10
57
  /**
11
58
  * Entry point file(s) for the bundle
12
59
  */
@@ -95,7 +142,7 @@ export interface TsdownActionOptions {
95
142
  /**
96
143
  * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).
97
144
  */
98
- export declare class TsdownAction extends Action<TsdownActionOptions> {
145
+ declare class TsdownAction extends Action<TsdownActionOptions> {
99
146
  readonly name = "TsdownAction";
100
147
  describe(): string;
101
148
  validateOptions(options: TsdownActionOptions): boolean;
@@ -109,4 +156,16 @@ export declare class TsdownAction extends Action<TsdownActionOptions> {
109
156
  */
110
157
  private runTsdown;
111
158
  }
112
- //# sourceMappingURL=TsdownAction.d.ts.map
159
+
160
+ /**
161
+ * Plugin definition for kist
162
+ */
163
+ declare const _default: {
164
+ name: string;
165
+ version: string;
166
+ actions: {
167
+ TsdownAction: TsdownAction;
168
+ };
169
+ };
170
+
171
+ export { Action, TsdownAction, type TsdownActionOptions, type TsdownFormat, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,162 @@
1
- import { TsdownAction } from "./actions/TsdownAction/index.js";
2
- export { TsdownAction } from "./actions/TsdownAction/index.js";
3
- export type { TsdownActionOptions, TsdownFormat } from "./actions/TsdownAction/index.js";
4
- export { Action } from "./types/Action.js";
1
+ /**
2
+ * Base class for kist actions.
3
+ * Provides common functionality for all action implementations.
4
+ */
5
+ declare abstract class Action<TOptions = Record<string, unknown>> {
6
+ /**
7
+ * The unique name of this action.
8
+ */
9
+ abstract readonly name: string;
10
+ /**
11
+ * Returns a human-readable description of what this action does.
12
+ */
13
+ abstract describe(): string;
14
+ /**
15
+ * Validates the provided options before execution.
16
+ * @param options - The options to validate
17
+ * @returns true if options are valid, false otherwise
18
+ */
19
+ abstract validateOptions(options: TOptions): boolean;
20
+ /**
21
+ * Executes the action with the provided options.
22
+ * @param options - The options for this action
23
+ * @returns A promise that resolves when the action completes
24
+ */
25
+ abstract execute(options: TOptions): Promise<void>;
26
+ /**
27
+ * Logs an informational message.
28
+ * @param message - The message to log
29
+ */
30
+ protected logInfo(message: string): void;
31
+ /**
32
+ * Logs a warning message.
33
+ * @param message - The message to log
34
+ */
35
+ protected logWarning(message: string): void;
36
+ /**
37
+ * Logs an error message.
38
+ * @param message - The message to log
39
+ * @param error - Optional error object
40
+ */
41
+ protected logError(message: string, error?: unknown): void;
42
+ /**
43
+ * Logs a debug message.
44
+ * @param message - The message to log
45
+ */
46
+ protected logDebug(message: string): void;
47
+ }
48
+
49
+ /**
50
+ * Output format types supported by tsdown
51
+ */
52
+ type TsdownFormat = "esm" | "cjs" | "iife";
53
+ /**
54
+ * Options for the TsdownAction
55
+ */
56
+ interface TsdownActionOptions {
57
+ /**
58
+ * Entry point file(s) for the bundle
59
+ */
60
+ entry: string | string[];
61
+ /**
62
+ * Output directory for the bundle
63
+ */
64
+ outDir?: string;
65
+ /**
66
+ * Output format(s): esm, cjs, or iife
67
+ */
68
+ format?: TsdownFormat | TsdownFormat[];
69
+ /**
70
+ * Generate TypeScript declaration files
71
+ */
72
+ dts?: boolean;
73
+ /**
74
+ * Minify the output
75
+ */
76
+ minify?: boolean;
77
+ /**
78
+ * Generate sourcemaps
79
+ */
80
+ sourcemap?: boolean | "inline";
81
+ /**
82
+ * Clean output directory before build
83
+ */
84
+ clean?: boolean;
85
+ /**
86
+ * External packages to exclude from bundle
87
+ */
88
+ external?: string[];
89
+ /**
90
+ * Global variable names for external packages (for iife/umd)
91
+ */
92
+ globalName?: string;
93
+ /**
94
+ * Target environment
95
+ */
96
+ target?: string;
97
+ /**
98
+ * Path to tsconfig.json
99
+ */
100
+ tsconfig?: string;
101
+ /**
102
+ * Watch mode
103
+ */
104
+ watch?: boolean;
105
+ /**
106
+ * Enable tree shaking
107
+ */
108
+ treeshake?: boolean;
109
+ /**
110
+ * Define global constants
111
+ */
112
+ define?: Record<string, string>;
113
+ /**
114
+ * Environment variables to inline
115
+ */
116
+ env?: Record<string, string>;
117
+ /**
118
+ * Platform target: node or browser
119
+ */
120
+ platform?: "node" | "browser" | "neutral";
121
+ /**
122
+ * Bundle packages from node_modules
123
+ */
124
+ bundle?: boolean;
125
+ /**
126
+ * Skip node_modules bundling (noExternal)
127
+ */
128
+ noExternal?: string[];
129
+ /**
130
+ * Working directory
131
+ */
132
+ cwd?: string;
133
+ /**
134
+ * Silence output
135
+ */
136
+ silent?: boolean;
137
+ /**
138
+ * Path to tsdown config file
139
+ */
140
+ configPath?: string;
141
+ }
142
+ /**
143
+ * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).
144
+ */
145
+ declare class TsdownAction extends Action<TsdownActionOptions> {
146
+ readonly name = "TsdownAction";
147
+ describe(): string;
148
+ validateOptions(options: TsdownActionOptions): boolean;
149
+ execute(options: TsdownActionOptions): Promise<void>;
150
+ /**
151
+ * Build tsdown CLI arguments from options
152
+ */
153
+ private buildArgs;
154
+ /**
155
+ * Run tsdown with the given arguments
156
+ */
157
+ private runTsdown;
158
+ }
159
+
5
160
  /**
6
161
  * Plugin definition for kist
7
162
  */
@@ -12,5 +167,5 @@ declare const _default: {
12
167
  TsdownAction: TsdownAction;
13
168
  };
14
169
  };
15
- export default _default;
16
- //# sourceMappingURL=index.d.ts.map
170
+
171
+ export { Action, TsdownAction, type TsdownActionOptions, type TsdownFormat, _default as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,210 @@
1
+ import { spawn } from 'child_process';
2
+
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+ // src/types/Action.ts
11
+ var Action = class {
12
+ /**
13
+ * Logs an informational message.
14
+ * @param message - The message to log
15
+ */
16
+ logInfo(message) {
17
+ console.log(`[${this.name}] ${message}`);
18
+ }
19
+ /**
20
+ * Logs a warning message.
21
+ * @param message - The message to log
22
+ */
23
+ logWarning(message) {
24
+ console.warn(`[${this.name}] WARNING: ${message}`);
25
+ }
26
+ /**
27
+ * Logs an error message.
28
+ * @param message - The message to log
29
+ * @param error - Optional error object
30
+ */
31
+ logError(message, error) {
32
+ console.error(`[${this.name}] ERROR: ${message}`, error || "");
33
+ }
34
+ /**
35
+ * Logs a debug message.
36
+ * @param message - The message to log
37
+ */
38
+ logDebug(message) {
39
+ if (process.env.DEBUG) {
40
+ console.debug(`[${this.name}] DEBUG: ${message}`);
41
+ }
42
+ }
43
+ };
44
+ var TsdownAction = class extends Action {
45
+ name = "TsdownAction";
46
+ describe() {
47
+ return "Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)";
48
+ }
49
+ validateOptions(options) {
50
+ if (!options.entry) {
51
+ this.logError("Invalid options: 'entry' is required");
52
+ return false;
53
+ }
54
+ if (Array.isArray(options.entry) && options.entry.length === 0) {
55
+ this.logError("Invalid options: 'entry' must have at least one entry point");
56
+ return false;
57
+ }
58
+ if (options.format) {
59
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
60
+ const validFormats = ["esm", "cjs", "iife"];
61
+ for (const format of formats) {
62
+ if (!validFormats.includes(format)) {
63
+ this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(", ")}`);
64
+ return false;
65
+ }
66
+ }
67
+ }
68
+ if (options.platform && !["node", "browser", "neutral"].includes(options.platform)) {
69
+ this.logError("Invalid options: 'platform' must be one of: node, browser, neutral");
70
+ return false;
71
+ }
72
+ if (options.sourcemap !== void 0 && typeof options.sourcemap !== "boolean" && options.sourcemap !== "inline") {
73
+ this.logError("Invalid options: 'sourcemap' must be boolean or 'inline'");
74
+ return false;
75
+ }
76
+ return true;
77
+ }
78
+ async execute(options) {
79
+ if (!this.validateOptions(options)) {
80
+ throw new Error("Invalid options provided to TsdownAction");
81
+ }
82
+ const args = this.buildArgs(options);
83
+ const cwd = options.cwd || process.cwd();
84
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
85
+ this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);
86
+ try {
87
+ await this.runTsdown(args, cwd, options.silent);
88
+ this.logInfo("Bundle completed successfully");
89
+ } catch (error) {
90
+ this.logError("tsdown bundling failed.", error);
91
+ throw error;
92
+ }
93
+ }
94
+ /**
95
+ * Build tsdown CLI arguments from options
96
+ */
97
+ buildArgs(options) {
98
+ const args = [];
99
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
100
+ args.push(...entries);
101
+ if (options.configPath) {
102
+ args.push("--config", options.configPath);
103
+ }
104
+ if (options.outDir) {
105
+ args.push("--out-dir", options.outDir);
106
+ }
107
+ if (options.format) {
108
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
109
+ args.push("--format", formats.join(","));
110
+ }
111
+ if (options.dts) {
112
+ args.push("--dts");
113
+ }
114
+ if (options.minify) {
115
+ args.push("--minify");
116
+ }
117
+ if (options.sourcemap !== void 0) {
118
+ if (options.sourcemap === true) {
119
+ args.push("--sourcemap");
120
+ } else if (options.sourcemap === "inline") {
121
+ args.push("--sourcemap", "inline");
122
+ }
123
+ }
124
+ if (options.clean) {
125
+ args.push("--clean");
126
+ }
127
+ if (options.external && options.external.length > 0) {
128
+ for (const ext of options.external) {
129
+ args.push("--external", ext);
130
+ }
131
+ }
132
+ if (options.globalName) {
133
+ args.push("--global-name", options.globalName);
134
+ }
135
+ if (options.target) {
136
+ args.push("--target", options.target);
137
+ }
138
+ if (options.tsconfig) {
139
+ args.push("--tsconfig", options.tsconfig);
140
+ }
141
+ if (options.watch) {
142
+ args.push("--watch");
143
+ }
144
+ if (options.treeshake === false) {
145
+ args.push("--no-treeshake");
146
+ }
147
+ if (options.define) {
148
+ for (const [key, value] of Object.entries(options.define)) {
149
+ args.push("--define", `${key}=${value}`);
150
+ }
151
+ }
152
+ if (options.platform) {
153
+ args.push("--platform", options.platform);
154
+ }
155
+ if (options.bundle === false) {
156
+ args.push("--no-bundle");
157
+ }
158
+ if (options.noExternal && options.noExternal.length > 0) {
159
+ for (const pkg of options.noExternal) {
160
+ args.push("--no-external", pkg);
161
+ }
162
+ }
163
+ return args;
164
+ }
165
+ /**
166
+ * Run tsdown with the given arguments
167
+ */
168
+ runTsdown(args, cwd, silent) {
169
+ return new Promise((resolve, reject) => {
170
+ let tsdownBin;
171
+ try {
172
+ tsdownBin = __require.resolve("tsdown/dist/cli.mjs");
173
+ } catch {
174
+ tsdownBin = "tsdown";
175
+ }
176
+ this.logDebug(`Running: tsdown ${args.join(" ")}`);
177
+ const isNpx = tsdownBin === "tsdown";
178
+ const command = isNpx ? "npx" : "node";
179
+ const spawnArgs = isNpx ? ["tsdown", ...args] : [tsdownBin, ...args];
180
+ const child = spawn(command, spawnArgs, {
181
+ cwd,
182
+ stdio: silent ? "ignore" : "inherit",
183
+ shell: isNpx
184
+ });
185
+ child.on("close", (code) => {
186
+ if (code === 0) {
187
+ resolve();
188
+ } else {
189
+ reject(new Error(`tsdown exited with code ${code}`));
190
+ }
191
+ });
192
+ child.on("error", (error) => {
193
+ reject(error);
194
+ });
195
+ });
196
+ }
197
+ };
198
+
199
+ // src/index.ts
200
+ var src_default = {
201
+ name: "@getkist/action-tsdown",
202
+ version: "1.0.0",
203
+ actions: {
204
+ TsdownAction: new TsdownAction()
205
+ }
206
+ };
207
+
208
+ export { Action, TsdownAction, src_default as default };
209
+ //# sourceMappingURL=index.mjs.map
210
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/Action.ts","../src/actions/TsdownAction/TsdownAction.ts","../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAIO,IAAe,SAAf,MAA0D;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BnD,QAAQ,OAAA,EAAuB;AACrC,IAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAAI,IAAA,CAAK,IAAI,CAAA,EAAA,EAAK,OAAO,C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,QAAA,SAAA,GAAY,QAAA;AAAA,MAChB;AAEA,MAAA,IAAA,CAAK,SAAS,CAAA,gBAAA,EAAmB,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAE,CAAA;AAEjD,MAAA,MAAM,QAAQ,SAAA,KAAc,QAAA;AAC5B,MAAA,MAAM,OAAA,GAAU,QAAQ,KAAA,GAAQ,MAAA;AAChC,MAAA,MAAM,SAAA,GAAY,KAAA,GAAQ,CAAC,QAAA,EAAU,GAAG,IAAI,CAAA,GAAI,CAAC,SAAA,EAAW,GAAG,IAAI,CAAA;AAEnE,MAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,OAAA,EAAS,SAAA,EAAW;AAAA,QACpC,GAAA;AAAA,QACA,KAAA,EAAO,SAAS,QAAA,GAAW,SAAA;AAAA,QAC3B,KAAA,EAAO;AAAA,OACV,CAAA;AAED,MAAA,KAAA,CAAM,EAAA,CAAG,OAAA,EAAS,CAAC,IAAA,KAAS;AACxB,QAAA,IAAI,SAAS,CAAA,EAAG;AACZ,UAAA,OAAA,EAAQ;AAAA,QACZ,CAAA,MAAO;AACH,UAAA,MAAA,CAAO,IAAI,KAAA,CAAM,CAAA,wBAAA,EAA2B,IAAI,EAAE,CAAC,CAAA;AAAA,QACvD;AAAA,MACJ,CAAC,CAAA;AAED,MAAA,KAAA,CAAM,EAAA,CAAG,OAAA,EAAS,CAAC,KAAA,KAAU;AACzB,QAAA,MAAA,CAAO,KAAK,CAAA;AAAA,MAChB,CAAC,CAAA;AAAA,IACL,CAAC,CAAA;AAAA,EACL;AACJ;;;ACpTA,IAAO,WAAA,GAAQ;AAAA,EACX,IAAA,EAAM,wBAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACL,YAAA,EAAc,IAAI,YAAA;AAAa;AAEvC","file":"index.mjs","sourcesContent":["/**\n * Base class for kist actions.\n * Provides common functionality for all action implementations.\n */\nexport abstract class Action<TOptions = Record<string, unknown>> {\n /**\n * The unique name of this action.\n */\n abstract readonly name: string;\n\n /**\n * Returns a human-readable description of what this action does.\n */\n abstract describe(): string;\n\n /**\n * Validates the provided options before execution.\n * @param options - The options to validate\n * @returns true if options are valid, false otherwise\n */\n abstract validateOptions(options: TOptions): boolean;\n\n /**\n * Executes the action with the provided options.\n * @param options - The options for this action\n * @returns A promise that resolves when the action completes\n */\n abstract execute(options: TOptions): Promise<void>;\n\n /**\n * Logs an informational message.\n * @param message - The message to log\n */\n protected logInfo(message: string): void {\n console.log(`[${this.name}] ${message}`);\n }\n\n /**\n * Logs a warning message.\n * @param message - The message to log\n */\n protected logWarning(message: string): void {\n console.warn(`[${this.name}] WARNING: ${message}`);\n }\n\n /**\n * Logs an error message.\n * @param message - The message to log\n * @param error - Optional error object\n */\n protected logError(message: string, error?: unknown): void {\n console.error(`[${this.name}] ERROR: ${message}`, error || \"\");\n }\n\n /**\n * Logs a debug message.\n * @param message - The message to log\n */\n protected logDebug(message: string): void {\n if (process.env.DEBUG) {\n console.debug(`[${this.name}] DEBUG: ${message}`);\n }\n }\n}\n","import { Action } from \"../../types/Action.js\";\nimport { spawn } from \"child_process\";\nimport path from \"path\";\n\n/**\n * Output format types supported by tsdown\n */\nexport type TsdownFormat = \"esm\" | \"cjs\" | \"iife\";\n\n/**\n * Options for the TsdownAction\n */\nexport interface TsdownActionOptions {\n /**\n * Entry point file(s) for the bundle\n */\n entry: string | string[];\n\n /**\n * Output directory for the bundle\n */\n outDir?: string;\n\n /**\n * Output format(s): esm, cjs, or iife\n */\n format?: TsdownFormat | TsdownFormat[];\n\n /**\n * Generate TypeScript declaration files\n */\n dts?: boolean;\n\n /**\n * Minify the output\n */\n minify?: boolean;\n\n /**\n * Generate sourcemaps\n */\n sourcemap?: boolean | \"inline\";\n\n /**\n * Clean output directory before build\n */\n clean?: boolean;\n\n /**\n * External packages to exclude from bundle\n */\n external?: string[];\n\n /**\n * Global variable names for external packages (for iife/umd)\n */\n globalName?: string;\n\n /**\n * Target environment\n */\n target?: string;\n\n /**\n * Path to tsconfig.json\n */\n tsconfig?: string;\n\n /**\n * Watch mode\n */\n watch?: boolean;\n\n /**\n * Enable tree shaking\n */\n treeshake?: boolean;\n\n /**\n * Define global constants\n */\n define?: Record<string, string>;\n\n /**\n * Environment variables to inline\n */\n env?: Record<string, string>;\n\n /**\n * Platform target: node or browser\n */\n platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Bundle packages from node_modules\n */\n bundle?: boolean;\n\n /**\n * Skip node_modules bundling (noExternal)\n */\n noExternal?: string[];\n\n /**\n * Working directory\n */\n cwd?: string;\n\n /**\n * Silence output\n */\n silent?: boolean;\n\n /**\n * Path to tsdown config file\n */\n configPath?: string;\n}\n\n/**\n * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).\n */\nexport class TsdownAction extends Action<TsdownActionOptions> {\n readonly name = \"TsdownAction\";\n\n describe(): string {\n return \"Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)\";\n }\n\n validateOptions(options: TsdownActionOptions): boolean {\n if (!options.entry) {\n this.logError(\"Invalid options: 'entry' is required\");\n return false;\n }\n\n if (Array.isArray(options.entry) && options.entry.length === 0) {\n this.logError(\"Invalid options: 'entry' must have at least one entry point\");\n return false;\n }\n\n if (options.format) {\n const formats = Array.isArray(options.format) ? options.format : [options.format];\n const validFormats: TsdownFormat[] = [\"esm\", \"cjs\", \"iife\"];\n for (const format of formats) {\n if (!validFormats.includes(format)) {\n this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(\", \")}`);\n return false;\n }\n }\n }\n\n if (options.platform && ![\"node\", \"browser\", \"neutral\"].includes(options.platform)) {\n this.logError(\"Invalid options: 'platform' must be one of: node, browser, neutral\");\n return false;\n }\n\n if (options.sourcemap !== undefined && \n typeof options.sourcemap !== \"boolean\" && \n options.sourcemap !== \"inline\") {\n this.logError(\"Invalid options: 'sourcemap' must be boolean or 'inline'\");\n return false;\n }\n\n return true;\n }\n\n async execute(options: TsdownActionOptions): Promise<void> {\n if (!this.validateOptions(options)) {\n throw new Error(\"Invalid options provided to TsdownAction\");\n }\n\n const args = this.buildArgs(options);\n const cwd = options.cwd || process.cwd();\n\n const entries = Array.isArray(options.entry) ? options.entry : [options.entry];\n this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);\n\n try {\n await this.runTsdown(args, cwd, options.silent);\n this.logInfo(\"Bundle completed successfully\");\n } catch (error) {\n this.logError(\"tsdown bundling failed.\", error);\n throw error;\n }\n }\n\n /**\n * Build tsdown CLI arguments from options\n */\n private buildArgs(options: TsdownActionOptions): string[] {\n const args: string[] = [];\n\n // Entry points\n const entries = Array.isArray(options.entry) ? options.entry : [options.entry];\n args.push(...entries);\n\n if (options.configPath) {\n args.push(\"--config\", options.configPath);\n }\n\n if (options.outDir) {\n args.push(\"--out-dir\", options.outDir);\n }\n\n if (options.format) {\n const formats = Array.isArray(options.format) ? options.format : [options.format];\n args.push(\"--format\", formats.join(\",\"));\n }\n\n if (options.dts) {\n args.push(\"--dts\");\n }\n\n if (options.minify) {\n args.push(\"--minify\");\n }\n\n if (options.sourcemap !== undefined) {\n if (options.sourcemap === true) {\n args.push(\"--sourcemap\");\n } else if (options.sourcemap === \"inline\") {\n args.push(\"--sourcemap\", \"inline\");\n }\n }\n\n if (options.clean) {\n args.push(\"--clean\");\n }\n\n if (options.external && options.external.length > 0) {\n for (const ext of options.external) {\n args.push(\"--external\", ext);\n }\n }\n\n if (options.globalName) {\n args.push(\"--global-name\", options.globalName);\n }\n\n if (options.target) {\n args.push(\"--target\", options.target);\n }\n\n if (options.tsconfig) {\n args.push(\"--tsconfig\", options.tsconfig);\n }\n\n if (options.watch) {\n args.push(\"--watch\");\n }\n\n if (options.treeshake === false) {\n args.push(\"--no-treeshake\");\n }\n\n if (options.define) {\n for (const [key, value] of Object.entries(options.define)) {\n args.push(\"--define\", `${key}=${value}`);\n }\n }\n\n if (options.platform) {\n args.push(\"--platform\", options.platform);\n }\n\n if (options.bundle === false) {\n args.push(\"--no-bundle\");\n }\n\n if (options.noExternal && options.noExternal.length > 0) {\n for (const pkg of options.noExternal) {\n args.push(\"--no-external\", pkg);\n }\n }\n\n return args;\n }\n\n /**\n * Run tsdown with the given arguments\n */\n private runTsdown(args: string[], cwd: string, silent?: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n // Try to find tsdown binary\n let tsdownBin: string;\n try {\n tsdownBin = require.resolve(\"tsdown/dist/cli.mjs\");\n } catch {\n // Fallback to npx\n tsdownBin = \"tsdown\";\n }\n\n this.logDebug(`Running: tsdown ${args.join(\" \")}`);\n\n const isNpx = tsdownBin === \"tsdown\";\n const command = isNpx ? \"npx\" : \"node\";\n const spawnArgs = isNpx ? [\"tsdown\", ...args] : [tsdownBin, ...args];\n\n const child = spawn(command, spawnArgs, {\n cwd,\n stdio: silent ? \"ignore\" : \"inherit\",\n shell: isNpx,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`tsdown exited with code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n }\n}\n","import { TsdownAction } from \"./actions/TsdownAction/index.js\";\n\nexport { TsdownAction } from \"./actions/TsdownAction/index.js\";\nexport type { TsdownActionOptions, TsdownFormat } from \"./actions/TsdownAction/index.js\";\nexport { Action } from \"./types/Action.js\";\n\n/**\n * Plugin definition for kist\n */\nexport default {\n name: \"@getkist/action-tsdown\",\n version: \"1.0.0\",\n actions: {\n TsdownAction: new TsdownAction(),\n },\n};\n"]}
package/package.json CHANGED
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "name": "@getkist/action-tsdown",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "tsdown bundler action for kist",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/src/index.d.ts",
11
- "import": "./dist/src/index.js"
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
12
18
  },
13
19
  "./package.json": "./package.json"
14
20
  },
15
21
  "scripts": {
16
- "build": "tsc",
22
+ "build": "tsup",
17
23
  "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
18
24
  "lint": "eslint src/**/*.ts",
19
25
  "prepublishOnly": "npm run build && npm test"
@@ -46,7 +52,8 @@
46
52
  "jest": "^29.7.0",
47
53
  "ts-jest": "^29.1.2",
48
54
  "typescript": "^5.3.0",
49
- "typescript-eslint": "^8.0.0"
55
+ "typescript-eslint": "^8.0.0",
56
+ "tsup": "^8.5.1"
50
57
  },
51
58
  "files": [
52
59
  "dist",
@@ -59,5 +66,6 @@
59
66
  "publishConfig": {
60
67
  "access": "public"
61
68
  },
62
- "sideEffects": false
69
+ "sideEffects": false,
70
+ "module": "./dist/index.mjs"
63
71
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"TsdownAction.d.ts","sourceRoot":"","sources":["../../../src/actions/TsdownAction/TsdownAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI/C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAEvC;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE/B;;OAEG;IACH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* Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).
5
- */
6
- export class TsdownAction extends Action {
7
- name = "TsdownAction";
8
- describe() {
9
- return "Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)";
10
- }
11
- validateOptions(options) {
12
- if (!options.entry) {
13
- this.logError("Invalid options: 'entry' is required");
14
- return false;
15
- }
16
- if (Array.isArray(options.entry) && options.entry.length === 0) {
17
- this.logError("Invalid options: 'entry' must have at least one entry point");
18
- return false;
19
- }
20
- if (options.format) {
21
- const formats = Array.isArray(options.format) ? options.format : [options.format];
22
- const validFormats = ["esm", "cjs", "iife"];
23
- for (const format of formats) {
24
- if (!validFormats.includes(format)) {
25
- this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(", ")}`);
26
- return false;
27
- }
28
- }
29
- }
30
- if (options.platform && !["node", "browser", "neutral"].includes(options.platform)) {
31
- this.logError("Invalid options: 'platform' must be one of: node, browser, neutral");
32
- return false;
33
- }
34
- if (options.sourcemap !== undefined &&
35
- typeof options.sourcemap !== "boolean" &&
36
- options.sourcemap !== "inline") {
37
- this.logError("Invalid options: 'sourcemap' must be boolean or 'inline'");
38
- return false;
39
- }
40
- return true;
41
- }
42
- async execute(options) {
43
- if (!this.validateOptions(options)) {
44
- throw new Error("Invalid options provided to TsdownAction");
45
- }
46
- const args = this.buildArgs(options);
47
- const cwd = options.cwd || process.cwd();
48
- const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
49
- this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);
50
- try {
51
- await this.runTsdown(args, cwd, options.silent);
52
- this.logInfo("Bundle completed successfully");
53
- }
54
- catch (error) {
55
- this.logError("tsdown bundling failed.", error);
56
- throw error;
57
- }
58
- }
59
- /**
60
- * Build tsdown CLI arguments from options
61
- */
62
- buildArgs(options) {
63
- const args = [];
64
- // Entry points
65
- const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
66
- args.push(...entries);
67
- if (options.configPath) {
68
- args.push("--config", options.configPath);
69
- }
70
- if (options.outDir) {
71
- args.push("--out-dir", options.outDir);
72
- }
73
- if (options.format) {
74
- const formats = Array.isArray(options.format) ? options.format : [options.format];
75
- args.push("--format", formats.join(","));
76
- }
77
- if (options.dts) {
78
- args.push("--dts");
79
- }
80
- if (options.minify) {
81
- args.push("--minify");
82
- }
83
- if (options.sourcemap !== undefined) {
84
- if (options.sourcemap === true) {
85
- args.push("--sourcemap");
86
- }
87
- else if (options.sourcemap === "inline") {
88
- args.push("--sourcemap", "inline");
89
- }
90
- }
91
- if (options.clean) {
92
- args.push("--clean");
93
- }
94
- if (options.external && options.external.length > 0) {
95
- for (const ext of options.external) {
96
- args.push("--external", ext);
97
- }
98
- }
99
- if (options.globalName) {
100
- args.push("--global-name", options.globalName);
101
- }
102
- if (options.target) {
103
- args.push("--target", options.target);
104
- }
105
- if (options.tsconfig) {
106
- args.push("--tsconfig", options.tsconfig);
107
- }
108
- if (options.watch) {
109
- args.push("--watch");
110
- }
111
- if (options.treeshake === false) {
112
- args.push("--no-treeshake");
113
- }
114
- if (options.define) {
115
- for (const [key, value] of Object.entries(options.define)) {
116
- args.push("--define", `${key}=${value}`);
117
- }
118
- }
119
- if (options.platform) {
120
- args.push("--platform", options.platform);
121
- }
122
- if (options.bundle === false) {
123
- args.push("--no-bundle");
124
- }
125
- if (options.noExternal && options.noExternal.length > 0) {
126
- for (const pkg of options.noExternal) {
127
- args.push("--no-external", pkg);
128
- }
129
- }
130
- return args;
131
- }
132
- /**
133
- * Run tsdown with the given arguments
134
- */
135
- runTsdown(args, cwd, silent) {
136
- return new Promise((resolve, reject) => {
137
- // Try to find tsdown binary
138
- let tsdownBin;
139
- try {
140
- tsdownBin = require.resolve("tsdown/dist/cli.mjs");
141
- }
142
- catch {
143
- // Fallback to npx
144
- tsdownBin = "tsdown";
145
- }
146
- this.logDebug(`Running: tsdown ${args.join(" ")}`);
147
- const isNpx = tsdownBin === "tsdown";
148
- const command = isNpx ? "npx" : "node";
149
- const spawnArgs = isNpx ? ["tsdown", ...args] : [tsdownBin, ...args];
150
- const child = spawn(command, spawnArgs, {
151
- cwd,
152
- stdio: silent ? "ignore" : "inherit",
153
- shell: isNpx,
154
- });
155
- child.on("close", (code) => {
156
- if (code === 0) {
157
- resolve();
158
- }
159
- else {
160
- reject(new Error(`tsdown exited with code ${code}`));
161
- }
162
- });
163
- child.on("error", (error) => {
164
- reject(error);
165
- });
166
- });
167
- }
168
- }
169
- //# sourceMappingURL=TsdownAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TsdownAction.js","sourceRoot":"","sources":["../../../src/actions/TsdownAction/TsdownAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAsHtC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAA2B;IAChD,IAAI,GAAG,cAAc,CAAC;IAE/B,QAAQ;QACJ,OAAO,0EAA0E,CAAC;IACtF,CAAC;IAED,eAAe,CAAC,OAA4B;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,CAAC,QAAQ,CAAC,sCAAsC,CAAC,CAAC;YACtD,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,QAAQ,CAAC,6DAA6D,CAAC,CAAC;YAC7E,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClF,MAAM,YAAY,G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type { TsdownActionOptions, TsdownFormat } from "./TsdownAction.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/TsdownAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { TsdownAction } from "./TsdownAction.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/TsdownAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;;;;;;;;AACH,wBAME"}
package/dist/index.js DELETED
@@ -1,14 +0,0 @@
1
- import { TsdownAction } from "./actions/TsdownAction/index.js";
2
- export { TsdownAction } from "./actions/TsdownAction/index.js";
3
- export { Action } from "./types/Action.js";
4
- /**
5
- * Plugin definition for kist
6
- */
7
- export default {
8
- name: "@getkist/action-tsdown",
9
- version: "1.0.0",
10
- actions: {
11
- TsdownAction: new TsdownAction(),
12
- },
13
- };
14
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,eAAe;IACX,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE;QACL,YAAY,EAAE,IAAI,YAAY,EAAE;KACnC;CACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Base class for kist actions.
3
- * Provides common functionality for all action implementations.
4
- */
5
- export declare abstract class Action<TOptions = Record<string, unknown>> {
6
- /**
7
- * The unique name of this action.
8
- */
9
- abstract readonly name: string;
10
- /**
11
- * Returns a human-readable description of what this action does.
12
- */
13
- abstract describe(): string;
14
- /**
15
- * Validates the provided options before execution.
16
- * @param options - The options to validate
17
- * @returns true if options are valid, false otherwise
18
- */
19
- abstract validateOptions(options: TOptions): boolean;
20
- /**
21
- * Executes the action with the provided options.
22
- * @param options - The options for this action
23
- * @returns A promise that resolves when the action completes
24
- */
25
- abstract execute(options: TOptions): Promise<void>;
26
- /**
27
- * Logs an informational message.
28
- * @param message - The message to log
29
- */
30
- protected logInfo(message: string): void;
31
- /**
32
- * Logs a warning message.
33
- * @param message - The message to log
34
- */
35
- protected logWarning(message: string): void;
36
- /**
37
- * Logs an error message.
38
- * @param message - The message to log
39
- * @param error - Optional error object
40
- */
41
- protected logError(message: string, error?: unknown): void;
42
- /**
43
- * Logs a debug message.
44
- * @param message - The message to log
45
- */
46
- protected logDebug(message: string): void;
47
- }
48
- //# sourceMappingURL=Action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAEpD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAK5C"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Base class for kist actions.
3
- * Provides common functionality for all action implementations.
4
- */
5
- export class Action {
6
- /**
7
- * Logs an informational message.
8
- * @param message - The message to log
9
- */
10
- logInfo(message) {
11
- console.log(`[${this.name}] ${message}`);
12
- }
13
- /**
14
- * Logs a warning message.
15
- * @param message - The message to log
16
- */
17
- logWarning(message) {
18
- console.warn(`[${this.name}] WARNING: ${message}`);
19
- }
20
- /**
21
- * Logs an error message.
22
- * @param message - The message to log
23
- * @param error - Optional error object
24
- */
25
- logError(message, error) {
26
- console.error(`[${this.name}] ERROR: ${message}`, error || "");
27
- }
28
- /**
29
- * Logs a debug message.
30
- * @param message - The message to log
31
- */
32
- logDebug(message) {
33
- if (process.env.DEBUG) {
34
- console.debug(`[${this.name}] DEBUG: ${message}`);
35
- }
36
- }
37
- }
38
- //# sourceMappingURL=Action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAyBxB;;;OAGG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;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;;;OAGG;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;CACJ"}