@_tc/template-core 0.0.1-bate.29 → 0.0.1-bate.30
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/cjs/_virtual/_rolldown/runtime.js +37 -0
- package/cjs/app/controller/base.js +28 -20
- package/cjs/app/controller/project.js +59 -49
- package/cjs/app/controller/view.js +14 -13
- package/cjs/app/data/signKey.js +23 -4
- package/cjs/app/extend/db.js +6 -10
- package/cjs/app/extend/generateErrorMessage.js +15 -13
- package/cjs/app/extend/logger.js +34 -71
- package/cjs/app/extend/parsingParamsOnUrl.js +21 -21
- package/cjs/app/extend/render-view.js +23 -22
- package/cjs/app/middleware/api-params-verify.js +61 -61
- package/cjs/app/middleware/api-sign-verify.js +22 -27
- package/cjs/app/middleware/error-handle.js +31 -32
- package/cjs/app/middleware/project-handler.js +20 -20
- package/cjs/app/middleware.js +30 -56
- package/cjs/app/router/project.js +9 -7
- package/cjs/app/router/view.js +6 -4
- package/cjs/app/router-schema/project.js +15 -32
- package/cjs/app/service/bese.js +16 -16
- package/cjs/app/service/project.js +32 -41
- package/cjs/app/type.js +1 -2
- package/cjs/app/typings.js +1 -2
- package/cjs/bundler/dev.js +16 -16
- package/cjs/bundler/index.js +16 -16
- package/cjs/bundler/prod.js +18 -17
- package/cjs/bundler/utils.js +144 -212
- package/cjs/index.js +25 -18
- package/cjs/packages/core/env.js +26 -24
- package/cjs/packages/core/index.js +101 -113
- package/cjs/packages/core/loader/config.js +39 -43
- package/cjs/packages/core/loader/controller.js +25 -32
- package/cjs/packages/core/loader/extend.js +29 -39
- package/cjs/packages/core/loader/middleware.js +28 -36
- package/cjs/packages/core/loader/model.js +98 -123
- package/cjs/packages/core/loader/router-schema.js +32 -33
- package/cjs/packages/core/loader/router.js +46 -61
- package/cjs/packages/core/loader/service.js +21 -22
- package/cjs/packages/core/paths.js +8 -6
- package/cjs/packages/core/types.js +1 -2
- package/cjs/packages/utils/getAllFilesInFolder.js +12 -43
- package/cjs/packages/utils/getAllFnReturnValue.js +1 -6
- package/cjs/packages/utils/index.js +11 -20
- package/cjs/packages/utils/loadFile.js +52 -62
- package/cjs/packages/utils/path.js +25 -58
- package/cjs/packages/utils/runFileFn.js +5 -4
- package/esm/_virtual/_rolldown/runtime.js +32 -0
- package/esm/app/controller/base.js +27 -20
- package/esm/app/controller/project.js +58 -41
- package/esm/app/controller/view.js +13 -11
- package/esm/app/data/signKey.js +10 -1
- package/esm/app/extend/db.js +6 -8
- package/esm/app/extend/generateErrorMessage.js +14 -11
- package/esm/app/extend/logger.js +33 -36
- package/esm/app/extend/parsingParamsOnUrl.js +20 -19
- package/esm/app/extend/render-view.js +18 -15
- package/esm/app/middleware/api-params-verify.js +58 -55
- package/esm/app/middleware/api-sign-verify.js +20 -21
- package/esm/app/middleware/error-handle.js +30 -30
- package/esm/app/middleware/project-handler.js +19 -18
- package/esm/app/middleware.js +22 -47
- package/esm/app/router/project.js +8 -5
- package/esm/app/router/view.js +5 -2
- package/esm/app/router-schema/project.js +14 -30
- package/esm/app/service/bese.js +13 -10
- package/esm/app/service/project.js +31 -33
- package/esm/app/type.js +0 -1
- package/esm/app/typings.js +0 -1
- package/esm/bundler/dev.js +15 -14
- package/esm/bundler/index.js +13 -11
- package/esm/bundler/prod.js +17 -15
- package/esm/bundler/utils.js +136 -169
- package/esm/index.js +16 -11
- package/esm/packages/core/env.js +25 -22
- package/esm/packages/core/index.js +98 -106
- package/esm/packages/core/loader/config.js +39 -41
- package/esm/packages/core/loader/controller.js +25 -30
- package/esm/packages/core/loader/extend.js +28 -36
- package/esm/packages/core/loader/middleware.js +28 -34
- package/esm/packages/core/loader/model.js +97 -118
- package/esm/packages/core/loader/router-schema.js +32 -31
- package/esm/packages/core/loader/router.js +44 -55
- package/esm/packages/core/loader/service.js +21 -20
- package/esm/packages/core/paths.js +7 -4
- package/esm/packages/core/types.js +0 -1
- package/esm/packages/utils/getAllFilesInFolder.js +8 -5
- package/esm/packages/utils/getAllFnReturnValue.js +0 -6
- package/esm/packages/utils/index.js +5 -4
- package/esm/packages/utils/loadFile.js +44 -58
- package/esm/packages/utils/path.js +23 -22
- package/esm/packages/utils/runFileFn.js +4 -1
- package/package.json +10 -8
- package/cjs/app/controller/base.d.ts +0 -12
- package/cjs/app/controller/project.d.ts +0 -10
- package/cjs/app/controller/view.d.ts +0 -7
- package/cjs/app/data/signKey.d.ts +0 -1
- package/cjs/app/extend/db.d.ts +0 -2
- package/cjs/app/extend/generateErrorMessage.d.ts +0 -7
- package/cjs/app/extend/logger.d.ts +0 -11
- package/cjs/app/extend/parsingParamsOnUrl.d.ts +0 -2
- package/cjs/app/extend/render-view.d.ts +0 -3
- package/cjs/app/middleware/api-params-verify.d.ts +0 -4
- package/cjs/app/middleware/api-sign-verify.d.ts +0 -4
- package/cjs/app/middleware/error-handle.d.ts +0 -4
- package/cjs/app/middleware/project-handler.d.ts +0 -4
- package/cjs/app/middleware.d.ts +0 -3
- package/cjs/app/router/project.d.ts +0 -4
- package/cjs/app/router/view.d.ts +0 -4
- package/cjs/app/router-schema/project.d.ts +0 -3
- package/cjs/app/service/bese.d.ts +0 -10
- package/cjs/app/service/project.d.ts +0 -27
- package/cjs/app/type.d.ts +0 -2
- package/cjs/app/typings.d.ts +0 -50
- package/cjs/bundler/dev.d.ts +0 -1
- package/cjs/bundler/index.d.ts +0 -1
- package/cjs/bundler/prod.d.ts +0 -1
- package/cjs/bundler/utils.d.ts +0 -9
- package/cjs/index.d.ts +0 -28
- package/cjs/packages/core/env.d.ts +0 -15
- package/cjs/packages/core/index.d.ts +0 -6
- package/cjs/packages/core/loader/config.d.ts +0 -9
- package/cjs/packages/core/loader/controller.d.ts +0 -17
- package/cjs/packages/core/loader/extend.d.ts +0 -8
- package/cjs/packages/core/loader/middleware.d.ts +0 -11
- package/cjs/packages/core/loader/model.d.ts +0 -36
- package/cjs/packages/core/loader/router-schema.d.ts +0 -18
- package/cjs/packages/core/loader/router.d.ts +0 -8
- package/cjs/packages/core/loader/service.d.ts +0 -17
- package/cjs/packages/core/paths.d.ts +0 -11
- package/cjs/packages/core/types.d.ts +0 -74
- package/cjs/packages/utils/getAllFilesInFolder.d.ts +0 -9
- package/cjs/packages/utils/getAllFnReturnValue.d.ts +0 -0
- package/cjs/packages/utils/index.d.ts +0 -4
- package/cjs/packages/utils/loadFile.d.ts +0 -20
- package/cjs/packages/utils/path.d.ts +0 -24
- package/cjs/packages/utils/runFileFn.d.ts +0 -5
- package/cjs/typings/type.d.ts +0 -4
- package/cjs/typings/type.js +0 -2
- package/esm/app/controller/base.d.ts +0 -13
- package/esm/app/controller/project.d.ts +0 -11
- package/esm/app/controller/view.d.ts +0 -8
- package/esm/app/data/signKey.d.ts +0 -2
- package/esm/app/extend/db.d.ts +0 -3
- package/esm/app/extend/generateErrorMessage.d.ts +0 -8
- package/esm/app/extend/logger.d.ts +0 -12
- package/esm/app/extend/parsingParamsOnUrl.d.ts +0 -3
- package/esm/app/extend/render-view.d.ts +0 -4
- package/esm/app/middleware/api-params-verify.d.ts +0 -5
- package/esm/app/middleware/api-sign-verify.d.ts +0 -5
- package/esm/app/middleware/error-handle.d.ts +0 -5
- package/esm/app/middleware/project-handler.d.ts +0 -5
- package/esm/app/middleware.d.ts +0 -4
- package/esm/app/router/project.d.ts +0 -5
- package/esm/app/router/view.d.ts +0 -5
- package/esm/app/router-schema/project.d.ts +0 -4
- package/esm/app/service/bese.d.ts +0 -11
- package/esm/app/service/project.d.ts +0 -28
- package/esm/app/type.d.ts +0 -3
- package/esm/app/typings.d.ts +0 -51
- package/esm/bundler/dev.d.ts +0 -2
- package/esm/bundler/index.d.ts +0 -2
- package/esm/bundler/prod.d.ts +0 -2
- package/esm/bundler/utils.d.ts +0 -10
- package/esm/index.d.ts +0 -29
- package/esm/packages/core/env.d.ts +0 -16
- package/esm/packages/core/index.d.ts +0 -7
- package/esm/packages/core/loader/config.d.ts +0 -10
- package/esm/packages/core/loader/controller.d.ts +0 -18
- package/esm/packages/core/loader/extend.d.ts +0 -9
- package/esm/packages/core/loader/middleware.d.ts +0 -12
- package/esm/packages/core/loader/model.d.ts +0 -37
- package/esm/packages/core/loader/router-schema.d.ts +0 -19
- package/esm/packages/core/loader/router.d.ts +0 -9
- package/esm/packages/core/loader/service.d.ts +0 -18
- package/esm/packages/core/paths.d.ts +0 -12
- package/esm/packages/core/types.d.ts +0 -75
- package/esm/packages/utils/getAllFilesInFolder.d.ts +0 -10
- package/esm/packages/utils/getAllFnReturnValue.d.ts +0 -1
- package/esm/packages/utils/index.d.ts +0 -5
- package/esm/packages/utils/loadFile.d.ts +0 -21
- package/esm/packages/utils/path.d.ts +0 -25
- package/esm/packages/utils/runFileFn.d.ts +0 -6
- package/esm/typings/type.d.ts +0 -5
- package/esm/typings/type.js +0 -1
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
app.extends.generateErrorMessage("signature not correct or api timeout", {
|
|
22
|
-
showError: true,
|
|
23
|
-
code: 100014,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
await next();
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_app_data_signKey = require("../data/signKey.js");
|
|
3
|
+
let md5 = require("md5");
|
|
4
|
+
md5 = require_runtime.__toESM(md5);
|
|
5
|
+
//#region app/middleware/api-sign-verify.ts
|
|
6
|
+
var keyTimeOut = 1e3 * 60 * 10;
|
|
7
|
+
var api_sign_verify_default = (app) => async (ctx, next) => {
|
|
8
|
+
const { path, method } = ctx;
|
|
9
|
+
if (path.includes("api") && !app.config?.apiSignVerify?.whiteList?.includes(path)) {
|
|
10
|
+
app.extends.logger?.info("--[api-sign-verify]--");
|
|
11
|
+
const { s_sign: sSgin, s_t: st } = ctx.request.header;
|
|
12
|
+
const { signKey } = (require_app_data_signKey.init_signKey(), require_runtime.__toCommonJS(require_app_data_signKey.signKey_exports));
|
|
13
|
+
const signature = (0, md5.default)(`${signKey}_${st}`);
|
|
14
|
+
app.extends.logger?.info(`[${method} ${path}] signature: ${signature}`);
|
|
15
|
+
if (!st || !sSgin || sSgin.toLowerCase() !== signature || Date.now() - Number(st) > keyTimeOut) app.extends.generateErrorMessage("signature not correct or api timeout", {
|
|
16
|
+
showError: true,
|
|
17
|
+
code: 100014
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
await next();
|
|
28
21
|
};
|
|
22
|
+
//#endregion
|
|
23
|
+
module.exports = api_sign_verify_default;
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
//#region app/middleware/error-handle.ts
|
|
3
|
+
var error_handle_default = (app) => async (ctx, next) => {
|
|
4
|
+
try {
|
|
5
|
+
await next();
|
|
6
|
+
} catch (error) {
|
|
7
|
+
const { status = 200, message, detail, code = 5e4, returnError } = error;
|
|
8
|
+
app.extends.logger?.info(`error info -> ${JSON.stringify(error)}`);
|
|
9
|
+
app.extends.logger?.error("-- [excption] --", error);
|
|
10
|
+
app.extends.logger?.error("-- [excption] info --", status, message, detail);
|
|
11
|
+
if (message?.includes("template not found")) {
|
|
12
|
+
ctx.status = 302;
|
|
13
|
+
ctx.redirect(app.options?.homePage ?? "/");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (returnError) {
|
|
17
|
+
ctx.status = status;
|
|
18
|
+
ctx.body = {
|
|
19
|
+
code,
|
|
20
|
+
message
|
|
21
|
+
};
|
|
22
|
+
} else {
|
|
23
|
+
ctx.status = 200;
|
|
24
|
+
ctx.body = {
|
|
25
|
+
code: 5e4,
|
|
26
|
+
message: "网络错误"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
33
30
|
};
|
|
31
|
+
//#endregion
|
|
32
|
+
module.exports = error_handle_default;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
await next();
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
//#region app/middleware/project-handler.ts
|
|
3
|
+
var project_handler_default = () => async (ctx, next) => {
|
|
4
|
+
const key = ctx.headers.proj_key;
|
|
5
|
+
const { path } = ctx;
|
|
6
|
+
if (path.indexOf("/api/proj/") !== -1) {
|
|
7
|
+
if (!key || ["undefined", "null"].includes(key)) {
|
|
8
|
+
ctx.status = 200;
|
|
9
|
+
ctx.body = {
|
|
10
|
+
code: 110,
|
|
11
|
+
data: null,
|
|
12
|
+
message: "请求不合法"
|
|
13
|
+
};
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
ctx.extInfo = { key };
|
|
18
|
+
await next();
|
|
21
19
|
};
|
|
20
|
+
//#endregion
|
|
21
|
+
module.exports = project_handler_default;
|
package/cjs/app/middleware.js
CHANGED
|
@@ -1,58 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let path = require("path");
|
|
3
|
+
let koa_compress = require("koa-compress");
|
|
4
|
+
koa_compress = require_runtime.__toESM(koa_compress);
|
|
5
|
+
let koa_static = require("koa-static");
|
|
6
|
+
koa_static = require_runtime.__toESM(koa_static);
|
|
7
|
+
let koa_bodyparser = require("koa-bodyparser");
|
|
8
|
+
koa_bodyparser = require_runtime.__toESM(koa_bodyparser);
|
|
9
|
+
//#region app/middleware.ts
|
|
10
|
+
var koaBody = (0, koa_bodyparser.default)({
|
|
11
|
+
formLimit: "1000mb",
|
|
12
|
+
enableTypes: [
|
|
13
|
+
"form",
|
|
14
|
+
"json",
|
|
15
|
+
"text"
|
|
16
|
+
]
|
|
14
17
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const basePublicPath = (0, path_1.resolve)(app.baseDir, "./app/public");
|
|
28
|
-
const framePublicPath = (0, path_1.resolve)(app.frameBaseDir, "./app/public");
|
|
29
|
-
// 错误捕获 层级越高捕获到的内容越多
|
|
30
|
-
app.use(app.middlewares.errorHandle);
|
|
31
|
-
// 开启 gzip 压缩
|
|
32
|
-
app.use((0, koa_compress_1.default)({
|
|
33
|
-
threshold: 2048, // 大于 2KB 的响应才会压缩
|
|
34
|
-
// flush: zlib.Z_SYNC_FLUSH,
|
|
35
|
-
}));
|
|
36
|
-
// 静态资源
|
|
37
|
-
app.use((0, koa_static_1.default)(framePublicPath, staticOpt));
|
|
38
|
-
app.use((0, koa_static_1.default)(basePublicPath, staticOpt));
|
|
39
|
-
// req.body 解析
|
|
40
|
-
app.use(koaBody);
|
|
41
|
-
// 扩展项目信息
|
|
42
|
-
app.use(app.middlewares.projectHandler);
|
|
43
|
-
// 渲染模版
|
|
44
|
-
// use(
|
|
45
|
-
// koaNunjucks({
|
|
46
|
-
// ext: "tpl",
|
|
47
|
-
// path: basePublicPath,
|
|
48
|
-
// nunjucksConfig: {
|
|
49
|
-
// noCath: true,
|
|
50
|
-
// trimBlocks: true,
|
|
51
|
-
// },
|
|
52
|
-
// }),
|
|
53
|
-
// );
|
|
54
|
-
// api 签名校验
|
|
55
|
-
!app.envs.isLocal() && app.use(app.middlewares.apiSignVerify);
|
|
56
|
-
// api参数校验
|
|
57
|
-
app.use(app.middlewares.apiParamsVerify);
|
|
18
|
+
var middleware_default = (app) => {
|
|
19
|
+
const staticOpt = { ...app.envs.isLocal() ? { maxage: 60 * 1e3 } : { maxage: 365 * 24 * 60 * 60 * 1e3 } };
|
|
20
|
+
const basePublicPath = (0, path.resolve)(app.baseDir, "./app/public");
|
|
21
|
+
const framePublicPath = (0, path.resolve)(app.frameBaseDir, "./app/public");
|
|
22
|
+
app.use(app.middlewares.errorHandle);
|
|
23
|
+
app.use((0, koa_compress.default)({ threshold: 2048 }));
|
|
24
|
+
app.use((0, koa_static.default)(framePublicPath, staticOpt));
|
|
25
|
+
app.use((0, koa_static.default)(basePublicPath, staticOpt));
|
|
26
|
+
app.use(koaBody);
|
|
27
|
+
app.use(app.middlewares.projectHandler);
|
|
28
|
+
!app.envs.isLocal() && app.use(app.middlewares.apiSignVerify);
|
|
29
|
+
app.use(app.middlewares.apiParamsVerify);
|
|
58
30
|
};
|
|
31
|
+
//#endregion
|
|
32
|
+
module.exports = middleware_default;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
//#region app/router/project.ts
|
|
3
|
+
var project_default = (app, router) => {
|
|
4
|
+
const { project: projectController } = app.controller;
|
|
5
|
+
router.get("/api/project/model_list", projectController.getModelList);
|
|
6
|
+
router.get("/api/project/list", projectController.getProjectList);
|
|
7
|
+
router.get("/api/project/:key", projectController.getProject);
|
|
8
8
|
};
|
|
9
|
+
//#endregion
|
|
10
|
+
module.exports = project_default;
|
package/cjs/app/router/view.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
//#region app/router/view.ts
|
|
3
|
+
var view_default = (app, router) => {
|
|
4
|
+
router.get(["/view/:page", "/view/:page(.*)"], app.controller.view.renderPage.bind(app.controller.view));
|
|
5
5
|
};
|
|
6
|
+
//#endregion
|
|
7
|
+
module.exports = view_default;
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
'/api/project/list': {
|
|
18
|
-
get: {
|
|
19
|
-
query: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
proj_key: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
'/api/project/model_list': {
|
|
30
|
-
get: {},
|
|
31
|
-
},
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
//#region app/router-schema/project.ts
|
|
3
|
+
var routerSchema = {
|
|
4
|
+
"/api/project/:key": { get: { params: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: { key: { type: "string" } },
|
|
7
|
+
required: ["key"]
|
|
8
|
+
} } },
|
|
9
|
+
"/api/project/list": { get: { query: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: { proj_key: { type: "string" } }
|
|
12
|
+
} } },
|
|
13
|
+
"/api/project/model_list": { get: {} }
|
|
32
14
|
};
|
|
33
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
module.exports = routerSchema;
|
package/cjs/app/service/bese.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return superagent_1.default;
|
|
16
|
-
}
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let superagent = require("superagent");
|
|
3
|
+
superagent = require_runtime.__toESM(superagent);
|
|
4
|
+
//#region app/service/bese.ts
|
|
5
|
+
var bese_default = (app) => class BaseService {
|
|
6
|
+
get app() {
|
|
7
|
+
return app;
|
|
8
|
+
}
|
|
9
|
+
get config() {
|
|
10
|
+
return app.config;
|
|
11
|
+
}
|
|
12
|
+
get curl() {
|
|
13
|
+
return superagent.default;
|
|
14
|
+
}
|
|
17
15
|
};
|
|
16
|
+
//#endregion
|
|
17
|
+
module.exports = bese_default;
|
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_app_service_bese = require("./bese.js");
|
|
3
|
+
let _tc_core = require("@tc/core");
|
|
4
|
+
//#region app/service/project.ts
|
|
5
|
+
var getProjectService = (app) => {
|
|
6
|
+
const BaseService = require_app_service_bese(app);
|
|
7
|
+
const modelData = (0, _tc_core.loaderModel)(app);
|
|
8
|
+
return class ProjectService extends BaseService {
|
|
9
|
+
async getModelList() {
|
|
10
|
+
return modelData;
|
|
11
|
+
}
|
|
12
|
+
getList = (key) => {
|
|
13
|
+
return modelData.reduce((preList, modeItem) => {
|
|
14
|
+
const { project } = modeItem;
|
|
15
|
+
if (key && !project[key]) return preList;
|
|
16
|
+
for (const PKey in project) {
|
|
17
|
+
const item = project[PKey];
|
|
18
|
+
if (item) preList.push(item);
|
|
19
|
+
}
|
|
20
|
+
return preList;
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
23
|
+
getProject = (projectKey) => {
|
|
24
|
+
return modelData.reduce((preData, modeItem) => {
|
|
25
|
+
const item = modeItem.project[projectKey];
|
|
26
|
+
if (item) return item;
|
|
27
|
+
return preData;
|
|
28
|
+
}, null);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
4
31
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const bese_1 = __importDefault(require("./bese"));
|
|
8
|
-
const getProjectService = (app) => {
|
|
9
|
-
const BaseService = (0, bese_1.default)(app);
|
|
10
|
-
// const modelData = require('../../model')(app) as ModelItem[];
|
|
11
|
-
const modelData = (0, core_1.loaderModel)(app);
|
|
12
|
-
return class ProjectService extends BaseService {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.getList = (key) => {
|
|
16
|
-
return modelData.reduce((preList, modeItem) => {
|
|
17
|
-
const { project } = modeItem;
|
|
18
|
-
if (key && !project[key])
|
|
19
|
-
return preList;
|
|
20
|
-
for (const PKey in project) {
|
|
21
|
-
const item = project[PKey];
|
|
22
|
-
if (item)
|
|
23
|
-
preList.push(item);
|
|
24
|
-
}
|
|
25
|
-
return preList;
|
|
26
|
-
}, []);
|
|
27
|
-
};
|
|
28
|
-
this.getProject = (projectKey) => {
|
|
29
|
-
return modelData.reduce((preData, modeItem) => {
|
|
30
|
-
const item = modeItem.project[projectKey];
|
|
31
|
-
if (item)
|
|
32
|
-
return item;
|
|
33
|
-
return preData;
|
|
34
|
-
}, null);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
async getModelList() {
|
|
38
|
-
return modelData;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
exports.default = getProjectService;
|
|
32
|
+
//#endregion
|
|
33
|
+
module.exports = getProjectService;
|
package/cjs/app/type.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
require("../_virtual/_rolldown/runtime.js");
|
package/cjs/app/typings.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
require("../_virtual/_rolldown/runtime.js");
|
package/cjs/bundler/dev.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
const require_bundler_utils = require("./utils.js");
|
|
4
|
+
//#region bundler/dev.ts
|
|
5
|
+
var init = async () => {
|
|
6
|
+
const input = require_bundler_utils.entries();
|
|
7
|
+
console.log(input);
|
|
8
|
+
if (!Object.keys(input).length) {
|
|
9
|
+
console.error("no entry found");
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
await require_bundler_utils.VBuildFE(input);
|
|
13
13
|
};
|
|
14
14
|
async function dev() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// 监听文件变化
|
|
18
|
-
(0, utils_1.watchFiles)(async () => init());
|
|
15
|
+
await init();
|
|
16
|
+
require_bundler_utils.watchFiles(async () => init());
|
|
19
17
|
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.dev = dev;
|
package/cjs/bundler/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
const require_bundler_dev = require("./dev.js");
|
|
4
|
+
const require_bundler_prod = require("./prod.js");
|
|
5
|
+
//#region bundler/index.ts
|
|
6
|
+
var buildFE = (mode) => {
|
|
7
|
+
switch (mode) {
|
|
8
|
+
case "dev":
|
|
9
|
+
require_bundler_dev.dev();
|
|
10
|
+
break;
|
|
11
|
+
case "prod":
|
|
12
|
+
require_bundler_prod.prod();
|
|
13
|
+
break;
|
|
14
|
+
default: console.log("Usage: npx tsx scripts/index.ts [dev|prod]");
|
|
15
|
+
}
|
|
17
16
|
};
|
|
17
|
+
//#endregion
|
|
18
18
|
exports.buildFE = buildFE;
|
package/cjs/bundler/prod.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
const require_bundler_utils = require("./utils.js");
|
|
4
|
+
//#region bundler/prod.ts
|
|
5
5
|
async function prod() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
6
|
+
const input = require_bundler_utils.entries();
|
|
7
|
+
if (!Object.keys(input).length) {
|
|
8
|
+
console.error("no entry found");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
await require_bundler_utils.VBuildFE(input);
|
|
13
|
+
console.log("build done");
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.error(String(err));
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
19
18
|
}
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.prod = prod;
|