@meng-xi/vite-plugin 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-en.md +186 -25
- package/README.md +343 -182
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.d.cts +9 -1
- package/dist/common/index.d.mts +9 -1
- package/dist/common/index.d.ts +9 -1
- package/dist/common/index.mjs +1 -1
- package/dist/factory/index.cjs +1 -1
- package/dist/factory/index.d.cts +71 -6
- package/dist/factory/index.d.mts +71 -6
- package/dist/factory/index.d.ts +71 -6
- package/dist/factory/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1 -1
- package/dist/logger/index.cjs +1 -1
- package/dist/logger/index.d.cts +1 -1
- package/dist/logger/index.d.mts +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.mjs +1 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.d.cts +82 -7
- package/dist/plugins/index.d.mts +82 -7
- package/dist/plugins/index.d.ts +82 -7
- package/dist/plugins/index.mjs +1 -1
- package/dist/shared/vite-plugin.B5wW4CiL.mjs +36 -0
- package/dist/shared/vite-plugin.Ba9646wL.cjs +1 -0
- package/dist/shared/vite-plugin.C3ejdBNf.mjs +1 -0
- package/dist/shared/{vite-plugin.B3PARlU9.d.cts → vite-plugin.CLr0ttuO.d.cts} +16 -0
- package/dist/shared/{vite-plugin.B3PARlU9.d.mts → vite-plugin.CLr0ttuO.d.mts} +16 -0
- package/dist/shared/{vite-plugin.B3PARlU9.d.ts → vite-plugin.CLr0ttuO.d.ts} +16 -0
- package/dist/shared/vite-plugin.CXlzkIgT.cjs +36 -0
- package/dist/shared/vite-plugin.CawoITTT.cjs +1 -0
- package/dist/shared/vite-plugin.DSb6XzBn.mjs +1 -0
- package/package.json +72 -72
- package/dist/shared/vite-plugin.BZsetDCm.cjs +0 -1
- package/dist/shared/vite-plugin.C7isVPKg.mjs +0 -1
- package/dist/shared/vite-plugin.CS9a5kjK.mjs +0 -36
- package/dist/shared/vite-plugin.CgnG5_UX.cjs +0 -36
- package/dist/shared/vite-plugin.DqWt65U-.cjs +0 -1
- package/dist/shared/vite-plugin.UkE7CdSe.d.cts +0 -43
- package/dist/shared/vite-plugin.UkE7CdSe.d.mts +0 -43
- package/dist/shared/vite-plugin.UkE7CdSe.d.ts +0 -43
- package/dist/shared/vite-plugin.YvjM8LxW.mjs +0 -1
package/dist/factory/index.d.cts
CHANGED
|
@@ -1,8 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.B3PARlU9.cjs';
|
|
1
|
+
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
+
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.CLr0ttuO.cjs';
|
|
4
3
|
import { V as Validator } from '../shared/vite-plugin.CiHfwMiN.cjs';
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 带插件实例引用的 Vite 插件类型
|
|
7
|
+
*
|
|
8
|
+
* @template T 插件配置类型
|
|
9
|
+
*/
|
|
10
|
+
interface PluginWithInstance<T extends BasePluginOptions = BasePluginOptions> extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* 原始插件实例的引用,方便外部访问插件内部状态
|
|
13
|
+
*/
|
|
14
|
+
pluginInstance?: BasePlugin<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 基础插件配置
|
|
18
|
+
*
|
|
19
|
+
* @interface BasePluginOptions
|
|
20
|
+
*/
|
|
21
|
+
interface BasePluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* 是否启用插件
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 是否启用日志
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
verbose?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 错误处理策略
|
|
36
|
+
*
|
|
37
|
+
* @default 'throw'
|
|
38
|
+
*/
|
|
39
|
+
errorStrategy?: 'throw' | 'log' | 'ignore';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 插件选项标准化器类型
|
|
43
|
+
*
|
|
44
|
+
* @template T 目标选项类型
|
|
45
|
+
* @template R 原始选项类型
|
|
46
|
+
*/
|
|
47
|
+
type OptionsNormalizer<T, R = any> = (raw?: R) => T;
|
|
48
|
+
/**
|
|
49
|
+
* 插件工厂函数类型
|
|
50
|
+
*
|
|
51
|
+
* @template T 插件配置类型,默认继承自 BasePluginOptions
|
|
52
|
+
* @template R 原始配置类型,默认与 T 相同
|
|
53
|
+
*/
|
|
54
|
+
type PluginFactory<T extends BasePluginOptions = BasePluginOptions, R = T> = (options?: R) => PluginWithInstance<T>;
|
|
55
|
+
|
|
6
56
|
/**
|
|
7
57
|
* 基础插件抽象类,提供插件开发的核心功能和生命周期管理
|
|
8
58
|
*
|
|
@@ -66,11 +116,10 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
66
116
|
* 获取插件的默认配置选项
|
|
67
117
|
*
|
|
68
118
|
* @protected
|
|
69
|
-
* @abstract
|
|
70
119
|
* @returns {Partial<T>} 插件特定的默认配置
|
|
71
|
-
* @description
|
|
120
|
+
* @description 子类可以重写此方法,以提供插件特定的默认配置值。默认返回空对象
|
|
72
121
|
*/
|
|
73
|
-
protected
|
|
122
|
+
protected getDefaultOptions(): Partial<T>;
|
|
74
123
|
/**
|
|
75
124
|
* 合并插件配置,将用户提供的配置与默认配置合并
|
|
76
125
|
*
|
|
@@ -142,6 +191,21 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
142
191
|
* @description 处理 Vite 配置解析完成事件,将解析后的配置存储到插件实例中
|
|
143
192
|
*/
|
|
144
193
|
protected onConfigResolved(config: ResolvedConfig): void;
|
|
194
|
+
/**
|
|
195
|
+
* 插件销毁生命周期
|
|
196
|
+
*
|
|
197
|
+
* @protected
|
|
198
|
+
* @virtual
|
|
199
|
+
* @description 插件销毁时调用的清理方法。基类会注销日志配置,子类可重写此方法添加自定义清理逻辑
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* protected destroy(): void {
|
|
203
|
+
* super.destroy()
|
|
204
|
+
* this.stopWatching()
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
protected destroy(): void;
|
|
145
209
|
/**
|
|
146
210
|
* 添加插件钩子到 Vite 插件对象
|
|
147
211
|
*
|
|
@@ -258,3 +322,4 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
258
322
|
declare function createPluginFactory<T extends BasePluginOptions, P extends BasePlugin<T>, R = T>(PluginClass: new (options: T, loggerConfig?: LoggerOptions) => P, normalizer?: OptionsNormalizer<T, R>): PluginFactory<T, R>;
|
|
259
323
|
|
|
260
324
|
export { BasePlugin, createPluginFactory };
|
|
325
|
+
export type { BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance };
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,8 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.B3PARlU9.mjs';
|
|
1
|
+
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
+
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.CLr0ttuO.mjs';
|
|
4
3
|
import { V as Validator } from '../shared/vite-plugin.CiHfwMiN.mjs';
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 带插件实例引用的 Vite 插件类型
|
|
7
|
+
*
|
|
8
|
+
* @template T 插件配置类型
|
|
9
|
+
*/
|
|
10
|
+
interface PluginWithInstance<T extends BasePluginOptions = BasePluginOptions> extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* 原始插件实例的引用,方便外部访问插件内部状态
|
|
13
|
+
*/
|
|
14
|
+
pluginInstance?: BasePlugin<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 基础插件配置
|
|
18
|
+
*
|
|
19
|
+
* @interface BasePluginOptions
|
|
20
|
+
*/
|
|
21
|
+
interface BasePluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* 是否启用插件
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 是否启用日志
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
verbose?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 错误处理策略
|
|
36
|
+
*
|
|
37
|
+
* @default 'throw'
|
|
38
|
+
*/
|
|
39
|
+
errorStrategy?: 'throw' | 'log' | 'ignore';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 插件选项标准化器类型
|
|
43
|
+
*
|
|
44
|
+
* @template T 目标选项类型
|
|
45
|
+
* @template R 原始选项类型
|
|
46
|
+
*/
|
|
47
|
+
type OptionsNormalizer<T, R = any> = (raw?: R) => T;
|
|
48
|
+
/**
|
|
49
|
+
* 插件工厂函数类型
|
|
50
|
+
*
|
|
51
|
+
* @template T 插件配置类型,默认继承自 BasePluginOptions
|
|
52
|
+
* @template R 原始配置类型,默认与 T 相同
|
|
53
|
+
*/
|
|
54
|
+
type PluginFactory<T extends BasePluginOptions = BasePluginOptions, R = T> = (options?: R) => PluginWithInstance<T>;
|
|
55
|
+
|
|
6
56
|
/**
|
|
7
57
|
* 基础插件抽象类,提供插件开发的核心功能和生命周期管理
|
|
8
58
|
*
|
|
@@ -66,11 +116,10 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
66
116
|
* 获取插件的默认配置选项
|
|
67
117
|
*
|
|
68
118
|
* @protected
|
|
69
|
-
* @abstract
|
|
70
119
|
* @returns {Partial<T>} 插件特定的默认配置
|
|
71
|
-
* @description
|
|
120
|
+
* @description 子类可以重写此方法,以提供插件特定的默认配置值。默认返回空对象
|
|
72
121
|
*/
|
|
73
|
-
protected
|
|
122
|
+
protected getDefaultOptions(): Partial<T>;
|
|
74
123
|
/**
|
|
75
124
|
* 合并插件配置,将用户提供的配置与默认配置合并
|
|
76
125
|
*
|
|
@@ -142,6 +191,21 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
142
191
|
* @description 处理 Vite 配置解析完成事件,将解析后的配置存储到插件实例中
|
|
143
192
|
*/
|
|
144
193
|
protected onConfigResolved(config: ResolvedConfig): void;
|
|
194
|
+
/**
|
|
195
|
+
* 插件销毁生命周期
|
|
196
|
+
*
|
|
197
|
+
* @protected
|
|
198
|
+
* @virtual
|
|
199
|
+
* @description 插件销毁时调用的清理方法。基类会注销日志配置,子类可重写此方法添加自定义清理逻辑
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* protected destroy(): void {
|
|
203
|
+
* super.destroy()
|
|
204
|
+
* this.stopWatching()
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
protected destroy(): void;
|
|
145
209
|
/**
|
|
146
210
|
* 添加插件钩子到 Vite 插件对象
|
|
147
211
|
*
|
|
@@ -258,3 +322,4 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
258
322
|
declare function createPluginFactory<T extends BasePluginOptions, P extends BasePlugin<T>, R = T>(PluginClass: new (options: T, loggerConfig?: LoggerOptions) => P, normalizer?: OptionsNormalizer<T, R>): PluginFactory<T, R>;
|
|
259
323
|
|
|
260
324
|
export { BasePlugin, createPluginFactory };
|
|
325
|
+
export type { BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance };
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,8 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.B3PARlU9.js';
|
|
1
|
+
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
+
import { P as PluginLogger, a as LoggerOptions } from '../shared/vite-plugin.CLr0ttuO.js';
|
|
4
3
|
import { V as Validator } from '../shared/vite-plugin.CiHfwMiN.js';
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 带插件实例引用的 Vite 插件类型
|
|
7
|
+
*
|
|
8
|
+
* @template T 插件配置类型
|
|
9
|
+
*/
|
|
10
|
+
interface PluginWithInstance<T extends BasePluginOptions = BasePluginOptions> extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* 原始插件实例的引用,方便外部访问插件内部状态
|
|
13
|
+
*/
|
|
14
|
+
pluginInstance?: BasePlugin<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 基础插件配置
|
|
18
|
+
*
|
|
19
|
+
* @interface BasePluginOptions
|
|
20
|
+
*/
|
|
21
|
+
interface BasePluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* 是否启用插件
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 是否启用日志
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
verbose?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 错误处理策略
|
|
36
|
+
*
|
|
37
|
+
* @default 'throw'
|
|
38
|
+
*/
|
|
39
|
+
errorStrategy?: 'throw' | 'log' | 'ignore';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 插件选项标准化器类型
|
|
43
|
+
*
|
|
44
|
+
* @template T 目标选项类型
|
|
45
|
+
* @template R 原始选项类型
|
|
46
|
+
*/
|
|
47
|
+
type OptionsNormalizer<T, R = any> = (raw?: R) => T;
|
|
48
|
+
/**
|
|
49
|
+
* 插件工厂函数类型
|
|
50
|
+
*
|
|
51
|
+
* @template T 插件配置类型,默认继承自 BasePluginOptions
|
|
52
|
+
* @template R 原始配置类型,默认与 T 相同
|
|
53
|
+
*/
|
|
54
|
+
type PluginFactory<T extends BasePluginOptions = BasePluginOptions, R = T> = (options?: R) => PluginWithInstance<T>;
|
|
55
|
+
|
|
6
56
|
/**
|
|
7
57
|
* 基础插件抽象类,提供插件开发的核心功能和生命周期管理
|
|
8
58
|
*
|
|
@@ -66,11 +116,10 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
66
116
|
* 获取插件的默认配置选项
|
|
67
117
|
*
|
|
68
118
|
* @protected
|
|
69
|
-
* @abstract
|
|
70
119
|
* @returns {Partial<T>} 插件特定的默认配置
|
|
71
|
-
* @description
|
|
120
|
+
* @description 子类可以重写此方法,以提供插件特定的默认配置值。默认返回空对象
|
|
72
121
|
*/
|
|
73
|
-
protected
|
|
122
|
+
protected getDefaultOptions(): Partial<T>;
|
|
74
123
|
/**
|
|
75
124
|
* 合并插件配置,将用户提供的配置与默认配置合并
|
|
76
125
|
*
|
|
@@ -142,6 +191,21 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
142
191
|
* @description 处理 Vite 配置解析完成事件,将解析后的配置存储到插件实例中
|
|
143
192
|
*/
|
|
144
193
|
protected onConfigResolved(config: ResolvedConfig): void;
|
|
194
|
+
/**
|
|
195
|
+
* 插件销毁生命周期
|
|
196
|
+
*
|
|
197
|
+
* @protected
|
|
198
|
+
* @virtual
|
|
199
|
+
* @description 插件销毁时调用的清理方法。基类会注销日志配置,子类可重写此方法添加自定义清理逻辑
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* protected destroy(): void {
|
|
203
|
+
* super.destroy()
|
|
204
|
+
* this.stopWatching()
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
protected destroy(): void;
|
|
145
209
|
/**
|
|
146
210
|
* 添加插件钩子到 Vite 插件对象
|
|
147
211
|
*
|
|
@@ -258,3 +322,4 @@ declare abstract class BasePlugin<T extends BasePluginOptions = BasePluginOption
|
|
|
258
322
|
declare function createPluginFactory<T extends BasePluginOptions, P extends BasePlugin<T>, R = T>(PluginClass: new (options: T, loggerConfig?: LoggerOptions) => P, normalizer?: OptionsNormalizer<T, R>): PluginFactory<T, R>;
|
|
259
323
|
|
|
260
324
|
export { BasePlugin, createPluginFactory };
|
|
325
|
+
export type { BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance };
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{B as BasePlugin,c as createPluginFactory}from"../shared/vite-plugin.
|
|
1
|
+
export{B as BasePlugin,c as createPluginFactory}from"../shared/vite-plugin.DSb6XzBn.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 format=require("./shared/vite-plugin.
|
|
1
|
+
"use strict";const format=require("./shared/vite-plugin.Ba9646wL.cjs"),validation=require("./shared/vite-plugin.IGZeStMa.cjs"),index=require("./shared/vite-plugin.CawoITTT.cjs"),logger_index=require("./logger/index.cjs"),index$1=require("./shared/vite-plugin.CXlzkIgT.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.readFileContent=format.readFileContent,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,exports.BasePlugin=index.BasePlugin,exports.createPluginFactory=index.createPluginFactory,exports.Logger=logger_index.Logger,exports.copyFile=index$1.copyFile,exports.generateRouter=index$1.generateRouter,exports.generateVersion=index$1.generateVersion,exports.injectIco=index$1.injectIco;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.cjs';
|
|
1
|
+
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileContent, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.cjs';
|
|
2
2
|
export { V as Validator } from './shared/vite-plugin.CiHfwMiN.cjs';
|
|
3
|
-
export { BasePlugin, createPluginFactory } from './factory/index.cjs';
|
|
4
|
-
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.
|
|
5
|
-
export { copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.cjs';
|
|
3
|
+
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.cjs';
|
|
4
|
+
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.CLr0ttuO.cjs';
|
|
5
|
+
export { CopyFileOptions, GenerateRouterOptions, GenerateVersionOptions, Icon, InjectIcoOptions, NameStrategy, OutputFormat, OutputType, RouteConfig, RouteMeta, UniAppPageConfig, UniAppPagesJson, UniAppTabBarConfig, VersionFormat, copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.cjs';
|
|
6
6
|
import 'vite';
|
|
7
|
-
import './shared/vite-plugin.UkE7CdSe.cjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.mjs';
|
|
1
|
+
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileContent, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.mjs';
|
|
2
2
|
export { V as Validator } from './shared/vite-plugin.CiHfwMiN.mjs';
|
|
3
|
-
export { BasePlugin, createPluginFactory } from './factory/index.mjs';
|
|
4
|
-
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.
|
|
5
|
-
export { copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.mjs';
|
|
3
|
+
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.mjs';
|
|
4
|
+
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.CLr0ttuO.mjs';
|
|
5
|
+
export { CopyFileOptions, GenerateRouterOptions, GenerateVersionOptions, Icon, InjectIcoOptions, NameStrategy, OutputFormat, OutputType, RouteConfig, RouteMeta, UniAppPageConfig, UniAppPagesJson, UniAppTabBarConfig, VersionFormat, copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.mjs';
|
|
6
6
|
import 'vite';
|
|
7
|
-
import './shared/vite-plugin.UkE7CdSe.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.js';
|
|
1
|
+
export { DateFormatOptions, checkSourceExists, copySourceToTarget, deepMerge, ensureTargetDir, fileExists, formatDate, generateRandomHash, getDateFormatParams, padNumber, parseTemplate, readDirRecursive, readFileContent, readFileSync, runWithConcurrency, shouldUpdateFile, stripJsonComments, toCamelCase, toPascalCase, writeFileContent } from './common/index.js';
|
|
2
2
|
export { V as Validator } from './shared/vite-plugin.CiHfwMiN.js';
|
|
3
|
-
export { BasePlugin, createPluginFactory } from './factory/index.js';
|
|
4
|
-
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.
|
|
5
|
-
export { copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.js';
|
|
3
|
+
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.js';
|
|
4
|
+
export { L as Logger, P as PluginLogger } from './shared/vite-plugin.CLr0ttuO.js';
|
|
5
|
+
export { CopyFileOptions, GenerateRouterOptions, GenerateVersionOptions, Icon, InjectIcoOptions, NameStrategy, OutputFormat, OutputType, RouteConfig, RouteMeta, UniAppPageConfig, UniAppPagesJson, UniAppTabBarConfig, VersionFormat, copyFile, generateRouter, generateVersion, injectIco } from './plugins/index.js';
|
|
6
6
|
import 'vite';
|
|
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,f as fileExists,b as formatDate,g as generateRandomHash,d as getDateFormatParams,p as padNumber,h as parseTemplate,r as readDirRecursive,i as
|
|
1
|
+
export{c as checkSourceExists,a as copySourceToTarget,e as ensureTargetDir,f as fileExists,b as formatDate,g as generateRandomHash,d as getDateFormatParams,p as padNumber,h as parseTemplate,r as readDirRecursive,i as readFileContent,j as readFileSync,k as runWithConcurrency,s as shouldUpdateFile,l as stripJsonComments,t as toCamelCase,m as toPascalCase,w as writeFileContent}from"./shared/vite-plugin.C3ejdBNf.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.DSb6XzBn.mjs";export{Logger}from"./logger/index.mjs";export{c as copyFile,g as generateRouter,a as generateVersion,i as injectIco}from"./shared/vite-plugin.B5wW4CiL.mjs";import"fs";import"path";import"crypto";
|
package/dist/logger/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 t=Logger.getInstance();return t.registerPlugin(e.name,e.enabled??!0),t}registerPlugin(e,t){this.pluginConfigs.set(e,t)}unregisterPlugin(e){this.pluginConfigs.delete(e)}static unregister(e){Logger.instance&&Logger.instance.unregisterPlugin(e)}static destroy(){Logger.instance&&(Logger.instance.pluginConfigs.clear(),Logger.instance=null)}formatPrefix(e){return`[${this.libName}:${e}]`}isPluginEnabled(e){return this.pluginConfigs.get(e)??!0}log(e,t,n,r){if(!this.isPluginEnabled(e))return;const l=this.formatPrefix(e),u=this.logTypes[t],{method:o,icon:a,color:s,reset:i}=u,c=`${a} ${l}`;r!=null?o(s+c+i,s+n+i,r):o(s+c+i,s+n+i)}createPluginLogger(e){return{success:(t,n)=>this.log(e,"success",t,n),info:(t,n)=>this.log(e,"info",t,n),warn:(t,n)=>this.log(e,"warn",t,n),error:(t,n)=>this.log(e,"error",t,n)}}}exports.Logger=Logger;
|
package/dist/logger/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.
|
|
1
|
+
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.CLr0ttuO.cjs';
|
package/dist/logger/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.
|
|
1
|
+
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.CLr0ttuO.mjs';
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.
|
|
1
|
+
export { L as Logger, P as PluginLogger } from '../shared/vite-plugin.CLr0ttuO.js';
|
package/dist/logger/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class
|
|
1
|
+
class t{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 t.instance||(t.instance=new t),t.instance}static create(e){const n=t.getInstance();return n.registerPlugin(e.name,e.enabled??!0),n}registerPlugin(e,n){this.pluginConfigs.set(e,n)}unregisterPlugin(e){this.pluginConfigs.delete(e)}static unregister(e){t.instance&&t.instance.unregisterPlugin(e)}static destroy(){t.instance&&(t.instance.pluginConfigs.clear(),t.instance=null)}formatPrefix(e){return`[${this.libName}:${e}]`}isPluginEnabled(e){return this.pluginConfigs.get(e)??!0}log(e,n,s,o){if(!this.isPluginEnabled(e))return;const u=this.formatPrefix(e),a=this.logTypes[n],{method:l,icon:g,color:i,reset:r}=a,c=`${g} ${u}`;o!=null?l(i+c+r,i+s+r,o):l(i+c+r,i+s+r)}createPluginLogger(e){return{success:(n,s)=>this.log(e,"success",n,s),info:(n,s)=>this.log(e,"info",n,s),warn:(n,s)=>this.log(e,"warn",n,s),error:(n,s)=>this.log(e,"error",n,s)}}}export{t as Logger};
|
package/dist/plugins/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const index=require("../shared/vite-plugin.
|
|
1
|
+
"use strict";const index=require("../shared/vite-plugin.CXlzkIgT.cjs");require("../shared/vite-plugin.CawoITTT.cjs"),require("../logger/index.cjs"),require("fs"),require("path"),require("crypto"),require("../shared/vite-plugin.IGZeStMa.cjs"),require("../shared/vite-plugin.Ba9646wL.cjs"),exports.copyFile=index.copyFile,exports.generateRouter=index.generateRouter,exports.generateVersion=index.generateVersion,exports.injectIco=index.injectIco;
|
package/dist/plugins/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasePluginOptions, PluginFactory } from '../factory/index.cjs';
|
|
2
2
|
import 'vite';
|
|
3
|
+
import '../shared/vite-plugin.CLr0ttuO.cjs';
|
|
4
|
+
import '../shared/vite-plugin.CiHfwMiN.cjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* 复制文件插件的配置选项接口
|
|
@@ -72,6 +74,84 @@ interface CopyFileOptions extends BasePluginOptions {
|
|
|
72
74
|
*/
|
|
73
75
|
declare const copyFile: PluginFactory<CopyFileOptions, CopyFileOptions>;
|
|
74
76
|
|
|
77
|
+
/**
|
|
78
|
+
* 路由元信息
|
|
79
|
+
*/
|
|
80
|
+
interface RouteMeta {
|
|
81
|
+
/** 页面标题 */
|
|
82
|
+
title?: string;
|
|
83
|
+
/** 是否为TabBar页面 */
|
|
84
|
+
isTab?: boolean;
|
|
85
|
+
/** 是否需要登录 */
|
|
86
|
+
requireAuth?: boolean;
|
|
87
|
+
/** 自定义扩展字段 */
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 路由配置项
|
|
92
|
+
*/
|
|
93
|
+
interface RouteConfig {
|
|
94
|
+
/** 路由路径 */
|
|
95
|
+
path: string;
|
|
96
|
+
/** 路由名称(用于命名路由导航) */
|
|
97
|
+
name?: string;
|
|
98
|
+
/** 路由元信息 */
|
|
99
|
+
meta?: RouteMeta;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* uni-app pages.json 中的页面配置项
|
|
103
|
+
*/
|
|
104
|
+
interface UniAppPageConfig {
|
|
105
|
+
/** 页面路径 */
|
|
106
|
+
path: string;
|
|
107
|
+
/** 页面样式 */
|
|
108
|
+
style?: {
|
|
109
|
+
/** 导航栏标题 */
|
|
110
|
+
navigationBarTitleText?: string;
|
|
111
|
+
/** 是否需要登录 */
|
|
112
|
+
requireAuth?: boolean;
|
|
113
|
+
/** 其他自定义属性 */
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
};
|
|
116
|
+
/** 其他属性 */
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* uni-app pages.json 中的 tabBar 配置
|
|
121
|
+
*/
|
|
122
|
+
interface UniAppTabBarConfig {
|
|
123
|
+
/** tabBar 列表 */
|
|
124
|
+
list?: Array<{
|
|
125
|
+
/** 页面路径 */
|
|
126
|
+
pagePath: string;
|
|
127
|
+
/** 文字 */
|
|
128
|
+
text?: string;
|
|
129
|
+
/** 图标路径 */
|
|
130
|
+
iconPath?: string;
|
|
131
|
+
/** 选中图标路径 */
|
|
132
|
+
selectedIconPath?: string;
|
|
133
|
+
}>;
|
|
134
|
+
/** 其他属性 */
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* uni-app pages.json 结构
|
|
139
|
+
*/
|
|
140
|
+
interface UniAppPagesJson {
|
|
141
|
+
/** 页面列表 */
|
|
142
|
+
pages: UniAppPageConfig[];
|
|
143
|
+
/** 子包 */
|
|
144
|
+
subPackages?: Array<{
|
|
145
|
+
root: string;
|
|
146
|
+
pages: UniAppPageConfig[];
|
|
147
|
+
}>;
|
|
148
|
+
/** tabBar 配置 */
|
|
149
|
+
tabBar?: UniAppTabBarConfig;
|
|
150
|
+
/** 全局样式 */
|
|
151
|
+
globalStyle?: Record<string, unknown>;
|
|
152
|
+
/** 其他属性 */
|
|
153
|
+
[key: string]: unknown;
|
|
154
|
+
}
|
|
75
155
|
/**
|
|
76
156
|
* 输出文件格式类型
|
|
77
157
|
*/
|
|
@@ -260,12 +340,6 @@ interface GenerateVersionOptions extends BasePluginOptions {
|
|
|
260
340
|
* @default '1.0.0'
|
|
261
341
|
*/
|
|
262
342
|
semverBase?: string;
|
|
263
|
-
/**
|
|
264
|
-
* 是否自动递增补丁版本号
|
|
265
|
-
*
|
|
266
|
-
* @default false
|
|
267
|
-
*/
|
|
268
|
-
autoIncrement?: boolean;
|
|
269
343
|
/**
|
|
270
344
|
* 输出类型
|
|
271
345
|
*
|
|
@@ -503,3 +577,4 @@ interface InjectIcoOptions extends BasePluginOptions {
|
|
|
503
577
|
declare const injectIco: PluginFactory<InjectIcoOptions, string | InjectIcoOptions>;
|
|
504
578
|
|
|
505
579
|
export { copyFile, generateRouter, generateVersion, injectIco };
|
|
580
|
+
export type { CopyFileOptions, GenerateRouterOptions, GenerateVersionOptions, Icon, InjectIcoOptions, NameStrategy, OutputFormat, OutputType, RouteConfig, RouteMeta, UniAppPageConfig, UniAppPagesJson, UniAppTabBarConfig, VersionFormat };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasePluginOptions, PluginFactory } from '../factory/index.mjs';
|
|
2
2
|
import 'vite';
|
|
3
|
+
import '../shared/vite-plugin.CLr0ttuO.mjs';
|
|
4
|
+
import '../shared/vite-plugin.CiHfwMiN.mjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* 复制文件插件的配置选项接口
|
|
@@ -72,6 +74,84 @@ interface CopyFileOptions extends BasePluginOptions {
|
|
|
72
74
|
*/
|
|
73
75
|
declare const copyFile: PluginFactory<CopyFileOptions, CopyFileOptions>;
|
|
74
76
|
|
|
77
|
+
/**
|
|
78
|
+
* 路由元信息
|
|
79
|
+
*/
|
|
80
|
+
interface RouteMeta {
|
|
81
|
+
/** 页面标题 */
|
|
82
|
+
title?: string;
|
|
83
|
+
/** 是否为TabBar页面 */
|
|
84
|
+
isTab?: boolean;
|
|
85
|
+
/** 是否需要登录 */
|
|
86
|
+
requireAuth?: boolean;
|
|
87
|
+
/** 自定义扩展字段 */
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 路由配置项
|
|
92
|
+
*/
|
|
93
|
+
interface RouteConfig {
|
|
94
|
+
/** 路由路径 */
|
|
95
|
+
path: string;
|
|
96
|
+
/** 路由名称(用于命名路由导航) */
|
|
97
|
+
name?: string;
|
|
98
|
+
/** 路由元信息 */
|
|
99
|
+
meta?: RouteMeta;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* uni-app pages.json 中的页面配置项
|
|
103
|
+
*/
|
|
104
|
+
interface UniAppPageConfig {
|
|
105
|
+
/** 页面路径 */
|
|
106
|
+
path: string;
|
|
107
|
+
/** 页面样式 */
|
|
108
|
+
style?: {
|
|
109
|
+
/** 导航栏标题 */
|
|
110
|
+
navigationBarTitleText?: string;
|
|
111
|
+
/** 是否需要登录 */
|
|
112
|
+
requireAuth?: boolean;
|
|
113
|
+
/** 其他自定义属性 */
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
};
|
|
116
|
+
/** 其他属性 */
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* uni-app pages.json 中的 tabBar 配置
|
|
121
|
+
*/
|
|
122
|
+
interface UniAppTabBarConfig {
|
|
123
|
+
/** tabBar 列表 */
|
|
124
|
+
list?: Array<{
|
|
125
|
+
/** 页面路径 */
|
|
126
|
+
pagePath: string;
|
|
127
|
+
/** 文字 */
|
|
128
|
+
text?: string;
|
|
129
|
+
/** 图标路径 */
|
|
130
|
+
iconPath?: string;
|
|
131
|
+
/** 选中图标路径 */
|
|
132
|
+
selectedIconPath?: string;
|
|
133
|
+
}>;
|
|
134
|
+
/** 其他属性 */
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* uni-app pages.json 结构
|
|
139
|
+
*/
|
|
140
|
+
interface UniAppPagesJson {
|
|
141
|
+
/** 页面列表 */
|
|
142
|
+
pages: UniAppPageConfig[];
|
|
143
|
+
/** 子包 */
|
|
144
|
+
subPackages?: Array<{
|
|
145
|
+
root: string;
|
|
146
|
+
pages: UniAppPageConfig[];
|
|
147
|
+
}>;
|
|
148
|
+
/** tabBar 配置 */
|
|
149
|
+
tabBar?: UniAppTabBarConfig;
|
|
150
|
+
/** 全局样式 */
|
|
151
|
+
globalStyle?: Record<string, unknown>;
|
|
152
|
+
/** 其他属性 */
|
|
153
|
+
[key: string]: unknown;
|
|
154
|
+
}
|
|
75
155
|
/**
|
|
76
156
|
* 输出文件格式类型
|
|
77
157
|
*/
|
|
@@ -260,12 +340,6 @@ interface GenerateVersionOptions extends BasePluginOptions {
|
|
|
260
340
|
* @default '1.0.0'
|
|
261
341
|
*/
|
|
262
342
|
semverBase?: string;
|
|
263
|
-
/**
|
|
264
|
-
* 是否自动递增补丁版本号
|
|
265
|
-
*
|
|
266
|
-
* @default false
|
|
267
|
-
*/
|
|
268
|
-
autoIncrement?: boolean;
|
|
269
343
|
/**
|
|
270
344
|
* 输出类型
|
|
271
345
|
*
|
|
@@ -503,3 +577,4 @@ interface InjectIcoOptions extends BasePluginOptions {
|
|
|
503
577
|
declare const injectIco: PluginFactory<InjectIcoOptions, string | InjectIcoOptions>;
|
|
504
578
|
|
|
505
579
|
export { copyFile, generateRouter, generateVersion, injectIco };
|
|
580
|
+
export type { CopyFileOptions, GenerateRouterOptions, GenerateVersionOptions, Icon, InjectIcoOptions, NameStrategy, OutputFormat, OutputType, RouteConfig, RouteMeta, UniAppPageConfig, UniAppPagesJson, UniAppTabBarConfig, VersionFormat };
|