@lark-apaas/miaoda-presets 1.0.3 → 1.0.5-alpha.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.
@@ -1,148 +1,148 @@
1
1
  {
2
- "version": 1,
3
- "themeName": "UD Theme Style",
4
- "theme": {
5
- "seriesCnt": "6",
6
- "backgroundColor": "rgba(0,0,0,0)",
7
- "titleColor": "#1f2329",
8
- "subtitleColor": "#8f959e",
9
- "textColorShow": false,
10
- "textColor": "#333",
11
- "markTextColor": "#ffffff",
12
- "color": [
13
- "#3370eb",
14
- "#1bcebf",
15
- "#ffc60a",
16
- "#ed6d0c",
17
- "#dca1e4",
18
- "#25b2e5",
19
- "#6dcdeb",
20
- "#288fcb",
21
- "#94b5f5",
22
- "#8f61d1",
23
- "#8f61d1",
24
- "#bf78e9",
25
- "#008280",
26
- "#27ad8e",
27
- "#7bc335"
28
- ],
29
- "borderColor": "#dee0e3",
30
- "borderWidth": 0,
31
- "visualMapColor": ["#25b2e5", "#6dcdeb", "#288fcb"],
32
- "legendTextColor": "#8f959e",
33
- "kColor": "#fdc6c4",
34
- "kColor0": "transparent",
35
- "kBorderColor": "#f54a45",
36
- "kBorderColor0": "#32a645",
37
- "kBorderWidth": "2",
38
- "lineWidth": "1",
39
- "symbolSize": "6",
40
- "symbol": "emptyCircle",
41
- "symbolBorderWidth": "1",
42
- "lineSmooth": true,
43
- "graphLineWidth": 1,
44
- "graphLineColor": "#dee0e3",
45
- "mapLabelColor": "#000",
46
- "mapLabelColorE": "#516b91",
47
- "mapBorderColor": "#516b91",
48
- "mapBorderColorE": "#516b91",
49
- "mapBorderWidth": 0.5,
50
- "mapBorderWidthE": 1,
51
- "mapAreaColor": "#f3f3f3",
52
- "mapAreaColorE": "#a5e7f0",
53
- "axes": [
54
- {
55
- "type": "all",
56
- "name": "通用坐标轴",
57
- "axisLineShow": true,
58
- "axisLineColor": "#dee0e3",
59
- "axisTickShow": false,
60
- "axisTickColor": "#333",
61
- "axisLabelShow": true,
62
- "axisLabelColor": "#8f959e",
63
- "splitLineShow": true,
64
- "splitLineColor": ["#dee0e3"],
65
- "splitAreaShow": false,
66
- "splitAreaColor": ["rgba(250,250,250,0.05)", "rgba(200,200,200,0.02)"]
67
- },
68
- {
69
- "type": "category",
70
- "name": "类目坐标轴",
71
- "axisLineShow": true,
72
- "axisLineColor": "#333",
73
- "axisTickShow": true,
74
- "axisTickColor": "#333",
75
- "axisLabelShow": true,
76
- "axisLabelColor": "#333",
77
- "splitLineShow": false,
78
- "splitLineColor": ["#ccc"],
79
- "splitAreaShow": false,
80
- "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
81
- },
82
- {
83
- "type": "value",
84
- "name": "数值坐标轴",
85
- "axisLineShow": true,
86
- "axisLineColor": "#333",
87
- "axisTickShow": true,
88
- "axisTickColor": "#333",
89
- "axisLabelShow": true,
90
- "axisLabelColor": "#333",
91
- "splitLineShow": true,
92
- "splitLineColor": ["#ccc"],
93
- "splitAreaShow": false,
94
- "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
95
- },
96
- {
97
- "type": "log",
98
- "name": "对数坐标轴",
99
- "axisLineShow": true,
100
- "axisLineColor": "#333",
101
- "axisTickShow": true,
102
- "axisTickColor": "#333",
103
- "axisLabelShow": true,
104
- "axisLabelColor": "#333",
105
- "splitLineShow": true,
106
- "splitLineColor": ["#ccc"],
107
- "splitAreaShow": false,
108
- "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
109
- },
110
- {
111
- "type": "time",
112
- "name": "时间坐标轴",
113
- "axisLineShow": true,
114
- "axisLineColor": "#333",
115
- "axisTickShow": true,
116
- "axisTickColor": "#333",
117
- "axisLabelShow": true,
118
- "axisLabelColor": "#333",
119
- "splitLineShow": true,
120
- "splitLineColor": ["#ccc"],
121
- "splitAreaShow": false,
122
- "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
123
- }
124
- ],
125
- "axisSeperateSetting": false,
126
- "toolboxColor": "#8f959e",
127
- "toolboxEmphasisColor": "#1f2329",
128
- "tooltipAxisColor": "#dee0e3",
129
- "tooltipAxisWidth": 1,
130
- "timelineLineColor": "#336df4",
131
- "timelineLineWidth": "-1",
132
- "timelineItemColor": "#336df4",
133
- "timelineItemColorE": "#1456f0",
134
- "timelineCheckColor": "#1456f0",
135
- "timelineCheckBorderColor": "#94b4ff",
136
- "timelineItemBorderWidth": "0.5",
137
- "timelineControlColor": "#336df4",
138
- "timelineControlBorderColor": "#336df4",
139
- "timelineControlBorderWidth": 0.5,
140
- "timelineLabelColor": "#8f959e",
141
- "datazoomBackgroundColor": "rgba(0,0,0,0)",
142
- "datazoomDataColor": "rgba(255,255,255,0.3)",
143
- "datazoomFillColor": "rgba(167,183,204,0.4)",
144
- "datazoomHandleColor": "#a7b7cc",
145
- "datazoomHandleWidth": "100",
146
- "datazoomLabelColor": "#333"
147
- }
2
+ "version": 1,
3
+ "themeName": "UD Theme Style",
4
+ "theme": {
5
+ "seriesCnt": "6",
6
+ "backgroundColor": "rgba(0,0,0,0)",
7
+ "titleColor": "#1f2329",
8
+ "subtitleColor": "#8f959e",
9
+ "textColorShow": false,
10
+ "textColor": "#333",
11
+ "markTextColor": "#ffffff",
12
+ "color": [
13
+ "#3370eb",
14
+ "#1bcebf",
15
+ "#ffc60a",
16
+ "#ed6d0c",
17
+ "#dca1e4",
18
+ "#25b2e5",
19
+ "#6dcdeb",
20
+ "#288fcb",
21
+ "#94b5f5",
22
+ "#8f61d1",
23
+ "#8f61d1",
24
+ "#bf78e9",
25
+ "#008280",
26
+ "#27ad8e",
27
+ "#7bc335"
28
+ ],
29
+ "borderColor": "#dee0e3",
30
+ "borderWidth": 0,
31
+ "visualMapColor": ["#25b2e5", "#6dcdeb", "#288fcb"],
32
+ "legendTextColor": "#8f959e",
33
+ "kColor": "#fdc6c4",
34
+ "kColor0": "transparent",
35
+ "kBorderColor": "#f54a45",
36
+ "kBorderColor0": "#32a645",
37
+ "kBorderWidth": "2",
38
+ "lineWidth": "1",
39
+ "symbolSize": "6",
40
+ "symbol": "emptyCircle",
41
+ "symbolBorderWidth": "1",
42
+ "lineSmooth": true,
43
+ "graphLineWidth": 1,
44
+ "graphLineColor": "#dee0e3",
45
+ "mapLabelColor": "#000",
46
+ "mapLabelColorE": "#516b91",
47
+ "mapBorderColor": "#516b91",
48
+ "mapBorderColorE": "#516b91",
49
+ "mapBorderWidth": 0.5,
50
+ "mapBorderWidthE": 1,
51
+ "mapAreaColor": "#f3f3f3",
52
+ "mapAreaColorE": "#a5e7f0",
53
+ "axes": [
54
+ {
55
+ "type": "all",
56
+ "name": "通用坐标轴",
57
+ "axisLineShow": true,
58
+ "axisLineColor": "#dee0e3",
59
+ "axisTickShow": false,
60
+ "axisTickColor": "#333",
61
+ "axisLabelShow": true,
62
+ "axisLabelColor": "#8f959e",
63
+ "splitLineShow": true,
64
+ "splitLineColor": ["#dee0e3"],
65
+ "splitAreaShow": false,
66
+ "splitAreaColor": ["rgba(250,250,250,0.05)", "rgba(200,200,200,0.02)"]
67
+ },
68
+ {
69
+ "type": "category",
70
+ "name": "类目坐标轴",
71
+ "axisLineShow": true,
72
+ "axisLineColor": "#333",
73
+ "axisTickShow": true,
74
+ "axisTickColor": "#333",
75
+ "axisLabelShow": true,
76
+ "axisLabelColor": "#333",
77
+ "splitLineShow": false,
78
+ "splitLineColor": ["#ccc"],
79
+ "splitAreaShow": false,
80
+ "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
81
+ },
82
+ {
83
+ "type": "value",
84
+ "name": "数值坐标轴",
85
+ "axisLineShow": true,
86
+ "axisLineColor": "#333",
87
+ "axisTickShow": true,
88
+ "axisTickColor": "#333",
89
+ "axisLabelShow": true,
90
+ "axisLabelColor": "#333",
91
+ "splitLineShow": true,
92
+ "splitLineColor": ["#ccc"],
93
+ "splitAreaShow": false,
94
+ "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
95
+ },
96
+ {
97
+ "type": "log",
98
+ "name": "对数坐标轴",
99
+ "axisLineShow": true,
100
+ "axisLineColor": "#333",
101
+ "axisTickShow": true,
102
+ "axisTickColor": "#333",
103
+ "axisLabelShow": true,
104
+ "axisLabelColor": "#333",
105
+ "splitLineShow": true,
106
+ "splitLineColor": ["#ccc"],
107
+ "splitAreaShow": false,
108
+ "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
109
+ },
110
+ {
111
+ "type": "time",
112
+ "name": "时间坐标轴",
113
+ "axisLineShow": true,
114
+ "axisLineColor": "#333",
115
+ "axisTickShow": true,
116
+ "axisTickColor": "#333",
117
+ "axisLabelShow": true,
118
+ "axisLabelColor": "#333",
119
+ "splitLineShow": true,
120
+ "splitLineColor": ["#ccc"],
121
+ "splitAreaShow": false,
122
+ "splitAreaColor": ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"]
123
+ }
124
+ ],
125
+ "axisSeperateSetting": false,
126
+ "toolboxColor": "#8f959e",
127
+ "toolboxEmphasisColor": "#1f2329",
128
+ "tooltipAxisColor": "#dee0e3",
129
+ "tooltipAxisWidth": 1,
130
+ "timelineLineColor": "#336df4",
131
+ "timelineLineWidth": "-1",
132
+ "timelineItemColor": "#336df4",
133
+ "timelineItemColorE": "#1456f0",
134
+ "timelineCheckColor": "#1456f0",
135
+ "timelineCheckBorderColor": "#94b4ff",
136
+ "timelineItemBorderWidth": "0.5",
137
+ "timelineControlColor": "#336df4",
138
+ "timelineControlBorderColor": "#336df4",
139
+ "timelineControlBorderWidth": 0.5,
140
+ "timelineLabelColor": "#8f959e",
141
+ "datazoomBackgroundColor": "rgba(0,0,0,0)",
142
+ "datazoomDataColor": "rgba(255,255,255,0.3)",
143
+ "datazoomFillColor": "rgba(167,183,204,0.4)",
144
+ "datazoomHandleColor": "#a7b7cc",
145
+ "datazoomHandleWidth": "100",
146
+ "datazoomLabelColor": "#333"
147
+ }
148
148
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createRecommendRspackConfig = createRecommendRspackConfig;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const core_1 = __importDefault(require("@rspack/core"));
9
+ const dev_server_listener_1 = require("../utils/dev-server-listener");
9
10
  // eslint-disable-next-line @typescript-eslint/no-var-requires
10
11
  const RouteParserPlugin = require('../rspack-plugins/route-parser-plugin');
11
12
  // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -123,7 +124,9 @@ function createRecommendRspackConfig(options) {
123
124
  maxChunks: 1,
124
125
  }),
125
126
  // 全栈模式下,增加性能监控上报脚本注入
126
- runtimeMode === 'fullstack' ? new SlardarPerformanceMonitorPlugin() : undefined,
127
+ runtimeMode === 'fullstack'
128
+ ? new SlardarPerformanceMonitorPlugin()
129
+ : undefined,
127
130
  // 开发环境下,解析路由
128
131
  isDev &&
129
132
  needRoutes &&
@@ -177,7 +180,7 @@ function createRecommendRspackConfig(options) {
177
180
  },
178
181
  devtool: isDev ? 'source-map' : false, // 对应vite的sourcemap配置
179
182
  devServer: {
180
- headers: (req) => {
183
+ headers: req => {
181
184
  // 获取请求的Origin头
182
185
  const requestOrigin = req.headers.origin ?? '';
183
186
  // 定义允许的域名白名单
@@ -194,12 +197,17 @@ function createRecommendRspackConfig(options) {
194
197
  'Access-Control-Allow-Origin': allowedOrigin,
195
198
  };
196
199
  },
200
+ onListening(server) {
201
+ if (runtimeMode === 'fullstack') {
202
+ (0, dev_server_listener_1.listenHmrTiming)(server);
203
+ }
204
+ },
197
205
  client: {
198
206
  overlay: {
199
207
  errors: false,
200
208
  warnings: false,
201
- }
202
- }
209
+ },
210
+ },
203
211
  },
204
212
  };
205
213
  }
@@ -0,0 +1,38 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": false,
19
+ "noUnusedLocals": false,
20
+ "noUnusedParameters": false,
21
+ "noImplicitAny": false,
22
+ "noFallthroughCasesInSwitch": false,
23
+
24
+ "sourceMap": true,
25
+ "allowJs": true,
26
+ "strictNullChecks": false,
27
+
28
+ "incremental": false,
29
+ },
30
+ "include": [
31
+ "client/**/*"
32
+ ],
33
+ "exclude": [
34
+ "node_modules",
35
+ "dist",
36
+ "public"
37
+ ]
38
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+
5
+ "module": "commonjs",
6
+ "moduleResolution": "node",
7
+
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+
11
+ "experimentalDecorators": true,
12
+ "emitDecoratorMetadata": true,
13
+ "importHelpers": true,
14
+
15
+ "outDir": "./dist",
16
+
17
+ "incremental": true,
18
+
19
+ "strict": false,
20
+ "composite": true,
21
+ "declaration": true,
22
+ "removeComments": false,
23
+ "noEmit": false,
24
+
25
+ "baseUrl": "./",
26
+ "paths": {
27
+ "@server/*": ["server/*"]
28
+ },
29
+
30
+ "types": ["node"]
31
+ },
32
+ "watchOptions": {
33
+ "excludeDirectories": ["node_modules/**"]
34
+ },
35
+ "include": ["server/**/*", "scripts/**/*.ts"],
36
+ "exclude": ["node_modules", "dist", "client", "**/*.spec.ts", "**/*.e2e-spec.ts"],
37
+ "ts-node": { "require": ["tsconfig-paths/register"] }
38
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.listenHmrTiming = listenHmrTiming;
37
+ /* eslint-disable @typescript-eslint/no-explicit-any */
38
+ const fs = __importStar(require("fs"));
39
+ /**
40
+ * 监听 HMR 编译时间
41
+ * @param server
42
+ */
43
+ function listenHmrTiming(server) {
44
+ const compiler = server.compiler;
45
+ const ws = server.webSocketServer;
46
+ let start = 0;
47
+ let changedFiles = new Set();
48
+ // 监听文件变更
49
+ compiler.hooks.watchRun.tap('HmrTiming', (comp) => {
50
+ const modifiedFiles = comp.modifiedFiles;
51
+ if (modifiedFiles && modifiedFiles.size > 0) {
52
+ changedFiles = new Set(modifiedFiles);
53
+ }
54
+ else {
55
+ changedFiles.clear();
56
+ }
57
+ start = Date.now();
58
+ });
59
+ // 编译完成
60
+ compiler.hooks.done.tap('HmrTiming', () => {
61
+ const duration = Date.now() - start;
62
+ // 过滤有效文件 - 只保留实际的项目文件
63
+ const validFiles = [...changedFiles]
64
+ .map(f => f.replace(process.cwd(), '').replace(/\\/g, '/'))
65
+ .filter(filePath => {
66
+ // 过滤无效文件
67
+ if (!filePath || filePath.length === 0)
68
+ return false;
69
+ // 过滤 node_modules 中的文件
70
+ if (filePath.includes('/node_modules/'))
71
+ return false;
72
+ // 只保留支持的文件类型
73
+ const validExtensions = ['.js', '.jsx', '.ts', '.tsx', '.svelte', '.css', '.json', '.html'];
74
+ const hasValidExtension = validExtensions.some(ext => filePath.toLowerCase().endsWith(ext));
75
+ if (!hasValidExtension)
76
+ return false;
77
+ return true;
78
+ });
79
+ // 获取文件统计信息
80
+ const fileStats = validFiles.map(filePath => {
81
+ const fullPath = process.cwd() + filePath;
82
+ try {
83
+ const stats = fs.statSync(fullPath);
84
+ return {
85
+ path: filePath,
86
+ size: stats.size,
87
+ };
88
+ }
89
+ catch (error) {
90
+ return {
91
+ path: filePath,
92
+ size: 0,
93
+ };
94
+ }
95
+ });
96
+ // 计算总文件大小(B)
97
+ const totalSize = fileStats.reduce((sum, file) => sum + file.size, 0);
98
+ const payload = {
99
+ duration,
100
+ fileCount: validFiles.length,
101
+ fileTotalSize: totalSize,
102
+ };
103
+ // 推送到浏览器端
104
+ for (const client of ws.clients) {
105
+ if (client.readyState === 1) {
106
+ client.send(JSON.stringify({
107
+ type: 'hmr-timing',
108
+ data: payload,
109
+ }));
110
+ }
111
+ }
112
+ });
113
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-presets",
3
- "version": "1.0.3",
3
+ "version": "1.0.5-alpha.0",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc && npm run copy:json",
12
- "copy:json": "cp -r src/*.json lib",
12
+ "copy:json": "node scripts/copy-json.js",
13
13
  "watch": "tsc --watch",
14
14
  "bump": "changeset version",
15
15
  "change": "changeset",