@vef-framework-react/dev 2.1.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.
Files changed (93) hide show
  1. package/README +15 -0
  2. package/bin/vef.js +13 -0
  3. package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
  4. package/dist/cjs/index.cjs +1 -0
  5. package/dist/cjs/lint/commitlint.cjs +1 -0
  6. package/dist/cjs/lint/eslint.cjs +1 -0
  7. package/dist/cjs/lint/index.cjs +1 -0
  8. package/dist/cjs/lint/local-react-plugin.cjs +1 -0
  9. package/dist/cjs/lint/stylelint.cjs +1 -0
  10. package/dist/cjs/vite/chunks.cjs +1 -0
  11. package/dist/cjs/vite/config.cjs +1 -0
  12. package/dist/cjs/vite/constants.cjs +1 -0
  13. package/dist/cjs/vite/define.cjs +10 -0
  14. package/dist/cjs/vite/index.cjs +1 -0
  15. package/dist/cjs/vite/plugin-app-config.cjs +1 -0
  16. package/dist/cjs/vite/plugin-auto-enhance/core.cjs +1 -0
  17. package/dist/cjs/vite/plugin-auto-enhance/index.cjs +1 -0
  18. package/dist/cjs/vite/plugin-auto-enhance/plugins/index.cjs +1 -0
  19. package/dist/cjs/vite/plugin-auto-enhance/plugins/operation-column-width.cjs +1 -0
  20. package/dist/cjs/vite/plugin-conventional-config.cjs +1 -0
  21. package/dist/cjs/vite/plugin-eslint.cjs +1 -0
  22. package/dist/cjs/vite/plugin-html.cjs +144 -0
  23. package/dist/cjs/vite/plugin-icons.cjs +1 -0
  24. package/dist/cjs/vite/plugin-injection.cjs +1 -0
  25. package/dist/cjs/vite/plugin-inspect.cjs +1 -0
  26. package/dist/cjs/vite/plugin-react.cjs +1 -0
  27. package/dist/cjs/vite/plugin-router.cjs +11 -0
  28. package/dist/cjs/vite/plugin-stylelint.cjs +1 -0
  29. package/dist/cjs/vite/plugin-svgr.cjs +1 -0
  30. package/dist/cjs/vite/plugin-tsconfig-paths.cjs +1 -0
  31. package/dist/cjs/vite/postcss.cjs +1 -0
  32. package/dist/cli/index.js +5 -0
  33. package/dist/es/index.js +12 -0
  34. package/dist/es/lint/commitlint.js +10 -0
  35. package/dist/es/lint/eslint.js +675 -0
  36. package/dist/es/lint/index.js +3 -0
  37. package/dist/es/lint/local-react-plugin.js +42 -0
  38. package/dist/es/lint/stylelint.js +67 -0
  39. package/dist/es/vite/chunks.js +23 -0
  40. package/dist/es/vite/config.js +67 -0
  41. package/dist/es/vite/constants.js +15 -0
  42. package/dist/es/vite/define.js +21 -0
  43. package/dist/es/vite/index.js +2 -0
  44. package/dist/es/vite/plugin-app-config.js +29 -0
  45. package/dist/es/vite/plugin-auto-enhance/core.js +104 -0
  46. package/dist/es/vite/plugin-auto-enhance/index.js +27 -0
  47. package/dist/es/vite/plugin-auto-enhance/plugins/index.js +1 -0
  48. package/dist/es/vite/plugin-auto-enhance/plugins/operation-column-width.js +227 -0
  49. package/dist/es/vite/plugin-conventional-config.js +71 -0
  50. package/dist/es/vite/plugin-eslint.js +24 -0
  51. package/dist/es/vite/plugin-html.js +198 -0
  52. package/dist/es/vite/plugin-icons.js +17 -0
  53. package/dist/es/vite/plugin-injection.js +6 -0
  54. package/dist/es/vite/plugin-inspect.js +10 -0
  55. package/dist/es/vite/plugin-react.js +24 -0
  56. package/dist/es/vite/plugin-router.js +51 -0
  57. package/dist/es/vite/plugin-stylelint.js +24 -0
  58. package/dist/es/vite/plugin-svgr.js +49 -0
  59. package/dist/es/vite/plugin-tsconfig-paths.js +6 -0
  60. package/dist/es/vite/postcss.js +9 -0
  61. package/dist/types/src/cli/index.d.ts +1 -0
  62. package/dist/types/src/index.d.ts +2 -0
  63. package/dist/types/src/lint/commitlint.d.ts +2 -0
  64. package/dist/types/src/lint/eslint.d.ts +2 -0
  65. package/dist/types/src/lint/index.d.ts +3 -0
  66. package/dist/types/src/lint/local-react-plugin.d.ts +29 -0
  67. package/dist/types/src/lint/stylelint.d.ts +2 -0
  68. package/dist/types/src/vite/chunks.d.ts +5 -0
  69. package/dist/types/src/vite/config.d.ts +12 -0
  70. package/dist/types/src/vite/constants.d.ts +12 -0
  71. package/dist/types/src/vite/define.d.ts +4 -0
  72. package/dist/types/src/vite/index.d.ts +3 -0
  73. package/dist/types/src/vite/plugin-app-config.d.ts +19 -0
  74. package/dist/types/src/vite/plugin-auto-enhance/core.d.ts +20 -0
  75. package/dist/types/src/vite/plugin-auto-enhance/index.d.ts +10 -0
  76. package/dist/types/src/vite/plugin-auto-enhance/plugins/index.d.ts +1 -0
  77. package/dist/types/src/vite/plugin-auto-enhance/plugins/operation-column-width.d.ts +5 -0
  78. package/dist/types/src/vite/plugin-auto-enhance/types.d.ts +81 -0
  79. package/dist/types/src/vite/plugin-conventional-config.d.ts +35 -0
  80. package/dist/types/src/vite/plugin-eslint.d.ts +7 -0
  81. package/dist/types/src/vite/plugin-html.d.ts +7 -0
  82. package/dist/types/src/vite/plugin-icons.d.ts +8 -0
  83. package/dist/types/src/vite/plugin-injection.d.ts +5 -0
  84. package/dist/types/src/vite/plugin-inspect.d.ts +5 -0
  85. package/dist/types/src/vite/plugin-react.d.ts +30 -0
  86. package/dist/types/src/vite/plugin-router.d.ts +14 -0
  87. package/dist/types/src/vite/plugin-stylelint.d.ts +7 -0
  88. package/dist/types/src/vite/plugin-svgr.d.ts +7 -0
  89. package/dist/types/src/vite/plugin-tsconfig-paths.d.ts +8 -0
  90. package/dist/types/src/vite/postcss.d.ts +4 -0
  91. package/package.json +139 -0
  92. package/tsconfig.base.json +32 -0
  93. package/types.d.ts +16 -0
@@ -0,0 +1,81 @@
1
+ import { types } from 'recast';
2
+ /**
3
+ * Context information for auto-enhance plugins
4
+ */
5
+ export interface AutoEnhanceContext {
6
+ /**
7
+ * File ID (full path)
8
+ */
9
+ id: string;
10
+ /**
11
+ * File name (last few levels of relative path)
12
+ */
13
+ fileName: string;
14
+ /**
15
+ * Original source code
16
+ */
17
+ code: string;
18
+ /**
19
+ * AST root node
20
+ */
21
+ ast: types.ASTNode;
22
+ }
23
+ /**
24
+ * Transform result from auto-enhance plugins
25
+ */
26
+ export interface TransformResult {
27
+ /**
28
+ * Whether changes were made
29
+ */
30
+ hasChanges: boolean;
31
+ /**
32
+ * Log messages
33
+ */
34
+ logs?: string[];
35
+ }
36
+ /**
37
+ * Auto-enhance sub-plugin interface
38
+ */
39
+ export interface AutoEnhancePlugin {
40
+ /**
41
+ * Plugin name
42
+ */
43
+ name: string;
44
+ /**
45
+ * Plugin description
46
+ */
47
+ description?: string;
48
+ /**
49
+ * Whether this file should be processed
50
+ */
51
+ shouldProcess?: (context: AutoEnhanceContext) => boolean;
52
+ /**
53
+ * Execute transformation
54
+ */
55
+ transform: (context: AutoEnhanceContext) => TransformResult;
56
+ }
57
+ /**
58
+ * File pattern type for include/exclude options
59
+ */
60
+ export type FilePattern = string | RegExp | Array<string | RegExp>;
61
+ /**
62
+ * Auto-enhance plugin configuration
63
+ */
64
+ export interface AutoEnhanceOptions {
65
+ /**
66
+ * List of enabled sub-plugins
67
+ */
68
+ plugins?: AutoEnhancePlugin[];
69
+ /**
70
+ * File filter, only process matching files
71
+ */
72
+ include?: FilePattern;
73
+ /**
74
+ * File excluder, skip matching files
75
+ */
76
+ exclude?: FilePattern;
77
+ /**
78
+ * Custom log prefix
79
+ */
80
+ logPrefix?: string;
81
+ }
@@ -0,0 +1,35 @@
1
+ import { Plugin, ProxyOptions } from 'vite';
2
+ export interface PluginConventionalConfigOptions {
3
+ /**
4
+ * The name of the app
5
+ */
6
+ appName?: string;
7
+ /**
8
+ * The version of the app
9
+ */
10
+ appVersion: string;
11
+ /**
12
+ * The directory of the project
13
+ */
14
+ projectDir: string;
15
+ /**
16
+ * The base public path
17
+ */
18
+ basePublicPath?: string;
19
+ /**
20
+ * The output directory of the build
21
+ */
22
+ outputDir?: string;
23
+ /**
24
+ * The port of the server
25
+ */
26
+ serverPort?: number;
27
+ /**
28
+ * The proxies of the server
29
+ */
30
+ proxies?: Record<string, string | ProxyOptions>;
31
+ }
32
+ /**
33
+ * Create the conventional config plugin with VEF Framework defaults
34
+ */
35
+ export declare function createConventionalConfigPlugin({ appName, appVersion, basePublicPath, projectDir, outputDir, serverPort, proxies }: PluginConventionalConfigOptions): Plugin;
@@ -0,0 +1,7 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the ESLint plugin for development-time linting
4
+ *
5
+ * @returns The eslint plugin
6
+ */
7
+ export declare function createEslintPlugin(): PluginOption;
@@ -0,0 +1,7 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the HTML virtual module plugin
4
+ *
5
+ * @returns The HTML plugin array
6
+ */
7
+ export declare function createHtmlPlugin(): PluginOption;
@@ -0,0 +1,8 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the icons plugin for loading icon sets as React components
4
+ *
5
+ * @param projectDir - The project directory
6
+ * @returns The icons plugin
7
+ */
8
+ export declare function createIconsPlugin(projectDir: string): PluginOption;
@@ -0,0 +1,5 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the injection plugin for code injection into entry files
4
+ */
5
+ export declare function createInjectionPlugin(): PluginOption;
@@ -0,0 +1,5 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the inspect plugin for debugging Vite plugin transformations
4
+ */
5
+ export declare function createInspectPlugin(): PluginOption;
@@ -0,0 +1,30 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Babel plugin configuration type
4
+ */
5
+ type BabelPlugin = string | [string, Record<string, unknown>];
6
+ /**
7
+ * The react plugin options
8
+ */
9
+ export interface ReactPluginOptions {
10
+ /**
11
+ * Whether to use emotion
12
+ */
13
+ useEmotion?: boolean;
14
+ /**
15
+ * Whether to use the react compiler
16
+ */
17
+ useCompiler?: boolean;
18
+ /**
19
+ * The babel plugins to use
20
+ */
21
+ babelPlugins?: BabelPlugin[];
22
+ }
23
+ /**
24
+ * Create the React Vite plugin
25
+ *
26
+ * @param options - Plugin configuration options
27
+ * @returns The react plugin
28
+ */
29
+ export declare function createReactPlugin({ useEmotion, useCompiler, babelPlugins }?: ReactPluginOptions): PluginOption;
30
+ export {};
@@ -0,0 +1,14 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Router history mode type
4
+ */
5
+ type HistoryMode = "hash" | "browser";
6
+ /**
7
+ * Create the TanStack Router plugin for file-based routing
8
+ *
9
+ * @param projectDir - The project directory
10
+ * @param history - The history mode to use (hash or browser)
11
+ * @returns The router plugin
12
+ */
13
+ export declare function createRouterPlugin(projectDir: string, history?: HistoryMode): PluginOption;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the Stylelint plugin for development-time style linting
4
+ *
5
+ * @returns The stylelint plugin
6
+ */
7
+ export declare function createStylelintPlugin(): PluginOption;
@@ -0,0 +1,7 @@
1
+ import { PluginOption } from 'vite';
2
+ /**
3
+ * Create the SVGR plugin for converting SVG files to React components
4
+ *
5
+ * @returns The svgr plugin
6
+ */
7
+ export declare function createSvgrPlugin(): PluginOption;
@@ -0,0 +1,8 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * Vite 8 supports tsconfig path resolution natively via `resolve.tsconfigPaths`.
4
+ *
5
+ * This helper keeps the migration logic in one place without relying on the
6
+ * deprecated external plugin.
7
+ */
8
+ export declare function createTsconfigPathsResolveConfig(): Pick<NonNullable<UserConfig["resolve"]>, "tsconfigPaths">;
@@ -0,0 +1,4 @@
1
+ import { UserConfig } from 'vite';
2
+ type PostcssConfig = Exclude<NonNullable<UserConfig["css"]>["postcss"], string | undefined>;
3
+ export declare function createPostcssConfig(): PostcssConfig;
4
+ export {};
package/package.json ADDED
@@ -0,0 +1,139 @@
1
+ {
2
+ "name": "@vef-framework-react/dev",
3
+ "type": "module",
4
+ "version": "2.1.0",
5
+ "private": false,
6
+ "description": "Dev tools for VEF framework",
7
+ "author": {
8
+ "name": "Venus",
9
+ "email": "iweixiaopeng@163.com",
10
+ "url": "https://github.com/ilxqx"
11
+ },
12
+ "license": "Apache-2.0",
13
+ "homepage": "https://vef.ilxqx.com",
14
+ "keywords": [
15
+ "vef",
16
+ "framework",
17
+ "react",
18
+ "dev"
19
+ ],
20
+ "sideEffects": false,
21
+ "exports": {
22
+ ".": {
23
+ "vef": "./src/index.ts",
24
+ "types": "./dist/types/src/index.d.ts",
25
+ "import": "./dist/es/index.js",
26
+ "require": "./dist/cjs/index.cjs"
27
+ },
28
+ "./types": {
29
+ "types": "./types.d.ts"
30
+ },
31
+ "./tsconfig.json": "./tsconfig.base.json",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "main": "dist/cjs/index.cjs",
35
+ "module": "dist/es/index.js",
36
+ "types": "dist/types/src/index.d.ts",
37
+ "bin": {
38
+ "vef": "bin/vef.js"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "tsconfig.base.json",
43
+ "types.d.ts"
44
+ ],
45
+ "engines": {
46
+ "node": ">=22.x"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "peerDependencies": {
52
+ "@commitlint/cli": "^20.1.0",
53
+ "@stylistic/stylelint-config": "^4.0.0",
54
+ "eslint": "^10.0.0",
55
+ "husky": "^9.1.7",
56
+ "lint-staged": "^16.0.0",
57
+ "stylelint": "^17.0.0",
58
+ "stylelint-config-recess-order": "^7.0.0",
59
+ "stylelint-config-recommended": "^18.0.0",
60
+ "stylelint-config-standard-scss": "^17.0.0",
61
+ "stylelint-order": "^8.0.0",
62
+ "vite": "^8.0.0"
63
+ },
64
+ "dependencies": {
65
+ "@babel/core": "^7.29.0",
66
+ "@babel/parser": "^7.29.2",
67
+ "@babel/traverse": "^7.29.0",
68
+ "@commitlint/config-conventional": "^20.5.0",
69
+ "@emotion/babel-plugin": "^11.13.5",
70
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
71
+ "@eslint-react/eslint-plugin": "^3.0.0",
72
+ "@eslint/js": "^10.0.1",
73
+ "@rolldown/plugin-babel": "^0.2.2",
74
+ "@stylistic/eslint-plugin": "^5.10.0",
75
+ "@svgr/plugin-svgo": "^8.1.0",
76
+ "@tanstack/eslint-plugin-query": "^5.95.2",
77
+ "@tanstack/eslint-plugin-router": "^1.161.6",
78
+ "@tanstack/router-plugin": "^1.167.4",
79
+ "@typescript-eslint/utils": "^8.57.2",
80
+ "@vitejs/plugin-react": "^6.0.1",
81
+ "babel-plugin-react-compiler": "1.0.0",
82
+ "chalk": "^5.6.2",
83
+ "commander": "^14.0.3",
84
+ "consola": "^3.4.2",
85
+ "dotenv": "^17.3.1",
86
+ "eslint-config-flat-gitignore": "^2.3.0",
87
+ "eslint-plugin-antfu": "^3.2.2",
88
+ "eslint-plugin-format": "^2.0.1",
89
+ "eslint-plugin-import-lite": "^0.6.0",
90
+ "eslint-plugin-perfectionist": "^5.7.0",
91
+ "eslint-plugin-react-dom": "^3.0.0",
92
+ "eslint-plugin-react-hooks": "7.0.1",
93
+ "eslint-plugin-react-naming-convention": "^3.0.0",
94
+ "eslint-plugin-react-web-api": "^3.0.0",
95
+ "eslint-plugin-regexp": "^3.1.0",
96
+ "eslint-plugin-unicorn": "^63.0.0",
97
+ "eslint-plugin-unused-imports": "^4.4.1",
98
+ "execa": "^9.6.1",
99
+ "fs-extra": "^11.3.4",
100
+ "html-minifier-terser": "^7.2.0",
101
+ "jotai-babel": "^0.1.0",
102
+ "ora": "^9.3.0",
103
+ "prompts": "^2.4.2",
104
+ "radashi": "^12.7.2",
105
+ "recast": "^0.23.11",
106
+ "sass-embedded": "^1.98.0",
107
+ "typescript-eslint": "^8.57.2",
108
+ "unplugin-config": "^0.1.5",
109
+ "unplugin-icons": "^23.0.1",
110
+ "vite-plugin-eslint2": "^5.1.0",
111
+ "vite-plugin-inspect": "^11.3.3",
112
+ "vite-plugin-stylelint": "^6.1.0",
113
+ "vite-plugin-svgr": "^4.5.0"
114
+ },
115
+ "devDependencies": {
116
+ "@commitlint/cli": "^20.5.0",
117
+ "@commitlint/types": "^20.5.0",
118
+ "@stylistic/stylelint-config": "^4.0.0",
119
+ "@types/html-minifier-terser": "^7.0.2",
120
+ "@types/prompts": "^2.4.9",
121
+ "eslint": "^10.1.0",
122
+ "eslint-plugin-jsdoc": "^62.8.0",
123
+ "husky": "^9.1.7",
124
+ "lint-staged": "^16.4.0",
125
+ "stylelint": "^17.5.0",
126
+ "stylelint-config-recess-order": "^7.7.0",
127
+ "stylelint-config-recommended": "^18.0.0",
128
+ "stylelint-config-standard-scss": "^17.0.0",
129
+ "stylelint-order": "^8.1.1",
130
+ "tsup": "^8.5.1",
131
+ "type-fest": "^5.5.0",
132
+ "vite": "^8.0.2"
133
+ },
134
+ "scripts": {
135
+ "clean": "rimraf dist",
136
+ "typecheck": "tsc --noEmit",
137
+ "build": "vite build && tsup"
138
+ }
139
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["ESNext"],
5
+ "moduleDetection": "force",
6
+ "useDefineForClassFields": true,
7
+ "module": "esnext",
8
+ "moduleResolution": "bundler",
9
+ "resolveJsonModule": true,
10
+ "allowImportingTsExtensions": false,
11
+ "strict": true,
12
+ "allowUnreachableCode": false,
13
+ "allowUnusedLabels": false,
14
+ "noFallthroughCasesInSwitch": true,
15
+ "noImplicitAny": true,
16
+ "noImplicitOverride": true,
17
+ "noImplicitReturns": false,
18
+ "noImplicitThis": true,
19
+ "noUncheckedIndexedAccess": true,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "noErrorTruncation": true,
23
+ "noEmit": true,
24
+ "allowSyntheticDefaultImports": true,
25
+ "forceConsistentCasingInFileNames": true,
26
+ "isolatedModules": true,
27
+ "verbatimModuleSyntax": true,
28
+ "erasableSyntaxOnly": true,
29
+ "skipLibCheck": true,
30
+ "noUncheckedSideEffectImports": true
31
+ }
32
+ }
package/types.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
3
+ /// <reference types="unplugin-icons/types/react" />
4
+
5
+ /**
6
+ * The version of the vef framework
7
+ */
8
+ declare const __VEF_FRAMEWORK_VERSION__: string;
9
+ /**
10
+ * The version of the app
11
+ */
12
+ declare const __VEF_APP_VERSION__: string;
13
+ /**
14
+ * The configuration of the app
15
+ */
16
+ declare const __VEF_APP_CONFIG__: Readonly<Record<string, string>>;