@vef-framework/dev 1.0.135 → 2.0.2
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/README +15 -0
- package/dist/cjs/index.cjs +23 -0
- package/dist/cjs/lint/commitlint.cjs +14 -0
- package/dist/cjs/lint/eslint.cjs +981 -0
- package/dist/cjs/lint/index.cjs +14 -0
- package/dist/cjs/lint/stylelint.cjs +92 -0
- package/dist/cjs/vite/chunks.cjs +42 -0
- package/dist/cjs/vite/config.cjs +83 -0
- package/dist/cjs/vite/constants.cjs +30 -0
- package/dist/cjs/vite/define.cjs +26 -0
- package/dist/cjs/vite/index.cjs +11 -0
- package/dist/cjs/vite/plugin-app-config.cjs +38 -0
- package/dist/cjs/vite/plugin-auto-enhance/core.cjs +147 -0
- package/dist/cjs/vite/plugin-auto-enhance/index.cjs +40 -0
- package/dist/cjs/vite/plugin-auto-enhance/plugins/index.cjs +10 -0
- package/dist/cjs/vite/plugin-auto-enhance/plugins/operation-column-width.cjs +229 -0
- package/dist/cjs/vite/plugin-conventional-config.cjs +91 -0
- package/dist/cjs/vite/plugin-eslint.cjs +24 -0
- package/dist/cjs/vite/plugin-html.cjs +216 -0
- package/dist/cjs/vite/plugin-icons.cjs +22 -0
- package/dist/cjs/vite/plugin-injection.cjs +20 -0
- package/dist/cjs/vite/plugin-inspect.cjs +15 -0
- package/dist/cjs/vite/plugin-react.cjs +80 -0
- package/dist/cjs/vite/plugin-router.cjs +49 -0
- package/dist/cjs/vite/plugin-stylelint.cjs +24 -0
- package/dist/cjs/vite/plugin-svgr.cjs +59 -0
- package/dist/cjs/vite/plugin-tsconfig-paths.cjs +14 -0
- package/dist/cjs/vite/postcss.cjs +13 -0
- package/dist/es/index.js +8 -0
- package/dist/es/lint/commitlint.js +10 -0
- package/dist/es/lint/eslint.js +958 -0
- package/dist/es/lint/index.js +4 -0
- package/dist/es/lint/stylelint.js +88 -0
- package/dist/es/vite/chunks.js +38 -0
- package/dist/es/vite/config.js +79 -0
- package/dist/es/vite/constants.js +15 -0
- package/dist/es/vite/define.js +22 -0
- package/dist/es/vite/index.js +3 -0
- package/dist/es/vite/plugin-app-config.js +34 -0
- package/dist/es/vite/plugin-auto-enhance/core.js +143 -0
- package/dist/es/vite/plugin-auto-enhance/index.js +32 -0
- package/dist/es/vite/plugin-auto-enhance/plugins/index.js +2 -0
- package/dist/es/vite/plugin-auto-enhance/plugins/operation-column-width.js +225 -0
- package/dist/es/vite/plugin-conventional-config.js +87 -0
- package/dist/es/vite/plugin-eslint.js +20 -0
- package/dist/es/vite/plugin-html.js +212 -0
- package/dist/es/vite/plugin-icons.js +17 -0
- package/dist/es/vite/plugin-injection.js +16 -0
- package/dist/es/vite/plugin-inspect.js +11 -0
- package/dist/es/vite/plugin-react.js +76 -0
- package/dist/es/vite/plugin-router.js +45 -0
- package/dist/es/vite/plugin-stylelint.js +20 -0
- package/dist/es/vite/plugin-svgr.js +55 -0
- package/dist/es/vite/plugin-tsconfig-paths.js +10 -0
- package/dist/es/vite/postcss.js +9 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lint/commitlint.d.ts +8 -0
- package/dist/types/lint/eslint.d.ts +2 -0
- package/dist/types/lint/index.d.ts +3 -0
- package/dist/types/lint/stylelint.d.ts +7 -0
- package/dist/types/vite/chunks.d.ts +10 -0
- package/dist/types/vite/config.d.ts +39 -0
- package/{types → dist/types/vite}/constants.d.ts +4 -0
- package/dist/types/vite/define.d.ts +12 -0
- package/dist/types/vite/index.d.ts +3 -0
- package/{types → dist/types/vite}/plugin-app-config.d.ts +2 -1
- package/dist/types/vite/plugin-auto-enhance/core.d.ts +35 -0
- package/dist/types/vite/plugin-auto-enhance/index.d.ts +30 -0
- package/dist/types/vite/plugin-auto-enhance/plugins/index.d.ts +1 -0
- package/dist/types/vite/plugin-auto-enhance/plugins/operation-column-width.d.ts +14 -0
- package/dist/types/vite/plugin-auto-enhance/types.d.ts +83 -0
- package/{types → dist/types/vite}/plugin-conventional-config.d.ts +2 -2
- package/dist/types/vite/plugin-eslint.d.ts +7 -0
- package/{types → dist/types/vite}/plugin-html.d.ts +1 -1
- package/dist/types/vite/plugin-icons.d.ts +8 -0
- package/{types → dist/types/vite}/plugin-injection.d.ts +1 -1
- package/{types → dist/types/vite}/plugin-inspect.d.ts +2 -1
- package/dist/types/vite/plugin-react.d.ts +25 -0
- package/{types → dist/types/vite}/plugin-router.d.ts +2 -2
- package/dist/types/vite/plugin-stylelint.d.ts +7 -0
- package/dist/types/vite/plugin-svgr.d.ts +7 -0
- package/{types → dist/types/vite}/plugin-tsconfig-paths.d.ts +2 -1
- package/dist/types/vite/postcss.d.ts +9 -0
- package/package.json +97 -74
- package/{tsconfig.app.json → tsconfig.base.json} +13 -9
- package/{client.d.ts → types.d.ts} +0 -6
- package/README.md +0 -25
- package/bin/hoist-patterns.js +0 -1
- package/bin/vef.js +0 -18
- package/cjs/cli.cjs +0 -5
- package/cjs/commitlint-config.cjs +0 -2
- package/cjs/config.cjs +0 -2
- package/cjs/constants.cjs +0 -2
- package/cjs/eslint-config.cjs +0 -2
- package/cjs/index.cjs +0 -2
- package/cjs/json/monaco.nls.json.cjs +0 -15920
- package/cjs/json/monaco.theme.github-light.json.cjs +0 -349
- package/cjs/modules.d.cjs +0 -2
- package/cjs/plugin-app-config.cjs +0 -2
- package/cjs/plugin-conventional-config.cjs +0 -12
- package/cjs/plugin-eslint.cjs +0 -2
- package/cjs/plugin-html.cjs +0 -17
- package/cjs/plugin-icons.cjs +0 -2
- package/cjs/plugin-initialization.cjs +0 -135
- package/cjs/plugin-injection.cjs +0 -3
- package/cjs/plugin-inspect.cjs +0 -2
- package/cjs/plugin-monaco-nls.cjs +0 -80
- package/cjs/plugin-react-swc.cjs +0 -2
- package/cjs/plugin-router.cjs +0 -11
- package/cjs/plugin-stylelint.cjs +0 -2
- package/cjs/plugin-svgr.cjs +0 -2
- package/cjs/plugin-tailwind.cjs +0 -2
- package/cjs/plugin-tailwindcss.cjs +0 -3
- package/cjs/plugin-tsconfig-paths.cjs +0 -2
- package/cjs/plugin-visualizer.cjs +0 -2
- package/cjs/plugin-webfont.cjs +0 -2
- package/cjs/stylelint-config.cjs +0 -2
- package/cjs/tailwind-config.cjs +0 -2
- package/cjs/types.cjs +0 -2
- package/esm/cli.js +0 -5
- package/esm/commitlint-config.js +0 -2
- package/esm/config.js +0 -2
- package/esm/constants.js +0 -2
- package/esm/eslint-config.js +0 -2
- package/esm/index.js +0 -2
- package/esm/json/monaco.nls.json.js +0 -15920
- package/esm/json/monaco.theme.github-light.json.js +0 -349
- package/esm/modules.d.js +0 -2
- package/esm/plugin-app-config.js +0 -2
- package/esm/plugin-conventional-config.js +0 -12
- package/esm/plugin-eslint.js +0 -2
- package/esm/plugin-html.js +0 -17
- package/esm/plugin-icons.js +0 -2
- package/esm/plugin-initialization.js +0 -135
- package/esm/plugin-injection.js +0 -3
- package/esm/plugin-inspect.js +0 -2
- package/esm/plugin-monaco-nls.js +0 -80
- package/esm/plugin-react-swc.js +0 -2
- package/esm/plugin-router.js +0 -11
- package/esm/plugin-stylelint.js +0 -2
- package/esm/plugin-svgr.js +0 -2
- package/esm/plugin-tailwind.js +0 -2
- package/esm/plugin-tailwindcss.js +0 -3
- package/esm/plugin-tsconfig-paths.js +0 -2
- package/esm/plugin-visualizer.js +0 -2
- package/esm/plugin-webfont.js +0 -2
- package/esm/stylelint-config.js +0 -2
- package/esm/tailwind-config.js +0 -2
- package/esm/types.js +0 -2
- package/template/.vscode/settings.json +0 -6
- package/template/_gitignore +0 -35
- package/template/_package.json +0 -43
- package/template/_tsconfig.json +0 -7
- package/template/commitlint.config.js +0 -3
- package/template/env/.env +0 -7
- package/template/env/.env.development +0 -0
- package/template/env/.env.production +0 -0
- package/template/env.d.ts +0 -1
- package/template/eslint.config.js +0 -3
- package/template/index.html +0 -0
- package/template/public/favicon.svg +0 -1
- package/template/src/main.ts +0 -145
- package/template/src/pages/__root.ts +0 -3
- package/template/src/pages/_common/access-denied.ts +0 -6
- package/template/src/pages/_common/login.ts +0 -8
- package/template/src/pages/_layout/index.tsx +0 -35
- package/template/src/pages/_layout/route.ts +0 -9
- package/template/src/pages/_layout/system/data-dictionary.tsx +0 -14
- package/template/src/pages/_layout/system/index.ts +0 -7
- package/template/src/pages/_layout/system/tenant.tsx +0 -14
- package/template/src/router/index.ts +0 -1
- package/template/style.css +0 -2
- package/template/stylelint.config.js +0 -3
- package/template/tailwind.config.js +0 -3
- package/template/tsconfig.app.json +0 -4
- package/template/tsconfig.build.json +0 -4
- package/template/vef.config.ts +0 -7
- package/tsconfig.build.json +0 -26
- package/types/cli.d.ts +0 -1
- package/types/commitlint-config.d.ts +0 -7
- package/types/config.d.ts +0 -38
- package/types/eslint-config.d.ts +0 -7
- package/types/index.d.ts +0 -5
- package/types/plugin-eslint.d.ts +0 -6
- package/types/plugin-icons.d.ts +0 -7
- package/types/plugin-initialization.d.ts +0 -7
- package/types/plugin-monaco-nls.d.ts +0 -15
- package/types/plugin-react-swc.d.ts +0 -6
- package/types/plugin-stylelint.d.ts +0 -6
- package/types/plugin-svgr.d.ts +0 -6
- package/types/plugin-tailwind.d.ts +0 -7
- package/types/plugin-tailwindcss.d.ts +0 -7
- package/types/plugin-visualizer.d.ts +0 -7
- package/types/plugin-webfont.d.ts +0 -6
- package/types/stylelint-config.d.ts +0 -7
- package/types/tailwind-config.d.ts +0 -7
- package/types/types.d.ts +0 -15
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const recast = require('recast');
|
|
7
|
+
|
|
8
|
+
const CJK_CHAR_REGEX = /[\u4E00-\u9FFF\u3400-\u4DBF\uFF00-\uFFEF]/;
|
|
9
|
+
const OPERATION_COLUMN_ATTR = "operationColumn";
|
|
10
|
+
const OPERATION_BUTTON_COMPONENT = "OperationButton";
|
|
11
|
+
const VALID_IMPORT_SOURCES = [
|
|
12
|
+
"@vef-framework/components",
|
|
13
|
+
"@vef-framework/starter"
|
|
14
|
+
];
|
|
15
|
+
function isValidImportSource(source) {
|
|
16
|
+
return VALID_IMPORT_SOURCES.some((pkg) => source === pkg || source.startsWith(`${pkg}/`));
|
|
17
|
+
}
|
|
18
|
+
function collectOperationButtonAliases(ast) {
|
|
19
|
+
const aliasMap = /* @__PURE__ */ new Map();
|
|
20
|
+
recast.visit(ast, {
|
|
21
|
+
visitImportDeclaration(path) {
|
|
22
|
+
const source = path.node.source.value;
|
|
23
|
+
if (typeof source !== "string" || !isValidImportSource(source)) {
|
|
24
|
+
this.traverse(path);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
for (const specifier of path.node.specifiers || []) {
|
|
28
|
+
if (recast.types.namedTypes.ImportSpecifier.check(specifier)) {
|
|
29
|
+
const { imported } = specifier;
|
|
30
|
+
const { local } = specifier;
|
|
31
|
+
if (recast.types.namedTypes.Identifier.check(imported) && recast.types.namedTypes.Identifier.check(local) && imported.name === OPERATION_BUTTON_COMPONENT) {
|
|
32
|
+
aliasMap.set(local.name, imported.name);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
this.traverse(path);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return aliasMap;
|
|
41
|
+
}
|
|
42
|
+
function calculateTextWidth(text) {
|
|
43
|
+
let width = 0;
|
|
44
|
+
for (const char of text) {
|
|
45
|
+
width += CJK_CHAR_REGEX.test(char) ? 14 : 8;
|
|
46
|
+
}
|
|
47
|
+
return width;
|
|
48
|
+
}
|
|
49
|
+
function calculateOperationColumnWidth(buttons) {
|
|
50
|
+
if (buttons.length === 0) {
|
|
51
|
+
return {
|
|
52
|
+
calculatedWidth: 64,
|
|
53
|
+
buttonCount: 0,
|
|
54
|
+
analysis: "No buttons found, using minimum width"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
let totalWidth = 0;
|
|
58
|
+
const buttonCount = buttons.length;
|
|
59
|
+
for (const [index, button] of buttons.entries()) {
|
|
60
|
+
let buttonWidth = 16;
|
|
61
|
+
if (button.hasIcon) {
|
|
62
|
+
buttonWidth += 16;
|
|
63
|
+
if (button.textContent) {
|
|
64
|
+
buttonWidth += 8;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (button.textContent) {
|
|
68
|
+
buttonWidth += calculateTextWidth(button.textContent);
|
|
69
|
+
}
|
|
70
|
+
buttonWidth = Math.max(buttonWidth, button.hasIcon && !button.textContent ? 32 : 64);
|
|
71
|
+
totalWidth += buttonWidth;
|
|
72
|
+
if (index < buttonCount - 1) {
|
|
73
|
+
totalWidth += 8;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
totalWidth += 16;
|
|
77
|
+
const finalWidth = Math.ceil(totalWidth / 8) * 8;
|
|
78
|
+
const analysis = `${buttonCount} buttons, calculated: ${totalWidth}px, final: ${finalWidth}px`;
|
|
79
|
+
return {
|
|
80
|
+
calculatedWidth: finalWidth,
|
|
81
|
+
buttonCount,
|
|
82
|
+
analysis
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function extractButtonInfo(jsxElement, aliasMap) {
|
|
86
|
+
const { openingElement } = jsxElement;
|
|
87
|
+
if (!recast.types.namedTypes.JSXIdentifier.check(openingElement.name)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const componentName = openingElement.name.name;
|
|
91
|
+
if (!aliasMap.has(componentName)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const buttonInfo = {
|
|
95
|
+
hasIcon: false,
|
|
96
|
+
textContent: ""
|
|
97
|
+
};
|
|
98
|
+
for (const attr of openingElement.attributes || []) {
|
|
99
|
+
if (recast.types.namedTypes.JSXAttribute.check(attr) && recast.types.namedTypes.JSXIdentifier.check(attr.name) && attr.name.name === "icon") {
|
|
100
|
+
buttonInfo.hasIcon = true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const child of jsxElement.children || []) {
|
|
104
|
+
if (recast.types.namedTypes.JSXText.check(child)) {
|
|
105
|
+
buttonInfo.textContent += child.value.trim();
|
|
106
|
+
} else if (recast.types.namedTypes.JSXExpressionContainer.check(child) && recast.types.namedTypes.StringLiteral.check(child.expression)) {
|
|
107
|
+
buttonInfo.textContent += child.expression.value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return buttonInfo;
|
|
111
|
+
}
|
|
112
|
+
function findOperationButtons(node, aliasMap) {
|
|
113
|
+
const buttons = [];
|
|
114
|
+
recast.visit(node, {
|
|
115
|
+
visitJSXElement(path) {
|
|
116
|
+
const buttonInfo = extractButtonInfo(path.node, aliasMap);
|
|
117
|
+
if (buttonInfo) {
|
|
118
|
+
buttons.push(buttonInfo);
|
|
119
|
+
}
|
|
120
|
+
this.traverse(path);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return buttons;
|
|
125
|
+
}
|
|
126
|
+
function hasWidthProperty(objectExpression) {
|
|
127
|
+
return objectExpression.properties.some((prop) => {
|
|
128
|
+
if (recast.types.namedTypes.ObjectProperty.check(prop)) {
|
|
129
|
+
const { key } = prop;
|
|
130
|
+
return recast.types.namedTypes.Identifier.check(key) && key.name === "width" || recast.types.namedTypes.StringLiteral.check(key) && key.value === "width";
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function getRenderProperty(objectExpression) {
|
|
136
|
+
return objectExpression.properties.find((prop) => {
|
|
137
|
+
if (recast.types.namedTypes.ObjectProperty.check(prop) || recast.types.namedTypes.ObjectMethod.check(prop)) {
|
|
138
|
+
const { key } = prop;
|
|
139
|
+
return recast.types.namedTypes.Identifier.check(key) && key.name === "render" || recast.types.namedTypes.StringLiteral.check(key) && key.value === "render";
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function getComponentName(jsxElement) {
|
|
145
|
+
const { openingElement } = jsxElement;
|
|
146
|
+
if (recast.types.namedTypes.JSXIdentifier.check(openingElement.name)) {
|
|
147
|
+
return openingElement.name.name;
|
|
148
|
+
}
|
|
149
|
+
if (recast.types.namedTypes.JSXMemberExpression.check(openingElement.name)) {
|
|
150
|
+
const { object, property } = openingElement.name;
|
|
151
|
+
const objectName = recast.types.namedTypes.JSXIdentifier.check(object) ? object.name : "?";
|
|
152
|
+
const propertyName = recast.types.namedTypes.JSXIdentifier.check(property) ? property.name : "?";
|
|
153
|
+
return `${objectName}.${propertyName}`;
|
|
154
|
+
}
|
|
155
|
+
return "Unknown";
|
|
156
|
+
}
|
|
157
|
+
const operationColumnWidthPlugin = {
|
|
158
|
+
name: "operation-column-width",
|
|
159
|
+
description: "Automatically calculate optimal width for operation columns based on button analysis",
|
|
160
|
+
shouldProcess(context) {
|
|
161
|
+
return context.code.includes(OPERATION_COLUMN_ATTR);
|
|
162
|
+
},
|
|
163
|
+
transform(context) {
|
|
164
|
+
const aliasMap = collectOperationButtonAliases(context.ast);
|
|
165
|
+
if (aliasMap.size === 0) {
|
|
166
|
+
return { hasChanges: false, logs: [] };
|
|
167
|
+
}
|
|
168
|
+
let hasChanges = false;
|
|
169
|
+
const logs = [];
|
|
170
|
+
recast.visit(context.ast, {
|
|
171
|
+
visitJSXAttribute(path) {
|
|
172
|
+
const attr = path.node;
|
|
173
|
+
if (!recast.types.namedTypes.JSXIdentifier.check(attr.name) || attr.name.name !== OPERATION_COLUMN_ATTR) {
|
|
174
|
+
this.traverse(path);
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (!recast.types.namedTypes.JSXExpressionContainer.check(attr.value) || !recast.types.namedTypes.ObjectExpression.check(attr.value.expression)) {
|
|
178
|
+
this.traverse(path);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
const objectExpression = attr.value.expression;
|
|
182
|
+
if (hasWidthProperty(objectExpression)) {
|
|
183
|
+
this.traverse(path);
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
const renderProperty = getRenderProperty(objectExpression);
|
|
187
|
+
if (!renderProperty) {
|
|
188
|
+
this.traverse(path);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
const buttons = recast.types.namedTypes.ObjectProperty.check(renderProperty) ? findOperationButtons(renderProperty.value, aliasMap) : findOperationButtons(renderProperty.body, aliasMap);
|
|
192
|
+
if (buttons.length === 0) {
|
|
193
|
+
this.traverse(path);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
const { calculatedWidth, analysis } = calculateOperationColumnWidth(buttons);
|
|
197
|
+
const widthProperty = recast.types.builders.objectProperty(
|
|
198
|
+
recast.types.builders.identifier("width"),
|
|
199
|
+
recast.types.builders.numericLiteral(calculatedWidth)
|
|
200
|
+
);
|
|
201
|
+
widthProperty.comments = [recast.types.builders.commentLine(` Auto-calculated: ${analysis} `, true, false)];
|
|
202
|
+
objectExpression.properties.unshift(widthProperty);
|
|
203
|
+
hasChanges = true;
|
|
204
|
+
let componentName = "Unknown";
|
|
205
|
+
let { parentPath } = path;
|
|
206
|
+
while (parentPath) {
|
|
207
|
+
const { node, parentPath: nextParentPath } = parentPath;
|
|
208
|
+
if (recast.types.namedTypes.JSXElement.check(node)) {
|
|
209
|
+
componentName = getComponentName(node);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
parentPath = nextParentPath;
|
|
213
|
+
}
|
|
214
|
+
logs.push(
|
|
215
|
+
`📊 ${componentName}: ${context.fileName}`,
|
|
216
|
+
` └─ 🎯 Operation column auto-width: ${calculatedWidth}px (${analysis})`
|
|
217
|
+
);
|
|
218
|
+
this.traverse(path);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return {
|
|
223
|
+
hasChanges,
|
|
224
|
+
logs
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
exports.operationColumnWidthPlugin = operationColumnWidthPlugin;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const chunks = require('./chunks.cjs');
|
|
7
|
+
const constants = require('./constants.cjs');
|
|
8
|
+
const define = require('./define.cjs');
|
|
9
|
+
const postcss = require('./postcss.cjs');
|
|
10
|
+
|
|
11
|
+
function createConventionalConfigPlugin({
|
|
12
|
+
appName,
|
|
13
|
+
appVersion,
|
|
14
|
+
basePublicPath,
|
|
15
|
+
projectDir,
|
|
16
|
+
outputDir,
|
|
17
|
+
serverPort,
|
|
18
|
+
proxies
|
|
19
|
+
}) {
|
|
20
|
+
return {
|
|
21
|
+
name: "vef-framework:conventional-config",
|
|
22
|
+
config(_, { command }) {
|
|
23
|
+
const isDev = command === "serve";
|
|
24
|
+
return {
|
|
25
|
+
appType: "spa",
|
|
26
|
+
root: projectDir,
|
|
27
|
+
base: basePublicPath,
|
|
28
|
+
publicDir: constants.PUBLIC_DIR,
|
|
29
|
+
envDir: constants.ENV_DIR,
|
|
30
|
+
envPrefix: [constants.ENV_BUILD_PREFIX, constants.ENV_APP_PREFIX],
|
|
31
|
+
define: define.defineConstants(appName, appVersion, isDev),
|
|
32
|
+
css: {
|
|
33
|
+
transformer: "postcss",
|
|
34
|
+
modules: {
|
|
35
|
+
scopeBehaviour: "local",
|
|
36
|
+
localsConvention: "camelCaseOnly",
|
|
37
|
+
exportGlobals: true,
|
|
38
|
+
hashPrefix: "vef"
|
|
39
|
+
},
|
|
40
|
+
postcss: postcss.createPostcssConfig(),
|
|
41
|
+
preprocessorOptions: {
|
|
42
|
+
scss: {}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
resolve: {
|
|
46
|
+
dedupe: ["react", "react-dom"]
|
|
47
|
+
},
|
|
48
|
+
optimizeDeps: {
|
|
49
|
+
exclude: [],
|
|
50
|
+
esbuildOptions: {
|
|
51
|
+
plugins: []
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
build: {
|
|
55
|
+
outDir: outputDir ?? constants.DEFAULT_OUTPUT_DIR,
|
|
56
|
+
target: "es2024",
|
|
57
|
+
assetsDir: constants.ASSETS_DIR,
|
|
58
|
+
assetsInlineLimit: 10240,
|
|
59
|
+
reportCompressedSize: false,
|
|
60
|
+
chunkSizeWarningLimit: 2560,
|
|
61
|
+
minify: true,
|
|
62
|
+
cssCodeSplit: true,
|
|
63
|
+
cssMinify: true,
|
|
64
|
+
sourcemap: false,
|
|
65
|
+
rollupOptions: {
|
|
66
|
+
input: {
|
|
67
|
+
main: "index.html"
|
|
68
|
+
},
|
|
69
|
+
output: {
|
|
70
|
+
banner: `/*! Powered by VEF Framework v${constants.VEF_FRAMEWORK_VERSION}.${appVersion ? ` App version v${appVersion}.` : ""} Built at ${(/* @__PURE__ */ new Date()).toISOString()} */`,
|
|
71
|
+
chunkFileNames: `${constants.ASSETS_DIR}/js/[name]-[hash].js`,
|
|
72
|
+
entryFileNames: `${constants.ASSETS_DIR}/js/[name]-[hash].js`,
|
|
73
|
+
assetFileNames: `${constants.ASSETS_DIR}/[ext]/[name]-[hash].[ext]`,
|
|
74
|
+
manualChunks: chunks.createChunksConfig()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
server: {
|
|
79
|
+
port: serverPort || constants.DEFAULT_SERVER_PORT,
|
|
80
|
+
strictPort: true,
|
|
81
|
+
host: true,
|
|
82
|
+
allowedHosts: true,
|
|
83
|
+
open: true,
|
|
84
|
+
proxy: proxies
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.createConventionalConfigPlugin = createConventionalConfigPlugin;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const eslint = require('vite-plugin-eslint2');
|
|
7
|
+
|
|
8
|
+
function createEslintPlugin() {
|
|
9
|
+
return eslint({
|
|
10
|
+
fix: false,
|
|
11
|
+
test: false,
|
|
12
|
+
dev: true,
|
|
13
|
+
build: false,
|
|
14
|
+
cache: true,
|
|
15
|
+
cacheLocation: "node_modules/.cache/.eslintcache",
|
|
16
|
+
include: ["*.{js,ts,json,yaml,md}", "src/**/*.{ts,tsx,json,yaml,md}"],
|
|
17
|
+
exclude: ["node_modules", "virtual:", "vef:"],
|
|
18
|
+
emitError: true,
|
|
19
|
+
emitWarning: true,
|
|
20
|
+
emitWarningAsError: true
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.createEslintPlugin = createEslintPlugin;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const htmlMinifierTerser = require('html-minifier-terser');
|
|
7
|
+
|
|
8
|
+
const virtualModuleId = "index.html";
|
|
9
|
+
const htmlContent = `
|
|
10
|
+
<!doctype html>
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<meta charset="UTF-8" />
|
|
14
|
+
<link rel="icon" type="image/svg+xml" href="%VEF_APP_FAVICON%" />
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
16
|
+
<meta name="description" content="Powered by VEF framework" />
|
|
17
|
+
<meta name="app-version" content="%VEF_APP_VERSION%" />
|
|
18
|
+
<meta name="app-changelog" content="%VEF_APP_CHANGELOG%" />
|
|
19
|
+
<title>%VEF_APP_TITLE%</title>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<noscript>
|
|
23
|
+
<h2>很抱歉,如果没有启用 JavaScript,%VEF_APP_NAME% 无法正常工作。请启用 JavaScript 再继续。</h2>
|
|
24
|
+
</noscript>
|
|
25
|
+
<div id="__vef-initialization-loader">
|
|
26
|
+
<style>
|
|
27
|
+
#__vef-initialization-loader {
|
|
28
|
+
position: fixed;
|
|
29
|
+
inset: 0;
|
|
30
|
+
z-index: 9999;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
row-gap: 16px;
|
|
35
|
+
align-items: center;
|
|
36
|
+
height: 100%;
|
|
37
|
+
background-color: #ffffff;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#__vef-initialization-loader .loader-box {
|
|
41
|
+
color: #000000;
|
|
42
|
+
font-size: 0;
|
|
43
|
+
width: 360px;
|
|
44
|
+
height: 160px;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
column-gap: 12px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#__vef-initialization-loader .loader-box > span {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
font-size: 48px;
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
animation: text-wave 1.2s 0.4s linear infinite;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#__vef-initialization-loader .loader-box > span:nth-child(1) {
|
|
59
|
+
animation-delay: 0.1s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#__vef-initialization-loader .loader-box > span:nth-child(2) {
|
|
63
|
+
animation-delay: 0.2s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#__vef-initialization-loader .loader-box > span:nth-child(3) {
|
|
67
|
+
animation-delay: 0.3s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#__vef-initialization-loader .loader-box > span:nth-child(4) {
|
|
71
|
+
animation-delay: 0.4s;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#__vef-initialization-loader .loader-box > span:nth-child(5) {
|
|
75
|
+
animation-delay: 0.5s;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#__vef-initialization-loader .loader-box > span:nth-child(6) {
|
|
79
|
+
animation-delay: 0.6s;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#__vef-initialization-loader .loader-title {
|
|
83
|
+
max-width: 80%;
|
|
84
|
+
font-size: 18px;
|
|
85
|
+
font-weight: normal;
|
|
86
|
+
line-height: 1.5;
|
|
87
|
+
color: #999999;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes text-wave {
|
|
91
|
+
0% {
|
|
92
|
+
transform: translateY(0);
|
|
93
|
+
opacity: 0.8;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
25% {
|
|
97
|
+
transform: translateY(-16px);
|
|
98
|
+
opacity: 0.7;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
50% {
|
|
102
|
+
transform: translateY(0);
|
|
103
|
+
opacity: 0.6;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
75% {
|
|
107
|
+
transform: translateY(16px);
|
|
108
|
+
opacity: 0.7;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
100% {
|
|
112
|
+
transform: translateY(0);
|
|
113
|
+
opacity: 0.8;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
117
|
+
<div class="loader-box">
|
|
118
|
+
<span>资</span>
|
|
119
|
+
<span>源</span>
|
|
120
|
+
<span>加</span>
|
|
121
|
+
<span>载</span>
|
|
122
|
+
<span>中</span>
|
|
123
|
+
<span>...</span>
|
|
124
|
+
</div>
|
|
125
|
+
<div class="loader-title"></div>
|
|
126
|
+
<script>
|
|
127
|
+
(function() {
|
|
128
|
+
const text = "等待是一种修行,修行能让屏幕前的你参悟人生真谛,且珍惜这一段来之不易的等待吧!";
|
|
129
|
+
const element = document.querySelector(".loader-title");
|
|
130
|
+
let index = 0;
|
|
131
|
+
let currentText = "";
|
|
132
|
+
|
|
133
|
+
function typeWriter() {
|
|
134
|
+
if (index < text.length) {
|
|
135
|
+
currentText += text.charAt(index);
|
|
136
|
+
element.textContent = currentText;
|
|
137
|
+
index++;
|
|
138
|
+
|
|
139
|
+
const speed = Math.random() * 100 + 50;
|
|
140
|
+
setTimeout(typeWriter, speed);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setTimeout(typeWriter, 400);
|
|
145
|
+
})();
|
|
146
|
+
<\/script>
|
|
147
|
+
</div>
|
|
148
|
+
<div id="root"></div>
|
|
149
|
+
<script type="module" src="src/main.ts"><\/script>
|
|
150
|
+
</body>
|
|
151
|
+
</html>
|
|
152
|
+
`;
|
|
153
|
+
function createHtmlPlugin() {
|
|
154
|
+
return [
|
|
155
|
+
{
|
|
156
|
+
name: "vef-framework:html",
|
|
157
|
+
resolveId(source) {
|
|
158
|
+
if (source === virtualModuleId) {
|
|
159
|
+
return virtualModuleId;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
},
|
|
163
|
+
load(id) {
|
|
164
|
+
if (id === virtualModuleId) {
|
|
165
|
+
return htmlContent;
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
},
|
|
169
|
+
transformIndexHtml: {
|
|
170
|
+
order: "pre",
|
|
171
|
+
handler: () => htmlContent
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "vef-framework:html-minify",
|
|
176
|
+
enforce: "post",
|
|
177
|
+
async generateBundle(_, bundles) {
|
|
178
|
+
for (const bundle of Object.values(bundles)) {
|
|
179
|
+
if (bundle.type === "asset" && typeof bundle.source === "string" && bundle.fileName === virtualModuleId) {
|
|
180
|
+
bundle.source = await htmlMinifierTerser.minify(
|
|
181
|
+
bundle.source,
|
|
182
|
+
{
|
|
183
|
+
collapseBooleanAttributes: true,
|
|
184
|
+
collapseInlineTagWhitespace: true,
|
|
185
|
+
collapseWhitespace: true,
|
|
186
|
+
conservativeCollapse: false,
|
|
187
|
+
keepClosingSlash: true,
|
|
188
|
+
minifyCSS: true,
|
|
189
|
+
minifyJS: true,
|
|
190
|
+
minifyURLs: true,
|
|
191
|
+
noNewlinesBeforeTagClose: true,
|
|
192
|
+
quoteCharacter: `"`,
|
|
193
|
+
removeAttributeQuotes: false,
|
|
194
|
+
removeComments: true,
|
|
195
|
+
removeEmptyAttributes: true,
|
|
196
|
+
removeOptionalTags: false,
|
|
197
|
+
removeRedundantAttributes: true,
|
|
198
|
+
removeScriptTypeAttributes: false,
|
|
199
|
+
removeTagWhitespace: false,
|
|
200
|
+
removeEmptyElements: false,
|
|
201
|
+
removeStyleLinkTypeAttributes: false,
|
|
202
|
+
sortAttributes: true,
|
|
203
|
+
sortClassName: true,
|
|
204
|
+
trimCustomFragments: true,
|
|
205
|
+
useShortDoctype: true,
|
|
206
|
+
html5: true
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
exports.createHtmlPlugin = createHtmlPlugin;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const node_path = require('node:path');
|
|
7
|
+
const node_url = require('node:url');
|
|
8
|
+
const icons = require('unplugin-icons/vite');
|
|
9
|
+
|
|
10
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
|
+
function createIconsPlugin(projectDir) {
|
|
12
|
+
return icons({
|
|
13
|
+
autoInstall: false,
|
|
14
|
+
compiler: "jsx",
|
|
15
|
+
jsx: "react",
|
|
16
|
+
defaultClass: "inline-block",
|
|
17
|
+
scale: 1.2,
|
|
18
|
+
collectionsNodeResolvePath: [projectDir, node_path.resolve(node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite/plugin-icons.cjs', document.baseURI).href)))), "..")]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.createIconsPlugin = createIconsPlugin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
function createInjectionPlugin() {
|
|
7
|
+
return {
|
|
8
|
+
name: "vef-framework:injection"
|
|
9
|
+
// transform(code, id) {
|
|
10
|
+
// if (basename(dirname(id)) === "src" && basename(id).startsWith("main.ts")) {
|
|
11
|
+
// return `import "@vef-react/components/styles.layer.css";
|
|
12
|
+
// import "@vef-react/starter/styles.layer.css";
|
|
13
|
+
// ${code}`;
|
|
14
|
+
// }
|
|
15
|
+
// return null;
|
|
16
|
+
// }
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.createInjectionPlugin = createInjectionPlugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const inspect = require('vite-plugin-inspect');
|
|
7
|
+
|
|
8
|
+
function createInspectPlugin() {
|
|
9
|
+
return inspect({
|
|
10
|
+
dev: true,
|
|
11
|
+
build: false
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.createInspectPlugin = createInspectPlugin;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.100Z */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const react = require('@vitejs/plugin-react');
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
|
|
9
|
+
function createReactPlugin({
|
|
10
|
+
useEmotion = false,
|
|
11
|
+
useCompiler = true,
|
|
12
|
+
babelPlugins
|
|
13
|
+
} = {}) {
|
|
14
|
+
return react({
|
|
15
|
+
babel: {
|
|
16
|
+
plugins: [
|
|
17
|
+
...useEmotion ? [
|
|
18
|
+
[
|
|
19
|
+
"@emotion",
|
|
20
|
+
{
|
|
21
|
+
sourceMap: true,
|
|
22
|
+
autoLabel: "never",
|
|
23
|
+
cssPropOptimization: true
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
] : [],
|
|
27
|
+
...useCompiler ? [
|
|
28
|
+
[
|
|
29
|
+
"react-compiler",
|
|
30
|
+
{
|
|
31
|
+
/**
|
|
32
|
+
* `annotation`: Only compile functions that are explicitly marked with "use memo"
|
|
33
|
+
* `infer`: Use smart heuristics to identify React components and hooks
|
|
34
|
+
* Compilation conditions:
|
|
35
|
+
* Functions explicitly marked with "use memo"
|
|
36
|
+
* Functions named according to component or hook conventions (PascalCase or use prefix) that create JSX or call other hooks
|
|
37
|
+
*/
|
|
38
|
+
compilationMode: "infer",
|
|
39
|
+
panicThreshold: "none",
|
|
40
|
+
target: "19",
|
|
41
|
+
logger: {
|
|
42
|
+
logEvent(filename, event) {
|
|
43
|
+
switch (event.kind) {
|
|
44
|
+
case "CompileSuccess": {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "CompileError": {
|
|
48
|
+
console.error(`${chalk.blueBright("[Compiler]")} ❌ ${chalk.redBright(`Skipped: ${filename}`)}`);
|
|
49
|
+
console.error(chalk.red(`Reason: ${event.detail.reason}`));
|
|
50
|
+
if (event.detail.description) {
|
|
51
|
+
console.error(chalk.red(`Details: ${event.detail.description}`));
|
|
52
|
+
}
|
|
53
|
+
if (event.detail.loc) {
|
|
54
|
+
const { line, column } = event.detail.loc.start;
|
|
55
|
+
console.error(chalk.red(`Location: Line ${line}, Column ${column}`));
|
|
56
|
+
}
|
|
57
|
+
if (event.detail.suggestions) {
|
|
58
|
+
console.error(chalk.yellow(`Suggestions: ${event.detail.suggestions.map((suggestion) => suggestion.description).join(" | ")}`));
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case "CompileSkip": {
|
|
63
|
+
console.info(`${chalk.blueBright("[Compiler]")} ℹ️ ${chalk.gray(`Skipped: ${filename}`)}`, event);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
] : [],
|
|
71
|
+
"jotai/babel/plugin-debug-label",
|
|
72
|
+
"jotai/babel/plugin-react-refresh",
|
|
73
|
+
...babelPlugins ?? []
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
jsxImportSource: useEmotion ? "@emotion/react" : void 0
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.createReactPlugin = createReactPlugin;
|