g-ui-web 1.4.39 → 1.4.40
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/lib/g-ui-web.cjs +72 -158
- package/lib/g-ui-web.iife.js +73 -159
- package/lib/g-ui-web.iife.js.gz +0 -0
- package/lib/g-ui-web.js +61510 -82028
- package/lib/g-ui-web.js.gz +0 -0
- package/lib/g-ui-web.umd.cjs +73 -159
- package/lib/plugins/index.cjs +10 -19
- package/lib/plugins/index.mjs +10 -19
- package/package.json +1 -1
package/lib/plugins/index.cjs
CHANGED
|
@@ -88,8 +88,6 @@ var init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then(({ export
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
// packages/plugins/component-usage.ts
|
|
91
|
-
var import_compiler_sfc = require("@vue/compiler-sfc");
|
|
92
|
-
var import_compiler_dom = require("@vue/compiler-dom");
|
|
93
91
|
function componentUsagePlugin(options = {}) {
|
|
94
92
|
const { libraryName = "", reportUrl = "", extraData = {}, enableInDev = false } = options;
|
|
95
93
|
const importStats = {
|
|
@@ -163,21 +161,14 @@ function componentUsagePlugin(options = {}) {
|
|
|
163
161
|
});
|
|
164
162
|
}
|
|
165
163
|
if (id.endsWith(".vue")) {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
importStats.totalImports++;
|
|
175
|
-
}
|
|
176
|
-
if (Array.isArray(node.children)) {
|
|
177
|
-
node.children.forEach(walkNode);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
descriptor.template.ast.children.forEach(walkNode);
|
|
164
|
+
const tagRegex = /<(g-[a-z][a-z0-9-]*)/g;
|
|
165
|
+
let match;
|
|
166
|
+
while ((match = tagRegex.exec(code)) !== null) {
|
|
167
|
+
const tag = match[1];
|
|
168
|
+
const currentCount = importStats.componentCount.get(tag) || 0;
|
|
169
|
+
importStats.componentCount.set(tag, currentCount + 1);
|
|
170
|
+
componentsInFile.push(tag);
|
|
171
|
+
importStats.totalImports++;
|
|
181
172
|
}
|
|
182
173
|
}
|
|
183
174
|
if (componentsInFile.length > 0) {
|
|
@@ -189,8 +180,8 @@ function componentUsagePlugin(options = {}) {
|
|
|
189
180
|
}
|
|
190
181
|
return null;
|
|
191
182
|
},
|
|
192
|
-
//
|
|
193
|
-
async
|
|
183
|
+
// 构建结束时发送数据
|
|
184
|
+
async buildEnd() {
|
|
194
185
|
if (!isBuild && !enableInDev) return;
|
|
195
186
|
if (hasReported) return;
|
|
196
187
|
hasReported = true;
|
package/lib/plugins/index.mjs
CHANGED
|
@@ -62,8 +62,6 @@ var init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then(({ export
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
// packages/plugins/component-usage.ts
|
|
65
|
-
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
66
|
-
import { NodeTypes } from "@vue/compiler-dom";
|
|
67
65
|
function componentUsagePlugin(options = {}) {
|
|
68
66
|
const { libraryName = "", reportUrl = "", extraData = {}, enableInDev = false } = options;
|
|
69
67
|
const importStats = {
|
|
@@ -137,21 +135,14 @@ function componentUsagePlugin(options = {}) {
|
|
|
137
135
|
});
|
|
138
136
|
}
|
|
139
137
|
if (id.endsWith(".vue")) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
importStats.totalImports++;
|
|
149
|
-
}
|
|
150
|
-
if (Array.isArray(node.children)) {
|
|
151
|
-
node.children.forEach(walkNode);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
descriptor.template.ast.children.forEach(walkNode);
|
|
138
|
+
const tagRegex = /<(g-[a-z][a-z0-9-]*)/g;
|
|
139
|
+
let match;
|
|
140
|
+
while ((match = tagRegex.exec(code)) !== null) {
|
|
141
|
+
const tag = match[1];
|
|
142
|
+
const currentCount = importStats.componentCount.get(tag) || 0;
|
|
143
|
+
importStats.componentCount.set(tag, currentCount + 1);
|
|
144
|
+
componentsInFile.push(tag);
|
|
145
|
+
importStats.totalImports++;
|
|
155
146
|
}
|
|
156
147
|
}
|
|
157
148
|
if (componentsInFile.length > 0) {
|
|
@@ -163,8 +154,8 @@ function componentUsagePlugin(options = {}) {
|
|
|
163
154
|
}
|
|
164
155
|
return null;
|
|
165
156
|
},
|
|
166
|
-
//
|
|
167
|
-
async
|
|
157
|
+
// 构建结束时发送数据
|
|
158
|
+
async buildEnd() {
|
|
168
159
|
if (!isBuild && !enableInDev) return;
|
|
169
160
|
if (hasReported) return;
|
|
170
161
|
hasReported = true;
|