@meng-xi/vite-plugin 0.0.3 → 0.0.5

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 (38) hide show
  1. package/README-en.md +182 -150
  2. package/README.md +182 -84
  3. package/dist/common/index.cjs +1 -1
  4. package/dist/common/index.d.cts +207 -6
  5. package/dist/common/index.d.mts +207 -6
  6. package/dist/common/index.d.ts +207 -6
  7. package/dist/common/index.mjs +1 -1
  8. package/dist/factory/index.cjs +1 -1
  9. package/dist/factory/index.mjs +1 -1
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.mjs +1 -1
  15. package/dist/logger/index.cjs +1 -1
  16. package/dist/logger/index.mjs +1 -1
  17. package/dist/plugins/index.cjs +1 -1
  18. package/dist/plugins/index.d.cts +296 -1
  19. package/dist/plugins/index.d.mts +296 -1
  20. package/dist/plugins/index.d.ts +296 -1
  21. package/dist/plugins/index.mjs +1 -1
  22. package/dist/shared/vite-plugin.B88RyRN8.mjs +3 -0
  23. package/dist/shared/vite-plugin.BZsetDCm.cjs +1 -0
  24. package/dist/shared/vite-plugin.C7isVPKg.mjs +1 -0
  25. package/dist/shared/vite-plugin.CS9a5kjK.mjs +36 -0
  26. package/dist/shared/vite-plugin.CgnG5_UX.cjs +36 -0
  27. package/dist/shared/vite-plugin.DqWt65U-.cjs +1 -0
  28. package/dist/shared/vite-plugin.IGZeStMa.cjs +3 -0
  29. package/dist/shared/vite-plugin.YvjM8LxW.mjs +1 -0
  30. package/package.json +72 -72
  31. package/dist/shared/vite-plugin.BT1oHRKK.cjs +0 -1
  32. package/dist/shared/vite-plugin.BTKhc7n7.cjs +0 -3
  33. package/dist/shared/vite-plugin.BZqhBDYR.mjs +0 -1
  34. package/dist/shared/vite-plugin.Bn8mcCzy.cjs +0 -3
  35. package/dist/shared/vite-plugin.CY2ydccp.mjs +0 -3
  36. package/dist/shared/vite-plugin.ClHiVXD6.mjs +0 -1
  37. package/dist/shared/vite-plugin.DSRKYuae.mjs +0 -3
  38. package/dist/shared/vite-plugin.DrSzERYS.cjs +0 -1
package/README-en.md CHANGED
@@ -1,150 +1,182 @@
1
- **English** | [中文](./README.md)
2
-
3
- <div align="center">
4
- <a href="https://github.com/MengXi-Studio/vite-plugin">
5
- <img alt="梦曦工作室 Logo" width="215" src="https://github.com/MengXi-Studio/vite-plugin/blob/master/packages/docs/src/public/logo.svg">
6
- </a>
7
- <br>
8
- <h1>@meng-xi/vite-plugin</h1>
9
-
10
- [![license](https://img.shields.io/github/license/MengXi-Studio/vite-plugin.svg)](LICENSE) [![npm](https://img.shields.io/npm/v/@meng-xi/vite-plugin?color=blue)](https://www.npmjs.com/package/@meng-xi/vite-plugin)
11
- ![npm](https://img.shields.io/npm/dt/@meng-xi/vite-plugin?color=green)
12
-
13
- </div>
14
-
15
- > - This is a toolkit that provides practical plugins for Vite, helping developers simplify the build process and improve development efficiency.
16
- > - Extends Vite build process functionality, providing automated processing solutions for common build tasks.
17
- > - All plugins support detailed configuration options, allowing customization based on project needs to meet different usage scenarios.
18
- > - Plugins provide error handling mechanisms to ensure build processes can catch errors, improving build reliability.
19
- > - Adopts modular design, plugins can be used individually or in combination, flexibly responding to different project needs.
20
-
21
- ---
22
-
23
- Start reading the [documentation](https://mengxi-studio.github.io/vite-plugin/).
24
-
25
- ## Quick Start
26
-
27
- ### Installation
28
-
29
- Install `@meng-xi/vite-plugin` using a package manager:
30
-
31
- ```bash
32
- # Using npm
33
- npm install @meng-xi/vite-plugin --save-dev
34
-
35
- # Using yarn
36
- yarn add @meng-xi/vite-plugin --save-dev
37
-
38
- # Using pnpm
39
- pnpm add @meng-xi/vite-plugin --save-dev
40
- ```
41
-
42
- ### Basic Usage
43
-
44
- Import and use the plugins in your Vite configuration file:
45
-
46
- ```typescript
47
- import { defineConfig } from 'vite'
48
- import { copyFile, injectIco } from '@meng-xi/vite-plugin'
49
-
50
- export default defineConfig({
51
- plugins: [
52
- // Copy file plugin
53
- copyFile({
54
- sourceDir: 'src/assets',
55
- targetDir: 'dist/assets'
56
- }),
57
-
58
- // Inject icon plugin
59
- injectIco({
60
- base: '/assets'
61
- })
62
- ]
63
- })
64
- ```
65
-
66
- ### Import All
67
-
68
- You can also use default import to import all plugins:
69
-
70
- ```typescript
71
- import { defineConfig } from 'vite'
72
- import vitePlugin from '@meng-xi/vite-plugin'
73
-
74
- export default defineConfig({
75
- plugins: [
76
- // Copy file plugin
77
- vitePlugin.copyFile({
78
- sourceDir: 'src/assets',
79
- targetDir: 'dist/assets'
80
- }),
81
-
82
- // Inject icon plugin
83
- vitePlugin.injectIco({
84
- base: '/assets'
85
- })
86
- ]
87
- })
88
- ```
89
-
90
- ## Plugin Details
91
-
92
- ### copyFile Plugin
93
-
94
- Used to copy files or directories to specified locations after Vite build is completed.
95
-
96
- **Configuration Options**:
97
-
98
- - `sourceDir`: Source directory path (required)
99
- - `targetDir`: Target directory path (required)
100
- - `overwrite`: Whether to overwrite existing files, default is `true`
101
- - `recursive`: Whether to recursively copy subdirectories, default is `true`
102
- - `verbose`: Whether to output detailed logs, default is `true`
103
- - `enabled`: Whether to enable the plugin, default is `true`
104
-
105
- ### injectIco Plugin
106
-
107
- Used to inject website icon links into the head of HTML files during the Vite build process.
108
-
109
- **Configuration Options**:
110
-
111
- - `base`: Base path for icon files
112
- - `url`: Complete URL for the icon
113
- - `link`: Custom complete link tag HTML
114
- - `icons`: Custom icon array
115
- - `verbose`: Whether to output detailed logs, default is `true`
116
- - `enabled`: Whether to enable the plugin, default is `true`
117
- - `copyOptions`: Icon file copying configuration
118
-
119
- ## Contribution
120
-
121
- Welcome to contribute to `@meng-xi/vite-plugin`. Here are the steps to contribute code:
122
-
123
- 1. Fork the project: Fork this project on GitHub.
124
- 2. Clone the code: Clone the forked project to your local machine.
125
-
126
- ```bash
127
- git clone https://github.com/your-username/vite-plugin.git
128
- cd vite-plugin
129
- ```
130
-
131
- 3. Create a new branch: Create a new feature branch based on the `master` branch.
132
-
133
- ```bash
134
- git checkout -b feature/your-feature
135
- ```
136
-
137
- 4. Commit changes: Ensure your code passes tests and commit your changes with clear commit messages.
138
-
139
- ```bash
140
- git add .
141
- git commit -m "feat: add your feature description"
142
- ```
143
-
144
- 5. Push changes: Push your local branch to GitHub.
145
-
146
- ```bash
147
- git push origin feature/your-feature
148
- ```
149
-
150
- 6. Create a PR: Create a Pull Request on GitHub and wait for review.
1
+ **English** | [中文](./README.md)
2
+
3
+ <div align="center">
4
+ <a href="https://github.com/MengXi-Studio/vite-plugin">
5
+ <img alt="MengXi Studio Logo" width="215" src="https://github.com/MengXi-Studio/vite-plugin/blob/master/packages/docs/src/public/logo.svg">
6
+ </a>
7
+ <br>
8
+ <h1>@meng-xi/vite-plugin</h1>
9
+ <p>A toolkit providing practical plugins for Vite, also a complete plugin development framework</p>
10
+
11
+ [![license](https://img.shields.io/github/license/MengXi-Studio/vite-plugin.svg)](LICENSE) [![npm](https://img.shields.io/npm/v/@meng-xi/vite-plugin?color=blue)](https://www.npmjs.com/package/@meng-xi/vite-plugin)
12
+ ![npm](https://img.shields.io/npm/dt/@meng-xi/vite-plugin?color=green)
13
+
14
+ </div>
15
+
16
+ ## Features
17
+
18
+ - **Ready to Use** - Provides practical plugins for file copying, router generation, version management, icon injection
19
+ - **Plugin Development Framework** - Exports core components like BasePlugin, Logger, Validator for building custom plugins
20
+ - **Type Safe** - Complete TypeScript type definitions with configuration validators ensuring parameter correctness
21
+ - **Flexible Configuration** - All plugins support detailed configuration to meet diverse scenario requirements
22
+
23
+ ## Documentation
24
+
25
+ View full documentation: [https://mengxi-studio.github.io/vite-plugin/](https://mengxi-studio.github.io/vite-plugin/)
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ # npm
31
+ npm install @meng-xi/vite-plugin -D
32
+
33
+ # yarn
34
+ yarn add @meng-xi/vite-plugin -D
35
+
36
+ # pnpm
37
+ pnpm add @meng-xi/vite-plugin -D
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Using Built-in Plugins
43
+
44
+ ```typescript
45
+ import { defineConfig } from 'vite'
46
+ import { copyFile, generateRouter, generateVersion, injectIco } from '@meng-xi/vite-plugin'
47
+
48
+ export default defineConfig({
49
+ plugins: [
50
+ // Copy files
51
+ copyFile({
52
+ sourceDir: 'src/assets',
53
+ targetDir: 'dist/assets'
54
+ }),
55
+
56
+ // Generate router config (uni-app)
57
+ generateRouter({
58
+ pagesJsonPath: 'src/pages.json',
59
+ outputPath: 'src/router.config.ts'
60
+ }),
61
+
62
+ // Generate version
63
+ generateVersion({
64
+ format: 'datetime',
65
+ outputType: 'both'
66
+ }),
67
+
68
+ // Inject website icon
69
+ injectIco({
70
+ base: '/assets'
71
+ })
72
+ ]
73
+ })
74
+ ```
75
+
76
+ ### Developing Custom Plugins
77
+
78
+ ```typescript
79
+ import { BasePlugin, createPluginFactory } from '@meng-xi/vite-plugin'
80
+ import type { Plugin } from 'vite'
81
+
82
+ interface MyPluginOptions {
83
+ path: string
84
+ enabled?: boolean
85
+ verbose?: boolean
86
+ errorStrategy?: 'throw' | 'log' | 'ignore'
87
+ }
88
+
89
+ class MyPlugin extends BasePlugin<MyPluginOptions> {
90
+ protected getDefaultOptions() {
91
+ return { path: './default' }
92
+ }
93
+
94
+ protected validateOptions(): void {
95
+ this.validator.field('path').required().string().validate()
96
+ }
97
+
98
+ protected getPluginName(): string {
99
+ return 'my-plugin'
100
+ }
101
+
102
+ protected addPluginHooks(plugin: Plugin): void {
103
+ plugin.buildStart = () => {
104
+ this.logger.info(`Plugin started with path: ${this.options.path}`)
105
+ }
106
+ }
107
+ }
108
+
109
+ export const myPlugin = createPluginFactory(MyPlugin)
110
+ ```
111
+
112
+ ## Built-in Plugins
113
+
114
+ ### copyFile
115
+
116
+ Copy files or directories to specified locations after Vite build is completed.
117
+
118
+ | Option | Type | Default | Description |
119
+ | ----------- | ------- | ------- | ------------------------------------------ |
120
+ | sourceDir | string | - | Source directory path (required) |
121
+ | targetDir | string | - | Target directory path (required) |
122
+ | overwrite | boolean | true | Whether to overwrite existing files |
123
+ | recursive | boolean | true | Whether to recursively copy subdirectories |
124
+ | incremental | boolean | true | Whether to enable incremental copying |
125
+
126
+ ### generateRouter
127
+
128
+ Automatically generate router configuration files based on uni-app project's `pages.json`.
129
+
130
+ | Option | Type | Default | Description |
131
+ | -------------------- | ------------ | ---------------------- | ------------------------------------------------ |
132
+ | pagesJsonPath | string | 'src/pages.json' | Path to pages.json file |
133
+ | outputPath | string | 'src/router.config.ts' | Output file path |
134
+ | outputFormat | 'ts' \| 'js' | 'ts' | Output file format |
135
+ | nameStrategy | string | 'camelCase' | Route name strategy |
136
+ | includeSubPackages | boolean | true | Whether to include sub-package routes |
137
+ | watch | boolean | true | Whether to watch changes and auto-regenerate |
138
+ | metaMapping | object | - | Mapping from page style fields to meta |
139
+ | preserveRouteChanges | boolean | true | Whether to preserve user modifications to routes |
140
+
141
+ ### generateVersion
142
+
143
+ Automatically generate version numbers during the Vite build process.
144
+
145
+ | Option | Type | Default | Description |
146
+ | ---------- | ------ | --------------------- | ------------------------------ |
147
+ | format | string | 'timestamp' | Version format |
148
+ | outputType | string | 'file' | Output type |
149
+ | outputFile | string | 'version.json' | Output file path |
150
+ | defineName | string | '\_\_APP_VERSION\_\_' | Global variable name to inject |
151
+ | prefix | string | - | Version number prefix |
152
+ | suffix | string | - | Version number suffix |
153
+
154
+ ### injectIco
155
+
156
+ Inject website icon links into the head of HTML files during the Vite build process.
157
+
158
+ | Option | Type | Default | Description |
159
+ | ----------- | ------ | ------- | ------------------------------- |
160
+ | base | string | - | Base path for icon files |
161
+ | url | string | - | Complete URL for the icon |
162
+ | link | string | - | Custom complete link tag HTML |
163
+ | icons | array | - | Custom icon array |
164
+ | copyOptions | object | - | Icon file copying configuration |
165
+
166
+ ## Changelog
167
+
168
+ See [GitHub Releases](https://github.com/MengXi-Studio/vite-plugin/releases)
169
+
170
+ ## Contributing
171
+
172
+ Contributions are welcome! Please follow these steps:
173
+
174
+ 1. Fork the repository
175
+ 2. Create a feature branch: `git checkout -b feature/your-feature`
176
+ 3. Commit changes: `git commit -m "feat: your feature description"`
177
+ 4. Push to branch: `git push origin feature/your-feature`
178
+ 5. Create a Pull Request
179
+
180
+ ## License
181
+
182
+ [MIT](LICENSE)
package/README.md CHANGED
@@ -1,84 +1,182 @@
1
- **中文** | [English](./README-en.md)
2
-
3
- <div align="center">
4
- <a href="https://github.com/MengXi-Studio/vite-plugin">
5
- <img alt="梦曦工作室 Logo" width="215" src="https://github.com/MengXi-Studio/vite-plugin/blob/master/packages/docs/src/public/logo.svg">
6
- </a>
7
- <br>
8
- <h1>@meng-xi/vite-plugin</h1>
9
-
10
- [![license](https://img.shields.io/github/license/MengXi-Studio/vite-plugin.svg)](LICENSE) [![npm](https://img.shields.io/npm/v/@meng-xi/vite-plugin?color=blue)](https://www.npmjs.com/package/@meng-xi/vite-plugin)
11
- ![npm](https://img.shields.io/npm/dt/@meng-xi/vite-plugin?color=green)
12
-
13
- </div>
14
-
15
- ## 简介
16
-
17
- `@meng-xi/vite-plugin` 是一个为 Vite 提供实用插件的工具包,帮助开发者简化构建流程,提高开发效率。
18
-
19
- ## 特性
20
-
21
- - **增强 Vite 构建流程**:提供实用插件集合,扩展 Vite 功能,简化构建过程中的常见任务,提高开发效率
22
- - **模块化插件架构**:采用模块化设计,插件可单独使用或组合使用,灵活应对不同项目需求
23
- - **高度可配置**:所有功能支持详细配置选项,可根据项目需求自定义行为,满足多样化场景
24
- - **环境感知能力**:支持根据构建环境条件执行插件功能,智能控制不同环境下的行为
25
- - **详细日志输出**:提供可选的详细日志,帮助开发者了解执行过程,便于调试和问题排查
26
- - **类型安全**:完全使用 TypeScript 开发,提供完整类型定义,确保使用过程中的类型安全
27
- - **无缝集成**:与 Vite 构建流程无缝集成,无需复杂配置即可快速启用
28
- - **优化开发体验**:简化常见构建任务,减少手动操作,让开发者专注于核心业务逻辑
29
-
30
- ## 文档
31
-
32
- 开始阅读[文档地址](https://mengxi-studio.github.io/vite-plugin/)。
33
-
34
- ## 安装
35
-
36
- 使用包管理器安装 `@meng-xi/vite-plugin`:
37
-
38
- ```bash
39
- # 使用 npm
40
- npm install @meng-xi/vite-plugin --save-dev
41
-
42
- # 使用 yarn
43
- yarn add @meng-xi/vite-plugin --save-dev
44
-
45
- # 使用 pnpm
46
- pnpm add @meng-xi/vite-plugin --save-dev
47
- ```
48
-
49
- ## 更新日志
50
-
51
- [CHANGELOG](https://github.com/MengXi-Studio/vite-plugin/releases)
52
-
53
- ## 如何贡献
54
-
55
- 欢迎为 `@meng-xi/vite-plugin` 贡献代码。以下是贡献代码的步骤:
56
-
57
- 1. Fork 项目:在 GitHub 上 Fork 此项目。
58
- 2. 克隆代码:将 Fork 后的项目克隆到您的本地机器。
59
-
60
- ```bash
61
- git clone https://github.com/your-username/vite-plugin.git
62
- cd vite-plugin
63
- ```
64
-
65
- 3. 创建新分支:基于 `master` 分支创建一个新的功能分支。
66
-
67
- ```bash
68
- git checkout -b feature/your-feature
69
- ```
70
-
71
- 4. 提交变更:确保您的代码通过了测试,并使用清晰的提交消息提交您的变更。
72
-
73
- ```bash
74
- git add .
75
- git commit -m "feat: add your feature description"
76
- ```
77
-
78
- 5. Push 变更:将您的本地分支推送到 GitHub。
79
-
80
- ```bash
81
- git push origin feature/your-feature
82
- ```
83
-
84
- 6. 创建 PR:在 GitHub 上创建一个 Pull Request,并等待审核。
1
+ **中文** | [English](./README-en.md)
2
+
3
+ <div align="center">
4
+ <a href="https://github.com/MengXi-Studio/vite-plugin">
5
+ <img alt="梦曦工作室 Logo" width="215" src="https://github.com/MengXi-Studio/vite-plugin/blob/master/packages/docs/src/public/logo.svg">
6
+ </a>
7
+ <br>
8
+ <h1>@meng-xi/vite-plugin</h1>
9
+ <p>一个为 Vite 提供实用插件的工具包,同时也是一个完整的插件开发框架</p>
10
+
11
+ [![license](https://img.shields.io/github/license/MengXi-Studio/vite-plugin.svg)](LICENSE) [![npm](https://img.shields.io/npm/v/@meng-xi/vite-plugin?color=blue)](https://www.npmjs.com/package/@meng-xi/vite-plugin)
12
+ ![npm](https://img.shields.io/npm/dt/@meng-xi/vite-plugin?color=green)
13
+
14
+ </div>
15
+
16
+ ## 特性
17
+
18
+ - **开箱即用** - 提供文件复制、路由生成、版本管理、图标注入等实用插件
19
+ - **插件开发框架** - 导出 BasePlugin、Logger、Validator 等核心组件,快速构建自定义插件
20
+ - **类型安全** - 完整的 TypeScript 类型定义,配置验证器确保参数正确性
21
+ - **灵活配置** - 所有插件支持详细配置,满足多样化场景需求
22
+
23
+ ## 文档
24
+
25
+ 查看完整文档:[https://mengxi-studio.github.io/vite-plugin/](https://mengxi-studio.github.io/vite-plugin/)
26
+
27
+ ## 安装
28
+
29
+ ```bash
30
+ # npm
31
+ npm install @meng-xi/vite-plugin -D
32
+
33
+ # yarn
34
+ yarn add @meng-xi/vite-plugin -D
35
+
36
+ # pnpm
37
+ pnpm add @meng-xi/vite-plugin -D
38
+ ```
39
+
40
+ ## 快速开始
41
+
42
+ ### 使用内置插件
43
+
44
+ ```typescript
45
+ import { defineConfig } from 'vite'
46
+ import { copyFile, generateRouter, generateVersion, injectIco } from '@meng-xi/vite-plugin'
47
+
48
+ export default defineConfig({
49
+ plugins: [
50
+ // 复制文件
51
+ copyFile({
52
+ sourceDir: 'src/assets',
53
+ targetDir: 'dist/assets'
54
+ }),
55
+
56
+ // 生成路由配置(uni-app)
57
+ generateRouter({
58
+ pagesJsonPath: 'src/pages.json',
59
+ outputPath: 'src/router.config.ts'
60
+ }),
61
+
62
+ // 生成版本号
63
+ generateVersion({
64
+ format: 'datetime',
65
+ outputType: 'both'
66
+ }),
67
+
68
+ // 注入网站图标
69
+ injectIco({
70
+ base: '/assets'
71
+ })
72
+ ]
73
+ })
74
+ ```
75
+
76
+ ### 开发自定义插件
77
+
78
+ ```typescript
79
+ import { BasePlugin, createPluginFactory } from '@meng-xi/vite-plugin'
80
+ import type { Plugin } from 'vite'
81
+
82
+ interface MyPluginOptions {
83
+ path: string
84
+ enabled?: boolean
85
+ verbose?: boolean
86
+ errorStrategy?: 'throw' | 'log' | 'ignore'
87
+ }
88
+
89
+ class MyPlugin extends BasePlugin<MyPluginOptions> {
90
+ protected getDefaultOptions() {
91
+ return { path: './default' }
92
+ }
93
+
94
+ protected validateOptions(): void {
95
+ this.validator.field('path').required().string().validate()
96
+ }
97
+
98
+ protected getPluginName(): string {
99
+ return 'my-plugin'
100
+ }
101
+
102
+ protected addPluginHooks(plugin: Plugin): void {
103
+ plugin.buildStart = () => {
104
+ this.logger.info(`Plugin started with path: ${this.options.path}`)
105
+ }
106
+ }
107
+ }
108
+
109
+ export const myPlugin = createPluginFactory(MyPlugin)
110
+ ```
111
+
112
+ ## 内置插件
113
+
114
+ ### copyFile
115
+
116
+ 在 Vite 构建完成后复制文件或目录到指定位置。
117
+
118
+ | 选项 | 类型 | 默认值 | 描述 |
119
+ | ----------- | ------- | ------ | -------------------- |
120
+ | sourceDir | string | - | 源目录路径(必填) |
121
+ | targetDir | string | - | 目标目录路径(必填) |
122
+ | overwrite | boolean | true | 是否覆盖现有文件 |
123
+ | recursive | boolean | true | 是否递归复制子目录 |
124
+ | incremental | boolean | true | 是否启用增量复制 |
125
+
126
+ ### generateRouter
127
+
128
+ 根据 uni-app 项目的 `pages.json` 自动生成路由配置文件。
129
+
130
+ | 选项 | 类型 | 默认值 | 描述 |
131
+ | -------------------- | ------------ | ---------------------- | ----------------------------- |
132
+ | pagesJsonPath | string | 'src/pages.json' | pages.json 文件路径 |
133
+ | outputPath | string | 'src/router.config.ts' | 输出文件路径 |
134
+ | outputFormat | 'ts' \| 'js' | 'ts' | 输出文件格式 |
135
+ | nameStrategy | string | 'camelCase' | 路由名称策略 |
136
+ | includeSubPackages | boolean | true | 是否包含子包路由 |
137
+ | watch | boolean | true | 是否监听变化自动重新生成 |
138
+ | metaMapping | object | - | 页面 style 字段到 meta 的映射 |
139
+ | preserveRouteChanges | boolean | true | 是否保留用户对 routes 的修改 |
140
+
141
+ ### generateVersion
142
+
143
+ 在 Vite 构建过程中自动生成版本号。
144
+
145
+ | 选项 | 类型 | 默认值 | 描述 |
146
+ | ---------- | ------ | --------------------- | ---------------- |
147
+ | format | string | 'timestamp' | 版本格式 |
148
+ | outputType | string | 'file' | 输出类型 |
149
+ | outputFile | string | 'version.json' | 输出文件路径 |
150
+ | defineName | string | '\_\_APP_VERSION\_\_' | 注入的全局变量名 |
151
+ | prefix | string | - | 版本号前缀 |
152
+ | suffix | string | - | 版本号后缀 |
153
+
154
+ ### injectIco
155
+
156
+ 在 Vite 构建过程中将网站图标链接注入到 HTML 文件的 head 中。
157
+
158
+ | 选项 | 类型 | 默认值 | 描述 |
159
+ | ----------- | ------ | ------ | --------------------------- |
160
+ | base | string | - | 图标文件的基础路径 |
161
+ | url | string | - | 图标的完整 URL |
162
+ | link | string | - | 自定义完整的 link 标签 HTML |
163
+ | icons | array | - | 自定义图标数组 |
164
+ | copyOptions | object | - | 图标文件复制配置 |
165
+
166
+ ## 更新日志
167
+
168
+ 查看 [GitHub Releases](https://github.com/MengXi-Studio/vite-plugin/releases)
169
+
170
+ ## 贡献指南
171
+
172
+ 欢迎贡献代码!请按以下步骤操作:
173
+
174
+ 1. Fork 本项目
175
+ 2. 创建功能分支:`git checkout -b feature/your-feature`
176
+ 3. 提交变更:`git commit -m "feat: your feature description"`
177
+ 4. 推送分支:`git push origin feature/your-feature`
178
+ 5. 创建 Pull Request
179
+
180
+ ## License
181
+
182
+ [MIT](LICENSE)
@@ -1 +1 @@
1
- "use strict";const index=require("../shared/vite-plugin.DrSzERYS.cjs"),validation=require("../shared/vite-plugin.BTKhc7n7.cjs");require("fs"),require("path"),exports.checkSourceExists=index.checkSourceExists,exports.copySourceToTarget=index.copySourceToTarget,exports.ensureTargetDir=index.ensureTargetDir,exports.readDirRecursive=index.readDirRecursive,exports.readFileSync=index.readFileSync,exports.shouldUpdateFile=index.shouldUpdateFile,exports.writeFileContent=index.writeFileContent,exports.Validator=validation.Validator,exports.deepMerge=validation.deepMerge;
1
+ "use strict";const format=require("../shared/vite-plugin.BZsetDCm.cjs"),validation=require("../shared/vite-plugin.IGZeStMa.cjs");require("fs"),require("path"),require("crypto"),exports.checkSourceExists=format.checkSourceExists,exports.copySourceToTarget=format.copySourceToTarget,exports.ensureTargetDir=format.ensureTargetDir,exports.fileExists=format.fileExists,exports.formatDate=format.formatDate,exports.generateRandomHash=format.generateRandomHash,exports.getDateFormatParams=format.getDateFormatParams,exports.padNumber=format.padNumber,exports.parseTemplate=format.parseTemplate,exports.readDirRecursive=format.readDirRecursive,exports.readFileSync=format.readFileSync,exports.runWithConcurrency=format.runWithConcurrency,exports.shouldUpdateFile=format.shouldUpdateFile,exports.stripJsonComments=format.stripJsonComments,exports.toCamelCase=format.toCamelCase,exports.toPascalCase=format.toPascalCase,exports.writeFileContent=format.writeFileContent,exports.Validator=validation.Validator,exports.deepMerge=validation.deepMerge;