koatty 3.13.0 → 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 +1881 -2064
- 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
package/package.json
CHANGED
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koatty",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
-
"build:cp": "
|
|
8
|
-
"build:
|
|
9
|
-
"build:
|
|
10
|
-
"build:
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"release
|
|
16
|
-
"release:
|
|
17
|
-
"release:
|
|
18
|
-
"
|
|
19
|
-
"test
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"@commitlint/
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@microsoft/api-
|
|
59
|
-
"@
|
|
60
|
-
"@rollup/plugin-
|
|
61
|
-
"@rollup/plugin-
|
|
62
|
-
"@rollup/plugin-
|
|
63
|
-
"@
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/
|
|
66
|
-
"@types/koa
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/
|
|
70
|
-
"@types/
|
|
71
|
-
"@types/
|
|
72
|
-
"@
|
|
73
|
-
"@typescript-eslint/
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"eslint
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"jest
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"rollup
|
|
84
|
-
"rollup-plugin-
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"ts-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "koatty",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Koa + Typescript = koatty. Use Typescript's decorator implement auto injection.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp && npm run build:fix",
|
|
7
|
+
"build:cp": "npx copyfiles package.json LICENSE README.md dist/ && node scripts/postBuild",
|
|
8
|
+
"build:fix": "node scripts/fixWorkspaceDeps",
|
|
9
|
+
"build:js": "npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
10
|
+
"build:doc": "npx api-documenter markdown --input temp --output docs/api",
|
|
11
|
+
"build:dts": "npx tsc --skipLibCheck && npx api-extractor run --local --verbose",
|
|
12
|
+
"eslint": "eslint --ext .ts,.js ./",
|
|
13
|
+
"prepublishOnly": "echo 'Skipping prepublishOnly in monorepo'",
|
|
14
|
+
"prerelease": "npm test && npm run build",
|
|
15
|
+
"release": "standard-version",
|
|
16
|
+
"release:pre": "npm run release -- --prerelease",
|
|
17
|
+
"release:major": "npm run release -- --release-as major",
|
|
18
|
+
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
+
"test": "npm run eslint && jest --passWithNoTests",
|
|
20
|
+
"test:cov": "jest --collectCoverage --detectOpenHandles",
|
|
21
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"directories": {
|
|
30
|
+
"doc": "docs"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/thinkkoa/koatty.git"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
},
|
|
39
|
+
"author": {
|
|
40
|
+
"name": "richenlin",
|
|
41
|
+
"email": "richenlin@gmail.com"
|
|
42
|
+
},
|
|
43
|
+
"license": "BSD-3-Clause",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/thinkkoa/koatty/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/thinkkoa/koatty",
|
|
48
|
+
"maintainers": [
|
|
49
|
+
{
|
|
50
|
+
"name": "richenlin",
|
|
51
|
+
"email": "richenlin@gmail.com"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@commitlint/cli": "^19.x.x",
|
|
56
|
+
"@commitlint/config-conventional": "^19.x.x",
|
|
57
|
+
"@grpc/grpc-js": "^1.12.2",
|
|
58
|
+
"@microsoft/api-documenter": "^7.x.x",
|
|
59
|
+
"@microsoft/api-extractor": "^7.x.x",
|
|
60
|
+
"@rollup/plugin-commonjs": "^28.x.x",
|
|
61
|
+
"@rollup/plugin-json": "^6.x.x",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
63
|
+
"@rollup/plugin-terser": "^0.x.x",
|
|
64
|
+
"@types/formidable": "^3.x.x",
|
|
65
|
+
"@types/jest": "^29.x.x",
|
|
66
|
+
"@types/koa": "^2.x.x",
|
|
67
|
+
"@types/koa-compose": "^3.x.x",
|
|
68
|
+
"@types/lodash": "^4.x.x",
|
|
69
|
+
"@types/node": "^22.x.x",
|
|
70
|
+
"@types/on-finished": "^2.x.x",
|
|
71
|
+
"@types/supertest": "^6.x.x",
|
|
72
|
+
"@types/ws": "^8.x.x",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^8.x.x",
|
|
74
|
+
"@typescript-eslint/parser": "^8.x.x",
|
|
75
|
+
"conventional-changelog-cli": "^5.x.x",
|
|
76
|
+
"eslint": "^8.x.x",
|
|
77
|
+
"eslint-plugin-jest": "^28.x.x",
|
|
78
|
+
"husky": "^4.x.x",
|
|
79
|
+
"jest": "^29.x.x",
|
|
80
|
+
"jest-html-reporters": "^3.x.x",
|
|
81
|
+
"koatty_validation": "~1.x.x",
|
|
82
|
+
"reflect-metadata": "^0.x.x",
|
|
83
|
+
"rollup": "^4.x.x",
|
|
84
|
+
"rollup-plugin-delete": "^2.x.x",
|
|
85
|
+
"rollup-plugin-typescript2": "^0.x.x",
|
|
86
|
+
"standard-version": "^9.x.x",
|
|
87
|
+
"supertest": "^7.x.x",
|
|
88
|
+
"ts-jest": "^29.x.x",
|
|
89
|
+
"ts-node": "^10.x.x",
|
|
90
|
+
"tslib": "^2.x.x",
|
|
91
|
+
"typescript": "^5.x.x"
|
|
92
|
+
},
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"koa": "^3.0.3",
|
|
95
|
+
"koatty_config": "^1.2.2",
|
|
96
|
+
"koatty_container": "^1.17.0",
|
|
97
|
+
"koatty_core": "^2.0.8",
|
|
98
|
+
"koatty_exception": "^2.0.4",
|
|
99
|
+
"koatty_lib": "^1.4.3",
|
|
100
|
+
"koatty_loader": "^1.3.0",
|
|
101
|
+
"koatty_logger": "2.8.1",
|
|
102
|
+
"koatty_router": "^2.0.2",
|
|
103
|
+
"koatty_serve": "^3.0.0",
|
|
104
|
+
"koatty_trace": "^2.0.0",
|
|
105
|
+
"ts-morph": "^27.0.2"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var commonjs = require('@rollup/plugin-commonjs');
|
|
6
|
+
var json = require('@rollup/plugin-json');
|
|
7
|
+
var resolve = require('@rollup/plugin-node-resolve');
|
|
8
|
+
var module$1 = require('module');
|
|
9
|
+
var del = require('rollup-plugin-delete');
|
|
10
|
+
var typescript = require('rollup-plugin-typescript2');
|
|
11
|
+
var terser = require('@rollup/plugin-terser');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @Description:
|
|
16
|
+
* @Author: richen
|
|
17
|
+
* @Date: 2024-11-07 11:22:26
|
|
18
|
+
* @LastEditTime: 2025-04-02 15:05:36
|
|
19
|
+
* @License: BSD (3-Clause)
|
|
20
|
+
* @Copyright (c): <richenlin(at)gmail.com>
|
|
21
|
+
*/
|
|
22
|
+
const pkg = require('./package.json');
|
|
23
|
+
|
|
24
|
+
var _rollup_config = [
|
|
25
|
+
{
|
|
26
|
+
input: './src/index.ts',
|
|
27
|
+
output: [
|
|
28
|
+
{
|
|
29
|
+
format: 'cjs',
|
|
30
|
+
file: './dist/index.js',
|
|
31
|
+
banner: require('./scripts/copyright'),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
format: 'es',
|
|
35
|
+
file: './dist/index.mjs',
|
|
36
|
+
banner: require('./scripts/copyright'),
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
plugins: [
|
|
40
|
+
del({ targets: ["dist/*", "temp/*", "docs/api"] }),
|
|
41
|
+
// babel({
|
|
42
|
+
// babelHelpers: "runtime",
|
|
43
|
+
// configFile: './babel.config.js',
|
|
44
|
+
// exclude: 'node_modules/**',
|
|
45
|
+
// }),
|
|
46
|
+
json(),
|
|
47
|
+
resolve({
|
|
48
|
+
preferBuiltins: true, // 优先选择内置模块
|
|
49
|
+
}),
|
|
50
|
+
commonjs(),
|
|
51
|
+
typescript({
|
|
52
|
+
tsconfigOverride: {
|
|
53
|
+
compilerOptions: {
|
|
54
|
+
declaration: false,
|
|
55
|
+
declarationMap: false,
|
|
56
|
+
module: "ESNext"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
terser({
|
|
61
|
+
compress: {
|
|
62
|
+
defaults: false, // 改为 `false`(新版本默认启用所有优化)
|
|
63
|
+
arrows: true, // 保留箭头函数转换
|
|
64
|
+
booleans: true, // 保留布尔简化
|
|
65
|
+
drop_console: false, // 保留 console
|
|
66
|
+
keep_fnames: true // 保留函数名
|
|
67
|
+
},
|
|
68
|
+
mangle: {
|
|
69
|
+
reserved: ['$super'], // 保留关键字
|
|
70
|
+
keep_classnames: true // 保留类名
|
|
71
|
+
},
|
|
72
|
+
format: {
|
|
73
|
+
beautify: true, // 启用格式化
|
|
74
|
+
indent_level: 2, // 缩进层级
|
|
75
|
+
comments: /@Author|@License|@Copyright/ // 保留特定注释
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
],
|
|
79
|
+
external: [
|
|
80
|
+
...module$1.builtinModules, // 排除 Node.js 内置模块
|
|
81
|
+
...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
|
|
82
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
exports.default = _rollup_config;
|
package/tsconfig.test.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"types": [
|
|
5
|
-
"jest",
|
|
6
|
-
"node"
|
|
7
|
-
]
|
|
8
|
-
},
|
|
9
|
-
"exclude": [
|
|
10
|
-
"node_modules"
|
|
11
|
-
],
|
|
12
|
-
"include": [
|
|
13
|
-
"test/*.test.ts"
|
|
14
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"types": [
|
|
5
|
+
"jest",
|
|
6
|
+
"node"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"exclude": [
|
|
10
|
+
"node_modules"
|
|
11
|
+
],
|
|
12
|
+
"include": [
|
|
13
|
+
"test/*.test.ts"
|
|
14
|
+
]
|
|
15
15
|
}
|
package/.vscode/launch.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"name": "Koatty Demo Program",
|
|
8
|
-
"args": [
|
|
9
|
-
"${workspaceRoot}/demo/src/App.ts"
|
|
10
|
-
],
|
|
11
|
-
"runtimeArgs": [
|
|
12
|
-
"--nolazy",
|
|
13
|
-
"-r",
|
|
14
|
-
"ts-node/register"
|
|
15
|
-
],
|
|
16
|
-
"env": {
|
|
17
|
-
"NODE_ENV": "development"
|
|
18
|
-
},
|
|
19
|
-
"outputCapture": "std",
|
|
20
|
-
"sourceMaps": true,
|
|
21
|
-
"cwd": "${workspaceRoot}",
|
|
22
|
-
"protocol": "inspector",
|
|
23
|
-
"internalConsoleOptions": "neverOpen"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"type": "node",
|
|
27
|
-
"name": "vscode-jest-tests",
|
|
28
|
-
"request": "launch",
|
|
29
|
-
"console": "integratedTerminal",
|
|
30
|
-
"internalConsoleOptions": "neverOpen",
|
|
31
|
-
"disableOptimisticBPs": true,
|
|
32
|
-
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
33
|
-
"cwd": "${workspaceFolder}",
|
|
34
|
-
"args": [
|
|
35
|
-
"--config",
|
|
36
|
-
"jest.config.js",
|
|
37
|
-
"--runInBand",
|
|
38
|
-
"--watchAll=false"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|