koatty 3.11.9 → 3.13.0

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/.rollup.config.js CHANGED
@@ -1,9 +1,11 @@
1
- /*
1
+ /**
2
+ *
2
3
  * @Description:
3
- * @Usage:
4
4
  * @Author: richen
5
- * @Date: 2021-12-17 10:20:44
6
- * @LastEditTime: 2024-11-29 17:33:44
5
+ * @Date: 2024-11-07 11:22:26
6
+ * @LastEditTime: 2025-04-02 15:05:36
7
+ * @License: BSD (3-Clause)
8
+ * @Copyright (c): <richenlin(at)gmail.com>
7
9
  */
8
10
  import commonjs from '@rollup/plugin-commonjs';
9
11
  import json from "@rollup/plugin-json";
@@ -12,6 +14,7 @@ import { builtinModules } from 'module';
12
14
  import del from "rollup-plugin-delete";
13
15
  import typescript from 'rollup-plugin-typescript2';
14
16
  // import babel from '@rollup/plugin-babel';
17
+ import terser from "@rollup/plugin-terser";
15
18
  const pkg = require('./package.json');
16
19
 
17
20
  export default [
@@ -27,7 +30,7 @@ export default [
27
30
  format: 'es',
28
31
  file: './dist/index.mjs',
29
32
  banner: require('./scripts/copyright'),
30
- },
33
+ }
31
34
  ],
32
35
  plugins: [
33
36
  del({ targets: ["dist/*", "temp/*", "docs/api"] }),
@@ -49,12 +52,31 @@ export default [
49
52
  module: "ESNext"
50
53
  }
51
54
  }
55
+ }),
56
+ terser({
57
+ compress: {
58
+ defaults: false, // 改为 `false`(新版本默认启用所有优化)
59
+ arrows: true, // 保留箭头函数转换
60
+ booleans: true, // 保留布尔简化
61
+ drop_console: false, // 保留 console
62
+ keep_fnames: true // 保留函数名
63
+ },
64
+ mangle: {
65
+ reserved: ['$super'], // 保留关键字
66
+ keep_classnames: true // 保留类名
67
+ },
68
+ format: {
69
+ beautify: true, // 启用格式化
70
+ indent_level: 2, // 缩进层级
71
+ comments: /@Author|@License|@Copyright/ // 保留特定注释
72
+ }
52
73
  })
53
74
  ],
54
75
  external: [
55
76
  ...builtinModules, // 排除 Node.js 内置模块
56
77
  ...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
78
+ ...Object.keys(pkg.devDependencies || {}),
57
79
  ],
58
80
  },
59
81
 
60
- ]
82
+ ]