g-ui-web 1.4.42 → 1.4.44

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.
@@ -100,6 +100,7 @@ function componentUsagePlugin(options = {}) {
100
100
  // 总引用次数
101
101
  totalImports: 0
102
102
  };
103
+ const excludeNames = /* @__PURE__ */ new Set(["GuiWeb", "DataSource", "useDataSource"]);
103
104
  let isBuild = false;
104
105
  let hasReported = false;
105
106
  return {
@@ -143,7 +144,7 @@ function componentUsagePlugin(options = {}) {
143
144
  return parts[0].trim();
144
145
  });
145
146
  components.forEach((comp) => {
146
- if (comp) {
147
+ if (comp && !excludeNames.has(comp)) {
147
148
  const currentCount = importStats.componentCount.get(comp) || 0;
148
149
  importStats.componentCount.set(comp, currentCount + 1);
149
150
  componentsInFile.push(comp);
@@ -154,10 +155,12 @@ function componentUsagePlugin(options = {}) {
154
155
  const defaultImportMatch = importStatement.match(/import\s+(\w+)\s+from/);
155
156
  if (defaultImportMatch && !importStatement.includes("{")) {
156
157
  const comp = defaultImportMatch[1];
157
- const currentCount = importStats.componentCount.get(comp) || 0;
158
- importStats.componentCount.set(comp, currentCount + 1);
159
- componentsInFile.push(comp);
160
- importStats.totalImports++;
158
+ if (!excludeNames.has(comp)) {
159
+ const currentCount = importStats.componentCount.get(comp) || 0;
160
+ importStats.componentCount.set(comp, currentCount + 1);
161
+ componentsInFile.push(comp);
162
+ importStats.totalImports++;
163
+ }
161
164
  }
162
165
  }
163
166
  });
@@ -201,9 +204,50 @@ function componentUsagePlugin(options = {}) {
201
204
  topComponents: [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20).map(([name, count]) => ({ name, count })),
202
205
  ...extraData
203
206
  };
204
- const outputPath = (0, import_path.resolve)(process.cwd(), "component-usage-report.json");
207
+ const topAll = [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]);
208
+ let md = `# \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A
209
+
210
+ `;
211
+ md += `- **\u7EC4\u4EF6\u5E93**: ${libraryName}
212
+ `;
213
+ md += `- **\u7EDF\u8BA1\u65F6\u95F4**: ${reportData.timestamp}
214
+ `;
215
+ md += `- **\u603B\u5F15\u7528\u6B21\u6570**: ${reportData.summary.totalImports}
216
+ `;
217
+ md += `- **\u4F7F\u7528\u7684\u7EC4\u4EF6\u6570**: ${reportData.summary.uniqueComponents}
218
+ `;
219
+ md += `- **\u6D89\u53CA\u6587\u4EF6\u6570**: ${reportData.summary.filesWithImports}
220
+ `;
221
+ md += `
222
+ ## \u7EC4\u4EF6\u4F7F\u7528\u6392\u884C
223
+
224
+ `;
225
+ md += `| \u6392\u540D | \u7EC4\u4EF6\u540D\u79F0 | \u5F15\u7528\u6B21\u6570 |
226
+ `;
227
+ md += `| --- | --- | --- |
228
+ `;
229
+ topAll.forEach(([name, count], index) => {
230
+ md += `| ${index + 1} | ${name} | ${count} |
231
+ `;
232
+ });
233
+ md += `
234
+ ## \u6587\u4EF6\u5F15\u7528\u8BE6\u60C5
235
+
236
+ `;
237
+ importStats.fileDetails.forEach((components, filePath) => {
238
+ md += `### ${filePath}
239
+
240
+ `;
241
+ components.forEach((comp) => {
242
+ md += `- ${comp}
243
+ `;
244
+ });
245
+ md += `
246
+ `;
247
+ });
248
+ const outputPath = (0, import_path.resolve)(process.cwd(), "component-usage-report.md");
205
249
  (0, import_fs.mkdirSync)((0, import_path.dirname)(outputPath), { recursive: true });
206
- (0, import_fs.writeFileSync)(outputPath, JSON.stringify(reportData, null, 2), "utf-8");
250
+ (0, import_fs.writeFileSync)(outputPath, md, "utf-8");
207
251
  console.log(`
208
252
  \u{1F4CA} \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A\u5DF2\u751F\u6210: ${outputPath}`);
209
253
  if (reportUrl) {
@@ -74,6 +74,7 @@ function componentUsagePlugin(options = {}) {
74
74
  // 总引用次数
75
75
  totalImports: 0
76
76
  };
77
+ const excludeNames = /* @__PURE__ */ new Set(["GuiWeb", "DataSource", "useDataSource"]);
77
78
  let isBuild = false;
78
79
  let hasReported = false;
79
80
  return {
@@ -117,7 +118,7 @@ function componentUsagePlugin(options = {}) {
117
118
  return parts[0].trim();
118
119
  });
119
120
  components.forEach((comp) => {
120
- if (comp) {
121
+ if (comp && !excludeNames.has(comp)) {
121
122
  const currentCount = importStats.componentCount.get(comp) || 0;
122
123
  importStats.componentCount.set(comp, currentCount + 1);
123
124
  componentsInFile.push(comp);
@@ -128,10 +129,12 @@ function componentUsagePlugin(options = {}) {
128
129
  const defaultImportMatch = importStatement.match(/import\s+(\w+)\s+from/);
129
130
  if (defaultImportMatch && !importStatement.includes("{")) {
130
131
  const comp = defaultImportMatch[1];
131
- const currentCount = importStats.componentCount.get(comp) || 0;
132
- importStats.componentCount.set(comp, currentCount + 1);
133
- componentsInFile.push(comp);
134
- importStats.totalImports++;
132
+ if (!excludeNames.has(comp)) {
133
+ const currentCount = importStats.componentCount.get(comp) || 0;
134
+ importStats.componentCount.set(comp, currentCount + 1);
135
+ componentsInFile.push(comp);
136
+ importStats.totalImports++;
137
+ }
135
138
  }
136
139
  }
137
140
  });
@@ -175,9 +178,50 @@ function componentUsagePlugin(options = {}) {
175
178
  topComponents: [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20).map(([name, count]) => ({ name, count })),
176
179
  ...extraData
177
180
  };
178
- const outputPath = resolve(process.cwd(), "component-usage-report.json");
181
+ const topAll = [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]);
182
+ let md = `# \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A
183
+
184
+ `;
185
+ md += `- **\u7EC4\u4EF6\u5E93**: ${libraryName}
186
+ `;
187
+ md += `- **\u7EDF\u8BA1\u65F6\u95F4**: ${reportData.timestamp}
188
+ `;
189
+ md += `- **\u603B\u5F15\u7528\u6B21\u6570**: ${reportData.summary.totalImports}
190
+ `;
191
+ md += `- **\u4F7F\u7528\u7684\u7EC4\u4EF6\u6570**: ${reportData.summary.uniqueComponents}
192
+ `;
193
+ md += `- **\u6D89\u53CA\u6587\u4EF6\u6570**: ${reportData.summary.filesWithImports}
194
+ `;
195
+ md += `
196
+ ## \u7EC4\u4EF6\u4F7F\u7528\u6392\u884C
197
+
198
+ `;
199
+ md += `| \u6392\u540D | \u7EC4\u4EF6\u540D\u79F0 | \u5F15\u7528\u6B21\u6570 |
200
+ `;
201
+ md += `| --- | --- | --- |
202
+ `;
203
+ topAll.forEach(([name, count], index) => {
204
+ md += `| ${index + 1} | ${name} | ${count} |
205
+ `;
206
+ });
207
+ md += `
208
+ ## \u6587\u4EF6\u5F15\u7528\u8BE6\u60C5
209
+
210
+ `;
211
+ importStats.fileDetails.forEach((components, filePath) => {
212
+ md += `### ${filePath}
213
+
214
+ `;
215
+ components.forEach((comp) => {
216
+ md += `- ${comp}
217
+ `;
218
+ });
219
+ md += `
220
+ `;
221
+ });
222
+ const outputPath = resolve(process.cwd(), "component-usage-report.md");
179
223
  mkdirSync(dirname(outputPath), { recursive: true });
180
- writeFileSync(outputPath, JSON.stringify(reportData, null, 2), "utf-8");
224
+ writeFileSync(outputPath, md, "utf-8");
181
225
  console.log(`
182
226
  \u{1F4CA} \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A\u5DF2\u751F\u6210: ${outputPath}`);
183
227
  if (reportUrl) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "g-ui-web",
3
3
  "private": false,
4
4
  "description": "可视化组件库",
5
- "version": "1.4.42",
5
+ "version": "1.4.44",
6
6
  "author": "wyu",
7
7
  "license": "MIT",
8
8
  "type": "module",