@vef-framework/dev 1.0.135 → 2.0.1
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 +30 -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 +26 -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 +94 -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,87 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import { createChunksConfig } from './chunks.js';
|
|
3
|
+
import { DEFAULT_SERVER_PORT, ASSETS_DIR, VEF_FRAMEWORK_VERSION, DEFAULT_OUTPUT_DIR, ENV_BUILD_PREFIX, ENV_APP_PREFIX, ENV_DIR, PUBLIC_DIR } from './constants.js';
|
|
4
|
+
import { defineConstants } from './define.js';
|
|
5
|
+
import { createPostcssConfig } from './postcss.js';
|
|
6
|
+
|
|
7
|
+
function createConventionalConfigPlugin({
|
|
8
|
+
appName,
|
|
9
|
+
appVersion,
|
|
10
|
+
basePublicPath,
|
|
11
|
+
projectDir,
|
|
12
|
+
outputDir,
|
|
13
|
+
serverPort,
|
|
14
|
+
proxies
|
|
15
|
+
}) {
|
|
16
|
+
return {
|
|
17
|
+
name: "vef-framework:conventional-config",
|
|
18
|
+
config(_, { command }) {
|
|
19
|
+
const isDev = command === "serve";
|
|
20
|
+
return {
|
|
21
|
+
appType: "spa",
|
|
22
|
+
root: projectDir,
|
|
23
|
+
base: basePublicPath,
|
|
24
|
+
publicDir: PUBLIC_DIR,
|
|
25
|
+
envDir: ENV_DIR,
|
|
26
|
+
envPrefix: [ENV_BUILD_PREFIX, ENV_APP_PREFIX],
|
|
27
|
+
define: defineConstants(appName, appVersion, isDev),
|
|
28
|
+
css: {
|
|
29
|
+
transformer: "postcss",
|
|
30
|
+
modules: {
|
|
31
|
+
scopeBehaviour: "local",
|
|
32
|
+
localsConvention: "camelCaseOnly",
|
|
33
|
+
exportGlobals: true,
|
|
34
|
+
hashPrefix: "vef"
|
|
35
|
+
},
|
|
36
|
+
postcss: createPostcssConfig(),
|
|
37
|
+
preprocessorOptions: {
|
|
38
|
+
scss: {}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
resolve: {
|
|
42
|
+
dedupe: ["react", "react-dom"]
|
|
43
|
+
},
|
|
44
|
+
optimizeDeps: {
|
|
45
|
+
exclude: [],
|
|
46
|
+
esbuildOptions: {
|
|
47
|
+
plugins: []
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
build: {
|
|
51
|
+
outDir: outputDir ?? DEFAULT_OUTPUT_DIR,
|
|
52
|
+
target: "es2024",
|
|
53
|
+
assetsDir: ASSETS_DIR,
|
|
54
|
+
assetsInlineLimit: 10240,
|
|
55
|
+
reportCompressedSize: false,
|
|
56
|
+
chunkSizeWarningLimit: 2560,
|
|
57
|
+
minify: true,
|
|
58
|
+
cssCodeSplit: true,
|
|
59
|
+
cssMinify: true,
|
|
60
|
+
sourcemap: false,
|
|
61
|
+
rollupOptions: {
|
|
62
|
+
input: {
|
|
63
|
+
main: "index.html"
|
|
64
|
+
},
|
|
65
|
+
output: {
|
|
66
|
+
banner: `/*! Powered by VEF Framework v${VEF_FRAMEWORK_VERSION}.${appVersion ? ` App version v${appVersion}.` : ""} Built at ${(/* @__PURE__ */ new Date()).toISOString()} */`,
|
|
67
|
+
chunkFileNames: `${ASSETS_DIR}/js/[name]-[hash].js`,
|
|
68
|
+
entryFileNames: `${ASSETS_DIR}/js/[name]-[hash].js`,
|
|
69
|
+
assetFileNames: `${ASSETS_DIR}/[ext]/[name]-[hash].[ext]`,
|
|
70
|
+
manualChunks: createChunksConfig()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
server: {
|
|
75
|
+
port: serverPort || DEFAULT_SERVER_PORT,
|
|
76
|
+
strictPort: true,
|
|
77
|
+
host: true,
|
|
78
|
+
allowedHosts: true,
|
|
79
|
+
open: true,
|
|
80
|
+
proxy: proxies
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { createConventionalConfigPlugin };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import eslint from 'vite-plugin-eslint2';
|
|
3
|
+
|
|
4
|
+
function createEslintPlugin() {
|
|
5
|
+
return eslint({
|
|
6
|
+
fix: false,
|
|
7
|
+
test: false,
|
|
8
|
+
dev: true,
|
|
9
|
+
build: false,
|
|
10
|
+
cache: true,
|
|
11
|
+
cacheLocation: "node_modules/.cache/.eslintcache",
|
|
12
|
+
include: ["*.{js,ts,json,yaml,md}", "src/**/*.{ts,tsx,json,yaml,md}"],
|
|
13
|
+
exclude: ["node_modules", "virtual:", "vef:"],
|
|
14
|
+
emitError: true,
|
|
15
|
+
emitWarning: true,
|
|
16
|
+
emitWarningAsError: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { createEslintPlugin };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import { minify } from 'html-minifier-terser';
|
|
3
|
+
|
|
4
|
+
const virtualModuleId = "index.html";
|
|
5
|
+
const htmlContent = `
|
|
6
|
+
<!doctype html>
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8" />
|
|
10
|
+
<link rel="icon" type="image/svg+xml" href="%VEF_APP_FAVICON%" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
12
|
+
<meta name="description" content="Powered by VEF framework" />
|
|
13
|
+
<meta name="app-version" content="%VEF_APP_VERSION%" />
|
|
14
|
+
<meta name="app-changelog" content="%VEF_APP_CHANGELOG%" />
|
|
15
|
+
<title>%VEF_APP_TITLE%</title>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<noscript>
|
|
19
|
+
<h2>很抱歉,如果没有启用 JavaScript,%VEF_APP_NAME% 无法正常工作。请启用 JavaScript 再继续。</h2>
|
|
20
|
+
</noscript>
|
|
21
|
+
<div id="__vef-initialization-loader">
|
|
22
|
+
<style>
|
|
23
|
+
#__vef-initialization-loader {
|
|
24
|
+
position: fixed;
|
|
25
|
+
inset: 0;
|
|
26
|
+
z-index: 9999;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
row-gap: 16px;
|
|
31
|
+
align-items: center;
|
|
32
|
+
height: 100%;
|
|
33
|
+
background-color: #ffffff;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#__vef-initialization-loader .loader-box {
|
|
37
|
+
color: #000000;
|
|
38
|
+
font-size: 0;
|
|
39
|
+
width: 360px;
|
|
40
|
+
height: 160px;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
column-gap: 12px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#__vef-initialization-loader .loader-box > span {
|
|
48
|
+
display: inline-block;
|
|
49
|
+
font-size: 48px;
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
animation: text-wave 1.2s 0.4s linear infinite;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#__vef-initialization-loader .loader-box > span:nth-child(1) {
|
|
55
|
+
animation-delay: 0.1s;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#__vef-initialization-loader .loader-box > span:nth-child(2) {
|
|
59
|
+
animation-delay: 0.2s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#__vef-initialization-loader .loader-box > span:nth-child(3) {
|
|
63
|
+
animation-delay: 0.3s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#__vef-initialization-loader .loader-box > span:nth-child(4) {
|
|
67
|
+
animation-delay: 0.4s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#__vef-initialization-loader .loader-box > span:nth-child(5) {
|
|
71
|
+
animation-delay: 0.5s;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#__vef-initialization-loader .loader-box > span:nth-child(6) {
|
|
75
|
+
animation-delay: 0.6s;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#__vef-initialization-loader .loader-title {
|
|
79
|
+
max-width: 80%;
|
|
80
|
+
font-size: 18px;
|
|
81
|
+
font-weight: normal;
|
|
82
|
+
line-height: 1.5;
|
|
83
|
+
color: #999999;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@keyframes text-wave {
|
|
87
|
+
0% {
|
|
88
|
+
transform: translateY(0);
|
|
89
|
+
opacity: 0.8;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
25% {
|
|
93
|
+
transform: translateY(-16px);
|
|
94
|
+
opacity: 0.7;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
50% {
|
|
98
|
+
transform: translateY(0);
|
|
99
|
+
opacity: 0.6;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
75% {
|
|
103
|
+
transform: translateY(16px);
|
|
104
|
+
opacity: 0.7;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
100% {
|
|
108
|
+
transform: translateY(0);
|
|
109
|
+
opacity: 0.8;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
113
|
+
<div class="loader-box">
|
|
114
|
+
<span>资</span>
|
|
115
|
+
<span>源</span>
|
|
116
|
+
<span>加</span>
|
|
117
|
+
<span>载</span>
|
|
118
|
+
<span>中</span>
|
|
119
|
+
<span>...</span>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="loader-title"></div>
|
|
122
|
+
<script>
|
|
123
|
+
(function() {
|
|
124
|
+
const text = "等待是一种修行,修行能让屏幕前的你参悟人生真谛,且珍惜这一段来之不易的等待吧!";
|
|
125
|
+
const element = document.querySelector(".loader-title");
|
|
126
|
+
let index = 0;
|
|
127
|
+
let currentText = "";
|
|
128
|
+
|
|
129
|
+
function typeWriter() {
|
|
130
|
+
if (index < text.length) {
|
|
131
|
+
currentText += text.charAt(index);
|
|
132
|
+
element.textContent = currentText;
|
|
133
|
+
index++;
|
|
134
|
+
|
|
135
|
+
const speed = Math.random() * 100 + 50;
|
|
136
|
+
setTimeout(typeWriter, speed);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
setTimeout(typeWriter, 400);
|
|
141
|
+
})();
|
|
142
|
+
<\/script>
|
|
143
|
+
</div>
|
|
144
|
+
<div id="root"></div>
|
|
145
|
+
<script type="module" src="src/main.ts"><\/script>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
148
|
+
`;
|
|
149
|
+
function createHtmlPlugin() {
|
|
150
|
+
return [
|
|
151
|
+
{
|
|
152
|
+
name: "vef-framework:html",
|
|
153
|
+
resolveId(source) {
|
|
154
|
+
if (source === virtualModuleId) {
|
|
155
|
+
return virtualModuleId;
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
},
|
|
159
|
+
load(id) {
|
|
160
|
+
if (id === virtualModuleId) {
|
|
161
|
+
return htmlContent;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
},
|
|
165
|
+
transformIndexHtml: {
|
|
166
|
+
order: "pre",
|
|
167
|
+
handler: () => htmlContent
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "vef-framework:html-minify",
|
|
172
|
+
enforce: "post",
|
|
173
|
+
async generateBundle(_, bundles) {
|
|
174
|
+
for (const bundle of Object.values(bundles)) {
|
|
175
|
+
if (bundle.type === "asset" && typeof bundle.source === "string" && bundle.fileName === virtualModuleId) {
|
|
176
|
+
bundle.source = await minify(
|
|
177
|
+
bundle.source,
|
|
178
|
+
{
|
|
179
|
+
collapseBooleanAttributes: true,
|
|
180
|
+
collapseInlineTagWhitespace: true,
|
|
181
|
+
collapseWhitespace: true,
|
|
182
|
+
conservativeCollapse: false,
|
|
183
|
+
keepClosingSlash: true,
|
|
184
|
+
minifyCSS: true,
|
|
185
|
+
minifyJS: true,
|
|
186
|
+
minifyURLs: true,
|
|
187
|
+
noNewlinesBeforeTagClose: true,
|
|
188
|
+
quoteCharacter: `"`,
|
|
189
|
+
removeAttributeQuotes: false,
|
|
190
|
+
removeComments: true,
|
|
191
|
+
removeEmptyAttributes: true,
|
|
192
|
+
removeOptionalTags: false,
|
|
193
|
+
removeRedundantAttributes: true,
|
|
194
|
+
removeScriptTypeAttributes: false,
|
|
195
|
+
removeTagWhitespace: false,
|
|
196
|
+
removeEmptyElements: false,
|
|
197
|
+
removeStyleLinkTypeAttributes: false,
|
|
198
|
+
sortAttributes: true,
|
|
199
|
+
sortClassName: true,
|
|
200
|
+
trimCustomFragments: true,
|
|
201
|
+
useShortDoctype: true,
|
|
202
|
+
html5: true
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { createHtmlPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import icons from 'unplugin-icons/vite';
|
|
5
|
+
|
|
6
|
+
function createIconsPlugin(projectDir) {
|
|
7
|
+
return icons({
|
|
8
|
+
autoInstall: false,
|
|
9
|
+
compiler: "jsx",
|
|
10
|
+
jsx: "react",
|
|
11
|
+
defaultClass: "inline-block",
|
|
12
|
+
scale: 1.2,
|
|
13
|
+
collectionsNodeResolvePath: [projectDir, resolve(dirname(fileURLToPath(import.meta.url)), "..")]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { createIconsPlugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
function createInjectionPlugin() {
|
|
3
|
+
return {
|
|
4
|
+
name: "vef-framework:injection"
|
|
5
|
+
// transform(code, id) {
|
|
6
|
+
// if (basename(dirname(id)) === "src" && basename(id).startsWith("main.ts")) {
|
|
7
|
+
// return `import "@vef-react/components/styles.layer.css";
|
|
8
|
+
// import "@vef-react/starter/styles.layer.css";
|
|
9
|
+
// ${code}`;
|
|
10
|
+
// }
|
|
11
|
+
// return null;
|
|
12
|
+
// }
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { createInjectionPlugin };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
|
|
5
|
+
function createReactPlugin({
|
|
6
|
+
useEmotion = false,
|
|
7
|
+
useCompiler = true,
|
|
8
|
+
babelPlugins
|
|
9
|
+
} = {}) {
|
|
10
|
+
return react({
|
|
11
|
+
babel: {
|
|
12
|
+
plugins: [
|
|
13
|
+
...useEmotion ? [
|
|
14
|
+
[
|
|
15
|
+
"@emotion",
|
|
16
|
+
{
|
|
17
|
+
sourceMap: true,
|
|
18
|
+
autoLabel: "never",
|
|
19
|
+
cssPropOptimization: true
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
] : [],
|
|
23
|
+
...useCompiler ? [
|
|
24
|
+
[
|
|
25
|
+
"react-compiler",
|
|
26
|
+
{
|
|
27
|
+
/**
|
|
28
|
+
* `annotation`: Only compile functions that are explicitly marked with "use memo"
|
|
29
|
+
* `infer`: Use smart heuristics to identify React components and hooks
|
|
30
|
+
* Compilation conditions:
|
|
31
|
+
* Functions explicitly marked with "use memo"
|
|
32
|
+
* Functions named according to component or hook conventions (PascalCase or use prefix) that create JSX or call other hooks
|
|
33
|
+
*/
|
|
34
|
+
compilationMode: "infer",
|
|
35
|
+
panicThreshold: "none",
|
|
36
|
+
target: "19",
|
|
37
|
+
logger: {
|
|
38
|
+
logEvent(filename, event) {
|
|
39
|
+
switch (event.kind) {
|
|
40
|
+
case "CompileSuccess": {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case "CompileError": {
|
|
44
|
+
console.error(`${chalk.blueBright("[Compiler]")} ❌ ${chalk.redBright(`Skipped: ${filename}`)}`);
|
|
45
|
+
console.error(chalk.red(`Reason: ${event.detail.reason}`));
|
|
46
|
+
if (event.detail.description) {
|
|
47
|
+
console.error(chalk.red(`Details: ${event.detail.description}`));
|
|
48
|
+
}
|
|
49
|
+
if (event.detail.loc) {
|
|
50
|
+
const { line, column } = event.detail.loc.start;
|
|
51
|
+
console.error(chalk.red(`Location: Line ${line}, Column ${column}`));
|
|
52
|
+
}
|
|
53
|
+
if (event.detail.suggestions) {
|
|
54
|
+
console.error(chalk.yellow(`Suggestions: ${event.detail.suggestions.map((suggestion) => suggestion.description).join(" | ")}`));
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "CompileSkip": {
|
|
59
|
+
console.info(`${chalk.blueBright("[Compiler]")} ℹ️ ${chalk.gray(`Skipped: ${filename}`)}`, event);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
] : [],
|
|
67
|
+
"jotai/babel/plugin-debug-label",
|
|
68
|
+
"jotai/babel/plugin-react-refresh",
|
|
69
|
+
...babelPlugins ?? []
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
jsxImportSource: useEmotion ? "@emotion/react" : void 0
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { createReactPlugin };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
|
4
|
+
import { SRC_DIR, ROUTER_DIR, PAGES_DIR } from './constants.js';
|
|
5
|
+
|
|
6
|
+
function createRouterPlugin(projectDir, history = "browser") {
|
|
7
|
+
return tanstackRouter({
|
|
8
|
+
routesDirectory: resolve(projectDir, SRC_DIR, PAGES_DIR),
|
|
9
|
+
generatedRouteTree: resolve(projectDir, SRC_DIR, ROUTER_DIR, "router.gen.ts"),
|
|
10
|
+
quoteStyle: "double",
|
|
11
|
+
semicolons: true,
|
|
12
|
+
disableTypes: false,
|
|
13
|
+
addExtensions: false,
|
|
14
|
+
disableLogging: false,
|
|
15
|
+
routeFileIgnorePattern: "components|hooks|helpers|store|states|types|styles",
|
|
16
|
+
indexToken: "index",
|
|
17
|
+
routeToken: "route",
|
|
18
|
+
enableRouteGeneration: true,
|
|
19
|
+
autoCodeSplitting: true,
|
|
20
|
+
routeTreeFileHeader: [
|
|
21
|
+
"/* eslint-disable */",
|
|
22
|
+
"// @ts-nocheck",
|
|
23
|
+
"// noinspection JSUnusedGlobalSymbols",
|
|
24
|
+
`import { createRouter } from "@vef-framework/starter";`,
|
|
25
|
+
`import { routerContext as context } from "./context";`
|
|
26
|
+
],
|
|
27
|
+
routeTreeFileFooter: [
|
|
28
|
+
`const router = createRouter({
|
|
29
|
+
history: "${history}",
|
|
30
|
+
routeTree,
|
|
31
|
+
context
|
|
32
|
+
});
|
|
33
|
+
`,
|
|
34
|
+
`declare module "@tanstack/react-router" {
|
|
35
|
+
interface Register {
|
|
36
|
+
router: typeof router;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
`export default router;`
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { createRouterPlugin };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import stylelint from 'vite-plugin-stylelint';
|
|
3
|
+
|
|
4
|
+
function createStylelintPlugin() {
|
|
5
|
+
return stylelint({
|
|
6
|
+
fix: false,
|
|
7
|
+
test: false,
|
|
8
|
+
dev: true,
|
|
9
|
+
build: false,
|
|
10
|
+
cache: true,
|
|
11
|
+
cacheLocation: "node_modules/.cache/.stylelintcache",
|
|
12
|
+
include: ["src/**/*.{css,scss}"],
|
|
13
|
+
exclude: ["node_modules", "virtual:", "vef:"],
|
|
14
|
+
emitError: true,
|
|
15
|
+
emitWarning: true,
|
|
16
|
+
emitWarningAsError: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { createStylelintPlugin };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import svgr from 'vite-plugin-svgr';
|
|
3
|
+
|
|
4
|
+
function createSvgrPlugin() {
|
|
5
|
+
return svgr({
|
|
6
|
+
include: "**/*.svg?react",
|
|
7
|
+
esbuildOptions: {
|
|
8
|
+
platform: "browser",
|
|
9
|
+
minify: true,
|
|
10
|
+
jsx: "automatic"
|
|
11
|
+
},
|
|
12
|
+
svgrOptions: {
|
|
13
|
+
plugins: [
|
|
14
|
+
"@svgr/plugin-svgo",
|
|
15
|
+
"@svgr/plugin-jsx"
|
|
16
|
+
],
|
|
17
|
+
icon: false,
|
|
18
|
+
dimensions: false,
|
|
19
|
+
prettier: true,
|
|
20
|
+
memo: true,
|
|
21
|
+
svgo: true,
|
|
22
|
+
ref: false,
|
|
23
|
+
typescript: true,
|
|
24
|
+
jsxRuntime: "automatic",
|
|
25
|
+
svgoConfig: {
|
|
26
|
+
multipass: true,
|
|
27
|
+
datauri: "base64",
|
|
28
|
+
js2svg: {
|
|
29
|
+
indent: 2,
|
|
30
|
+
pretty: true
|
|
31
|
+
},
|
|
32
|
+
plugins: [
|
|
33
|
+
"preset-default",
|
|
34
|
+
{
|
|
35
|
+
name: "prefixIds",
|
|
36
|
+
params: {
|
|
37
|
+
prefix: "vef"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "cleanupIds",
|
|
42
|
+
params: {
|
|
43
|
+
force: true,
|
|
44
|
+
remove: true,
|
|
45
|
+
minify: true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
svgProps: {}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { createSvgrPlugin };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! @vef-framework/dev v2.0.0 made with ❤️ by Venus | 2025-11-25T10:06:28.561Z */
|
|
2
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
3
|
+
|
|
4
|
+
function createTsconfigPathsPlugin(projectDir) {
|
|
5
|
+
return tsconfigPaths({
|
|
6
|
+
root: projectDir
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createTsconfigPathsPlugin };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UserConfig } from '@commitlint/types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a commitlint configuration that extends the conventional commit format.
|
|
4
|
+
* This configuration ensures that commit messages follow the conventional commit specification.
|
|
5
|
+
*
|
|
6
|
+
* @returns A commitlint configuration object
|
|
7
|
+
*/
|
|
8
|
+
export declare function defineCommitlintConfig(): UserConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Config } from 'stylelint';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a stylelint configuration that extends the recommended configuration and uses the stylelint-order plugin.
|
|
4
|
+
*
|
|
5
|
+
* @returns The stylelint configuration object
|
|
6
|
+
*/
|
|
7
|
+
export declare function defineStylelintConfig(): Config;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnionToTuple } from 'type-fest';
|
|
2
|
+
import { BuildEnvironmentOptions } from 'vite';
|
|
3
|
+
type ManualChunksOption = NonNullable<UnionToTuple<NonNullable<NonNullable<BuildEnvironmentOptions["rollupOptions"]>["output"]>>[0]["manualChunks"]>;
|
|
4
|
+
/**
|
|
5
|
+
* Create the chunks config
|
|
6
|
+
*
|
|
7
|
+
* @returns The chunks config
|
|
8
|
+
*/
|
|
9
|
+
export declare function createChunksConfig(): ManualChunksOption;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PluginOption, ProxyOptions, UserConfig, UserConfigExport } from 'vite';
|
|
2
|
+
import { AutoEnhancePlugin } from './plugin-auto-enhance';
|
|
3
|
+
import { ReactPluginOptions } from './plugin-react';
|
|
4
|
+
/**
|
|
5
|
+
* The options to define the vef config
|
|
6
|
+
*/
|
|
7
|
+
export interface DefineConfigOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The resolve config
|
|
10
|
+
*/
|
|
11
|
+
resolve?: Pick<NonNullable<UserConfig["resolve"]>, "alias" | "conditions">;
|
|
12
|
+
/**
|
|
13
|
+
* The plugins to use
|
|
14
|
+
*/
|
|
15
|
+
plugins?: PluginOption[];
|
|
16
|
+
/**
|
|
17
|
+
* The auto enhance plugins to use
|
|
18
|
+
*/
|
|
19
|
+
autoEnhancePlugins?: AutoEnhancePlugin[];
|
|
20
|
+
/**
|
|
21
|
+
* The history mode to use for the router
|
|
22
|
+
*/
|
|
23
|
+
routerHistory?: "hash" | "browser";
|
|
24
|
+
/**
|
|
25
|
+
* The react plugin options
|
|
26
|
+
*/
|
|
27
|
+
react?: ReactPluginOptions;
|
|
28
|
+
/**
|
|
29
|
+
* The proxies of the dev server
|
|
30
|
+
*/
|
|
31
|
+
proxies?: Record<string, string | ProxyOptions>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Define the vite config
|
|
35
|
+
*
|
|
36
|
+
* @param options - The options to define the vite config
|
|
37
|
+
* @returns The vite config
|
|
38
|
+
*/
|
|
39
|
+
export declare function defineViteConfig({ resolve, plugins, autoEnhancePlugins, routerHistory, react, proxies }?: DefineConfigOptions): UserConfigExport;
|