koatty 3.13.2 → 4.0.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/.package.json.backup +1 -0
- package/.rollup.config.js +89 -82
- package/.turbo/turbo-build.log +86 -0
- package/CHANGELOG.md +1880 -2065
- package/LICENSE +29 -29
- package/README.md +346 -162
- package/dist/LICENSE +29 -29
- package/dist/README.md +346 -162
- package/dist/index.d.ts +58 -5
- package/dist/index.js +252 -155
- package/dist/index.mjs +369 -272
- package/dist/package.json +107 -106
- package/examples/README.md +172 -0
- package/examples/basic-app/README.md +72 -0
- package/examples/basic-app/config/config.ts +142 -0
- package/examples/basic-app/package.json +20 -0
- package/examples/basic-app/pnpm-workspace.yaml +4 -0
- package/examples/basic-app/static/.gitkeep +0 -0
- package/examples/basic-app/static/favicon.ico +0 -0
- package/examples/basic-app/test-simple.ts +13 -0
- package/examples/basic-app/view/index.html +25 -0
- package/package.json +107 -106
- package/rollup.config-1761147987514.cjs +88 -0
- package/tsconfig.test.json +14 -14
- package/.vscode/launch.json +0 -42
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"dependencies":{"koa":"^3.0.3","koatty_config":"workspace:*","koatty_container":"^1.17.0","koatty_core":"workspace:*","koatty_exception":"workspace:*","koatty_lib":"^1.4.3","koatty_loader":"^1.3.0","koatty_logger":"2.8.1","koatty_router":"workspace:*","koatty_serve":"workspace:*","koatty_trace":"workspace:*","ts-morph":"^27.0.2"},"devDependencies":{"@commitlint/cli":"^19.x.x","@commitlint/config-conventional":"^19.x.x","@grpc/grpc-js":"^1.12.2","@microsoft/api-documenter":"^7.x.x","@microsoft/api-extractor":"^7.x.x","@rollup/plugin-commonjs":"^28.x.x","@rollup/plugin-json":"^6.x.x","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-terser":"^0.x.x","@types/formidable":"^3.x.x","@types/jest":"^29.x.x","@types/koa":"^2.x.x","@types/koa-compose":"^3.x.x","@types/lodash":"^4.x.x","@types/node":"^22.x.x","@types/on-finished":"^2.x.x","@types/supertest":"^6.x.x","@types/ws":"^8.x.x","@typescript-eslint/eslint-plugin":"^8.x.x","@typescript-eslint/parser":"^8.x.x","conventional-changelog-cli":"^5.x.x","eslint":"^8.x.x","eslint-plugin-jest":"^28.x.x","husky":"^4.x.x","jest":"^29.x.x","jest-html-reporters":"^3.x.x","koatty_validation":"~1.x.x","reflect-metadata":"^0.x.x","rollup":"^4.x.x","rollup-plugin-delete":"^2.x.x","rollup-plugin-typescript2":"^0.x.x","standard-version":"^9.x.x","supertest":"^7.x.x","ts-jest":"^29.x.x","ts-node":"^10.x.x","tslib":"^2.x.x","typescript":"^5.x.x"}}
|
package/.rollup.config.js
CHANGED
|
@@ -1,82 +1,89 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @Description:
|
|
4
|
-
* @Author: richen
|
|
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>
|
|
9
|
-
*/
|
|
10
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
11
|
-
import json from "@rollup/plugin-json";
|
|
12
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
13
|
-
import { builtinModules } from 'module';
|
|
14
|
-
import del from "rollup-plugin-delete";
|
|
15
|
-
import typescript from 'rollup-plugin-typescript2';
|
|
16
|
-
// import babel from '@rollup/plugin-babel';
|
|
17
|
-
import terser from "@rollup/plugin-terser";
|
|
18
|
-
const pkg = require('./package.json');
|
|
19
|
-
|
|
20
|
-
export default [
|
|
21
|
-
{
|
|
22
|
-
input: './src/index.ts',
|
|
23
|
-
output: [
|
|
24
|
-
{
|
|
25
|
-
format: 'cjs',
|
|
26
|
-
file: './dist/index.js',
|
|
27
|
-
banner: require('./scripts/copyright'),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
format: 'es',
|
|
31
|
-
file: './dist/index.mjs',
|
|
32
|
-
banner: require('./scripts/copyright'),
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
plugins: [
|
|
36
|
-
del({ targets: ["dist/*", "temp/*", "docs/api"] }),
|
|
37
|
-
// babel({
|
|
38
|
-
// babelHelpers: "runtime",
|
|
39
|
-
// configFile: './babel.config.js',
|
|
40
|
-
// exclude: 'node_modules/**',
|
|
41
|
-
// }),
|
|
42
|
-
json(),
|
|
43
|
-
resolve({
|
|
44
|
-
preferBuiltins: true, // 优先选择内置模块
|
|
45
|
-
}),
|
|
46
|
-
commonjs(),
|
|
47
|
-
typescript({
|
|
48
|
-
tsconfigOverride: {
|
|
49
|
-
compilerOptions: {
|
|
50
|
-
declaration: false,
|
|
51
|
-
declarationMap: false,
|
|
52
|
-
module: "ESNext"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Description:
|
|
4
|
+
* @Author: richen
|
|
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>
|
|
9
|
+
*/
|
|
10
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
11
|
+
import json from "@rollup/plugin-json";
|
|
12
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
13
|
+
import { builtinModules } from 'module';
|
|
14
|
+
import del from "rollup-plugin-delete";
|
|
15
|
+
import typescript from 'rollup-plugin-typescript2';
|
|
16
|
+
// import babel from '@rollup/plugin-babel';
|
|
17
|
+
import terser from "@rollup/plugin-terser";
|
|
18
|
+
const pkg = require('./package.json');
|
|
19
|
+
|
|
20
|
+
export default [
|
|
21
|
+
{
|
|
22
|
+
input: './src/index.ts',
|
|
23
|
+
output: [
|
|
24
|
+
{
|
|
25
|
+
format: 'cjs',
|
|
26
|
+
file: './dist/index.js',
|
|
27
|
+
banner: require('./scripts/copyright'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
format: 'es',
|
|
31
|
+
file: './dist/index.mjs',
|
|
32
|
+
banner: require('./scripts/copyright'),
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
plugins: [
|
|
36
|
+
del({ targets: ["dist/*", "temp/*", "docs/api"] }),
|
|
37
|
+
// babel({
|
|
38
|
+
// babelHelpers: "runtime",
|
|
39
|
+
// configFile: './babel.config.js',
|
|
40
|
+
// exclude: 'node_modules/**',
|
|
41
|
+
// }),
|
|
42
|
+
json(),
|
|
43
|
+
resolve({
|
|
44
|
+
preferBuiltins: true, // 优先选择内置模块
|
|
45
|
+
}),
|
|
46
|
+
commonjs(),
|
|
47
|
+
typescript({
|
|
48
|
+
tsconfigOverride: {
|
|
49
|
+
compilerOptions: {
|
|
50
|
+
declaration: false,
|
|
51
|
+
declarationMap: false,
|
|
52
|
+
module: "ESNext",
|
|
53
|
+
skipLibCheck: true,
|
|
54
|
+
// 不使用 paths,让 TypeScript 使用 node_modules 中的类型
|
|
55
|
+
// 这样可以避免类型冲突
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
// 使用 cache 来提高性能
|
|
59
|
+
useTsconfigDeclarationDir: false,
|
|
60
|
+
// 忽略类型错误,只做转译
|
|
61
|
+
check: false
|
|
62
|
+
}),
|
|
63
|
+
terser({
|
|
64
|
+
compress: {
|
|
65
|
+
defaults: false, // 改为 `false`(新版本默认启用所有优化)
|
|
66
|
+
arrows: true, // 保留箭头函数转换
|
|
67
|
+
booleans: true, // 保留布尔简化
|
|
68
|
+
drop_console: false, // 保留 console
|
|
69
|
+
keep_fnames: true // 保留函数名
|
|
70
|
+
},
|
|
71
|
+
mangle: {
|
|
72
|
+
reserved: ['$super'], // 保留关键字
|
|
73
|
+
keep_classnames: true // 保留类名
|
|
74
|
+
},
|
|
75
|
+
format: {
|
|
76
|
+
beautify: true, // 启用格式化
|
|
77
|
+
indent_level: 2, // 缩进层级
|
|
78
|
+
comments: /@Author|@License|@Copyright/ // 保留特定注释
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
],
|
|
82
|
+
external: [
|
|
83
|
+
...builtinModules, // 排除 Node.js 内置模块
|
|
84
|
+
...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
|
|
85
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> koatty@3.14.0-beta.1 build /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty
|
|
4
|
+
> npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp && npm run build:fix
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
> koatty@3.14.0-beta.1 build:js
|
|
8
|
+
> npx rollup --bundleConfigAsCjs -c .rollup.config.js
|
|
9
|
+
|
|
10
|
+
[1G[0K[1G[0K[36m
|
|
11
|
+
[1m./src/index.ts[22m → [1m./dist/index.js, ./dist/index.mjs[22m...[39m
|
|
12
|
+
[32mcreated [1m./dist/index.js, ./dist/index.mjs[22m in [1m1.4s[22m[39m
|
|
13
|
+
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
14
|
+
> koatty@3.14.0-beta.1 build:dts
|
|
15
|
+
> npx tsc && npx api-extractor run --local --verbose
|
|
16
|
+
|
|
17
|
+
[1G[0K[1G[0K[1G[0K⠙[1G[0K[1G[0K
|
|
18
|
+
[1mapi-extractor 7.53.2 [36m - https://api-extractor.com/[39m
|
|
19
|
+
[22m
|
|
20
|
+
Using configuration from ./api-extractor.json
|
|
21
|
+
Analysis will use the bundled TypeScript version 5.8.2
|
|
22
|
+
*** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
23
|
+
[36mWriting: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty/temp/koatty.api.json[39m
|
|
24
|
+
[36mWriting package typings: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty/dist/index.d.ts[39m
|
|
25
|
+
[33mWarning: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty-core/dist/index.d.ts:35:4 - (tsdoc-undefined-tag) The TSDoc tag "@export" is not defined in this configuration[39m
|
|
26
|
+
[33mWarning: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty-core/dist/index.d.ts:36:4 - (tsdoc-undefined-tag) The TSDoc tag "@enum" is not defined in this configuration[39m
|
|
27
|
+
[33mWarning: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty-core/dist/index.d.ts:663:4 - (tsdoc-undefined-tag) The TSDoc tag "@interface" is not defined in this configuration[39m
|
|
28
|
+
[33mWarning: /home/richen/workspace/nodejs/koatty-monorepo/packages/koatty-core/dist/index.d.ts:664:4 - (tsdoc-undefined-tag) The TSDoc tag "@extends" is not defined in this configuration[39m
|
|
29
|
+
[33mWarning: src/core/Bootstrap.ts:21:4 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen[39m
|
|
30
|
+
[33mWarning: src/core/Bootstrap.ts:33:1 - (ae-missing-release-tag) "Bootstrap" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
31
|
+
[33mWarning: src/core/Bootstrap.ts:46:4 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen[39m
|
|
32
|
+
[33mWarning: src/core/Bootstrap.ts:55:1 - (ae-missing-release-tag) "ExecBootStrap" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
33
|
+
[33mWarning: src/core/Bootstrap.ts:68:31 - (tsdoc-param-tag-with-invalid-optional-name) The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets.[39m
|
|
34
|
+
[33mWarning: src/core/Bootstrap.ts:68:11 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'[39m
|
|
35
|
+
[33mWarning: src/core/Bootstrap.ts:69:28 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
36
|
+
[33mWarning: src/core/Bootstrap.ts:69:13 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
37
|
+
[33mWarning: src/core/Bootstrap.ts:70:18 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
38
|
+
[33mWarning: src/core/Bootstrap.ts:70:12 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
39
|
+
[33mWarning: src/core/Bootstrap.ts:79:1 - (ae-missing-release-tag) "ComponentScan" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
40
|
+
[33mWarning: src/core/Bootstrap.ts:96:4 - (tsdoc-code-fence-missing-delimiter) Error parsing code fence: Missing closing delimiter[39m
|
|
41
|
+
[33mWarning: src/core/Bootstrap.ts:97:4 - (tsdoc-characters-after-block-tag) The token "@ConfigurationScan" looks like a TSDoc tag but contains an invalid character "("; if it is not a tag, use a backslash to escape the "@"[39m
|
|
42
|
+
[33mWarning: src/core/Bootstrap.ts:98:36 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
43
|
+
[33mWarning: src/core/Bootstrap.ts:100:4 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
44
|
+
[33mWarning: src/core/Bootstrap.ts:102:1 - (ae-missing-release-tag) "ConfigurationScan" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
45
|
+
[33mWarning: src/core/Bootstrap.ts:118:15 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
46
|
+
[33mWarning: src/core/Bootstrap.ts:118:13 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
47
|
+
[33mWarning: src/core/Bootstrap.ts:121:4 - (tsdoc-code-fence-missing-delimiter) Error parsing code fence: Missing closing delimiter[39m
|
|
48
|
+
[33mWarning: src/core/Bootstrap.ts:122:52 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
49
|
+
[33mWarning: src/core/Bootstrap.ts:123:33 - (tsdoc-escape-greater-than) The ">" character should be escaped using a backslash to avoid confusion with an HTML tag[39m
|
|
50
|
+
[33mWarning: src/core/Bootstrap.ts:123:35 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
51
|
+
[33mWarning: src/core/Bootstrap.ts:124:66 - (tsdoc-escape-greater-than) The ">" character should be escaped using a backslash to avoid confusion with an HTML tag[39m
|
|
52
|
+
[33mWarning: src/core/Bootstrap.ts:124:68 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
53
|
+
[33mWarning: src/core/Bootstrap.ts:127:6 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
54
|
+
[33mWarning: src/core/Bootstrap.ts:128:5 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
55
|
+
[33mWarning: src/core/Bootstrap.ts:129:4 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
56
|
+
[33mWarning: src/core/Bootstrap.ts:131:1 - (ae-missing-release-tag) "BindEventHook" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
57
|
+
[33mWarning: src/util/Logger.ts:17:14 - (ae-missing-release-tag) "Logger" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)[39m
|
|
58
|
+
|
|
59
|
+
API Extractor completed successfully
|
|
60
|
+
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
61
|
+
> koatty@3.14.0-beta.1 build:doc
|
|
62
|
+
> npx api-documenter markdown --input temp --output docs/api
|
|
63
|
+
|
|
64
|
+
[1G[0K[1G[0K
|
|
65
|
+
[1mapi-documenter 7.27.2 [36m - https://api-extractor.com/[39m
|
|
66
|
+
[22m
|
|
67
|
+
Reading koatty.api.json
|
|
68
|
+
|
|
69
|
+
Deleting old output from docs/api
|
|
70
|
+
Writing koatty package
|
|
71
|
+
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
72
|
+
> koatty@3.14.0-beta.1 build:cp
|
|
73
|
+
> node scripts/postBuild && npx copyfiles package.json LICENSE README.md dist/
|
|
74
|
+
|
|
75
|
+
[1G[0K[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
76
|
+
> koatty@3.14.0-beta.1 build:fix
|
|
77
|
+
> node scripts/fixWorkspaceDeps
|
|
78
|
+
|
|
79
|
+
[1G[0K✓ Fixed dependencies.koatty_config: workspace:* → ^1.2.2
|
|
80
|
+
✓ Fixed dependencies.koatty_core: workspace:* → ^2.0.0
|
|
81
|
+
✓ Fixed dependencies.koatty_exception: workspace:* → ^2.0.1
|
|
82
|
+
✓ Fixed dependencies.koatty_router: workspace:* → ^2.0.2
|
|
83
|
+
✓ Fixed dependencies.koatty_serve: workspace:* → ^3.0.0
|
|
84
|
+
✓ Fixed dependencies.koatty_trace: workspace:* → ^2.0.0
|
|
85
|
+
✅ Fixed workspace:* dependencies in dist/package.json
|
|
86
|
+
[1G[0K⠙[1G[0K
|