@getkist/action-tsdown 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 @@
1
+ # kist-action-tsdown
@@ -0,0 +1,112 @@
1
+ import { Action } from "../../types/Action.js";
2
+ /**
3
+ * Output format types supported by tsdown
4
+ */
5
+ export type TsdownFormat = "esm" | "cjs" | "iife";
6
+ /**
7
+ * Options for the TsdownAction
8
+ */
9
+ export interface TsdownActionOptions {
10
+ /**
11
+ * Entry point file(s) for the bundle
12
+ */
13
+ entry: string | string[];
14
+ /**
15
+ * Output directory for the bundle
16
+ */
17
+ outDir?: string;
18
+ /**
19
+ * Output format(s): esm, cjs, or iife
20
+ */
21
+ format?: TsdownFormat | TsdownFormat[];
22
+ /**
23
+ * Generate TypeScript declaration files
24
+ */
25
+ dts?: boolean;
26
+ /**
27
+ * Minify the output
28
+ */
29
+ minify?: boolean;
30
+ /**
31
+ * Generate sourcemaps
32
+ */
33
+ sourcemap?: boolean | "inline";
34
+ /**
35
+ * Clean output directory before build
36
+ */
37
+ clean?: boolean;
38
+ /**
39
+ * External packages to exclude from bundle
40
+ */
41
+ external?: string[];
42
+ /**
43
+ * Global variable names for external packages (for iife/umd)
44
+ */
45
+ globalName?: string;
46
+ /**
47
+ * Target environment
48
+ */
49
+ target?: string;
50
+ /**
51
+ * Path to tsconfig.json
52
+ */
53
+ tsconfig?: string;
54
+ /**
55
+ * Watch mode
56
+ */
57
+ watch?: boolean;
58
+ /**
59
+ * Enable tree shaking
60
+ */
61
+ treeshake?: boolean;
62
+ /**
63
+ * Define global constants
64
+ */
65
+ define?: Record<string, string>;
66
+ /**
67
+ * Environment variables to inline
68
+ */
69
+ env?: Record<string, string>;
70
+ /**
71
+ * Platform target: node or browser
72
+ */
73
+ platform?: "node" | "browser" | "neutral";
74
+ /**
75
+ * Bundle packages from node_modules
76
+ */
77
+ bundle?: boolean;
78
+ /**
79
+ * Skip node_modules bundling (noExternal)
80
+ */
81
+ noExternal?: string[];
82
+ /**
83
+ * Working directory
84
+ */
85
+ cwd?: string;
86
+ /**
87
+ * Silence output
88
+ */
89
+ silent?: boolean;
90
+ /**
91
+ * Path to tsdown config file
92
+ */
93
+ configPath?: string;
94
+ }
95
+ /**
96
+ * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).
97
+ */
98
+ export declare class TsdownAction extends Action<TsdownActionOptions> {
99
+ readonly name = "TsdownAction";
100
+ describe(): string;
101
+ validateOptions(options: TsdownActionOptions): boolean;
102
+ execute(options: TsdownActionOptions): Promise<void>;
103
+ /**
104
+ * Build tsdown CLI arguments from options
105
+ */
106
+ private buildArgs;
107
+ /**
108
+ * Run tsdown with the given arguments
109
+ */
110
+ private runTsdown;
111
+ }
112
+ //# sourceMappingURL=TsdownAction.d.ts.map
@@ -0,0 +1 @@
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,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAE1C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,MAAM,CAAC,mBAAmB,CAAC;IACzD,QAAQ,CAAC,IAAI,kBAAkB;IAE/B,QAAQ,IAAI,MAAM;IAIlB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO;IAqChD,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB1D;;OAEG;IACH,OAAO,CAAC,SAAS;IAyFjB;;OAEG;IACH,OAAO,CAAC,SAAS;CAoCpB"}
@@ -0,0 +1,172 @@
1
+ import { Action } from "../../types/Action.js";
2
+ import { spawn } from "child_process";
3
+ /**
4
+ * Action for bundling TypeScript/JavaScript using tsdown (Rolldown-based bundler).
5
+ */
6
+ export class TsdownAction extends Action {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.name = "TsdownAction";
10
+ }
11
+ describe() {
12
+ return "Bundle TypeScript/JavaScript files using tsdown (Rolldown-based bundler)";
13
+ }
14
+ validateOptions(options) {
15
+ if (!options.entry) {
16
+ this.logError("Invalid options: 'entry' is required");
17
+ return false;
18
+ }
19
+ if (Array.isArray(options.entry) && options.entry.length === 0) {
20
+ this.logError("Invalid options: 'entry' must have at least one entry point");
21
+ return false;
22
+ }
23
+ if (options.format) {
24
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
25
+ const validFormats = ["esm", "cjs", "iife"];
26
+ for (const format of formats) {
27
+ if (!validFormats.includes(format)) {
28
+ this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(", ")}`);
29
+ return false;
30
+ }
31
+ }
32
+ }
33
+ if (options.platform && !["node", "browser", "neutral"].includes(options.platform)) {
34
+ this.logError("Invalid options: 'platform' must be one of: node, browser, neutral");
35
+ return false;
36
+ }
37
+ if (options.sourcemap !== undefined &&
38
+ typeof options.sourcemap !== "boolean" &&
39
+ options.sourcemap !== "inline") {
40
+ this.logError("Invalid options: 'sourcemap' must be boolean or 'inline'");
41
+ return false;
42
+ }
43
+ return true;
44
+ }
45
+ async execute(options) {
46
+ if (!this.validateOptions(options)) {
47
+ throw new Error("Invalid options provided to TsdownAction");
48
+ }
49
+ const args = this.buildArgs(options);
50
+ const cwd = options.cwd || process.cwd();
51
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
52
+ this.logInfo(`Bundling ${entries.length} entry point(s) with tsdown`);
53
+ try {
54
+ await this.runTsdown(args, cwd, options.silent);
55
+ this.logInfo("Bundle completed successfully");
56
+ }
57
+ catch (error) {
58
+ this.logError("tsdown bundling failed.", error);
59
+ throw error;
60
+ }
61
+ }
62
+ /**
63
+ * Build tsdown CLI arguments from options
64
+ */
65
+ buildArgs(options) {
66
+ const args = [];
67
+ // Entry points
68
+ const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
69
+ args.push(...entries);
70
+ if (options.configPath) {
71
+ args.push("--config", options.configPath);
72
+ }
73
+ if (options.outDir) {
74
+ args.push("--out-dir", options.outDir);
75
+ }
76
+ if (options.format) {
77
+ const formats = Array.isArray(options.format) ? options.format : [options.format];
78
+ args.push("--format", formats.join(","));
79
+ }
80
+ if (options.dts) {
81
+ args.push("--dts");
82
+ }
83
+ if (options.minify) {
84
+ args.push("--minify");
85
+ }
86
+ if (options.sourcemap !== undefined) {
87
+ if (options.sourcemap === true) {
88
+ args.push("--sourcemap");
89
+ }
90
+ else if (options.sourcemap === "inline") {
91
+ args.push("--sourcemap", "inline");
92
+ }
93
+ }
94
+ if (options.clean) {
95
+ args.push("--clean");
96
+ }
97
+ if (options.external && options.external.length > 0) {
98
+ for (const ext of options.external) {
99
+ args.push("--external", ext);
100
+ }
101
+ }
102
+ if (options.globalName) {
103
+ args.push("--global-name", options.globalName);
104
+ }
105
+ if (options.target) {
106
+ args.push("--target", options.target);
107
+ }
108
+ if (options.tsconfig) {
109
+ args.push("--tsconfig", options.tsconfig);
110
+ }
111
+ if (options.watch) {
112
+ args.push("--watch");
113
+ }
114
+ if (options.treeshake === false) {
115
+ args.push("--no-treeshake");
116
+ }
117
+ if (options.define) {
118
+ for (const [key, value] of Object.entries(options.define)) {
119
+ args.push("--define", `${key}=${value}`);
120
+ }
121
+ }
122
+ if (options.platform) {
123
+ args.push("--platform", options.platform);
124
+ }
125
+ if (options.bundle === false) {
126
+ args.push("--no-bundle");
127
+ }
128
+ if (options.noExternal && options.noExternal.length > 0) {
129
+ for (const pkg of options.noExternal) {
130
+ args.push("--no-external", pkg);
131
+ }
132
+ }
133
+ return args;
134
+ }
135
+ /**
136
+ * Run tsdown with the given arguments
137
+ */
138
+ runTsdown(args, cwd, silent) {
139
+ return new Promise((resolve, reject) => {
140
+ // Try to find tsdown binary
141
+ let tsdownBin;
142
+ try {
143
+ tsdownBin = require.resolve("tsdown/dist/cli.mjs");
144
+ }
145
+ catch {
146
+ // Fallback to npx
147
+ tsdownBin = "tsdown";
148
+ }
149
+ this.logDebug(`Running: tsdown ${args.join(" ")}`);
150
+ const isNpx = tsdownBin === "tsdown";
151
+ const command = isNpx ? "npx" : "node";
152
+ const spawnArgs = isNpx ? ["tsdown", ...args] : [tsdownBin, ...args];
153
+ const child = spawn(command, spawnArgs, {
154
+ cwd,
155
+ stdio: silent ? "ignore" : "inherit",
156
+ shell: isNpx,
157
+ });
158
+ child.on("close", (code) => {
159
+ if (code === 0) {
160
+ resolve();
161
+ }
162
+ else {
163
+ reject(new Error(`tsdown exited with code ${code}`));
164
+ }
165
+ });
166
+ child.on("error", (error) => {
167
+ reject(error);
168
+ });
169
+ });
170
+ }
171
+ }
172
+ //# sourceMappingURL=TsdownAction.js.map
@@ -0,0 +1 @@
1
+ {"version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K,QAAQ,CAAC;YACrC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACvC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;YAErE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE;gBACpC,GAAG;gBACH,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;gBACpC,KAAK,EAAE,KAAK;aACf,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACb,OAAO,EAAE,CAAC;gBACd,CAAC;qBAAM,CAAC;oBACJ,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC,CAAC;gBACzD,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACxB,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export { TsdownAction } from "./TsdownAction.js";
2
+ export type { TsdownActionOptions, TsdownFormat } from "./TsdownAction.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export { TsdownAction } from "./TsdownAction.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/TsdownAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,16 @@
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";
5
+ /**
6
+ * Plugin definition for kist
7
+ */
8
+ declare const _default: {
9
+ name: string;
10
+ version: string;
11
+ actions: {
12
+ TsdownAction: TsdownAction;
13
+ };
14
+ };
15
+ export default _default;
16
+ //# 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,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 ADDED
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,48 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,38 @@
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
@@ -0,0 +1 @@
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"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@getkist/action-tsdown",
3
+ "version": "1.0.1",
4
+ "description": "tsdown bundler action for kist",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "type": "module",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
11
+ "lint": "eslint src/**/*.ts",
12
+ "prepublishOnly": "npm run build && npm test"
13
+ },
14
+ "keywords": [
15
+ "kist",
16
+ "tsdown",
17
+ "bundler",
18
+ "rolldown",
19
+ "typescript",
20
+ "plugin"
21
+ ],
22
+ "author": "kist",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/getkist/kist-action-tsdown.git"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.0.0",
30
+ "npm": ">=10.0.0"
31
+ },
32
+ "dependencies": {
33
+ "tsdown": "^0.4.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/jest": "^29.5.12",
37
+ "@types/node": "^20.11.0",
38
+ "eslint": "^9.0.0",
39
+ "jest": "^29.7.0",
40
+ "ts-jest": "^29.1.2",
41
+ "typescript": "^5.3.0",
42
+ "typescript-eslint": "^8.0.0"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md",
47
+ "LICENSE"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ }
52
+ }