@meng-xi/vite-plugin 0.0.3 → 0.0.4

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 +164 -150
  2. package/README.md +143 -84
  3. package/dist/common/index.cjs +1 -1
  4. package/dist/common/index.d.cts +132 -6
  5. package/dist/common/index.d.mts +132 -6
  6. package/dist/common/index.d.ts +132 -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 +166 -1
  19. package/dist/plugins/index.d.mts +166 -1
  20. package/dist/plugins/index.d.ts +166 -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.C7isVPKg.mjs +1 -0
  24. package/dist/shared/vite-plugin.D6NYITpX.cjs +1 -0
  25. package/dist/shared/vite-plugin.D8HTI0Ni.cjs +2 -0
  26. package/dist/shared/vite-plugin.Dd2ogbSe.mjs +2 -0
  27. package/dist/shared/vite-plugin.DqWt65U-.cjs +1 -0
  28. package/dist/shared/vite-plugin.HZb-1B5l.mjs +1 -0
  29. package/dist/shared/vite-plugin.IGZeStMa.cjs +3 -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
@@ -47,6 +47,17 @@ interface CopyResult {
47
47
  executionTime: number;
48
48
  }
49
49
 
50
+ /**
51
+ * 文件/目录条目信息
52
+ */
53
+ interface FileEntry {
54
+ /** 完整路径 */
55
+ path: string;
56
+ /** 是否为文件 */
57
+ isFile: boolean;
58
+ /** 是否为目录 */
59
+ isDirectory: boolean;
60
+ }
50
61
  /**
51
62
  * 检查源文件是否存在
52
63
  * @param sourcePath 源文件路径
@@ -60,12 +71,12 @@ declare function checkSourceExists(sourcePath: string): Promise<void>;
60
71
  */
61
72
  declare function ensureTargetDir(targetPath: string): Promise<void>;
62
73
  /**
63
- * 读取目录内容
74
+ * 读取目录内容(优化版:一次性获取文件类型信息)
64
75
  * @param dirPath 目录路径
65
76
  * @param recursive 是否递归读取
66
- * @returns 文件和目录列表
77
+ * @returns 文件和目录条目列表
67
78
  */
68
- declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<string[]>;
79
+ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<FileEntry[]>;
69
80
  /**
70
81
  * 检查文件是否需要更新
71
82
  * @param sourceFile 源文件路径
@@ -74,7 +85,7 @@ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<
74
85
  */
75
86
  declare function shouldUpdateFile(sourceFile: string, targetFile: string): Promise<boolean>;
76
87
  /**
77
- * 执行文件复制操作
88
+ * 执行文件复制操作(优化版:并行IO)
78
89
  * @param sourcePath 源文件或目录路径
79
90
  * @param targetPath 目标文件或目录路径
80
91
  * @param options 复制选项
@@ -97,13 +108,128 @@ declare function writeFileContent(filePath: string, content: string): Promise<vo
97
108
  */
98
109
  declare function readFileSync(filePath: string): string;
99
110
 
111
+ /**
112
+ * 数字补零格式化
113
+ *
114
+ * @param num 要格式化的数字
115
+ * @param length 目标长度
116
+ * @returns 补零后的字符串
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * padNumber(5, 2) // '05'
121
+ * padNumber(12, 3) // '012'
122
+ * padNumber(123, 2) // '123'
123
+ * ```
124
+ */
125
+ declare function padNumber(num: number, length?: number): string;
126
+ /**
127
+ * 生成随机哈希字符串
128
+ *
129
+ * @param length 哈希长度,范围 1-64
130
+ * @returns 随机哈希字符串
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * generateRandomHash(8) // 'a1b2c3d4'
135
+ * generateRandomHash(16) // 'a1b2c3d4e5f6g7h8'
136
+ * ```
137
+ */
138
+ declare function generateRandomHash(length?: number): string;
139
+ /**
140
+ * 日期格式化选项
141
+ */
142
+ interface DateFormatOptions {
143
+ /** 四位年份 */
144
+ YYYY: string;
145
+ /** 两位年份 */
146
+ YY: string;
147
+ /** 两位月份 */
148
+ MM: string;
149
+ /** 两位日期 */
150
+ DD: string;
151
+ /** 两位小时(24小时制) */
152
+ HH: string;
153
+ /** 两位分钟 */
154
+ mm: string;
155
+ /** 两位秒数 */
156
+ ss: string;
157
+ /** 三位毫秒 */
158
+ SSS: string;
159
+ /** 时间戳(毫秒) */
160
+ timestamp: string;
161
+ }
162
+ /**
163
+ * 获取日期格式化参数
164
+ *
165
+ * @param date 日期对象
166
+ * @returns 日期格式化参数对象
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const params = getDateFormatParams(new Date())
171
+ * // { YYYY: '2026', MM: '02', DD: '03', HH: '15', mm: '30', ss: '00', ... }
172
+ * ```
173
+ */
174
+ declare function getDateFormatParams(date?: Date): DateFormatOptions;
175
+ /**
176
+ * 格式化日期
177
+ *
178
+ * @param date 日期对象
179
+ * @param format 格式模板
180
+ * @returns 格式化后的日期字符串
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * formatDate(new Date(), '{YYYY}-{MM}-{DD}') // '2026-02-03'
185
+ * formatDate(new Date(), '{YYYY}{MM}{DD}{HH}{mm}{ss}') // '20260203153000'
186
+ * formatDate(new Date(), '{YYYY}.{MM}.{DD}') // '2026.02.03'
187
+ * ```
188
+ */
189
+ declare function formatDate(date: Date, format: string): string;
190
+ /**
191
+ * 解析模板字符串,替换占位符
192
+ *
193
+ * @param template 模板字符串
194
+ * @param values 占位符值映射
195
+ * @returns 替换后的字符串
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * parseTemplate('{name}-{version}', { name: 'app', version: '1.0.0' })
200
+ * // 'app-1.0.0'
201
+ * ```
202
+ */
203
+ declare function parseTemplate(template: string, values: Record<string, string>): string;
204
+
100
205
  /**
101
206
  * 深度合并对象
102
207
  *
103
- * @param target 目标对象
208
+ * @description 将多个源对象深度合并到一个新对象中。
209
+ * - undefined 值会被跳过,不会覆盖已有值
210
+ * - 嵌套对象会递归合并
211
+ * - 数组会直接覆盖,不会合并
212
+ * - null 值会覆盖已有值
213
+ *
104
214
  * @param sources 源对象列表
105
215
  * @returns 合并后的对象
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // 基本合并
220
+ * deepMerge({ a: 1 }, { b: 2 }) // { a: 1, b: 2 }
221
+ *
222
+ * // undefined 不覆盖
223
+ * deepMerge({ a: 1 }, { a: undefined }) // { a: 1 }
224
+ *
225
+ * // 嵌套对象合并
226
+ * deepMerge({ a: { b: 1 } }, { a: { c: 2 } }) // { a: { b: 1, c: 2 } }
227
+ *
228
+ * // 数组覆盖
229
+ * deepMerge({ a: [1, 2] }, { a: [3, 4] }) // { a: [3, 4] }
230
+ * ```
106
231
  */
107
232
  declare function deepMerge<T extends Record<string, any>>(...sources: Partial<T>[]): T;
108
233
 
109
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
234
+ export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
235
+ export type { DateFormatOptions };
@@ -47,6 +47,17 @@ interface CopyResult {
47
47
  executionTime: number;
48
48
  }
49
49
 
50
+ /**
51
+ * 文件/目录条目信息
52
+ */
53
+ interface FileEntry {
54
+ /** 完整路径 */
55
+ path: string;
56
+ /** 是否为文件 */
57
+ isFile: boolean;
58
+ /** 是否为目录 */
59
+ isDirectory: boolean;
60
+ }
50
61
  /**
51
62
  * 检查源文件是否存在
52
63
  * @param sourcePath 源文件路径
@@ -60,12 +71,12 @@ declare function checkSourceExists(sourcePath: string): Promise<void>;
60
71
  */
61
72
  declare function ensureTargetDir(targetPath: string): Promise<void>;
62
73
  /**
63
- * 读取目录内容
74
+ * 读取目录内容(优化版:一次性获取文件类型信息)
64
75
  * @param dirPath 目录路径
65
76
  * @param recursive 是否递归读取
66
- * @returns 文件和目录列表
77
+ * @returns 文件和目录条目列表
67
78
  */
68
- declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<string[]>;
79
+ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<FileEntry[]>;
69
80
  /**
70
81
  * 检查文件是否需要更新
71
82
  * @param sourceFile 源文件路径
@@ -74,7 +85,7 @@ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<
74
85
  */
75
86
  declare function shouldUpdateFile(sourceFile: string, targetFile: string): Promise<boolean>;
76
87
  /**
77
- * 执行文件复制操作
88
+ * 执行文件复制操作(优化版:并行IO)
78
89
  * @param sourcePath 源文件或目录路径
79
90
  * @param targetPath 目标文件或目录路径
80
91
  * @param options 复制选项
@@ -97,13 +108,128 @@ declare function writeFileContent(filePath: string, content: string): Promise<vo
97
108
  */
98
109
  declare function readFileSync(filePath: string): string;
99
110
 
111
+ /**
112
+ * 数字补零格式化
113
+ *
114
+ * @param num 要格式化的数字
115
+ * @param length 目标长度
116
+ * @returns 补零后的字符串
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * padNumber(5, 2) // '05'
121
+ * padNumber(12, 3) // '012'
122
+ * padNumber(123, 2) // '123'
123
+ * ```
124
+ */
125
+ declare function padNumber(num: number, length?: number): string;
126
+ /**
127
+ * 生成随机哈希字符串
128
+ *
129
+ * @param length 哈希长度,范围 1-64
130
+ * @returns 随机哈希字符串
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * generateRandomHash(8) // 'a1b2c3d4'
135
+ * generateRandomHash(16) // 'a1b2c3d4e5f6g7h8'
136
+ * ```
137
+ */
138
+ declare function generateRandomHash(length?: number): string;
139
+ /**
140
+ * 日期格式化选项
141
+ */
142
+ interface DateFormatOptions {
143
+ /** 四位年份 */
144
+ YYYY: string;
145
+ /** 两位年份 */
146
+ YY: string;
147
+ /** 两位月份 */
148
+ MM: string;
149
+ /** 两位日期 */
150
+ DD: string;
151
+ /** 两位小时(24小时制) */
152
+ HH: string;
153
+ /** 两位分钟 */
154
+ mm: string;
155
+ /** 两位秒数 */
156
+ ss: string;
157
+ /** 三位毫秒 */
158
+ SSS: string;
159
+ /** 时间戳(毫秒) */
160
+ timestamp: string;
161
+ }
162
+ /**
163
+ * 获取日期格式化参数
164
+ *
165
+ * @param date 日期对象
166
+ * @returns 日期格式化参数对象
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const params = getDateFormatParams(new Date())
171
+ * // { YYYY: '2026', MM: '02', DD: '03', HH: '15', mm: '30', ss: '00', ... }
172
+ * ```
173
+ */
174
+ declare function getDateFormatParams(date?: Date): DateFormatOptions;
175
+ /**
176
+ * 格式化日期
177
+ *
178
+ * @param date 日期对象
179
+ * @param format 格式模板
180
+ * @returns 格式化后的日期字符串
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * formatDate(new Date(), '{YYYY}-{MM}-{DD}') // '2026-02-03'
185
+ * formatDate(new Date(), '{YYYY}{MM}{DD}{HH}{mm}{ss}') // '20260203153000'
186
+ * formatDate(new Date(), '{YYYY}.{MM}.{DD}') // '2026.02.03'
187
+ * ```
188
+ */
189
+ declare function formatDate(date: Date, format: string): string;
190
+ /**
191
+ * 解析模板字符串,替换占位符
192
+ *
193
+ * @param template 模板字符串
194
+ * @param values 占位符值映射
195
+ * @returns 替换后的字符串
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * parseTemplate('{name}-{version}', { name: 'app', version: '1.0.0' })
200
+ * // 'app-1.0.0'
201
+ * ```
202
+ */
203
+ declare function parseTemplate(template: string, values: Record<string, string>): string;
204
+
100
205
  /**
101
206
  * 深度合并对象
102
207
  *
103
- * @param target 目标对象
208
+ * @description 将多个源对象深度合并到一个新对象中。
209
+ * - undefined 值会被跳过,不会覆盖已有值
210
+ * - 嵌套对象会递归合并
211
+ * - 数组会直接覆盖,不会合并
212
+ * - null 值会覆盖已有值
213
+ *
104
214
  * @param sources 源对象列表
105
215
  * @returns 合并后的对象
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // 基本合并
220
+ * deepMerge({ a: 1 }, { b: 2 }) // { a: 1, b: 2 }
221
+ *
222
+ * // undefined 不覆盖
223
+ * deepMerge({ a: 1 }, { a: undefined }) // { a: 1 }
224
+ *
225
+ * // 嵌套对象合并
226
+ * deepMerge({ a: { b: 1 } }, { a: { c: 2 } }) // { a: { b: 1, c: 2 } }
227
+ *
228
+ * // 数组覆盖
229
+ * deepMerge({ a: [1, 2] }, { a: [3, 4] }) // { a: [3, 4] }
230
+ * ```
106
231
  */
107
232
  declare function deepMerge<T extends Record<string, any>>(...sources: Partial<T>[]): T;
108
233
 
109
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
234
+ export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
235
+ export type { DateFormatOptions };
@@ -47,6 +47,17 @@ interface CopyResult {
47
47
  executionTime: number;
48
48
  }
49
49
 
50
+ /**
51
+ * 文件/目录条目信息
52
+ */
53
+ interface FileEntry {
54
+ /** 完整路径 */
55
+ path: string;
56
+ /** 是否为文件 */
57
+ isFile: boolean;
58
+ /** 是否为目录 */
59
+ isDirectory: boolean;
60
+ }
50
61
  /**
51
62
  * 检查源文件是否存在
52
63
  * @param sourcePath 源文件路径
@@ -60,12 +71,12 @@ declare function checkSourceExists(sourcePath: string): Promise<void>;
60
71
  */
61
72
  declare function ensureTargetDir(targetPath: string): Promise<void>;
62
73
  /**
63
- * 读取目录内容
74
+ * 读取目录内容(优化版:一次性获取文件类型信息)
64
75
  * @param dirPath 目录路径
65
76
  * @param recursive 是否递归读取
66
- * @returns 文件和目录列表
77
+ * @returns 文件和目录条目列表
67
78
  */
68
- declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<string[]>;
79
+ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<FileEntry[]>;
69
80
  /**
70
81
  * 检查文件是否需要更新
71
82
  * @param sourceFile 源文件路径
@@ -74,7 +85,7 @@ declare function readDirRecursive(dirPath: string, recursive: boolean): Promise<
74
85
  */
75
86
  declare function shouldUpdateFile(sourceFile: string, targetFile: string): Promise<boolean>;
76
87
  /**
77
- * 执行文件复制操作
88
+ * 执行文件复制操作(优化版:并行IO)
78
89
  * @param sourcePath 源文件或目录路径
79
90
  * @param targetPath 目标文件或目录路径
80
91
  * @param options 复制选项
@@ -97,13 +108,128 @@ declare function writeFileContent(filePath: string, content: string): Promise<vo
97
108
  */
98
109
  declare function readFileSync(filePath: string): string;
99
110
 
111
+ /**
112
+ * 数字补零格式化
113
+ *
114
+ * @param num 要格式化的数字
115
+ * @param length 目标长度
116
+ * @returns 补零后的字符串
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * padNumber(5, 2) // '05'
121
+ * padNumber(12, 3) // '012'
122
+ * padNumber(123, 2) // '123'
123
+ * ```
124
+ */
125
+ declare function padNumber(num: number, length?: number): string;
126
+ /**
127
+ * 生成随机哈希字符串
128
+ *
129
+ * @param length 哈希长度,范围 1-64
130
+ * @returns 随机哈希字符串
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * generateRandomHash(8) // 'a1b2c3d4'
135
+ * generateRandomHash(16) // 'a1b2c3d4e5f6g7h8'
136
+ * ```
137
+ */
138
+ declare function generateRandomHash(length?: number): string;
139
+ /**
140
+ * 日期格式化选项
141
+ */
142
+ interface DateFormatOptions {
143
+ /** 四位年份 */
144
+ YYYY: string;
145
+ /** 两位年份 */
146
+ YY: string;
147
+ /** 两位月份 */
148
+ MM: string;
149
+ /** 两位日期 */
150
+ DD: string;
151
+ /** 两位小时(24小时制) */
152
+ HH: string;
153
+ /** 两位分钟 */
154
+ mm: string;
155
+ /** 两位秒数 */
156
+ ss: string;
157
+ /** 三位毫秒 */
158
+ SSS: string;
159
+ /** 时间戳(毫秒) */
160
+ timestamp: string;
161
+ }
162
+ /**
163
+ * 获取日期格式化参数
164
+ *
165
+ * @param date 日期对象
166
+ * @returns 日期格式化参数对象
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const params = getDateFormatParams(new Date())
171
+ * // { YYYY: '2026', MM: '02', DD: '03', HH: '15', mm: '30', ss: '00', ... }
172
+ * ```
173
+ */
174
+ declare function getDateFormatParams(date?: Date): DateFormatOptions;
175
+ /**
176
+ * 格式化日期
177
+ *
178
+ * @param date 日期对象
179
+ * @param format 格式模板
180
+ * @returns 格式化后的日期字符串
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * formatDate(new Date(), '{YYYY}-{MM}-{DD}') // '2026-02-03'
185
+ * formatDate(new Date(), '{YYYY}{MM}{DD}{HH}{mm}{ss}') // '20260203153000'
186
+ * formatDate(new Date(), '{YYYY}.{MM}.{DD}') // '2026.02.03'
187
+ * ```
188
+ */
189
+ declare function formatDate(date: Date, format: string): string;
190
+ /**
191
+ * 解析模板字符串,替换占位符
192
+ *
193
+ * @param template 模板字符串
194
+ * @param values 占位符值映射
195
+ * @returns 替换后的字符串
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * parseTemplate('{name}-{version}', { name: 'app', version: '1.0.0' })
200
+ * // 'app-1.0.0'
201
+ * ```
202
+ */
203
+ declare function parseTemplate(template: string, values: Record<string, string>): string;
204
+
100
205
  /**
101
206
  * 深度合并对象
102
207
  *
103
- * @param target 目标对象
208
+ * @description 将多个源对象深度合并到一个新对象中。
209
+ * - undefined 值会被跳过,不会覆盖已有值
210
+ * - 嵌套对象会递归合并
211
+ * - 数组会直接覆盖,不会合并
212
+ * - null 值会覆盖已有值
213
+ *
104
214
  * @param sources 源对象列表
105
215
  * @returns 合并后的对象
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // 基本合并
220
+ * deepMerge({ a: 1 }, { b: 2 }) // { a: 1, b: 2 }
221
+ *
222
+ * // undefined 不覆盖
223
+ * deepMerge({ a: 1 }, { a: undefined }) // { a: 1 }
224
+ *
225
+ * // 嵌套对象合并
226
+ * deepMerge({ a: { b: 1 } }, { a: { c: 2 } }) // { a: { b: 1, c: 2 } }
227
+ *
228
+ * // 数组覆盖
229
+ * deepMerge({ a: [1, 2] }, { a: [3, 4] }) // { a: [3, 4] }
230
+ * ```
106
231
  */
107
232
  declare function deepMerge<T extends Record<string, any>>(...sources: Partial<T>[]): T;
108
233
 
109
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
234
+ export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent };
235
+ export type { DateFormatOptions };
@@ -1 +1 @@
1
- export{c as checkSourceExists,a as copySourceToTarget,e as ensureTargetDir,r as readDirRecursive,b as readFileSync,s as shouldUpdateFile,w as writeFileContent}from"../shared/vite-plugin.BZqhBDYR.mjs";export{V as Validator,d as deepMerge}from"../shared/vite-plugin.DSRKYuae.mjs";import"fs";import"path";
1
+ export{c as checkSourceExists,a as copySourceToTarget,e as ensureTargetDir,f as formatDate,g as generateRandomHash,b as getDateFormatParams,p as padNumber,d as parseTemplate,r as readDirRecursive,h as readFileSync,s as shouldUpdateFile,w as writeFileContent}from"../shared/vite-plugin.HZb-1B5l.mjs";export{V as Validator,d as deepMerge}from"../shared/vite-plugin.B88RyRN8.mjs";import"fs";import"path";import"crypto";
@@ -1 +1 @@
1
- "use strict";const index=require("../shared/vite-plugin.BT1oHRKK.cjs");require("../logger/index.cjs"),require("fs"),require("path"),require("../shared/vite-plugin.BTKhc7n7.cjs"),exports.BasePlugin=index.BasePlugin,exports.createPluginFactory=index.createPluginFactory;
1
+ "use strict";const index=require("../shared/vite-plugin.DqWt65U-.cjs");require("../logger/index.cjs"),require("fs"),require("path"),require("crypto"),require("../shared/vite-plugin.IGZeStMa.cjs"),exports.BasePlugin=index.BasePlugin,exports.createPluginFactory=index.createPluginFactory;
@@ -1 +1 @@
1
- export{B as BasePlugin,c as createPluginFactory}from"../shared/vite-plugin.ClHiVXD6.mjs";import"../logger/index.mjs";import"fs";import"path";import"../shared/vite-plugin.DSRKYuae.mjs";
1
+ export{B as BasePlugin,c as createPluginFactory}from"../shared/vite-plugin.C7isVPKg.mjs";import"../logger/index.mjs";import"fs";import"path";import"crypto";import"../shared/vite-plugin.B88RyRN8.mjs";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const index=require("./shared/vite-plugin.DrSzERYS.cjs"),validation=require("./shared/vite-plugin.BTKhc7n7.cjs"),index$1=require("./shared/vite-plugin.BT1oHRKK.cjs"),logger_index=require("./logger/index.cjs"),index$2=require("./shared/vite-plugin.Bn8mcCzy.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,exports.BasePlugin=index$1.BasePlugin,exports.createPluginFactory=index$1.createPluginFactory,exports.Logger=logger_index.Logger,exports.copyFile=index$2.copyFile,exports.injectIco=index$2.injectIco;
1
+ "use strict";const format=require("./shared/vite-plugin.D6NYITpX.cjs"),validation=require("./shared/vite-plugin.IGZeStMa.cjs"),index=require("./shared/vite-plugin.DqWt65U-.cjs"),logger_index=require("./logger/index.cjs"),index$1=require("./shared/vite-plugin.D8HTI0Ni.cjs");require("fs"),require("path"),require("crypto"),exports.checkSourceExists=format.checkSourceExists,exports.copySourceToTarget=format.copySourceToTarget,exports.ensureTargetDir=format.ensureTargetDir,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.shouldUpdateFile=format.shouldUpdateFile,exports.writeFileContent=format.writeFileContent,exports.Validator=validation.Validator,exports.deepMerge=validation.deepMerge,exports.BasePlugin=index.BasePlugin,exports.createPluginFactory=index.createPluginFactory,exports.Logger=logger_index.Logger,exports.copyFile=index$1.copyFile,exports.generateVersion=index$1.generateVersion,exports.injectIco=index$1.injectIco;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.cjs';
1
+ export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.cjs';
2
2
  export { V as Validator } from './shared/vite-plugin.CiHfwMiN.cjs';
3
3
  export { BasePlugin, createPluginFactory } from './factory/index.cjs';
4
4
  export { L as Logger, P as PluginLogger } from './shared/vite-plugin.B3PARlU9.cjs';
5
- export { copyFile, injectIco } from './plugins/index.cjs';
5
+ export { copyFile, generateVersion, injectIco } from './plugins/index.cjs';
6
6
  import 'vite';
7
7
  import './shared/vite-plugin.UkE7CdSe.cjs';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.mjs';
1
+ export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.mjs';
2
2
  export { V as Validator } from './shared/vite-plugin.CiHfwMiN.mjs';
3
3
  export { BasePlugin, createPluginFactory } from './factory/index.mjs';
4
4
  export { L as Logger, P as PluginLogger } from './shared/vite-plugin.B3PARlU9.mjs';
5
- export { copyFile, injectIco } from './plugins/index.mjs';
5
+ export { copyFile, generateVersion, injectIco } from './plugins/index.mjs';
6
6
  import 'vite';
7
7
  import './shared/vite-plugin.UkE7CdSe.mjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.js';
1
+ export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, shouldUpdateFile, writeFileContent } from './common/index.js';
2
2
  export { V as Validator } from './shared/vite-plugin.CiHfwMiN.js';
3
3
  export { BasePlugin, createPluginFactory } from './factory/index.js';
4
4
  export { L as Logger, P as PluginLogger } from './shared/vite-plugin.B3PARlU9.js';
5
- export { copyFile, injectIco } from './plugins/index.js';
5
+ export { copyFile, generateVersion, injectIco } from './plugins/index.js';
6
6
  import 'vite';
7
7
  import './shared/vite-plugin.UkE7CdSe.js';
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{c as checkSourceExists,a as copySourceToTarget,e as ensureTargetDir,r as readDirRecursive,b as readFileSync,s as shouldUpdateFile,w as writeFileContent}from"./shared/vite-plugin.BZqhBDYR.mjs";export{V as Validator,d as deepMerge}from"./shared/vite-plugin.DSRKYuae.mjs";export{B as BasePlugin,c as createPluginFactory}from"./shared/vite-plugin.ClHiVXD6.mjs";export{Logger}from"./logger/index.mjs";export{c as copyFile,i as injectIco}from"./shared/vite-plugin.CY2ydccp.mjs";import"fs";import"path";
1
+ export{c as checkSourceExists,a as copySourceToTarget,e as ensureTargetDir,f as formatDate,g as generateRandomHash,b as getDateFormatParams,p as padNumber,d as parseTemplate,r as readDirRecursive,h as readFileSync,s as shouldUpdateFile,w as writeFileContent}from"./shared/vite-plugin.HZb-1B5l.mjs";export{V as Validator,d as deepMerge}from"./shared/vite-plugin.B88RyRN8.mjs";export{B as BasePlugin,c as createPluginFactory}from"./shared/vite-plugin.C7isVPKg.mjs";export{Logger}from"./logger/index.mjs";export{c as copyFile,g as generateVersion,i as injectIco}from"./shared/vite-plugin.Dd2ogbSe.mjs";import"fs";import"path";import"crypto";
@@ -1 +1 @@
1
- "use strict";class Logger{static instance=null;libName="@meng-xi/vite-plugin";pluginConfigs=new Map;logTypes={info:{method:console.log,icon:"",color:"",reset:""},success:{method:console.log,icon:"\u2705",color:"\x1B[32m",reset:"\x1B[0m"},warn:{method:console.warn,icon:"\u26A0\uFE0F",color:"\x1B[33m",reset:"\x1B[0m"},error:{method:console.error,icon:"\u274C",color:"\x1B[31m",reset:"\x1B[0m"}};constructor(){}static getInstance(){return Logger.instance||(Logger.instance=new Logger),Logger.instance}static create(n){const e=Logger.getInstance();return e.registerPlugin(n.name,n.enabled??!0),e}registerPlugin(n,e){this.pluginConfigs.set(n,e)}formatPrefix(n){let e=`[${this.libName}:${n}]`;return e=`[${new Date().toLocaleString()}] ${e}`,e}isPluginEnabled(n){return this.pluginConfigs.get(n)??!0}log(n,e,t,i){if(!this.isPluginEnabled(n))return;const l=this.formatPrefix(n),u=this.logTypes[e],{method:s,icon:c,color:r,reset:o}=u,a=c?`${c} ${l}`:l;s("=================================="),i!=null?s(r+a+o,r+t+o,i):s(r+a+o,r+t+o),s("==================================")}createPluginLogger(n){return{success:(e,t)=>this.log(n,"success",e,t),info:(e,t)=>this.log(n,"info",e,t),warn:(e,t)=>this.log(n,"warn",e,t),error:(e,t)=>this.log(n,"error",e,t)}}}exports.Logger=Logger;
1
+ "use strict";class Logger{static instance=null;libName="@meng-xi/vite-plugin";pluginConfigs=new Map;logTypes={info:{method:console.log,icon:"\u2139\uFE0F",color:"\x1B[36m",reset:"\x1B[0m"},success:{method:console.log,icon:"\u2705",color:"\x1B[32m",reset:"\x1B[0m"},warn:{method:console.warn,icon:"\u26A0\uFE0F",color:"\x1B[33m",reset:"\x1B[0m"},error:{method:console.error,icon:"\u274C",color:"\x1B[31m",reset:"\x1B[0m"}};constructor(){}static getInstance(){return Logger.instance||(Logger.instance=new Logger),Logger.instance}static create(e){const n=Logger.getInstance();return n.registerPlugin(e.name,e.enabled??!0),n}registerPlugin(e,n){this.pluginConfigs.set(e,n)}formatPrefix(e){return`[${this.libName}:${e}]`}isPluginEnabled(e){return this.pluginConfigs.get(e)??!0}log(e,n,t,r){if(!this.isPluginEnabled(e))return;const l=this.formatPrefix(e),u=this.logTypes[n],{method:i,icon:a,color:s,reset:o}=u,c=`${a} ${l}`;r!=null?i(s+c+o,s+t+o,r):i(s+c+o,s+t+o)}createPluginLogger(e){return{success:(n,t)=>this.log(e,"success",n,t),info:(n,t)=>this.log(e,"info",n,t),warn:(n,t)=>this.log(e,"warn",n,t),error:(n,t)=>this.log(e,"error",n,t)}}}exports.Logger=Logger;
@@ -1 +1 @@
1
- class s{static instance=null;libName="@meng-xi/vite-plugin";pluginConfigs=new Map;logTypes={info:{method:console.log,icon:"",color:"",reset:""},success:{method:console.log,icon:"\u2705",color:"\x1B[32m",reset:"\x1B[0m"},warn:{method:console.warn,icon:"\u26A0\uFE0F",color:"\x1B[33m",reset:"\x1B[0m"},error:{method:console.error,icon:"\u274C",color:"\x1B[31m",reset:"\x1B[0m"}};constructor(){}static getInstance(){return s.instance||(s.instance=new s),s.instance}static create(n){const e=s.getInstance();return e.registerPlugin(n.name,n.enabled??!0),e}registerPlugin(n,e){this.pluginConfigs.set(n,e)}formatPrefix(n){let e=`[${this.libName}:${n}]`;return e=`[${new Date().toLocaleString()}] ${e}`,e}isPluginEnabled(n){return this.pluginConfigs.get(n)??!0}log(n,e,t,l){if(!this.isPluginEnabled(n))return;const c=this.formatPrefix(n),g=this.logTypes[e],{method:o,icon:a,color:r,reset:i}=g,u=a?`${a} ${c}`:c;o("=================================="),l!=null?o(r+u+i,r+t+i,l):o(r+u+i,r+t+i),o("==================================")}createPluginLogger(n){return{success:(e,t)=>this.log(n,"success",e,t),info:(e,t)=>this.log(n,"info",e,t),warn:(e,t)=>this.log(n,"warn",e,t),error:(e,t)=>this.log(n,"error",e,t)}}}export{s as Logger};
1
+ class o{static instance=null;libName="@meng-xi/vite-plugin";pluginConfigs=new Map;logTypes={info:{method:console.log,icon:"\u2139\uFE0F",color:"\x1B[36m",reset:"\x1B[0m"},success:{method:console.log,icon:"\u2705",color:"\x1B[32m",reset:"\x1B[0m"},warn:{method:console.warn,icon:"\u26A0\uFE0F",color:"\x1B[33m",reset:"\x1B[0m"},error:{method:console.error,icon:"\u274C",color:"\x1B[31m",reset:"\x1B[0m"}};constructor(){}static getInstance(){return o.instance||(o.instance=new o),o.instance}static create(e){const n=o.getInstance();return n.registerPlugin(e.name,e.enabled??!0),n}registerPlugin(e,n){this.pluginConfigs.set(e,n)}formatPrefix(e){return`[${this.libName}:${e}]`}isPluginEnabled(e){return this.pluginConfigs.get(e)??!0}log(e,n,t,i){if(!this.isPluginEnabled(e))return;const u=this.formatPrefix(e),a=this.logTypes[n],{method:l,icon:g,color:r,reset:s}=a,c=`${g} ${u}`;i!=null?l(r+c+s,r+t+s,i):l(r+c+s,r+t+s)}createPluginLogger(e){return{success:(n,t)=>this.log(e,"success",n,t),info:(n,t)=>this.log(e,"info",n,t),warn:(n,t)=>this.log(e,"warn",n,t),error:(n,t)=>this.log(e,"error",n,t)}}}export{o as Logger};
@@ -1 +1 @@
1
- "use strict";const index=require("../shared/vite-plugin.Bn8mcCzy.cjs");require("../shared/vite-plugin.BT1oHRKK.cjs"),require("../logger/index.cjs"),require("fs"),require("path"),require("../shared/vite-plugin.BTKhc7n7.cjs"),require("../shared/vite-plugin.DrSzERYS.cjs"),exports.copyFile=index.copyFile,exports.injectIco=index.injectIco;
1
+ "use strict";const index=require("../shared/vite-plugin.D8HTI0Ni.cjs");require("../shared/vite-plugin.DqWt65U-.cjs"),require("../logger/index.cjs"),require("fs"),require("path"),require("crypto"),require("../shared/vite-plugin.IGZeStMa.cjs"),require("../shared/vite-plugin.D6NYITpX.cjs"),exports.copyFile=index.copyFile,exports.generateVersion=index.generateVersion,exports.injectIco=index.injectIco;