@getkist/action-tsup 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 +21 -0
- package/README.md +122 -0
- package/dist/actions/BundleAction/BundleAction.d.ts +62 -0
- package/dist/actions/BundleAction/BundleAction.d.ts.map +1 -0
- package/dist/actions/BundleAction/BundleAction.js +93 -0
- package/dist/actions/BundleAction/BundleAction.js.map +1 -0
- package/dist/actions/BundleAction/index.d.ts +3 -0
- package/dist/actions/BundleAction/index.d.ts.map +1 -0
- package/dist/actions/BundleAction/index.js +9 -0
- package/dist/actions/BundleAction/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Action.d.ts +60 -0
- package/dist/types/Action.d.ts.map +1 -0
- package/dist/types/Action.js +56 -0
- package/dist/types/Action.js.map +1 -0
- package/package.json +78 -0
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,122 @@
|
|
|
1
|
+
# @getkist/action-tsup
|
|
2
|
+
|
|
3
|
+
TypeScript bundling actions for kist using tsup (powered by esbuild).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @getkist/action-tsup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### As a kist plugin
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
# kist.yml
|
|
17
|
+
plugins:
|
|
18
|
+
- "@getkist/action-tsup"
|
|
19
|
+
|
|
20
|
+
pipeline:
|
|
21
|
+
- action: BundleAction
|
|
22
|
+
options:
|
|
23
|
+
entry: "src/index.ts"
|
|
24
|
+
outDir: "dist"
|
|
25
|
+
format: ["esm", "cjs"]
|
|
26
|
+
dts: true
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Standalone usage
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { BundleAction } from "@getkist/action-tsup";
|
|
33
|
+
|
|
34
|
+
const action = new BundleAction();
|
|
35
|
+
await action.execute({
|
|
36
|
+
entry: "src/index.ts",
|
|
37
|
+
outDir: "dist",
|
|
38
|
+
format: ["esm", "cjs"],
|
|
39
|
+
dts: true,
|
|
40
|
+
minify: true,
|
|
41
|
+
sourcemap: true
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Actions
|
|
46
|
+
|
|
47
|
+
### BundleAction
|
|
48
|
+
|
|
49
|
+
Bundles TypeScript/JavaScript files using tsup (powered by esbuild).
|
|
50
|
+
|
|
51
|
+
#### Options
|
|
52
|
+
|
|
53
|
+
| Option | Type | Default | Description |
|
|
54
|
+
|--------|------|---------|-------------|
|
|
55
|
+
| `entry` | `string \| string[] \| Record<string, string>` | *required* | Entry point(s) for the bundle |
|
|
56
|
+
| `outDir` | `string` | `"dist"` | Output directory |
|
|
57
|
+
| `format` | `"esm" \| "cjs" \| "iife" \| Array` | `"esm"` | Output format(s) |
|
|
58
|
+
| `dts` | `boolean` | `true` | Generate TypeScript declaration files |
|
|
59
|
+
| `sourcemap` | `boolean` | `false` | Generate sourcemaps |
|
|
60
|
+
| `minify` | `boolean` | `false` | Minify output |
|
|
61
|
+
| `clean` | `boolean` | `true` | Clean output directory before build |
|
|
62
|
+
| `splitting` | `boolean` | `false` | Split code into chunks |
|
|
63
|
+
| `target` | `string` | `"node20"` | Target environment |
|
|
64
|
+
| `external` | `string[]` | `[]` | External packages to exclude |
|
|
65
|
+
| `configPath` | `string` | - | Path to tsup config file |
|
|
66
|
+
| `tsupOptions` | `object` | `{}` | Additional tsup options |
|
|
67
|
+
|
|
68
|
+
## Configuration Examples
|
|
69
|
+
|
|
70
|
+
### Multiple entry points
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
- action: BundleAction
|
|
74
|
+
options:
|
|
75
|
+
entry:
|
|
76
|
+
main: "src/index.ts"
|
|
77
|
+
cli: "src/cli.ts"
|
|
78
|
+
outDir: "dist"
|
|
79
|
+
format: ["esm", "cjs"]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Browser bundle (IIFE)
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
- action: BundleAction
|
|
86
|
+
options:
|
|
87
|
+
entry: "src/browser.ts"
|
|
88
|
+
outDir: "dist"
|
|
89
|
+
format: "iife"
|
|
90
|
+
minify: true
|
|
91
|
+
target: "es2020"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Library with sourcemaps
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
- action: BundleAction
|
|
98
|
+
options:
|
|
99
|
+
entry: "src/index.ts"
|
|
100
|
+
format: ["esm", "cjs"]
|
|
101
|
+
dts: true
|
|
102
|
+
sourcemap: true
|
|
103
|
+
external:
|
|
104
|
+
- "react"
|
|
105
|
+
- "react-dom"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Code splitting for ESM
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
- action: BundleAction
|
|
112
|
+
options:
|
|
113
|
+
entry:
|
|
114
|
+
- "src/index.ts"
|
|
115
|
+
- "src/utils.ts"
|
|
116
|
+
format: "esm"
|
|
117
|
+
splitting: true
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Action, ActionOptionsType } from "../../types/Action.js";
|
|
2
|
+
/**
|
|
3
|
+
* Output format for the bundle
|
|
4
|
+
*/
|
|
5
|
+
export type BundleFormat = "cjs" | "esm" | "iife";
|
|
6
|
+
/**
|
|
7
|
+
* Options for the BundleAction
|
|
8
|
+
*/
|
|
9
|
+
export interface BundleActionOptions extends ActionOptionsType {
|
|
10
|
+
/** Entry point(s) for the bundle */
|
|
11
|
+
entry: string | string[] | Record<string, string>;
|
|
12
|
+
/** Output directory (default: dist) */
|
|
13
|
+
outDir?: string;
|
|
14
|
+
/** Output format(s) (default: esm) */
|
|
15
|
+
format?: BundleFormat | BundleFormat[];
|
|
16
|
+
/** Generate TypeScript declaration files (default: true) */
|
|
17
|
+
dts?: boolean;
|
|
18
|
+
/** Generate sourcemaps (default: false) */
|
|
19
|
+
sourcemap?: boolean;
|
|
20
|
+
/** Minify output (default: false) */
|
|
21
|
+
minify?: boolean;
|
|
22
|
+
/** Clean output directory before build (default: true) */
|
|
23
|
+
clean?: boolean;
|
|
24
|
+
/** Split code into chunks (default: false) */
|
|
25
|
+
splitting?: boolean;
|
|
26
|
+
/** Target environment (default: node20) */
|
|
27
|
+
target?: string;
|
|
28
|
+
/** External packages to exclude from bundle */
|
|
29
|
+
external?: string[];
|
|
30
|
+
/** Path to tsup config file */
|
|
31
|
+
configPath?: string;
|
|
32
|
+
/** Additional tsup options */
|
|
33
|
+
tsupOptions?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* BundleAction handles TypeScript/JavaScript bundling using tsup.
|
|
37
|
+
* This action provides a fast, zero-config bundling solution powered by esbuild.
|
|
38
|
+
*/
|
|
39
|
+
export declare class BundleAction extends Action<BundleActionOptions> {
|
|
40
|
+
/**
|
|
41
|
+
* Validates the action options.
|
|
42
|
+
*
|
|
43
|
+
* @param options - The options to validate.
|
|
44
|
+
* @returns True if options are valid.
|
|
45
|
+
*/
|
|
46
|
+
validateOptions(options: BundleActionOptions): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Executes the bundle action using tsup.
|
|
49
|
+
*
|
|
50
|
+
* @param options - The options for bundling.
|
|
51
|
+
* @returns A Promise that resolves when bundling completes.
|
|
52
|
+
* @throws {Error} If bundling encounters an error.
|
|
53
|
+
*/
|
|
54
|
+
execute(options: BundleActionOptions): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Provides a description of the action.
|
|
57
|
+
*
|
|
58
|
+
* @returns A string description of the action.
|
|
59
|
+
*/
|
|
60
|
+
describe(): string;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=BundleAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BundleAction.d.ts","sourceRoot":"","sources":["../../../src/actions/BundleAction/BundleAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMlE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACvC,4DAA4D;IAC5D,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAMD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAM,CAAC,mBAAmB,CAAC;IACzD;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO;IA8BtD;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmD1D;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { build } from "tsup";
|
|
5
|
+
import { Action } from "../../types/Action.js";
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Classes
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* BundleAction handles TypeScript/JavaScript bundling using tsup.
|
|
11
|
+
* This action provides a fast, zero-config bundling solution powered by esbuild.
|
|
12
|
+
*/
|
|
13
|
+
export class BundleAction extends Action {
|
|
14
|
+
/**
|
|
15
|
+
* Validates the action options.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The options to validate.
|
|
18
|
+
* @returns True if options are valid.
|
|
19
|
+
*/
|
|
20
|
+
validateOptions(options) {
|
|
21
|
+
if (!options.entry) {
|
|
22
|
+
this.logError("Invalid options: 'entry' is required.");
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (options.format !== undefined) {
|
|
26
|
+
const validFormats = ["cjs", "esm", "iife"];
|
|
27
|
+
const formats = Array.isArray(options.format) ? options.format : [options.format];
|
|
28
|
+
for (const format of formats) {
|
|
29
|
+
if (!validFormats.includes(format)) {
|
|
30
|
+
this.logError(`Invalid options: 'format' must be one of: ${validFormats.join(", ")}`);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (options.dts !== undefined && typeof options.dts !== "boolean") {
|
|
36
|
+
this.logError("Invalid options: 'dts' must be a boolean.");
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (options.minify !== undefined && typeof options.minify !== "boolean") {
|
|
40
|
+
this.logError("Invalid options: 'minify' must be a boolean.");
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Executes the bundle action using tsup.
|
|
47
|
+
*
|
|
48
|
+
* @param options - The options for bundling.
|
|
49
|
+
* @returns A Promise that resolves when bundling completes.
|
|
50
|
+
* @throws {Error} If bundling encounters an error.
|
|
51
|
+
*/
|
|
52
|
+
async execute(options) {
|
|
53
|
+
if (!this.validateOptions(options)) {
|
|
54
|
+
throw new Error("Invalid options provided to BundleAction.");
|
|
55
|
+
}
|
|
56
|
+
const { entry, outDir = "dist", format = "esm", dts = true, sourcemap = false, minify = false, clean = true, splitting = false, target = "node20", external = [], configPath, tsupOptions = {}, } = options;
|
|
57
|
+
this.logInfo(`Bundling with tsup: ${JSON.stringify(entry)} → ${outDir}`);
|
|
58
|
+
try {
|
|
59
|
+
const tsupConfig = {
|
|
60
|
+
entry: entry,
|
|
61
|
+
outDir,
|
|
62
|
+
format: format,
|
|
63
|
+
dts,
|
|
64
|
+
sourcemap,
|
|
65
|
+
minify,
|
|
66
|
+
clean,
|
|
67
|
+
splitting,
|
|
68
|
+
target,
|
|
69
|
+
external,
|
|
70
|
+
...tsupOptions,
|
|
71
|
+
};
|
|
72
|
+
// If config path is provided, it will be loaded by tsup automatically
|
|
73
|
+
if (configPath) {
|
|
74
|
+
this.logInfo(`Using config file: ${configPath}`);
|
|
75
|
+
}
|
|
76
|
+
await build(tsupConfig);
|
|
77
|
+
this.logInfo(`Bundle created successfully in ${outDir}`);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.logError("Bundling failed.", error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Provides a description of the action.
|
|
86
|
+
*
|
|
87
|
+
* @returns A string description of the action.
|
|
88
|
+
*/
|
|
89
|
+
describe() {
|
|
90
|
+
return "Bundles TypeScript/JavaScript files using tsup (powered by esbuild).";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=BundleAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BundleAction.js","sourceRoot":"","sources":["../../../src/actions/BundleAction/BundleAction.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,KAAK,EAAW,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,MAAM,EAAqB,MAAM,uBAAuB,CAAC;AAyClE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;IAClF,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/BundleAction/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMpF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { BundleAction } from "./BundleAction.js";
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Export
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export { BundleAction };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/BundleAction/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAqC,MAAM,mBAAmB,CAAC;AAEpF,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAqC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionPlugin } from "./types/Action.js";
|
|
2
|
+
import { BundleAction } from "./actions/BundleAction/index.js";
|
|
3
|
+
declare const plugin: ActionPlugin;
|
|
4
|
+
export default plugin;
|
|
5
|
+
export type { BundleActionOptions, BundleFormat } from "./actions/BundleAction/index.js";
|
|
6
|
+
export { BundleAction };
|
|
7
|
+
export { Action, ActionPlugin, ActionOptionsType } from "./types/Action.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BundleAction } from "./actions/BundleAction/index.js";
|
|
2
|
+
const plugin = {
|
|
3
|
+
name: "@getkist/action-tsup",
|
|
4
|
+
version: "1.0.0",
|
|
5
|
+
actions: { BundleAction },
|
|
6
|
+
};
|
|
7
|
+
export default plugin;
|
|
8
|
+
export { BundleAction };
|
|
9
|
+
export { Action } from "./types/Action.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,MAAM,GAAiB;IACzB,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,EAAE,YAAY,EAAE;CAC5B,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,MAAM,EAAmC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Action types for kist action plugins
|
|
3
|
+
* These types match the kist Action interface for compatibility
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Action options type - a generic record of key-value pairs
|
|
7
|
+
*/
|
|
8
|
+
export type ActionOptionsType = Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for all kist actions
|
|
11
|
+
* Provides logging and execution interface
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class Action<T extends ActionOptionsType = ActionOptionsType> {
|
|
14
|
+
/**
|
|
15
|
+
* Gets the unique name of the action.
|
|
16
|
+
*/
|
|
17
|
+
get name(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Validates options before execution
|
|
20
|
+
* Override in subclasses for specific validation
|
|
21
|
+
*/
|
|
22
|
+
validateOptions(_options: T): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Execute the action with given options
|
|
25
|
+
* Must be implemented by subclasses
|
|
26
|
+
*/
|
|
27
|
+
abstract execute(options: T): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Provides a description of the action
|
|
30
|
+
*/
|
|
31
|
+
describe(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Log an info message
|
|
34
|
+
*/
|
|
35
|
+
protected logInfo(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Log an error message
|
|
38
|
+
*/
|
|
39
|
+
protected logError(message: string, error?: unknown): void;
|
|
40
|
+
/**
|
|
41
|
+
* Log a debug message
|
|
42
|
+
*/
|
|
43
|
+
protected logDebug(message: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Log a warning message
|
|
46
|
+
*/
|
|
47
|
+
protected logWarning(message: string): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Plugin interface for kist action packages
|
|
51
|
+
*/
|
|
52
|
+
export interface ActionPlugin {
|
|
53
|
+
/** Plugin name */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Plugin version */
|
|
56
|
+
version: string;
|
|
57
|
+
/** Map of action names to action classes */
|
|
58
|
+
actions: Record<string, new () => Action>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD;;;GAGG;AACH,8BAAsB,MAAM,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACxE;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO;IAIrC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMzC;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG9C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,MAAM,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Action types for kist action plugins
|
|
3
|
+
* These types match the kist Action interface for compatibility
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class for all kist actions
|
|
7
|
+
* Provides logging and execution interface
|
|
8
|
+
*/
|
|
9
|
+
export class Action {
|
|
10
|
+
/**
|
|
11
|
+
* Gets the unique name of the action.
|
|
12
|
+
*/
|
|
13
|
+
get name() {
|
|
14
|
+
return this.constructor.name;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates options before execution
|
|
18
|
+
* Override in subclasses for specific validation
|
|
19
|
+
*/
|
|
20
|
+
validateOptions(_options) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provides a description of the action
|
|
25
|
+
*/
|
|
26
|
+
describe() {
|
|
27
|
+
return `${this.name} action`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Log an info message
|
|
31
|
+
*/
|
|
32
|
+
logInfo(message) {
|
|
33
|
+
console.log(`[${this.name}] ${message}`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Log an error message
|
|
37
|
+
*/
|
|
38
|
+
logError(message, error) {
|
|
39
|
+
console.error(`[${this.name}] ERROR: ${message}`, error || "");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Log a debug message
|
|
43
|
+
*/
|
|
44
|
+
logDebug(message) {
|
|
45
|
+
if (process.env.DEBUG) {
|
|
46
|
+
console.debug(`[${this.name}] DEBUG: ${message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Log a warning message
|
|
51
|
+
*/
|
|
52
|
+
logWarning(message) {
|
|
53
|
+
console.warn(`[${this.name}] WARNING: ${message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=Action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,MAAM,OAAgB,MAAM;IACxB;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,eAAe,CAAC,QAAW;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAQD;;OAEG;IACH,QAAQ;QACJ,OAAO,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED;;OAEG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getkist/action-tsup",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "TypeScript bundling actions for kist using tsup",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"kist",
|
|
17
|
+
"kist-action",
|
|
18
|
+
"tsup",
|
|
19
|
+
"bundler",
|
|
20
|
+
"typescript",
|
|
21
|
+
"build",
|
|
22
|
+
"esbuild"
|
|
23
|
+
],
|
|
24
|
+
"author": "kist",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/getkist/kist-action-tsup.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/getkist/kist-action-tsup/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/getkist/kist-action-tsup#readme",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20.0.0",
|
|
36
|
+
"npm": ">=10.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"build:watch": "tsc --watch",
|
|
41
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
42
|
+
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
|
|
43
|
+
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
|
|
44
|
+
"test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.test\\.ts$",
|
|
45
|
+
"test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPatterns=\\.integration\\.test\\.ts$",
|
|
46
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
47
|
+
"lint:fix": "eslint 'src/**/*.ts' --fix",
|
|
48
|
+
"format": "prettier --write 'src/**/*.ts'",
|
|
49
|
+
"docs": "typedoc",
|
|
50
|
+
"docs:watch": "typedoc --watch",
|
|
51
|
+
"clean": "rm -rf dist docs/api coverage",
|
|
52
|
+
"prepublishOnly": "npm run clean && npm run build && npm test"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"kist": ">=0.1.58"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"tsup": "^8.0.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/jest": "30.0.0",
|
|
62
|
+
"@types/node": "25.2.2",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
64
|
+
"@typescript-eslint/parser": "8.54.0",
|
|
65
|
+
"eslint": "10.0.0",
|
|
66
|
+
"jest": "30.2.0",
|
|
67
|
+
"ts-jest": "^29.4.6",
|
|
68
|
+
"typedoc": "^0.28.0",
|
|
69
|
+
"typedoc-plugin-markdown": "^4.10.0",
|
|
70
|
+
"typescript": "^5.9.3"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"dist",
|
|
74
|
+
"README.md",
|
|
75
|
+
"LICENSE"
|
|
76
|
+
],
|
|
77
|
+
"sideEffects": false
|
|
78
|
+
}
|