@vef-framework/dev 1.0.63 → 1.0.64

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 (52) hide show
  1. package/es/cli.js +287 -2
  2. package/es/commitlint-config.js +11 -2
  3. package/es/config.js +72 -2
  4. package/es/constants.js +14 -2
  5. package/es/eslint-config.js +431 -2
  6. package/es/index.js +6 -2
  7. package/es/modules.d.js +2 -1
  8. package/es/plugin-app-config.js +34 -2
  9. package/es/plugin-conventional-config.js +109 -2
  10. package/es/plugin-eslint.js +20 -2
  11. package/es/plugin-html.js +82 -2
  12. package/es/plugin-icons.js +17 -2
  13. package/es/plugin-injection.js +17 -2
  14. package/es/plugin-inspect.js +11 -2
  15. package/es/plugin-react-swc.js +10 -2
  16. package/es/plugin-router.js +43 -2
  17. package/es/plugin-stylelint.js +20 -2
  18. package/es/plugin-svgr.js +55 -2
  19. package/es/plugin-tailwindcss.js +23 -2
  20. package/es/plugin-tsconfig-paths.js +10 -2
  21. package/es/plugin-visualizer.js +12 -2
  22. package/es/plugin-webfont.js +11 -2
  23. package/es/stylelint-config.js +64 -2
  24. package/es/tailwind-config.js +392 -2
  25. package/lib/cli.cjs +289 -2
  26. package/lib/commitlint-config.cjs +15 -2
  27. package/lib/config.cjs +76 -2
  28. package/lib/constants.cjs +28 -2
  29. package/lib/eslint-config.cjs +435 -2
  30. package/lib/index.cjs +18 -2
  31. package/lib/modules.d.cjs +4 -2
  32. package/lib/plugin-app-config.cjs +38 -2
  33. package/lib/plugin-conventional-config.cjs +113 -2
  34. package/lib/plugin-eslint.cjs +24 -2
  35. package/lib/plugin-html.cjs +86 -2
  36. package/lib/plugin-icons.cjs +22 -2
  37. package/lib/plugin-injection.cjs +21 -2
  38. package/lib/plugin-inspect.cjs +15 -2
  39. package/lib/plugin-react-swc.cjs +14 -2
  40. package/lib/plugin-router.cjs +47 -2
  41. package/lib/plugin-stylelint.cjs +24 -2
  42. package/lib/plugin-svgr.cjs +59 -2
  43. package/lib/plugin-tailwindcss.cjs +27 -2
  44. package/lib/plugin-tsconfig-paths.cjs +14 -2
  45. package/lib/plugin-visualizer.cjs +16 -2
  46. package/lib/plugin-webfont.cjs +15 -2
  47. package/lib/stylelint-config.cjs +68 -2
  48. package/lib/tailwind-config.cjs +396 -2
  49. package/lib/types.cjs +4 -2
  50. package/package.json +1 -1
  51. package/template/package-lock.json +16992 -0
  52. package/template/package.json +5 -5
package/lib/cli.cjs CHANGED
@@ -1,3 +1,290 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.787Z, made by Venus. */
2
- "use strict";const e=require("@commitlint/format"),t=require("@commitlint/lint"),i=require("@commitlint/load"),o=require("@commitlint/read"),s=require("chalk"),n=require("commander"),r=require("consola"),a=require("execa"),c=require("fs-extra"),l=require("lint-staged"),p=require("node:path"),m=require("node:process"),d=require("ora"),u=require("prompts"),g=require("vite"),{exists:f,readJsonSync:v,writeFile:y,readJson:w,writeJson:h,copy:E,readFile:F,move:S}=c,b=m.cwd();const k=function(){const e=p.resolve(void 0,"../package.json");return v(e,{encoding:"utf-8"}).version}();async function q(){return(await import("../bin/hoist-patterns.js")).default}function x(e,t){return t||("build"===e?"production":"development")}async function V(e,t,i){const o=p.resolve(b,e||"vef.config.ts");if(!await f(o))throw r.error(`Config file not found: ${o}, it is required for VEF Framework`),new Error(`Config file not found: ${o}`);const s=await g.loadConfigFromFile({command:t,mode:i},o);return s?.config??{}}function j(e,t){r.error(`Error during ${e}:`,t),m.exit(1)}n.program.name("vef").description(s.magenta("VEF Framework CLI")).addHelpText("before",s.blue("VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus.")).addHelpText("before",s.bgGreenBright(`Version: ${k}`)).version(k).option("--mode <mode>","Specify running mode (will override default NODE_ENV)"),n.program.command("dev").description("Start dev server").option("-c, --config <file>","Specify vef config file","vef.config.ts").action((async e=>{try{const t=x("serve",n.program.opts().mode);m.env.NODE_ENV=t,m.env.VEF_FRAMEWORK_VERSION=k;const i=await V(e.config,"serve",t),o=await g.createServer({...i,mode:t,configFile:!1,logLevel:"info"});await o.listen(),o.printUrls(),o.bindCLIShortcuts({print:!0})}catch(e){j("dev server startup",e)}})),n.program.command("build").description("Build for production").option("-c, --config <file>","Specify vef config file","vef.config.ts").action((async e=>{try{const t=x("build",n.program.opts().mode);m.env.NODE_ENV=t,m.env.VEF_FRAMEWORK_VERSION=k;const i=await V(e.config,"build",t);await g.build({...i,mode:t,configFile:!1,logLevel:"info"}),r.success("Build completed successfully!")}catch(e){j("build",e)}})),n.program.command("preview").description("Preview the build").option("-c, --config <file>","Specify vef config file","vef.config.ts").action((async e=>{try{const t=x("build",n.program.opts().mode);m.env.NODE_ENV=t,m.env.VEF_FRAMEWORK_VERSION=k;const i=await V(e.config,"build",t),o=await g.preview({...i,mode:t,configFile:!1,logLevel:"info"});o.printUrls(),o.bindCLIShortcuts({print:!0})}catch(e){j("preview server startup",e)}})),n.program.command("prepare").description("Sets up the project for development mode").action((async()=>{await f(p.resolve(b,".husky"))||((await import("husky")).default(),r.success("Successfully set up husky")),await f(p.resolve(b,".husky/pre-commit"))||(await y(p.resolve(b,".husky/pre-commit"),"pnpm lint -t code"),r.success("Successfully set up pre-commit hook")),await f(p.resolve(b,".husky/commit-msg"))||(await y(p.resolve(b,".husky/commit-msg"),"pnpm lint -t commit-message -m $1"),r.success("Successfully set up commit-msg hook"));const e=await w(p.resolve(b,"package.json"),{encoding:"utf-8"}),{scripts:t}=e;let i=!1;t.prepare||(t.prepare="vef prepare",i=!0),i&&(await h(p.resolve(b,"package.json"),e,{encoding:"utf-8",spaces:2}),r.success("Successfully set up prepare script and lint-staged"))})),n.program.command("install").description("Install the dependencies of the project").action((async()=>{const e=await q();await a.execa({cwd:b,stdio:"inherit"})("pnpm",["install",...e.flatMap((e=>["--public-hoist-pattern",e]))])})),n.program.command("lint").description("Run lint-staged for the project").option("-t, --type <type>","Specify the type(code/commit-message) of linting to run","code").option("-m, --message <message>","Specify the commit message").action((async s=>{const{type:n,message:r}=s;if("code"===n)await l({cwd:b,concurrent:!0,config:{"*.{js,ts,tsx,json,jsonc,yaml,toml,md}":["eslint --fix","git add"],"*.{css,scss}":["stylelint --fix","git add"]}});else if("commit-message"===n){"string"==typeof r&&r.trim()||j("lint commit-message","Commit message is required");const s=await i({extends:["@commitlint/config-conventional"]}),n=await o({edit:r}),a=(await Promise.all(n.map((e=>t(e,s.rules,s.parserPreset?{parserOpts:s.parserPreset.parserOpts}:{}))))).reduce(((e,t)=>(e.valid=!!t.valid&&e.valid,e.errorCount+=t.errors.length,e.warningCount+=t.warnings.length,e.results.push(t),e)),{valid:!0,errorCount:0,warningCount:0,results:[]}),c=e(a);c&&console.log(c),(a.errorCount>0||a.warningCount>0)&&j("lint commit-message","Commit message is invalid, please fix the errors and try again")}else j("lint",`Invalid lint type: ${n}`)})),n.program.command("init").description("Initialize an empty VEF project").action((async()=>{console.log(s.blue("Welcome to use the cli tool of VEF Framework\n"));const e=await u([{type:"text",name:"appName",message:"What is the name of your app?",validate:e=>"string"==typeof e&&e.trim().length>0||"App name is required"},{type:"text",name:"appTitle",message:"What is the title of your app?",validate:e=>"string"==typeof e&&e.trim().length>0||"App title is required"}]),{appName:t,appTitle:i}=e;await E(p.resolve(void 0,"../template"),p.resolve(b,t)),r.success("Successfully copied template files"),await S(p.resolve(b,t,"_gitignore"),p.resolve(b,t,".gitignore")),await S(p.resolve(b,t,"_tsconfig.json"),p.resolve(b,t,"tsconfig.json"));const o=await w(p.resolve(b,t,"package.json"),{encoding:"utf-8"});o.name=t,await h(p.resolve(b,t,"package.json"),o,{encoding:"utf-8",spaces:2}),r.success("Successfully replaced name and title in package.json");const n=(await F(p.resolve(b,t,"env/.env"),{encoding:"utf-8"})).replace(/APP_NAME=.*$/m,`APP_NAME=${t}`).replace(/APP_TITLE=.*$/m,`APP_TITLE=${i}`);await y(p.resolve(b,t,"env/.env"),n),r.success("Successfully replaced name and title in .env file");const c=d("Initializing git repository...").start();try{await(a.execa`git --version`),await(a.execa({cwd:p.resolve(b,t)})`git init`),c.succeed("Successfully initialized git repository")}catch(e){c.fail("Failed to initialize git repository"),j("init",e)}c.start("Installing dependencies...");try{const e=await q();await a.execa({cwd:p.resolve(b,t)})("pnpm",["install",...e.flatMap((e=>["--public-hoist-pattern",e]))]),c.succeed("Successfully installed dependencies")}catch(e){c.fail("Failed to install dependencies"),j("init",e)}r.success(s.green("\nšŸŽ‰šŸŽ‰šŸŽ‰ VEF project created successfully !")),console.log(s.blue("\n✨ Next steps:")),console.log(s.cyan(` cd ${t}`)),console.log(s.cyan(" pnpm dev"))})),n.program.parse();
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.941Z, made by Venus. */
2
+ 'use strict';
3
+
4
+ const format = require('@commitlint/format');
5
+ const lint = require('@commitlint/lint');
6
+ const load = require('@commitlint/load');
7
+ const read = require('@commitlint/read');
8
+ const chalk = require('chalk');
9
+ const commander = require('commander');
10
+ const consola = require('consola');
11
+ const execa = require('execa');
12
+ const fsExtra = require('fs-extra');
13
+ const lintStaged = require('lint-staged');
14
+ const node_path = require('node:path');
15
+ const process = require('node:process');
16
+ const ora = require('ora');
17
+ const prompts = require('prompts');
18
+ const vite = require('vite');
19
+
20
+ const {
21
+ exists,
22
+ readJsonSync,
23
+ writeFile,
24
+ readJson,
25
+ writeJson,
26
+ copy,
27
+ readFile,
28
+ move
29
+ } = fsExtra;
30
+ const currentDir = process.cwd();
31
+ function readPackageVersion() {
32
+ const packageJsonPath = node_path.resolve(undefined, "../package.json");
33
+ const packageJson = readJsonSync(packageJsonPath, { encoding: "utf-8" });
34
+ return packageJson.version;
35
+ }
36
+ const frameworkVersion = readPackageVersion();
37
+ async function importHoistPatterns() {
38
+ const hoistedPatterns = (await import('../bin/hoist-patterns.js')).default;
39
+ return hoistedPatterns;
40
+ }
41
+ function resolveEnvMode(command, userMode) {
42
+ if (userMode) {
43
+ return userMode;
44
+ }
45
+ return command === "build" ? "production" : "development";
46
+ }
47
+ async function loadVefConfig(configPath, command, mode) {
48
+ const vefConfigPath = node_path.resolve(currentDir, configPath || "vef.config.ts");
49
+ if (!await exists(vefConfigPath)) {
50
+ consola.error(`Config file not found: ${vefConfigPath}, it is required for VEF Framework`);
51
+ throw new Error(`Config file not found: ${vefConfigPath}`);
52
+ }
53
+ const vefConfig = await vite.loadConfigFromFile(
54
+ {
55
+ command,
56
+ mode
57
+ },
58
+ vefConfigPath
59
+ );
60
+ return vefConfig?.config ?? {};
61
+ }
62
+ function handleError(phase, error) {
63
+ consola.error(`Error during ${phase}:`, error);
64
+ process.exit(1);
65
+ }
66
+ commander.program.name("vef").description(chalk.magenta("VEF Framework CLI")).addHelpText("before", chalk.blue("VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus.")).addHelpText("before", chalk.bgGreenBright(`Version: ${frameworkVersion}`)).version(frameworkVersion).option("--mode <mode>", "Specify running mode (will override default NODE_ENV)");
67
+ commander.program.command("dev").description("Start dev server").option("-c, --config <file>", "Specify vef config file", "vef.config.ts").action(async (options) => {
68
+ try {
69
+ const mode = resolveEnvMode("serve", commander.program.opts().mode);
70
+ process.env.NODE_ENV = mode;
71
+ process.env.VEF_FRAMEWORK_VERSION = frameworkVersion;
72
+ const config = await loadVefConfig(options.config, "serve", mode);
73
+ const server = await vite.createServer({
74
+ ...config,
75
+ mode,
76
+ configFile: false,
77
+ logLevel: "info"
78
+ });
79
+ await server.listen();
80
+ server.printUrls();
81
+ server.bindCLIShortcuts({ print: true });
82
+ } catch (e) {
83
+ handleError("dev server startup", e);
84
+ }
85
+ });
86
+ commander.program.command("build").description("Build for production").option("-c, --config <file>", "Specify vef config file", "vef.config.ts").action(async (options) => {
87
+ try {
88
+ const mode = resolveEnvMode("build", commander.program.opts().mode);
89
+ process.env.NODE_ENV = mode;
90
+ process.env.VEF_FRAMEWORK_VERSION = frameworkVersion;
91
+ const config = await loadVefConfig(options.config, "build", mode);
92
+ await vite.build({
93
+ ...config,
94
+ mode,
95
+ configFile: false,
96
+ logLevel: "info"
97
+ });
98
+ consola.success("Build completed successfully!");
99
+ } catch (e) {
100
+ handleError("build", e);
101
+ }
102
+ });
103
+ commander.program.command("preview").description("Preview the build").option("-c, --config <file>", "Specify vef config file", "vef.config.ts").action(async (options) => {
104
+ try {
105
+ const mode = resolveEnvMode("build", commander.program.opts().mode);
106
+ process.env.NODE_ENV = mode;
107
+ process.env.VEF_FRAMEWORK_VERSION = frameworkVersion;
108
+ const config = await loadVefConfig(options.config, "build", mode);
109
+ const server = await vite.preview({
110
+ ...config,
111
+ mode,
112
+ configFile: false,
113
+ logLevel: "info"
114
+ });
115
+ server.printUrls();
116
+ server.bindCLIShortcuts({ print: true });
117
+ } catch (e) {
118
+ handleError("preview server startup", e);
119
+ }
120
+ });
121
+ commander.program.command("prepare").description("Sets up the project for development mode").action(async () => {
122
+ if (!await exists(node_path.resolve(currentDir, ".husky"))) {
123
+ (await import('husky')).default();
124
+ consola.success("Successfully set up husky");
125
+ }
126
+ if (!await exists(node_path.resolve(currentDir, ".husky/pre-commit"))) {
127
+ await writeFile(
128
+ node_path.resolve(currentDir, ".husky/pre-commit"),
129
+ "pnpm lint -t code"
130
+ );
131
+ consola.success("Successfully set up pre-commit hook");
132
+ }
133
+ if (!await exists(node_path.resolve(currentDir, ".husky/commit-msg"))) {
134
+ await writeFile(
135
+ node_path.resolve(currentDir, ".husky/commit-msg"),
136
+ "pnpm lint -t commit-message -m $1"
137
+ );
138
+ consola.success("Successfully set up commit-msg hook");
139
+ }
140
+ const packageJson = await readJson(node_path.resolve(currentDir, "package.json"), { encoding: "utf-8" });
141
+ const { scripts } = packageJson;
142
+ let changed = false;
143
+ if (!scripts.prepare) {
144
+ scripts.prepare = "vef prepare";
145
+ changed = true;
146
+ }
147
+ if (changed) {
148
+ await writeJson(
149
+ node_path.resolve(currentDir, "package.json"),
150
+ packageJson,
151
+ {
152
+ encoding: "utf-8",
153
+ spaces: 2
154
+ }
155
+ );
156
+ consola.success("Successfully set up prepare script and lint-staged");
157
+ }
158
+ });
159
+ commander.program.command("install").description("Install the dependencies of the project").action(async () => {
160
+ const hoistedPatterns = await importHoistPatterns();
161
+ await execa.execa({
162
+ cwd: currentDir,
163
+ stdio: "inherit"
164
+ })("pnpm", ["install", ...hoistedPatterns.flatMap((pattern) => ["--public-hoist-pattern", pattern])]);
165
+ });
166
+ commander.program.command("lint").description("Run lint-staged for the project").option("-t, --type <type>", "Specify the type(code/commit-message) of linting to run", "code").option("-m, --message <message>", "Specify the commit message").action(async (options) => {
167
+ const { type, message } = options;
168
+ if (type === "code") {
169
+ await lintStaged({
170
+ cwd: currentDir,
171
+ concurrent: true,
172
+ config: {
173
+ "*.{js,ts,tsx,json,jsonc,yaml,toml,md}": [
174
+ "eslint --fix",
175
+ "git add"
176
+ ],
177
+ "*.{css,scss}": [
178
+ "stylelint --fix",
179
+ "git add"
180
+ ]
181
+ }
182
+ });
183
+ } else if (type === "commit-message") {
184
+ if (typeof message !== "string" || !message.trim()) {
185
+ handleError("lint commit-message", "Commit message is required");
186
+ }
187
+ const config = await load({
188
+ extends: ["@commitlint/config-conventional"]
189
+ });
190
+ const result = await read({
191
+ edit: message
192
+ });
193
+ const outcomes = await Promise.all(
194
+ result.map(
195
+ (commit) => lint(
196
+ commit,
197
+ config.rules,
198
+ config.parserPreset ? {
199
+ parserOpts: config.parserPreset.parserOpts
200
+ } : {}
201
+ )
202
+ )
203
+ );
204
+ const report = outcomes.reduce(
205
+ (info, result2) => {
206
+ info.valid = result2.valid ? info.valid : false;
207
+ info.errorCount += result2.errors.length;
208
+ info.warningCount += result2.warnings.length;
209
+ info.results.push(result2);
210
+ return info;
211
+ },
212
+ {
213
+ valid: true,
214
+ errorCount: 0,
215
+ warningCount: 0,
216
+ results: []
217
+ }
218
+ );
219
+ const output = format(report);
220
+ if (output) {
221
+ console.log(output);
222
+ }
223
+ if (report.errorCount > 0 || report.warningCount > 0) {
224
+ handleError("lint commit-message", "Commit message is invalid, please fix the errors and try again");
225
+ }
226
+ } else {
227
+ handleError("lint", `Invalid lint type: ${type}`);
228
+ }
229
+ });
230
+ commander.program.command("init").description("Initialize an empty VEF project").action(async () => {
231
+ console.log(chalk.blue("Welcome to use the cli tool of VEF Framework\n"));
232
+ const result = await prompts([
233
+ {
234
+ type: "text",
235
+ name: "appName",
236
+ message: "What is the name of your app?",
237
+ validate: (value) => typeof value === "string" && value.trim().length > 0 ? true : "App name is required"
238
+ },
239
+ {
240
+ type: "text",
241
+ name: "appTitle",
242
+ message: "What is the title of your app?",
243
+ validate: (value) => typeof value === "string" && value.trim().length > 0 ? true : "App title is required"
244
+ }
245
+ ]);
246
+ const { appName, appTitle } = result;
247
+ await copy(node_path.resolve(undefined, "../template"), node_path.resolve(currentDir, appName));
248
+ consola.success("Successfully copied template files");
249
+ await move(node_path.resolve(currentDir, appName, "_gitignore"), node_path.resolve(currentDir, appName, ".gitignore"));
250
+ await move(node_path.resolve(currentDir, appName, "_tsconfig.json"), node_path.resolve(currentDir, appName, "tsconfig.json"));
251
+ const packageJson = await readJson(node_path.resolve(currentDir, appName, "package.json"), { encoding: "utf-8" });
252
+ packageJson.name = appName;
253
+ await writeJson(node_path.resolve(currentDir, appName, "package.json"), packageJson, {
254
+ encoding: "utf-8",
255
+ spaces: 2
256
+ });
257
+ consola.success("Successfully replaced name and title in package.json");
258
+ const envContent = await readFile(node_path.resolve(currentDir, appName, "env/.env"), { encoding: "utf-8" });
259
+ const replacedEnvContent = envContent.replace(/APP_NAME=.*$/m, `APP_NAME=${appName}`).replace(/APP_TITLE=.*$/m, `APP_TITLE=${appTitle}`);
260
+ await writeFile(node_path.resolve(currentDir, appName, "env/.env"), replacedEnvContent);
261
+ consola.success("Successfully replaced name and title in .env file");
262
+ const spinner = ora("Initializing git repository...").start();
263
+ try {
264
+ await execa.execa`git --version`;
265
+ await execa.execa({
266
+ cwd: node_path.resolve(currentDir, appName)
267
+ })`git init`;
268
+ spinner.succeed("Successfully initialized git repository");
269
+ } catch (e) {
270
+ spinner.fail("Failed to initialize git repository");
271
+ handleError("init", e);
272
+ }
273
+ spinner.start("Installing dependencies...");
274
+ try {
275
+ const hoistedPatterns = await importHoistPatterns();
276
+ await execa.execa({
277
+ cwd: node_path.resolve(currentDir, appName)
278
+ })("pnpm", ["install", ...hoistedPatterns.flatMap((pattern) => ["--public-hoist-pattern", pattern])]);
279
+ spinner.succeed("Successfully installed dependencies");
280
+ } catch (e) {
281
+ spinner.fail("Failed to install dependencies");
282
+ handleError("init", e);
283
+ }
284
+ consola.success(chalk.green("\n\u{1F389}\u{1F389}\u{1F389} VEF project created successfully !"));
285
+ console.log(chalk.blue("\n\u2728 Next steps:"));
286
+ console.log(chalk.cyan(` cd ${appName}`));
287
+ console.log(chalk.cyan(` pnpm dev`));
288
+ });
289
+ commander.program.parse();
3
290
  /*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
@@ -1,3 +1,16 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.787Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.defineCommitlintConfig=function(){return{extends:["@commitlint/config-conventional"],formatter:"@commitlint/format"}};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.941Z, made by Venus. */
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ function defineCommitlintConfig() {
7
+ return {
8
+ extends: [
9
+ "@commitlint/config-conventional"
10
+ ],
11
+ formatter: "@commitlint/format"
12
+ };
13
+ }
14
+
15
+ exports.defineCommitlintConfig = defineCommitlintConfig;
3
16
  /*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
package/lib/config.cjs CHANGED
@@ -1,3 +1,77 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.787Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("consola"),i=require("fs-extra"),n=require("node:path"),r=require("vite"),t=require("./constants.cjs"),u=require("./plugin-app-config.cjs"),c=require("./plugin-conventional-config.cjs"),s=require("./plugin-eslint.cjs"),l=require("./plugin-html.cjs"),o=require("./plugin-icons.cjs"),a=require("./plugin-injection.cjs"),g=require("./plugin-inspect.cjs"),p=require("./plugin-react-swc.cjs"),P=require("./plugin-router.cjs"),j=require("./plugin-stylelint.cjs"),_=require("./plugin-svgr.cjs"),q=require("./plugin-tailwindcss.cjs"),f=require("./plugin-tsconfig-paths.cjs"),E=require("./plugin-visualizer.cjs"),I=require("./plugin-webfont.cjs"),{readJson:d}=i;exports.defineConfig=function({projectDir:i,proxies:v}){return r.defineConfig((async({mode:D})=>{const b=r.loadEnv(D,t.ENV_DIR,t.ENV_BUILD_PREFIX);Object.keys(b).length>0&&(e.info("Loaded environment variables:"),console.table(b));const U=await async function(e){const i=await d(n.resolve(e,"package.json"),{encoding:"utf-8"});return i.version}(i);return{plugins:[g.createInspectPlugin(),c.createConventionalConfigPlugin({appVersion:U,projectDir:i,basePublicPath:b.VEF_BUILD_BASE_PUBLIC_PATH,outputDir:b.VEF_BUILD_OUTPUT_DIR,serverPort:Number(b.VEF_BUILD_SERVER_PORT),proxies:v}),p.createReactSwcPlugin(),f.createTsconfigPathsPlugin(i),l.createHtmlPlugin(),q.createTailwindcssPlugin(),a.createInjectionPlugin(),u.createAppConfigPlugin({basePublicPath:b.VEF_BUILD_BASE_PUBLIC_PATH,outputDir:b.VEF_BUILD_OUTPUT_DIR,appName:b.VEF_APP_NAME}),o.createIconsPlugin(i),_.createSvgrPlugin(),I.createWebfontPlugin(),P.createRouterPlugin(i),s.createEslintPlugin(),j.createStylelintPlugin(),E.createVisualizerPlugin(i)]}}))};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.941Z, made by Venus. */
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ const consola = require('consola');
7
+ const fsExtra = require('fs-extra');
8
+ const node_path = require('node:path');
9
+ const vite = require('vite');
10
+ const constants = require('./constants.cjs');
11
+ const pluginAppConfig = require('./plugin-app-config.cjs');
12
+ const pluginConventionalConfig = require('./plugin-conventional-config.cjs');
13
+ const pluginEslint = require('./plugin-eslint.cjs');
14
+ const pluginHtml = require('./plugin-html.cjs');
15
+ const pluginIcons = require('./plugin-icons.cjs');
16
+ const pluginInjection = require('./plugin-injection.cjs');
17
+ const pluginInspect = require('./plugin-inspect.cjs');
18
+ const pluginReactSwc = require('./plugin-react-swc.cjs');
19
+ const pluginRouter = require('./plugin-router.cjs');
20
+ const pluginStylelint = require('./plugin-stylelint.cjs');
21
+ const pluginSvgr = require('./plugin-svgr.cjs');
22
+ const pluginTailwindcss = require('./plugin-tailwindcss.cjs');
23
+ const pluginTsconfigPaths = require('./plugin-tsconfig-paths.cjs');
24
+ const pluginVisualizer = require('./plugin-visualizer.cjs');
25
+ const pluginWebfont = require('./plugin-webfont.cjs');
26
+
27
+ const { readJson } = fsExtra;
28
+ function defineConfig({
29
+ projectDir,
30
+ proxies
31
+ }) {
32
+ return vite.defineConfig(async ({ mode }) => {
33
+ const env = vite.loadEnv(mode, constants.ENV_DIR, constants.ENV_BUILD_PREFIX);
34
+ if (Object.keys(env).length > 0) {
35
+ consola.info("Loaded environment variables:");
36
+ console.table(env);
37
+ }
38
+ const appVersion = await getAppVersion(projectDir);
39
+ return {
40
+ plugins: [
41
+ pluginInspect.createInspectPlugin(),
42
+ pluginConventionalConfig.createConventionalConfigPlugin({
43
+ appVersion,
44
+ projectDir,
45
+ basePublicPath: env.VEF_BUILD_BASE_PUBLIC_PATH,
46
+ outputDir: env.VEF_BUILD_OUTPUT_DIR,
47
+ serverPort: Number(env.VEF_BUILD_SERVER_PORT),
48
+ proxies
49
+ }),
50
+ pluginReactSwc.createReactSwcPlugin(),
51
+ pluginTsconfigPaths.createTsconfigPathsPlugin(projectDir),
52
+ pluginHtml.createHtmlPlugin(),
53
+ pluginTailwindcss.createTailwindcssPlugin(),
54
+ pluginInjection.createInjectionPlugin(),
55
+ pluginAppConfig.createAppConfigPlugin({
56
+ basePublicPath: env.VEF_BUILD_BASE_PUBLIC_PATH,
57
+ outputDir: env.VEF_BUILD_OUTPUT_DIR,
58
+ appName: env.VEF_APP_NAME
59
+ }),
60
+ pluginIcons.createIconsPlugin(projectDir),
61
+ pluginSvgr.createSvgrPlugin(),
62
+ pluginWebfont.createWebfontPlugin(),
63
+ pluginRouter.createRouterPlugin(projectDir),
64
+ pluginEslint.createEslintPlugin(),
65
+ pluginStylelint.createStylelintPlugin(),
66
+ pluginVisualizer.createVisualizerPlugin(projectDir)
67
+ ]
68
+ };
69
+ });
70
+ }
71
+ async function getAppVersion(projectDir) {
72
+ const packageJson = await readJson(node_path.resolve(projectDir, "package.json"), { encoding: "utf-8" });
73
+ return packageJson.version;
74
+ }
75
+
76
+ exports.defineConfig = defineConfig;
3
77
  /*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
package/lib/constants.cjs CHANGED
@@ -1,3 +1,29 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.787Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.ASSETS_DIR="assets",exports.DEFAULT_APP_NAME="APP",exports.DEFAULT_OUTPUT_DIR="dist",exports.DEFAULT_SERVER_PORT=3833,exports.ENV_APP_PREFIX="VEF_APP_",exports.ENV_BUILD_PREFIX="VEF_BUILD_",exports.ENV_DIR="env",exports.PAGES_DIR="pages",exports.PUBLIC_DIR="public",exports.ROUTER_DIR="router",exports.SRC_DIR="src";
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.941Z, made by Venus. */
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ const PUBLIC_DIR = "public";
7
+ const ENV_DIR = "env";
8
+ const ASSETS_DIR = "assets";
9
+ const ENV_APP_PREFIX = "VEF_APP_";
10
+ const ENV_BUILD_PREFIX = "VEF_BUILD_";
11
+ const SRC_DIR = "src";
12
+ const DEFAULT_OUTPUT_DIR = "dist";
13
+ const DEFAULT_SERVER_PORT = 3833;
14
+ const DEFAULT_APP_NAME = "APP";
15
+ const PAGES_DIR = "pages";
16
+ const ROUTER_DIR = "router";
17
+
18
+ exports.ASSETS_DIR = ASSETS_DIR;
19
+ exports.DEFAULT_APP_NAME = DEFAULT_APP_NAME;
20
+ exports.DEFAULT_OUTPUT_DIR = DEFAULT_OUTPUT_DIR;
21
+ exports.DEFAULT_SERVER_PORT = DEFAULT_SERVER_PORT;
22
+ exports.ENV_APP_PREFIX = ENV_APP_PREFIX;
23
+ exports.ENV_BUILD_PREFIX = ENV_BUILD_PREFIX;
24
+ exports.ENV_DIR = ENV_DIR;
25
+ exports.PAGES_DIR = PAGES_DIR;
26
+ exports.PUBLIC_DIR = PUBLIC_DIR;
27
+ exports.ROUTER_DIR = ROUTER_DIR;
28
+ exports.SRC_DIR = SRC_DIR;
3
29
  /*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */