@getkist/action-terser 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 +110 -0
- package/dist/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts +49 -0
- package/dist/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts.map +1 -0
- package/dist/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js +103 -0
- package/dist/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js.map +1 -0
- package/dist/actions/JavaScriptMinifyAction/index.d.ts +3 -0
- package/dist/actions/JavaScriptMinifyAction/index.d.ts.map +1 -0
- package/dist/actions/JavaScriptMinifyAction/index.js +9 -0
- package/dist/actions/JavaScriptMinifyAction/index.js.map +1 -0
- package/dist/actions/JavaScriptMinifyAction/terser.config.d.ts +28 -0
- package/dist/actions/JavaScriptMinifyAction/terser.config.d.ts.map +1 -0
- package/dist/actions/JavaScriptMinifyAction/terser.config.js +103 -0
- package/dist/actions/JavaScriptMinifyAction/terser.config.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,110 @@
|
|
|
1
|
+
# @getkist/action-terser
|
|
2
|
+
|
|
3
|
+
JavaScript minification actions for kist using Terser.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @getkist/action-terser
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### As a kist plugin
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
# kist.yml
|
|
17
|
+
plugins:
|
|
18
|
+
- "@getkist/action-terser"
|
|
19
|
+
|
|
20
|
+
pipeline:
|
|
21
|
+
- action: JavaScriptMinifyAction
|
|
22
|
+
options:
|
|
23
|
+
inputPath: "src/app.js"
|
|
24
|
+
outputPath: "dist/app.min.js"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Standalone usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { JavaScriptMinifyAction } from "@getkist/action-terser";
|
|
31
|
+
|
|
32
|
+
const action = new JavaScriptMinifyAction();
|
|
33
|
+
await action.execute({
|
|
34
|
+
inputPath: "src/app.js",
|
|
35
|
+
outputPath: "dist/app.min.js",
|
|
36
|
+
customConfig: {
|
|
37
|
+
compress: {
|
|
38
|
+
drop_console: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Actions
|
|
45
|
+
|
|
46
|
+
### JavaScriptMinifyAction
|
|
47
|
+
|
|
48
|
+
Minifies JavaScript files using Terser to reduce file size and optimize performance.
|
|
49
|
+
|
|
50
|
+
#### Options
|
|
51
|
+
|
|
52
|
+
| Option | Type | Required | Description |
|
|
53
|
+
|--------|------|----------|-------------|
|
|
54
|
+
| `inputPath` | `string` | Yes | Path to the input JavaScript file |
|
|
55
|
+
| `outputPath` | `string` | Yes | Path where the minified file will be saved |
|
|
56
|
+
| `customConfig` | `object` | No | Custom Terser configuration to merge with defaults |
|
|
57
|
+
|
|
58
|
+
#### Default Terser Configuration
|
|
59
|
+
|
|
60
|
+
The action uses sensible defaults optimized for production:
|
|
61
|
+
|
|
62
|
+
- **Compression**: Drops console statements, removes debugger, dead code elimination
|
|
63
|
+
- **Mangling**: Minifies variable and function names
|
|
64
|
+
- **Output**: Removes comments, no beautification
|
|
65
|
+
- **ECMAScript**: Targets ES5 for broad compatibility
|
|
66
|
+
|
|
67
|
+
You can override any Terser option via `customConfig`.
|
|
68
|
+
|
|
69
|
+
## Configuration Examples
|
|
70
|
+
|
|
71
|
+
### Preserve console.log statements
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
- action: JavaScriptMinifyAction
|
|
75
|
+
options:
|
|
76
|
+
inputPath: "src/app.js"
|
|
77
|
+
outputPath: "dist/app.min.js"
|
|
78
|
+
customConfig:
|
|
79
|
+
compress:
|
|
80
|
+
drop_console: false
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Generate source maps
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
- action: JavaScriptMinifyAction
|
|
87
|
+
options:
|
|
88
|
+
inputPath: "src/app.js"
|
|
89
|
+
outputPath: "dist/app.min.js"
|
|
90
|
+
customConfig:
|
|
91
|
+
sourceMap:
|
|
92
|
+
filename: "app.min.js.map"
|
|
93
|
+
url: "app.min.js.map"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Target modern browsers (ES2020)
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
- action: JavaScriptMinifyAction
|
|
100
|
+
options:
|
|
101
|
+
inputPath: "src/app.js"
|
|
102
|
+
outputPath: "dist/app.min.js"
|
|
103
|
+
customConfig:
|
|
104
|
+
ecma: 2020
|
|
105
|
+
module: true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Action, ActionOptionsType } from "../../types/Action.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the JavaScriptMinifyAction
|
|
4
|
+
*/
|
|
5
|
+
export interface JavaScriptMinifyActionOptions extends ActionOptionsType {
|
|
6
|
+
/** Path to the input JavaScript file */
|
|
7
|
+
inputPath: string;
|
|
8
|
+
/** Path where the minified file will be saved */
|
|
9
|
+
outputPath: string;
|
|
10
|
+
/** Custom Terser configuration to merge with defaults */
|
|
11
|
+
customConfig?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* JavaScriptMinifyAction handles the minification of JavaScript files.
|
|
15
|
+
* Uses Terser to reduce file size and optimize performance.
|
|
16
|
+
*/
|
|
17
|
+
export declare class JavaScriptMinifyAction extends Action<JavaScriptMinifyActionOptions> {
|
|
18
|
+
/**
|
|
19
|
+
* Validates the action options.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The options to validate.
|
|
22
|
+
* @returns True if options are valid.
|
|
23
|
+
*/
|
|
24
|
+
validateOptions(options: JavaScriptMinifyActionOptions): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Executes the JavaScript minification action.
|
|
27
|
+
*
|
|
28
|
+
* @param options - The options containing input and output file paths.
|
|
29
|
+
* @returns A Promise that resolves when the minification process completes.
|
|
30
|
+
* @throws {Error} If input file is missing, minification fails, or output cannot be written.
|
|
31
|
+
*/
|
|
32
|
+
execute(options: JavaScriptMinifyActionOptions): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Minifies a JavaScript file using Terser.
|
|
35
|
+
*
|
|
36
|
+
* @param inputPath - Path to the input JavaScript file.
|
|
37
|
+
* @param outputPath - Path where the minified file will be saved.
|
|
38
|
+
* @param customConfig - Custom Terser configuration.
|
|
39
|
+
* @returns A Promise that resolves when the minification is complete.
|
|
40
|
+
*/
|
|
41
|
+
private minifyFile;
|
|
42
|
+
/**
|
|
43
|
+
* Provides a description of the action.
|
|
44
|
+
*
|
|
45
|
+
* @returns A string description of the action.
|
|
46
|
+
*/
|
|
47
|
+
describe(): string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=JavaScriptMinifyAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JavaScriptMinifyAction.d.ts","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAOlE;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,iBAAiB;IACpE,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAMD;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,MAAM,CAAC,6BAA6B,CAAC;IAC7E;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO;IAYhE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBpE;;;;;;;OAOG;YACW,UAAU;IAyCxB;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { promises as fs } from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { minify } from "terser";
|
|
7
|
+
import { Action } from "../../types/Action.js";
|
|
8
|
+
import terserConfig from "./terser.config.js";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Classes
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* JavaScriptMinifyAction handles the minification of JavaScript files.
|
|
14
|
+
* Uses Terser to reduce file size and optimize performance.
|
|
15
|
+
*/
|
|
16
|
+
export class JavaScriptMinifyAction extends Action {
|
|
17
|
+
/**
|
|
18
|
+
* Validates the action options.
|
|
19
|
+
*
|
|
20
|
+
* @param options - The options to validate.
|
|
21
|
+
* @returns True if options are valid.
|
|
22
|
+
*/
|
|
23
|
+
validateOptions(options) {
|
|
24
|
+
if (!options.inputPath || typeof options.inputPath !== "string") {
|
|
25
|
+
this.logError("Invalid options: 'inputPath' is required and must be a string.");
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (!options.outputPath || typeof options.outputPath !== "string") {
|
|
29
|
+
this.logError("Invalid options: 'outputPath' is required and must be a string.");
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Executes the JavaScript minification action.
|
|
36
|
+
*
|
|
37
|
+
* @param options - The options containing input and output file paths.
|
|
38
|
+
* @returns A Promise that resolves when the minification process completes.
|
|
39
|
+
* @throws {Error} If input file is missing, minification fails, or output cannot be written.
|
|
40
|
+
*/
|
|
41
|
+
async execute(options) {
|
|
42
|
+
if (!this.validateOptions(options)) {
|
|
43
|
+
throw new Error("Invalid options: 'inputPath' and 'outputPath' are required.");
|
|
44
|
+
}
|
|
45
|
+
const { inputPath, outputPath, customConfig = {} } = options;
|
|
46
|
+
this.logInfo(`Minifying JavaScript file: ${inputPath} → ${outputPath}`);
|
|
47
|
+
try {
|
|
48
|
+
await this.minifyFile(inputPath, outputPath, customConfig);
|
|
49
|
+
this.logInfo(`JavaScript minification completed: ${outputPath}`);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.logError("JavaScript minification failed.", error);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Minifies a JavaScript file using Terser.
|
|
58
|
+
*
|
|
59
|
+
* @param inputPath - Path to the input JavaScript file.
|
|
60
|
+
* @param outputPath - Path where the minified file will be saved.
|
|
61
|
+
* @param customConfig - Custom Terser configuration.
|
|
62
|
+
* @returns A Promise that resolves when the minification is complete.
|
|
63
|
+
*/
|
|
64
|
+
async minifyFile(inputPath, outputPath, customConfig) {
|
|
65
|
+
try {
|
|
66
|
+
const resolvedInputPath = path.resolve(inputPath);
|
|
67
|
+
const resolvedOutputPath = path.resolve(outputPath);
|
|
68
|
+
// Read JavaScript file
|
|
69
|
+
const inputCode = await fs.readFile(resolvedInputPath, "utf8");
|
|
70
|
+
// Merge Terser configuration with explicit type casting
|
|
71
|
+
const terserOptions = {
|
|
72
|
+
...terserConfig,
|
|
73
|
+
...customConfig,
|
|
74
|
+
ecma: terserConfig.ecma,
|
|
75
|
+
nameCache: terserConfig.nameCache ?? undefined,
|
|
76
|
+
};
|
|
77
|
+
// Minify using Terser
|
|
78
|
+
const result = await minify(inputCode, terserOptions);
|
|
79
|
+
if (!result.code) {
|
|
80
|
+
throw new Error("Minification resulted in empty output.");
|
|
81
|
+
}
|
|
82
|
+
// Ensure output directory exists
|
|
83
|
+
const outputDir = path.dirname(resolvedOutputPath);
|
|
84
|
+
await fs.mkdir(outputDir, { recursive: true });
|
|
85
|
+
// Write minified file
|
|
86
|
+
await fs.writeFile(resolvedOutputPath, result.code, "utf8");
|
|
87
|
+
this.logDebug(`Minified JavaScript file saved to ${resolvedOutputPath}`);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
this.logError(`Error minifying JavaScript file: ${inputPath}`, error);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Provides a description of the action.
|
|
96
|
+
*
|
|
97
|
+
* @returns A string description of the action.
|
|
98
|
+
*/
|
|
99
|
+
describe() {
|
|
100
|
+
return "Minifies JavaScript files using Terser to reduce size and optimize performance.";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=JavaScriptMinifyAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JavaScriptMinifyAction.js","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAqB,MAAM,uBAAuB,CAAC;AAClE,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAkB9C,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,MAAqC;IAC7E;;;;;OAKG;IACH,eAAe,CAAC,OAAsC;QAClD,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC9D,IAAI,CAAC,QAAQ,CAAC,gEAAgE,CAAC,CAAC;YAChF,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAChE,IAAI,CAAC,QAAQ,CAAC,iEAAiE,CAAC,CAAC;YACjF,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,OAAsC;QAChD,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,8BAA8B,SAAS,MAAM,UAAU,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,YAAuC,CAAC,CAAC;YACtF,IAAI,CAAC,OAAO,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACK,KAAK,CAAC,UAAU,CACpB,SAAiB,EACjB,UAAkB,EAClB,YAAqC;QAErC,IAAI,CAAC;YACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAEpD,uBAAuB;YACvB,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;YAE/D,wDAAwD;YACxD,MAAM,aAAa,GAAkB;gBACjC,GAAG,YAAY;gBACf,GAAG,YAAY;gBACf,IAAI,EAAE,YAAY,CAAC,IAA6B;gBAChD,SAAS,EAAE,YAAY,CAAC,SAAS,IAAI,SAAS;aACjD,CAAC;YAEF,sBAAsB;YACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YAEtD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC9D,CAAC;YAED,iCAAiC;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;YACnD,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE/C,sBAAsB;YACtB,MAAM,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE5D,IAAI,CAAC,QAAQ,CAAC,qCAAqC,kBAAkB,EAAE,CAAC,CAAC;QAC7E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,CAAC,oCAAoC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACJ,OAAO,iFAAiF,CAAC;IAC7F,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAMpG,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { JavaScriptMinifyAction } from "./JavaScriptMinifyAction.js";
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Export
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export { JavaScriptMinifyAction };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,sBAAsB,EAAiC,MAAM,6BAA6B,CAAC;AAEpG,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,sBAAsB,EAAiC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const terserConfig: {
|
|
2
|
+
parse: {};
|
|
3
|
+
compress: {
|
|
4
|
+
drop_console: boolean;
|
|
5
|
+
drop_debugger: boolean;
|
|
6
|
+
pure_funcs: string[];
|
|
7
|
+
arrows: boolean;
|
|
8
|
+
};
|
|
9
|
+
mangle: {
|
|
10
|
+
properties: boolean;
|
|
11
|
+
};
|
|
12
|
+
format: {
|
|
13
|
+
comments: boolean;
|
|
14
|
+
beautify: boolean;
|
|
15
|
+
};
|
|
16
|
+
sourceMap: {};
|
|
17
|
+
ecma: number;
|
|
18
|
+
enclose: boolean;
|
|
19
|
+
keep_classnames: boolean;
|
|
20
|
+
keep_fnames: boolean;
|
|
21
|
+
ie8: boolean;
|
|
22
|
+
module: boolean;
|
|
23
|
+
nameCache: null;
|
|
24
|
+
safari10: boolean;
|
|
25
|
+
toplevel: boolean;
|
|
26
|
+
};
|
|
27
|
+
export default terserConfig;
|
|
28
|
+
//# sourceMappingURL=terser.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terser.config.d.ts","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/terser.config.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAgGjB,CAAC;AAMF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Terser Configuration
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// https://terser.org/docs/api-reference/
|
|
5
|
+
const terserConfig = {
|
|
6
|
+
parse: {
|
|
7
|
+
// parse options
|
|
8
|
+
},
|
|
9
|
+
compress: {
|
|
10
|
+
// compress options
|
|
11
|
+
drop_console: true, // Remove console.log statements
|
|
12
|
+
drop_debugger: true, // Remove debugger statements
|
|
13
|
+
pure_funcs: ["console.info", "console.debug", "console.warn"], // Remove specific console functions
|
|
14
|
+
// defaults (default: true) -- Pass false to disable most default enabled compress transforms.
|
|
15
|
+
// Useful when you only want to enable a few compress options while disabling the rest.
|
|
16
|
+
// Class and object literal methods are converted will also be
|
|
17
|
+
// converted to arrow expressions if the resultant code is shorter:
|
|
18
|
+
// m(){return x} becomes m:()=>x. To do this to regular ES5 functions
|
|
19
|
+
// which don't use this or arguments, see unsafe_arrows.
|
|
20
|
+
arrows: true, // (default: true)
|
|
21
|
+
// arguments (default: false) -- replace arguments[index] with function parameter name whenever possible.
|
|
22
|
+
// booleans (default: true) -- various optimizations for boolean context, for example !!a ? b : c → a ? b : c
|
|
23
|
+
// booleans_as_integers (default: false) -- Turn booleans into 0 and 1
|
|
24
|
+
// collapse_vars (default: true) -- Collapse single-use non-constant variables, side effects permitting.
|
|
25
|
+
// comparisons (default: true) -- apply certain optimizations to binary nodes
|
|
26
|
+
// computed_props (default: true) -- Transforms constant computed properties into regular ones
|
|
27
|
+
// conditionals (default: true) -- apply optimizations for if-s and conditional expressions
|
|
28
|
+
// dead_code (default: true) -- remove unreachable code
|
|
29
|
+
// directives (default: true) -- remove redundant or non-standard directives
|
|
30
|
+
// drop_console (default: false) -- Pass true to discard calls to console.* functions
|
|
31
|
+
// drop_debugger (default: true) -- remove debugger; statements
|
|
32
|
+
// ecma (default: 5) -- Pass 2015 or greater to enable compress options that will transform ES5 code
|
|
33
|
+
// evaluate (default: true) -- attempt to evaluate constant expressions
|
|
34
|
+
// expression (default: false) -- Pass true to preserve completion values from terminal statements
|
|
35
|
+
// global_defs (default: {}) -- see conditional compilation
|
|
36
|
+
// hoist_funs (default: false) -- hoist function declarations
|
|
37
|
+
// hoist_props (default: true) -- hoist properties from constant object and array literals
|
|
38
|
+
// hoist_vars (default: false) -- hoist var declarations
|
|
39
|
+
// if_return (default: true) -- optimizations for if/return and if/continue
|
|
40
|
+
// inline (default: true) -- inline calls to function with simple/return statement
|
|
41
|
+
// join_vars (default: true) -- join consecutive var, let and const statements
|
|
42
|
+
// keep_classnames (default: false) -- Pass true to prevent discarding class names
|
|
43
|
+
// keep_fargs (default: true) -- Prevents discarding unused function arguments
|
|
44
|
+
// keep_fnames (default: false) -- Pass true to prevent discarding function names
|
|
45
|
+
// keep_infinity (default: false) -- Pass true to prevent Infinity from being compressed into 1/0
|
|
46
|
+
// lhs_constants (default: true) -- Moves constant values to the left-hand side of binary nodes
|
|
47
|
+
// loops (default: true) -- optimizations for do, while and for loops
|
|
48
|
+
// module (default false) -- Pass true when compressing an ES6 module
|
|
49
|
+
// negate_iife (default: true) -- negate "Immediately-Called Function Expressions"
|
|
50
|
+
// passes (default: 1) -- The maximum number of times to run compress
|
|
51
|
+
// properties (default: true) -- rewrite property access using the dot notation
|
|
52
|
+
// pure_funcs (default: null) -- array of function names that don't produce side effects
|
|
53
|
+
// pure_getters (default: "strict") -- assume object property access doesn't have side effects
|
|
54
|
+
// pure_new (default: false) -- Set to true to assume new X() never has side effects
|
|
55
|
+
// reduce_vars (default: true) -- Improve optimization on variables assigned as constants
|
|
56
|
+
// reduce_funcs (default: true) -- Inline single-use functions when possible
|
|
57
|
+
// sequences (default: true) -- join consecutive simple statements using the comma operator
|
|
58
|
+
// side_effects (default: true) -- Remove expressions which have no side effects
|
|
59
|
+
// switches (default: true) -- de-duplicate and remove unreachable switch branches
|
|
60
|
+
// toplevel (default: false) -- drop unreferenced functions and/or variables in toplevel scope
|
|
61
|
+
// top_retain (default: null) -- prevent specific toplevel functions and variables from removal
|
|
62
|
+
// typeofs (default: true) -- Transforms typeof foo == "undefined" into foo === void 0
|
|
63
|
+
// unsafe (default: false) -- apply "unsafe" transformations
|
|
64
|
+
// unsafe_arrows (default: false) -- Convert ES5 style anonymous function expressions to arrow functions
|
|
65
|
+
// unsafe_comps (default: false) -- Reverse < and <= to > and >=
|
|
66
|
+
// unsafe_Function (default: false) -- compress and mangle Function(args, code)
|
|
67
|
+
// unsafe_math (default: false) -- optimize numerical expressions
|
|
68
|
+
// unsafe_symbols (default: false) -- removes keys from native Symbol declarations
|
|
69
|
+
// unsafe_methods (default: false) -- Converts { m: function(){} } to { m(){} }
|
|
70
|
+
// unsafe_proto (default: false) -- optimize expressions like Array.prototype.slice.call(a)
|
|
71
|
+
// unsafe_regexp (default: false) -- enable substitutions of variables with RegExp values
|
|
72
|
+
// unsafe_undefined (default: false) -- substitute void 0 if there is undefined in scope
|
|
73
|
+
// unused (default: true) -- drop unreferenced functions and variables
|
|
74
|
+
},
|
|
75
|
+
mangle: {
|
|
76
|
+
// mangle options
|
|
77
|
+
// Mangle names for obfuscation and size reduction
|
|
78
|
+
properties: false, // Don't mangle property names (can break code)
|
|
79
|
+
},
|
|
80
|
+
format: {
|
|
81
|
+
// format options (can also use `output` for backwards compatibility)
|
|
82
|
+
comments: false, // Remove comments to reduce file size
|
|
83
|
+
beautify: false, // Disable beautification for smaller file size
|
|
84
|
+
},
|
|
85
|
+
sourceMap: {
|
|
86
|
+
// source map options
|
|
87
|
+
},
|
|
88
|
+
// Define ECMAScript target version
|
|
89
|
+
ecma: 5, // specify one of: 5, 2015, 2016, etc.
|
|
90
|
+
enclose: false, // or specify true, or "args:values"
|
|
91
|
+
keep_classnames: false, // Remove class names
|
|
92
|
+
keep_fnames: false, // Remove function names
|
|
93
|
+
ie8: false,
|
|
94
|
+
module: false,
|
|
95
|
+
nameCache: null, // or specify a name cache object
|
|
96
|
+
safari10: false,
|
|
97
|
+
toplevel: false, // Don't remove top-level variables by default (can break exports)
|
|
98
|
+
};
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// Export
|
|
101
|
+
// ============================================================================
|
|
102
|
+
export default terserConfig;
|
|
103
|
+
//# sourceMappingURL=terser.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terser.config.js","sourceRoot":"","sources":["../../../src/actions/JavaScriptMinifyAction/terser.config.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,yCAAyC;AAEzC,MAAM,YAAY,GAAG;IACjB,KAAK,EAAE;IACH,gBAAgB;KACnB;IACD,QAAQ,EAAE;QACN,mBAAmB;QACnB,YAAY,EAAE,IAAI,EAAE,gCAAgC;QACpD,aAAa,EAAE,IAAI,EAAE,6BAA6B;QAClD,UAAU,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,cAAc,CAAC,EAAE,oCAAoC;QAEnG,8FAA8F;QAC9F,uFAAuF;QAEvF,8DAA8D;QAC9D,mEAAmE;QACnE,qEAAqE;QACrE,wDAAwD;QACxD,MAAM,EAAE,IAAI,EAAE,kBAAkB;QAEhC,yGAAyG;QACzG,6GAA6G;QAC7G,sEAAsE;QACtE,wGAAwG;QACxG,6EAA6E;QAC7E,8FAA8F;QAC9F,2FAA2F;QAC3F,uDAAuD;QACvD,4EAA4E;QAC5E,qFAAqF;QACrF,+DAA+D;QAC/D,oGAAoG;QACpG,uEAAuE;QACvE,kGAAkG;QAClG,2DAA2D;QAC3D,6DAA6D;QAC7D,0FAA0F;QAC1F,wDAAwD;QACxD,2EAA2E;QAC3E,kFAAkF;QAClF,8EAA8E;QAC9E,kFAAkF;QAClF,8EAA8E;QAC9E,iFAAiF;QACjF,iGAAiG;QACjG,+FAA+F;QAC/F,qEAAqE;QACrE,qEAAqE;QACrE,kFAAkF;QAClF,qEAAqE;QACrE,+EAA+E;QAC/E,wFAAwF;QACxF,8FAA8F;QAC9F,oFAAoF;QACpF,yFAAyF;QACzF,4EAA4E;QAC5E,2FAA2F;QAC3F,gFAAgF;QAChF,kFAAkF;QAClF,8FAA8F;QAC9F,+FAA+F;QAC/F,sFAAsF;QACtF,4DAA4D;QAC5D,wGAAwG;QACxG,gEAAgE;QAChE,+EAA+E;QAC/E,iEAAiE;QACjE,kFAAkF;QAClF,+EAA+E;QAC/E,2FAA2F;QAC3F,yFAAyF;QACzF,wFAAwF;QACxF,sEAAsE;KACzE;IACD,MAAM,EAAE;QACJ,iBAAiB;QACjB,kDAAkD;QAClD,UAAU,EAAE,KAAK,EAAE,+CAA+C;KACrE;IACD,MAAM,EAAE;QACJ,qEAAqE;QACrE,QAAQ,EAAE,KAAK,EAAE,sCAAsC;QACvD,QAAQ,EAAE,KAAK,EAAE,+CAA+C;KACnE;IACD,SAAS,EAAE;IACP,qBAAqB;KACxB;IACD,mCAAmC;IACnC,IAAI,EAAE,CAAC,EAAE,sCAAsC;IAC/C,OAAO,EAAE,KAAK,EAAE,oCAAoC;IACpD,eAAe,EAAE,KAAK,EAAE,qBAAqB;IAC7C,WAAW,EAAE,KAAK,EAAE,wBAAwB;IAC5C,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,IAAI,EAAE,iCAAiC;IAClD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK,EAAE,kEAAkE;CACtF,CAAC;AAEF,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,eAAe,YAAY,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionPlugin } from "./types/Action.js";
|
|
2
|
+
import { JavaScriptMinifyAction } from "./actions/JavaScriptMinifyAction/index.js";
|
|
3
|
+
declare const plugin: ActionPlugin;
|
|
4
|
+
export default plugin;
|
|
5
|
+
export type { JavaScriptMinifyActionOptions } from "./actions/JavaScriptMinifyAction/index.js";
|
|
6
|
+
export { JavaScriptMinifyAction };
|
|
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,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JavaScriptMinifyAction } from "./actions/JavaScriptMinifyAction/index.js";
|
|
2
|
+
const plugin = {
|
|
3
|
+
name: "@getkist/action-terser",
|
|
4
|
+
version: "1.0.0",
|
|
5
|
+
actions: { JavaScriptMinifyAction },
|
|
6
|
+
};
|
|
7
|
+
export default plugin;
|
|
8
|
+
export { JavaScriptMinifyAction };
|
|
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,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,MAAM,GAAiB;IACzB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,EAAE,sBAAsB,EAAE;CACtC,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,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-terser",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "JavaScript minification actions for kist using Terser",
|
|
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
|
+
"terser",
|
|
19
|
+
"minify",
|
|
20
|
+
"javascript",
|
|
21
|
+
"minification",
|
|
22
|
+
"compression"
|
|
23
|
+
],
|
|
24
|
+
"author": "kist",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/getkist/kist-action-terser.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/getkist/kist-action-terser/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/getkist/kist-action-terser#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
|
+
"terser": "^5.37.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
|
+
}
|