@_tc/template-core 0.2.0-bate.0 → 0.2.0-bate.10
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/.skills/tc-component-usage-skills/reference/template-core-frontend.md +8 -1
- package/.skills/tc-generator/SKILL.md +3 -2
- package/.skills/tc-generator/reference/example.md +1 -1
- package/.skills/tc-generator/reference/model-schema.md +18 -0
- package/.skills/tc-generator/reference/project-template/index.js +1 -1
- package/.skills/tc-generator/reference/runtime-extensions.md +22 -2
- package/AGENT_README.md +35 -14
- package/README.md +238 -33
- package/cjs/app/controller/view.js +1 -1
- package/cjs/app/{extend → extends}/db.js +1 -1
- package/cjs/app/extends/localCacheHtmlEtag.js +1 -0
- package/cjs/app/extends/render-view.js +1 -0
- package/cjs/app/middleware.js +1 -1
- package/cjs/app/view/entry.tpl +0 -16
- package/cjs/bundler/buildFE.js +1 -0
- package/cjs/bundler/index.js +1 -1
- package/cjs/bundler/state.js +1 -1
- package/cjs/bundler/utils.js +3 -3
- package/cjs/packages/common/index.js +1 -1
- package/cjs/packages/common/rafTimer.js +1 -0
- package/cjs/packages/common/string/index.js +1 -1
- package/cjs/packages/core/index.js +1 -1
- package/cjs/packages/core/loader/controller.js +1 -1
- package/cjs/packages/core/loader/extend.js +1 -1
- package/cjs/packages/core/loader/middleware.js +1 -1
- package/cjs/packages/core/loader/router-schema.js +1 -1
- package/cjs/packages/core/loader/router.js +1 -1
- package/cjs/packages/core/loader/service.js +1 -1
- package/cjs/packages/utils/runFileFn.js +1 -1
- package/esm/app/controller/view.js +28 -15
- package/esm/app/{extend → extends}/$fetch.js +1 -1
- package/esm/app/{extend → extends}/crypto.js +1 -1
- package/esm/app/{extend → extends}/db.js +2 -2
- package/esm/app/{extend → extends}/generateErrorMessage.js +1 -1
- package/esm/app/extends/localCacheHtmlEtag.js +41 -0
- package/esm/app/{extend → extends}/logger.js +1 -1
- package/esm/app/{extend → extends}/parsingParamsOnUrl.js +1 -1
- package/esm/app/extends/render-view.js +18 -0
- package/esm/app/middleware.js +8 -12
- package/esm/app/view/entry.tpl +0 -16
- package/esm/bundler/buildFE.js +14 -0
- package/esm/bundler/index.js +2 -14
- package/esm/bundler/state.js +5 -1
- package/esm/bundler/utils.js +130 -104
- package/esm/packages/common/index.js +7 -6
- package/esm/packages/common/rafTimer.js +47 -0
- package/esm/packages/common/string/index.js +11 -2
- package/esm/packages/core/index.js +34 -28
- package/esm/packages/core/loader/controller.js +6 -6
- package/esm/packages/core/loader/extend.js +6 -6
- package/esm/packages/core/loader/middleware.js +6 -6
- package/esm/packages/core/loader/router-schema.js +7 -7
- package/esm/packages/core/loader/router.js +13 -13
- package/esm/packages/core/loader/service.js +6 -6
- package/esm/packages/utils/runFileFn.js +10 -10
- package/fe/frontend/apps/dash/Dashboard.js +6 -4
- package/fe/frontend/apps/dash/dash.entry.js +4 -0
- package/fe/frontend/src/common/generateMenuData.d.ts +4 -1
- package/fe/frontend/src/common/generateMenuData.js +3 -3
- package/fe/frontend/src/common/language.d.ts +12 -1
- package/fe/frontend/src/common/language.js +25 -4
- package/fe/frontend/src/common/rafTimer.d.ts +1 -0
- package/fe/frontend/src/common/rafTimer.js +2 -0
- package/fe/frontend/src/common/request.js +1 -0
- package/fe/frontend/src/common/theme.d.ts +7 -0
- package/fe/frontend/src/common/theme.js +33 -0
- package/fe/frontend/src/components/BasePage/HeaderView.js +2 -2
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +22 -6
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.d.ts +3 -2
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +6 -29
- package/fe/frontend/src/components/ThemeSwitch/index.d.ts +1 -0
- package/fe/frontend/src/components/ThemeSwitch/index.js +3 -2
- package/fe/frontend/src/components/index.js +2 -2
- package/fe/frontend/src/defaultPages/NotFoundPage/index.js +4 -3
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +14 -9
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +8 -7
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +20 -24
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/PreviewImage.d.ts +10 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/PreviewImage.js +17 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/data.d.ts +5 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/data.js +8 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +50 -32
- package/fe/frontend/src/defaultPages/SchemaPage/index.css +0 -4
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +5 -3
- package/fe/frontend/src/defaultPages/SlotPage/index.js +6 -3
- package/fe/frontend/src/hooks/useText.d.ts +3 -0
- package/fe/frontend/src/hooks/useText.js +14 -0
- package/fe/frontend/src/index.d.ts +11 -3
- package/fe/frontend/src/index.js +8 -3
- package/fe/frontend/src/language/index.d.ts +0 -2
- package/fe/frontend/src/language/index.js +1 -7
- package/fe/frontend/src/language/resources.d.ts +2 -0
- package/fe/frontend/src/language/resources.js +9 -0
- package/fe/model/types/data/schema.d.ts +24 -2
- package/fe/model/types/index.d.ts +1 -0
- package/fe/packages/common/i18n/default.js +3 -0
- package/fe/packages/common/i18n/en-US.js +5 -2
- package/fe/packages/common/i18n/index.js +13 -0
- package/fe/packages/common/i18n/locales.js +7 -0
- package/fe/packages/common/index.d.ts +1 -0
- package/fe/packages/common/rafTimer.d.ts +7 -0
- package/fe/packages/common/rafTimer.js +168 -0
- package/fe/packages/common/string/index.d.ts +9 -0
- package/fe/packages/react/hooks/index.d.ts +9 -0
- package/fe/packages/react/hooks/index.js +8 -0
- package/fe/packages/react/hooks/useRefState.d.ts +4 -12
- package/fe/packages/react/hooks/useRefState.js +18 -8
- package/fe/packages/react/ui/components/DataTable/dataTableWidth.d.ts +12 -0
- package/fe/packages/react/ui/components/DataTable/dataTableWidth.js +33 -0
- package/fe/packages/react/ui/components/DataTable/dataTableWidth.test.js +39 -0
- package/fe/packages/react/ui/components/DataTable/index.d.ts +1 -1
- package/fe/packages/react/ui/components/DataTable/index.js +12 -32
- package/fe/packages/react/ui/components/Textarea/Textarea.d.ts +1 -1
- package/fe/packages/react/ui/components/Textarea/Textarea.js +1 -1
- package/fe/packages/react/ui/components/types/baseType.d.ts +21 -0
- package/fe/packages/react/ui/components/types/baseType.js +0 -0
- package/model/frontend/src/common/language.d.ts +12 -1
- package/model/frontend/src/hooks/useText.d.ts +3 -0
- package/model/frontend/src/language/index.d.ts +0 -2
- package/model/frontend/src/language/resources.d.ts +2 -0
- package/model/model/types/data/schema.d.ts +24 -2
- package/model/model/types/index.d.ts +1 -0
- package/model/packages/common/index.d.ts +1 -0
- package/model/packages/common/rafTimer.d.ts +7 -0
- package/model/packages/common/string/index.d.ts +9 -0
- package/model/packages/react/ui/components/DataTable/dataTableWidth.d.ts +12 -0
- package/model/packages/react/ui/components/DataTable/index.d.ts +1 -1
- package/model/packages/react/ui/components/Textarea/Textarea.d.ts +1 -1
- package/model/packages/react/ui/components/types/baseType.d.ts +21 -0
- package/package.json +5 -5
- package/types/app/extends/localCacheHtmlEtag.d.ts +10 -0
- package/types/app/{extend → extends}/render-view.d.ts +1 -1
- package/types/app/service/base.d.ts +1 -1
- package/types/app/service/project.d.ts +1 -1
- package/types/app/type.d.ts +2 -1
- package/types/app/typings.d.ts +10 -8
- package/types/bundler/buildFE.d.ts +2 -0
- package/types/bundler/index.d.ts +1 -2
- package/types/bundler/state.d.ts +4 -0
- package/types/bundler/utils.d.ts +5 -0
- package/types/index.d.ts +3 -3
- package/types/packages/common/i18n/default.d.ts +4 -0
- package/types/packages/common/i18n/en-US.d.ts +6 -2
- package/types/packages/common/i18n/index.d.ts +21 -0
- package/types/packages/common/i18n/locales.d.ts +10 -0
- package/types/packages/common/i18n/types.d.ts +40 -0
- package/types/packages/common/index.d.ts +1 -0
- package/types/packages/common/rafTimer.d.ts +44 -0
- package/types/packages/common/string/index.d.ts +16 -0
- package/types/packages/core/loader/extend.d.ts +1 -1
- package/types/packages/core/types.d.ts +4 -0
- package/cjs/app/extend/render-view.js +0 -1
- package/esm/app/extend/render-view.js +0 -25
- /package/cjs/app/{extend → extends}/$fetch.js +0 -0
- /package/cjs/app/{extend → extends}/crypto.js +0 -0
- /package/cjs/app/{extend → extends}/generateErrorMessage.js +0 -0
- /package/cjs/app/{extend → extends}/logger.js +0 -0
- /package/cjs/app/{extend → extends}/parsingParamsOnUrl.js +0 -0
- /package/types/app/{extend → extends}/$fetch.d.ts +0 -0
- /package/types/app/{extend → extends}/crypto.d.ts +0 -0
- /package/types/app/{extend → extends}/db.d.ts +0 -0
- /package/types/app/{extend → extends}/generateErrorMessage.d.ts +0 -0
- /package/types/app/{extend → extends}/logger.d.ts +0 -0
- /package/types/app/{extend → extends}/parsingParamsOnUrl.d.ts +0 -0
package/esm/bundler/utils.js
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { colorize as e, logJoinColorized as t, logRed as n, logWhite as r, logYellow as i } from "../packages/common/log/index.js";
|
|
2
|
+
import { resolve as a } from "../packages/utils/path.js";
|
|
2
3
|
import "../packages/utils/index.js";
|
|
3
|
-
import { colorize as t, logJoinColorized as n, logRed as r, logWhite as i, logYellow as a } from "../packages/common/log/index.js";
|
|
4
4
|
import { buildFESharedState as o } from "./state.js";
|
|
5
|
-
import s from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { build as
|
|
9
|
-
import
|
|
10
|
-
import { createRequire as
|
|
11
|
-
import { fileURLToPath as
|
|
5
|
+
import { existsSync as s, mkdirSync as c, readFileSync as l, readdirSync as u, rmSync as d, rmdirSync as f, unlinkSync as p, writeFileSync as m } from "fs";
|
|
6
|
+
import h from "path";
|
|
7
|
+
import * as g from "glob";
|
|
8
|
+
import { build as _ } from "vite";
|
|
9
|
+
import v from "@tailwindcss/vite";
|
|
10
|
+
import { createRequire as y } from "module";
|
|
11
|
+
import { fileURLToPath as b } from "url";
|
|
12
12
|
//#region bundler/utils.ts
|
|
13
|
-
var
|
|
13
|
+
var x = typeof __filename == "string" ? __filename : b(import.meta.url), S = h.dirname(x), C = process.cwd(), w = y(x), T = h.resolve(S, "../../"), E = h.resolve(S, "../"), D = h.resolve(T, "./fe/frontend"), O = h.resolve(C, "."), k = h.resolve(O, "./frontend"), A = (e) => h.dirname(w.resolve(`${e}/package.json`)), j = h.join(O, ".tc-entry-html"), M = "<!-- {{InsertScript}} -->", N = {
|
|
14
14
|
head: "<!-- TC_HEAD_SLOT -->",
|
|
15
15
|
bodyBeforeRoot: "<!-- TC_BODY_BEFORE_ROOT_SLOT -->",
|
|
16
16
|
bodyAfterRoot: "<!-- TC_BODY_AFTER_ROOT_SLOT -->"
|
|
17
|
-
},
|
|
17
|
+
}, P = [
|
|
18
18
|
"head",
|
|
19
19
|
"body-before-root",
|
|
20
20
|
"body-after-root"
|
|
21
|
-
],
|
|
21
|
+
], F = () => ({
|
|
22
22
|
head: "",
|
|
23
23
|
"body-before-root": "",
|
|
24
24
|
"body-after-root": ""
|
|
25
|
-
}),
|
|
26
|
-
let t =
|
|
25
|
+
}), I = (e) => e.trim().replace(/<!--(?!\s*(?:tc-slot:|\/tc-slot:))[\s\S]*?-->/g, "").replace(/>\s+</g, "><"), L = (e) => {
|
|
26
|
+
let t = [], n = e.replace(/<(script|style|textarea|pre)\b[\s\S]*?<\/\1>/gi, (e) => {
|
|
27
|
+
let n = `__TC_HTML_PRESERVED_${t.length}__`;
|
|
28
|
+
return t.push(e), n;
|
|
29
|
+
}).replace(/<!--(?!\s*(?:tc-slot:|\/tc-slot:|\{\{InsertScript\}\}|TC_))[\s\S]*?-->/g, "").replace(/>\s+</g, "><").trim();
|
|
30
|
+
return t.reduce((e, t, n) => e.replace(`__TC_HTML_PRESERVED_${n}__`, t), n);
|
|
31
|
+
}, R = (e) => e.split(h.sep).join("/"), z = (e) => {
|
|
32
|
+
let t = R(e);
|
|
27
33
|
return t.startsWith(".") || t.startsWith("/") ? t : `./${t}`;
|
|
28
|
-
},
|
|
29
|
-
let t =
|
|
30
|
-
if (n.replace(r, (n, r,
|
|
31
|
-
if (
|
|
32
|
-
return t[r] +=
|
|
34
|
+
}, B = (e) => /<html[\s>]/i.test(e) && e.includes("window['_basePath']") && /<div\s+id=["']root["']\s*><\/div>/i.test(e), V = (e) => {
|
|
35
|
+
let t = F(), n = l(e, "utf-8"), r = /<!--\s*tc-slot:([\w-]+)\s*-->([\s\S]*?)<!--\s*\/tc-slot:\1\s*-->/g, a = !1, o = n;
|
|
36
|
+
if (n.replace(r, (n, r, i) => {
|
|
37
|
+
if (a = !0, !P.includes(r)) throw Error(`Invalid html slot "${r}" in ${e}. Allowed slots: ${P.join(", ")}.`);
|
|
38
|
+
return t[r] += i.trim() ? `${i}\n` : "", o = o.replace(n, ""), n;
|
|
33
39
|
}), o.trim()) {
|
|
34
|
-
if (
|
|
40
|
+
if (B(n)) return i(`ignored legacy generated entry html: ${e}`), F();
|
|
35
41
|
throw Error([
|
|
36
42
|
`Invalid custom entry html: ${e}.`,
|
|
37
43
|
"Custom entry html can only contain tc-slot blocks, for example:",
|
|
@@ -40,99 +46,117 @@ var S = typeof __filename == "string" ? __filename : x(import.meta.url), C = s.d
|
|
|
40
46
|
"<!-- /tc-slot:head -->"
|
|
41
47
|
].join("\n"));
|
|
42
48
|
}
|
|
43
|
-
return
|
|
44
|
-
},
|
|
45
|
-
let
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
48
|
-
},
|
|
49
|
-
let
|
|
50
|
-
return
|
|
49
|
+
return a && i(`using custom entry html slots: ${e}`), t;
|
|
50
|
+
}, H = (e, t) => {
|
|
51
|
+
let n = h.basename(e), r = [h.join(e, `${t}.html`), h.join(e, `${n}.html`)].find((e) => s(e));
|
|
52
|
+
if (r) return r;
|
|
53
|
+
if (g.sync(a(e, "*.html")).length) throw Error([`Entry html filename is not supported in ${e}.`, `Use ${t}.html or ${n}.html as a tc-slot file.`].join("\n"));
|
|
54
|
+
}, U = (e, t) => e.replace(N.head, I(t.head)).replace(N.bodyBeforeRoot, I(t["body-before-root"])).replace(N.bodyAfterRoot, I(t["body-after-root"])), W = (e = /* @__PURE__ */ new Date()) => {
|
|
55
|
+
let t = (e, t = 2) => e.toString().padStart(t, "0");
|
|
56
|
+
return [
|
|
57
|
+
e.getFullYear(),
|
|
58
|
+
t(e.getMonth() + 1),
|
|
59
|
+
t(e.getDate()),
|
|
60
|
+
t(e.getHours())
|
|
61
|
+
].join("/") + `:${t(e.getMinutes())}:${t(e.getSeconds())}:${t(e.getMilliseconds(), 3)}`;
|
|
62
|
+
}, G = (e, t, n, r) => {
|
|
63
|
+
let i = h.join(j, `${n}.html`), a = z(h.relative(h.dirname(i), t));
|
|
64
|
+
return m(i, U(e, r).replace(M, `<script type="module" src="${a}"><\/script>`)), i;
|
|
51
65
|
};
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
let
|
|
66
|
+
function K() {
|
|
67
|
+
r("frameFEPath: " + D), r("runFEPath: " + k);
|
|
68
|
+
let e = [D, k].reduce((e, t) => {
|
|
69
|
+
let n = [
|
|
56
70
|
"js",
|
|
57
71
|
"jsx",
|
|
58
72
|
"ts",
|
|
59
73
|
"tsx"
|
|
60
|
-
].map((
|
|
61
|
-
return [...
|
|
62
|
-
}, []),
|
|
63
|
-
if (!
|
|
64
|
-
|
|
74
|
+
].map((e) => a(t, "/**", "/*." + e)), r = g.sync(n).filter((e) => e.includes(".entry.")).filter((e) => !e.includes(".d.ts"));
|
|
75
|
+
return [...e, ...r];
|
|
76
|
+
}, []), t = {};
|
|
77
|
+
if (!e.length) return t;
|
|
78
|
+
d(j, {
|
|
65
79
|
recursive: !0,
|
|
66
80
|
force: !0
|
|
67
|
-
}),
|
|
68
|
-
let
|
|
69
|
-
for (let
|
|
70
|
-
let i =
|
|
71
|
-
|
|
81
|
+
}), c(j, { recursive: !0 });
|
|
82
|
+
let n = l(h.resolve(E, "./app/view/entry.tpl"), "utf-8");
|
|
83
|
+
for (let r = 0; r < e.length; r++) {
|
|
84
|
+
let i = e[r], a = h.resolve(i, "../"), o = H(a, h.basename(i).replace(/\.entry\.[^.]+$/, "")), s = o ? h.basename(o, ".html") : a.split(h.sep).at(-1);
|
|
85
|
+
t[s] = G(n, i, s, o ? V(o) : F());
|
|
72
86
|
}
|
|
73
|
-
return
|
|
87
|
+
return t;
|
|
74
88
|
}
|
|
75
|
-
function
|
|
89
|
+
function q() {
|
|
76
90
|
let e = o.options.output ?? "frame";
|
|
77
|
-
return e !== "frame" &&
|
|
91
|
+
return e !== "frame" && n("Please pay attention to the build output."), e === "run" ? h.join(O, "./app/public/dist") : typeof e == "function" ? e() : h.join(E, "./app/public/dist");
|
|
78
92
|
}
|
|
79
|
-
var
|
|
80
|
-
let t = (await import("chokidar")).watch(
|
|
93
|
+
var J = async (e) => {
|
|
94
|
+
let t = (await import("chokidar")).watch(k, {
|
|
81
95
|
ignored: /(^|[\/\\])\../,
|
|
82
96
|
persistent: !0,
|
|
83
97
|
ignoreInitial: !0
|
|
84
|
-
}),
|
|
98
|
+
}), r = !1;
|
|
85
99
|
t.on("change", async (t) => {
|
|
86
|
-
if (!
|
|
87
|
-
|
|
100
|
+
if (!r) {
|
|
101
|
+
r = !0, i(`changed: ${t}`);
|
|
88
102
|
try {
|
|
89
103
|
await e?.();
|
|
90
104
|
} catch (e) {
|
|
91
|
-
|
|
105
|
+
n(e);
|
|
92
106
|
} finally {
|
|
93
|
-
|
|
107
|
+
r = !1;
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
|
-
}),
|
|
110
|
+
}), i(`watching ${k}/...`);
|
|
97
111
|
};
|
|
98
|
-
function
|
|
112
|
+
function Y() {
|
|
113
|
+
return {
|
|
114
|
+
name: "flatten-html",
|
|
115
|
+
apply: "build",
|
|
116
|
+
closeBundle() {
|
|
117
|
+
let e = q(), t = W();
|
|
118
|
+
m(a(e, "./FEBuildKey"), t);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function X(e = ".html") {
|
|
99
123
|
let t = [...new Set(Array.isArray(e) ? e : [e])];
|
|
100
124
|
return {
|
|
101
125
|
name: "flatten-html",
|
|
102
126
|
apply: "build",
|
|
103
127
|
closeBundle() {
|
|
104
|
-
let e =
|
|
105
|
-
if (!
|
|
106
|
-
let n =
|
|
128
|
+
let e = q();
|
|
129
|
+
if (!s(e)) return;
|
|
130
|
+
let n = o.options.minifyHtml ?? !1, r = g.sync("**/*.html", {
|
|
107
131
|
cwd: e,
|
|
108
132
|
dot: !0
|
|
109
133
|
});
|
|
110
|
-
for (let
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
for (let
|
|
114
|
-
let t =
|
|
115
|
-
|
|
134
|
+
for (let i of r) {
|
|
135
|
+
let r = h.join(e, i), a = l(r, "utf-8"), o = n ? L(a) : a, s = h.basename(i, ".html"), c = ".entry";
|
|
136
|
+
s.indexOf(c) === -1 && (s += c);
|
|
137
|
+
for (let i of t) {
|
|
138
|
+
let t = s + i, a = h.join(e, t);
|
|
139
|
+
r === a ? n && m(a, o) : m(a, o);
|
|
116
140
|
}
|
|
117
|
-
t.some((t) =>
|
|
141
|
+
t.some((t) => r === h.join(e, s + t)) || p(r);
|
|
118
142
|
}
|
|
119
|
-
let
|
|
120
|
-
if (!(
|
|
121
|
-
|
|
122
|
-
let t = e.split(
|
|
123
|
-
t.length &&
|
|
143
|
+
let a = [...new Set(r.map((e) => h.dirname(e)))].sort().reverse(), c = (e) => {
|
|
144
|
+
if (!(s(e) ? u(e) : [1]).length) {
|
|
145
|
+
f(e);
|
|
146
|
+
let t = e.split(h.sep).slice(0, -1);
|
|
147
|
+
t.length && c(t.join(h.sep));
|
|
124
148
|
}
|
|
125
149
|
};
|
|
126
|
-
for (let t of
|
|
127
|
-
let
|
|
150
|
+
for (let t of a) t && t !== "." && c(h.join(e, t));
|
|
151
|
+
let d = t.flatMap((t) => g.sync("**/*" + t, {
|
|
128
152
|
cwd: e,
|
|
129
153
|
dot: !0
|
|
130
154
|
}));
|
|
131
|
-
for (let e of
|
|
155
|
+
for (let e of d) i("final file path -----> " + e);
|
|
132
156
|
}
|
|
133
157
|
};
|
|
134
158
|
}
|
|
135
|
-
function
|
|
159
|
+
function Z(e) {
|
|
136
160
|
let t = [
|
|
137
161
|
"",
|
|
138
162
|
".ts",
|
|
@@ -140,73 +164,74 @@ function J(e) {
|
|
|
140
164
|
".js",
|
|
141
165
|
".jsx"
|
|
142
166
|
];
|
|
143
|
-
return e.reduce((e, [n, r, i =
|
|
144
|
-
let o = t.map((e) =>
|
|
167
|
+
return e.reduce((e, [n, r, i = k, a = "./defaultAlias"]) => {
|
|
168
|
+
let o = t.map((e) => h.resolve(i, r + e)).find((e) => s(e)), c = h.resolve(S, a);
|
|
145
169
|
return o && (c = o), e[n] = c, e;
|
|
146
170
|
}, {});
|
|
147
171
|
}
|
|
148
|
-
var
|
|
172
|
+
var Q = (...e) => new RegExp(e.join("[\\/]")), $ = (e) => `_${e}_tcC`, ee = async (r, i) => {
|
|
149
173
|
try {
|
|
150
|
-
await
|
|
174
|
+
await _({
|
|
151
175
|
configFile: !1,
|
|
152
176
|
base: "/dist",
|
|
153
177
|
plugins: [
|
|
154
178
|
(await import("@vitejs/plugin-react")).default(),
|
|
155
|
-
|
|
156
|
-
|
|
179
|
+
X([".tpl"]),
|
|
180
|
+
Y(),
|
|
181
|
+
v()
|
|
157
182
|
],
|
|
158
183
|
build: {
|
|
159
|
-
outDir:
|
|
184
|
+
outDir: q(),
|
|
160
185
|
emptyOutDir: !0,
|
|
161
186
|
sourcemap: i === "dev" ? "inline" : "hidden",
|
|
162
187
|
rolldownOptions: {
|
|
163
|
-
input:
|
|
188
|
+
input: r,
|
|
164
189
|
output: { codeSplitting: { groups: [
|
|
165
190
|
{
|
|
166
|
-
name:
|
|
167
|
-
test:
|
|
191
|
+
name: $("__nm"),
|
|
192
|
+
test: Q("node_modules"),
|
|
168
193
|
maxSize: 5e5,
|
|
169
194
|
minShareCount: 2,
|
|
170
195
|
priority: 1
|
|
171
196
|
},
|
|
172
197
|
{
|
|
173
|
-
name:
|
|
174
|
-
test:
|
|
198
|
+
name: $("r"),
|
|
199
|
+
test: Q("node_modules", "react"),
|
|
175
200
|
minShareCount: 2,
|
|
176
201
|
maxSize: 5e5,
|
|
177
202
|
priority: 5
|
|
178
203
|
},
|
|
179
204
|
{
|
|
180
|
-
name:
|
|
181
|
-
test:
|
|
205
|
+
name: $("r-d"),
|
|
206
|
+
test: Q("node_modules", "react-dom"),
|
|
182
207
|
minShareCount: 2,
|
|
183
208
|
maxSize: 2e5,
|
|
184
209
|
priority: 10
|
|
185
210
|
},
|
|
186
211
|
{
|
|
187
|
-
name:
|
|
188
|
-
test:
|
|
212
|
+
name: $("r-r-d"),
|
|
213
|
+
test: Q("node_modules", "react-router-dom"),
|
|
189
214
|
minShareCount: 2,
|
|
190
215
|
maxSize: 5e5,
|
|
191
216
|
priority: 10
|
|
192
217
|
},
|
|
193
218
|
{
|
|
194
|
-
name:
|
|
195
|
-
test:
|
|
219
|
+
name: $("ajv"),
|
|
220
|
+
test: Q("node_modules", "ajv"),
|
|
196
221
|
minShareCount: 2,
|
|
197
222
|
maxSize: 2e5,
|
|
198
223
|
priority: 10
|
|
199
224
|
},
|
|
200
225
|
{
|
|
201
|
-
name:
|
|
202
|
-
test:
|
|
226
|
+
name: $("ui-lib"),
|
|
227
|
+
test: Q("components"),
|
|
203
228
|
minShareCount: 2,
|
|
204
229
|
maxSize: 2e5,
|
|
205
230
|
priority: 5
|
|
206
231
|
},
|
|
207
232
|
{
|
|
208
|
-
name:
|
|
209
|
-
test:
|
|
233
|
+
name: $("ui-f-lib"),
|
|
234
|
+
test: Q("components", ".*?[Ff]orm.*?"),
|
|
210
235
|
minShareCount: 2,
|
|
211
236
|
maxSize: 5e4,
|
|
212
237
|
priority: 10
|
|
@@ -215,18 +240,19 @@ var Y = (...e) => new RegExp(e.join("[\\/]")), X = (e) => `_${e}_tcC`, Z = async
|
|
|
215
240
|
}
|
|
216
241
|
},
|
|
217
242
|
resolve: { alias: {
|
|
218
|
-
react:
|
|
219
|
-
"react-dom":
|
|
220
|
-
"@tc/ui-react/hooks":
|
|
221
|
-
"@tc/ui-react":
|
|
222
|
-
...
|
|
243
|
+
react: A("react"),
|
|
244
|
+
"react-dom": A("react-dom"),
|
|
245
|
+
"@tc/ui-react/hooks": h.resolve(S, "../../fe/packages/react/hooks/"),
|
|
246
|
+
"@tc/ui-react": h.resolve(S, "../../fe/packages/react/ui/"),
|
|
247
|
+
...Z([
|
|
223
248
|
[
|
|
224
249
|
"@tc/scalability/SchemaForm/frameData",
|
|
225
250
|
"./extended/SchemaForm/data",
|
|
226
|
-
|
|
251
|
+
D
|
|
227
252
|
],
|
|
228
253
|
["@tc/scalability/SchemaForm/data", "./extended/SchemaForm/data"],
|
|
229
254
|
["@tc/scalability/SchemaPage/CallCom/data", "./extended/SchemaPage/CallCom/data"],
|
|
255
|
+
["@tc/scalability/SchemaPage/SchemaTable/data", "./extended/SchemaPage/SchemaTable/data"],
|
|
230
256
|
["@tc/scalability/dash/customRoutes", "./extended/dash/customRoutes"],
|
|
231
257
|
["@tc/scalability/dash/init", "./extended/dash/init"],
|
|
232
258
|
["@tc/scalability/dash/components", "./extended/dash/components"],
|
|
@@ -238,10 +264,10 @@ var Y = (...e) => new RegExp(e.join("[\\/]")), X = (e) => `_${e}_tcC`, Z = async
|
|
|
238
264
|
]
|
|
239
265
|
])
|
|
240
266
|
} }
|
|
241
|
-
}),
|
|
267
|
+
}), t(e("builded", "green"), e(" -> ", "white"), e("time: ", "cyan"), e(/* @__PURE__ */ new Date(), "pink"));
|
|
242
268
|
} catch (e) {
|
|
243
|
-
if (
|
|
269
|
+
if (n(e), i !== "dev") throw e;
|
|
244
270
|
}
|
|
245
271
|
};
|
|
246
272
|
//#endregion
|
|
247
|
-
export {
|
|
273
|
+
export { ee as VBuildFE, K as entries, Y as generateBuildKeyPlugin, q as outDir, J as watchFiles };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { isBoolean as e, isFunction as t, isNil as n, isNonNullable as r, isNumber as i, isPlainObject as a, isString as o } from "./guards/index.js";
|
|
2
|
+
import { chunk as s, compact as c, groupBy as l, toArray as u, uniqueBy as d } from "./array/index.js";
|
|
3
|
+
import { LRUCache as f } from "./cache/LRUCache.js";
|
|
4
|
+
import { FetchAxios as p, axios as m, createInstance as h } from "./http/index.js";
|
|
5
5
|
import { defaultLanguageResources as g } from "./i18n/default.js";
|
|
6
6
|
import { defaultEnglishResources as _ } from "./i18n/en-US.js";
|
|
7
7
|
import { defaultLanguage as v, languageLocalKey as y, translations as b } from "./i18n/locales.js";
|
|
@@ -10,5 +10,6 @@ import { ANSI_RESET as j, ansiColors as M, colorLog as N, colorize as P, joinCol
|
|
|
10
10
|
import { clamp as W, toFiniteNumber as G } from "./number/index.js";
|
|
11
11
|
import { filterEmpty as K, filtereEmpty as q } from "./object/filterEmpty.js";
|
|
12
12
|
import { mapValues as J, omit as Y, pick as X } from "./object/index.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import { clearRafTimer as Z, rafClearInterval as Q, rafClearTimeout as $, rafSetInterval as ee, rafSetTimeout as te } from "./rafTimer.js";
|
|
14
|
+
import { capitalize as ne, isBlank as re, joinStr as ie, kebabCase as ae } from "./string/index.js";
|
|
15
|
+
export { j as ANSI_RESET, p as FetchAxios, f as LRUCache, M as ansiColors, m as axios, ne as capitalize, s as chunk, W as clamp, Z as clearRafTimer, N as colorLog, P as colorize, c as compact, h as createInstance, _ as defaultEnglishResources, v as defaultLanguage, g as defaultLanguageResources, K as filterEmpty, q as filtereEmpty, x as getI18nPathValue, S as getLanguage, l as groupBy, C as i18n, w as i18nStore, T as interpolateI18nMessage, re as isBlank, e as isBoolean, t as isFunction, n as isNil, r as isNonNullable, i as isNumber, E as isPlainI18nDictionary, a as isPlainObject, o as isString, F as joinColorized, ie as joinStr, ae as kebabCase, y as languageLocalKey, I as logColor, L as logColorized, R as logGreen, z as logJoinColorized, B as logPink, V as logRed, H as logWhite, U as logYellow, J as mapValues, D as mergeI18nDictionary, O as mergeI18nResources, Y as omit, X as pick, Q as rafClearInterval, $ as rafClearTimeout, ee as rafSetInterval, te as rafSetTimeout, k as t, u as toArray, G as toFiniteNumber, A as translate, b as translations, d as uniqueBy };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region packages/common/rafTimer.ts
|
|
2
|
+
var e = 16, t = globalThis, n = /* @__PURE__ */ new Map(), r = 0, i = (e) => Math.max(0, e ?? 0), a = () => t.performance?.now?.() ?? Date.now(), o = () => {
|
|
3
|
+
let n = t.requestAnimationFrame, r = t.cancelAnimationFrame;
|
|
4
|
+
if (typeof n == "function" && typeof r == "function") return {
|
|
5
|
+
scheduleFrame: (e) => n.call(t, e),
|
|
6
|
+
cancelFrame: (e) => r.call(t, e)
|
|
7
|
+
};
|
|
8
|
+
let i = t.setTimeout, o = t.clearTimeout;
|
|
9
|
+
if (typeof i != "function" || typeof o != "function") throw Error("raf timer requires requestAnimationFrame or setTimeout/clearTimeout.");
|
|
10
|
+
return {
|
|
11
|
+
scheduleFrame: (n) => i.call(t, () => n(a()), e),
|
|
12
|
+
cancelFrame: (e) => o.call(t, e)
|
|
13
|
+
};
|
|
14
|
+
}, s, c = () => (s ??= o(), s), l = () => (r += 1, r), u = (e) => {
|
|
15
|
+
let t = n.get(e);
|
|
16
|
+
t && (c().cancelFrame(t.frameId), n.delete(e));
|
|
17
|
+
}, d = (e, t) => {
|
|
18
|
+
let r = n.get(e);
|
|
19
|
+
if (r) {
|
|
20
|
+
if (r.type === "timeout" ? t - r.startTime >= r.delay : t - r.lastRunTime >= r.delay) {
|
|
21
|
+
if (r.type === "timeout") {
|
|
22
|
+
n.delete(e), r.callback();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
r.lastRunTime = t, r.callback();
|
|
26
|
+
}
|
|
27
|
+
n.has(e) && (r.frameId = c().scheduleFrame((t) => d(e, t)));
|
|
28
|
+
}
|
|
29
|
+
}, f = (e, t, r, o) => {
|
|
30
|
+
let s = l(), u = a(), f = {
|
|
31
|
+
type: e,
|
|
32
|
+
delay: i(r),
|
|
33
|
+
callback: () => t(...o ?? []),
|
|
34
|
+
startTime: u,
|
|
35
|
+
lastRunTime: u,
|
|
36
|
+
frameId: 0
|
|
37
|
+
};
|
|
38
|
+
return n.set(s, f), f.frameId = c().scheduleFrame((e) => d(s, e)), s;
|
|
39
|
+
}, p = (e, t, ...n) => f("timeout", e, t, n), m = (e) => {
|
|
40
|
+
u(e);
|
|
41
|
+
}, h = (e, t, ...n) => f("interval", e, t, n), g = (e) => {
|
|
42
|
+
u(e);
|
|
43
|
+
}, _ = (e) => {
|
|
44
|
+
u(e);
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { _ as clearRafTimer, g as rafClearInterval, m as rafClearTimeout, h as rafSetInterval, p as rafSetTimeout };
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
//#region packages/common/string/index.ts
|
|
2
|
-
var e = (e) => e == null || e.trim().length === 0, t = (e) => e.length === 0 ? e : `${e.charAt(0).toUpperCase()}${e.slice(1)}`, n = (e) => e.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").replace(/-+/g, "-").toLowerCase()
|
|
2
|
+
var e = (e) => e == null || e.trim().length === 0, t = (e) => e.length === 0 ? e : `${e.charAt(0).toUpperCase()}${e.slice(1)}`, n = (e) => e.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").replace(/-+/g, "-").toLowerCase(), r = (...e) => {
|
|
3
|
+
let t = e[e.length - 1], n = typeof t == "object" && t && !Array.isArray(t) && "separator" in t ? t : void 0, r = n?.separator ?? " ";
|
|
4
|
+
return (n ? e.slice(0, -1) : e).flatMap((e) => {
|
|
5
|
+
if (Array.isArray(e)) {
|
|
6
|
+
let [t, n] = e;
|
|
7
|
+
return t ? n : void 0;
|
|
8
|
+
}
|
|
9
|
+
return e;
|
|
10
|
+
}).filter((e) => e != null && e !== !1 && e !== "").join(r);
|
|
11
|
+
};
|
|
3
12
|
//#endregion
|
|
4
|
-
export { t as capitalize, e as isBlank, n as kebabCase };
|
|
13
|
+
export { t as capitalize, e as isBlank, r as joinStr, n as kebabCase };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
4
|
-
import { runFileFn as r } from "../utils/runFileFn.js";
|
|
1
|
+
import e from "./env.js";
|
|
2
|
+
import { resolve as t } from "../utils/path.js";
|
|
3
|
+
import { runFileFn as n } from "../utils/runFileFn.js";
|
|
5
4
|
import "../utils/index.js";
|
|
6
|
-
import
|
|
5
|
+
import r from "./loader/config.js";
|
|
6
|
+
import { getAppPath as i } from "./paths.js";
|
|
7
7
|
import a from "./loader/controller.js";
|
|
8
8
|
import o from "./loader/extend.js";
|
|
9
9
|
import s from "./loader/middleware.js";
|
|
@@ -13,39 +13,45 @@ import u from "./loader/router-schema.js";
|
|
|
13
13
|
import d from "./loader/service.js";
|
|
14
14
|
import f from "koa";
|
|
15
15
|
//#region packages/core/index.ts
|
|
16
|
-
var p = c, m = async (
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
let { frameBaseDir:
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
|
|
16
|
+
var p = c, m = async (n = {}) => {
|
|
17
|
+
let c = new f();
|
|
18
|
+
c.hooks = {}, c.hooks.initing?.();
|
|
19
|
+
let { frameBaseDir: p, baseDir: m, ...g } = n;
|
|
20
|
+
c.options = g, c.options.pageBasePage = c.options.pageBasePage ?? "/", c.options.apiPrefix = c.options.apiPrefix || "/api";
|
|
21
|
+
let _ = c.baseDir = m ?? process.cwd(), v = c.frameBaseDir = p ?? t(__dirname, "..");
|
|
22
|
+
c.businessAppPath = t(_, "app"), c.frameAppPath = t(v, "app"), c.paths = [{
|
|
23
23
|
type: "frame",
|
|
24
|
-
path:
|
|
24
|
+
path: c.frameAppPath
|
|
25
25
|
}, {
|
|
26
26
|
type: "business",
|
|
27
|
-
path:
|
|
28
|
-
}]
|
|
27
|
+
path: c.businessAppPath
|
|
28
|
+
}];
|
|
29
|
+
let y = c.options.additionalPublicPaths ?? [];
|
|
30
|
+
y = Array.isArray(y) ? y : [y], c.publicsPath = [
|
|
31
|
+
t(i(c, "business"), "./public"),
|
|
32
|
+
t(i(c, "frame"), "./public"),
|
|
33
|
+
...y
|
|
34
|
+
], c.envs = e(), console.log(`-- [init] env: ${c.envs.get()} --`), r(c), console.log("-- [init] loader config done --"), await o(c), console.log("-- [init] loader extends done --"), u(c), console.log("-- [init] loader routerSchema done --"), d(c), console.log("-- [init] loader service done --"), a(c), console.log("-- [init] loader controller done --"), s(c), console.log("-- [init] loader middleware done --"), h(c), l(c), console.log("-- [init] loader router done --");
|
|
29
35
|
try {
|
|
30
|
-
let
|
|
31
|
-
|
|
36
|
+
let t = c.config.port || process.env.PORT || "8080", n = parseInt(t + "", 10), r = process.env.IP || "0.0.0.0";
|
|
37
|
+
c.listen(n, r), console.log(`Server port: http://localhost:${n}`), console.log(`run env is ${e().get()}`);
|
|
32
38
|
} catch (e) {
|
|
33
39
|
console.error(e);
|
|
34
40
|
}
|
|
35
|
-
return
|
|
36
|
-
}, h = (
|
|
37
|
-
["frame", "business"].map((
|
|
38
|
-
type:
|
|
39
|
-
path: e
|
|
40
|
-
})).forEach((
|
|
41
|
+
return c.hooks.inited?.(), c;
|
|
42
|
+
}, h = (e) => {
|
|
43
|
+
["frame", "business"].map((t) => ({
|
|
44
|
+
type: t,
|
|
45
|
+
path: i(e, t)
|
|
46
|
+
})).forEach((r) => {
|
|
41
47
|
for (let i of ["ts", "js"]) {
|
|
42
|
-
let a = `middleware.${i}`, o =
|
|
48
|
+
let a = `middleware.${i}`, o = t(r.path, a);
|
|
43
49
|
try {
|
|
44
|
-
|
|
50
|
+
n(o)?.(e), console.log(`-- [init] loader ${r.type} appMiddleware ${a} done -- (${r.path})`);
|
|
45
51
|
break;
|
|
46
|
-
} catch (
|
|
47
|
-
let
|
|
48
|
-
if (!(
|
|
52
|
+
} catch (e) {
|
|
53
|
+
let t = e;
|
|
54
|
+
if (!(t?.code === "MODULE_NOT_FOUND" && typeof t?.message == "string" && (t.message.includes(`Cannot find module '${o}'`) || t.message.includes(`Cannot find module "${o}"`)))) throw console.log(`-- [error] loader ${r.type} appMiddleware ${a} error -- (${o})`), e;
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { runFileFn as n } from "../../utils/runFileFn.js";
|
|
1
|
+
import { loadFileFn as e } from "../../utils/loadFile.js";
|
|
2
|
+
import { runFileFn as t } from "../../utils/runFileFn.js";
|
|
4
3
|
import "../../utils/index.js";
|
|
4
|
+
import { getAppPaths as n } from "../paths.js";
|
|
5
5
|
//#region packages/core/loader/controller.ts
|
|
6
6
|
var r = (r) => {
|
|
7
|
-
r.controller =
|
|
8
|
-
...
|
|
9
|
-
...
|
|
7
|
+
r.controller = n(r).reduce((n, i) => ({
|
|
8
|
+
...n,
|
|
9
|
+
...e(i, "controller", { loadFileCallback: (e) => new (t(e)(r))() })
|
|
10
10
|
}), {});
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { runFileFn as n } from "../../utils/runFileFn.js";
|
|
1
|
+
import { loadFileFn as e } from "../../utils/loadFile.js";
|
|
2
|
+
import { runFileFn as t } from "../../utils/runFileFn.js";
|
|
4
3
|
import "../../utils/index.js";
|
|
4
|
+
import { getAppPaths as n } from "../paths.js";
|
|
5
5
|
//#region packages/core/loader/extend.ts
|
|
6
6
|
var r = async (r) => {
|
|
7
7
|
r.extends = { ...r.extends };
|
|
8
8
|
let i = [];
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
n(r).forEach((n) => {
|
|
10
|
+
e(n, "extends", { processingFileCallback: ((e, n, a) => {
|
|
11
11
|
if (!a) {
|
|
12
12
|
for (let t in r) if (t === e) {
|
|
13
13
|
console.log("\x1B[31m%s\x1B[0m", `[extend loader error] name:${e} is already in app`);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
let a = n
|
|
16
|
+
let a = t(n)(r);
|
|
17
17
|
i.push(Promise.resolve(a).then((t) => ({
|
|
18
18
|
fileName: e,
|
|
19
19
|
value: t
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { runFileFn as n } from "../../utils/runFileFn.js";
|
|
1
|
+
import { loadFileFn as e } from "../../utils/loadFile.js";
|
|
2
|
+
import { runFileFn as t } from "../../utils/runFileFn.js";
|
|
4
3
|
import "../../utils/index.js";
|
|
4
|
+
import { getAppPaths as n } from "../paths.js";
|
|
5
5
|
//#region packages/core/loader/middleware.ts
|
|
6
6
|
var r = (r) => {
|
|
7
|
-
r.middlewares =
|
|
8
|
-
let a =
|
|
7
|
+
r.middlewares = n(r).reduce((n, i) => {
|
|
8
|
+
let a = e(i, "middlewares", { loadFileCallback: (e) => t(e)(r) });
|
|
9
9
|
return {
|
|
10
|
-
...
|
|
10
|
+
...n,
|
|
11
11
|
...a
|
|
12
12
|
};
|
|
13
13
|
}, {});
|