@meng-xi/vite-plugin 0.1.4 → 0.1.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 +34 -20
- package/README.md +33 -19
- package/dist/common/format/index.cjs +1 -1
- package/dist/common/format/index.d.cts +19 -114
- package/dist/common/format/index.d.mts +19 -114
- package/dist/common/format/index.d.ts +19 -114
- package/dist/common/format/index.mjs +1 -1
- package/dist/common/fs/index.cjs +1 -1
- package/dist/common/fs/index.d.cts +36 -89
- package/dist/common/fs/index.d.mts +36 -89
- package/dist/common/fs/index.d.ts +36 -89
- package/dist/common/fs/index.mjs +1 -1
- package/dist/common/html/index.cjs +2 -2
- package/dist/common/html/index.d.cts +12 -307
- package/dist/common/html/index.d.mts +12 -307
- package/dist/common/html/index.d.ts +12 -307
- package/dist/common/html/index.mjs +2 -2
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.d.cts +7 -11
- package/dist/common/index.d.mts +7 -11
- package/dist/common/index.d.ts +7 -11
- package/dist/common/index.mjs +1 -1
- package/dist/common/script/index.cjs +1 -1
- package/dist/common/script/index.d.cts +1 -44
- package/dist/common/script/index.d.mts +1 -44
- package/dist/common/script/index.d.ts +1 -44
- package/dist/common/script/index.mjs +1 -1
- package/dist/common/ui/index.cjs +1 -1
- package/dist/common/ui/index.d.cts +1 -111
- package/dist/common/ui/index.d.mts +1 -111
- package/dist/common/ui/index.d.ts +1 -111
- package/dist/common/ui/index.mjs +1 -1
- package/dist/common/validation/index.cjs +1 -1
- package/dist/common/validation/index.d.cts +2 -80
- package/dist/common/validation/index.d.mts +2 -80
- package/dist/common/validation/index.d.ts +2 -80
- package/dist/common/validation/index.mjs +1 -1
- package/dist/factory/index.cjs +1 -1
- package/dist/factory/index.d.cts +1 -1
- package/dist/factory/index.d.mts +1 -1
- package/dist/factory/index.d.ts +1 -1
- package/dist/factory/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -12
- package/dist/index.d.mts +10 -12
- package/dist/index.d.ts +10 -12
- package/dist/index.mjs +1 -1
- package/dist/logger/index.d.cts +92 -1
- package/dist/logger/index.d.mts +92 -1
- package/dist/logger/index.d.ts +92 -1
- package/dist/plugins/autoImport/index.cjs +19 -0
- package/dist/plugins/autoImport/index.d.cts +291 -0
- package/dist/plugins/autoImport/index.d.mts +291 -0
- package/dist/plugins/autoImport/index.d.ts +291 -0
- package/dist/plugins/autoImport/index.mjs +19 -0
- package/dist/plugins/buildProgress/index.cjs +1 -1
- package/dist/plugins/buildProgress/index.d.cts +1 -1
- package/dist/plugins/buildProgress/index.d.mts +1 -1
- package/dist/plugins/buildProgress/index.d.ts +1 -1
- package/dist/plugins/buildProgress/index.mjs +2 -2
- package/dist/plugins/bundleAnalyzer/index.cjs +21 -21
- package/dist/plugins/bundleAnalyzer/index.d.cts +1 -1
- package/dist/plugins/bundleAnalyzer/index.d.mts +1 -1
- package/dist/plugins/bundleAnalyzer/index.d.ts +1 -1
- package/dist/plugins/bundleAnalyzer/index.mjs +18 -18
- package/dist/plugins/compressAssets/index.cjs +1 -1
- package/dist/plugins/compressAssets/index.d.cts +1 -1
- package/dist/plugins/compressAssets/index.d.mts +1 -1
- package/dist/plugins/compressAssets/index.d.ts +1 -1
- package/dist/plugins/compressAssets/index.mjs +1 -1
- package/dist/plugins/copyFile/index.cjs +1 -1
- package/dist/plugins/copyFile/index.d.cts +1 -1
- package/dist/plugins/copyFile/index.d.mts +1 -1
- package/dist/plugins/copyFile/index.d.ts +1 -1
- package/dist/plugins/copyFile/index.mjs +1 -1
- package/dist/plugins/envGuard/index.cjs +11 -11
- package/dist/plugins/envGuard/index.d.cts +101 -2
- package/dist/plugins/envGuard/index.d.mts +101 -2
- package/dist/plugins/envGuard/index.d.ts +101 -2
- package/dist/plugins/envGuard/index.mjs +9 -9
- package/dist/plugins/faviconManager/index.cjs +1 -1
- package/dist/plugins/faviconManager/index.d.cts +1 -1
- package/dist/plugins/faviconManager/index.d.mts +1 -1
- package/dist/plugins/faviconManager/index.d.ts +1 -1
- package/dist/plugins/faviconManager/index.mjs +1 -1
- package/dist/plugins/generateRouter/index.cjs +5 -4
- package/dist/plugins/generateRouter/index.d.cts +34 -1
- package/dist/plugins/generateRouter/index.d.mts +34 -1
- package/dist/plugins/generateRouter/index.d.ts +34 -1
- package/dist/plugins/generateRouter/index.mjs +5 -4
- package/dist/plugins/generateVersion/index.cjs +1 -1
- package/dist/plugins/generateVersion/index.d.cts +1 -1
- package/dist/plugins/generateVersion/index.d.mts +1 -1
- package/dist/plugins/generateVersion/index.d.ts +1 -1
- package/dist/plugins/generateVersion/index.mjs +1 -1
- package/dist/plugins/htmlInject/index.cjs +7 -1
- package/dist/plugins/htmlInject/index.d.cts +2 -2
- package/dist/plugins/htmlInject/index.d.mts +2 -2
- package/dist/plugins/htmlInject/index.d.ts +2 -2
- package/dist/plugins/htmlInject/index.mjs +7 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.d.cts +3 -3
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.mjs +1 -1
- package/dist/plugins/loadingManager/index.cjs +26 -26
- package/dist/plugins/loadingManager/index.d.cts +1 -1
- package/dist/plugins/loadingManager/index.d.mts +1 -1
- package/dist/plugins/loadingManager/index.d.ts +1 -1
- package/dist/plugins/loadingManager/index.mjs +10 -10
- package/dist/plugins/versionUpdateChecker/index.cjs +5 -5
- package/dist/plugins/versionUpdateChecker/index.d.cts +1 -1
- package/dist/plugins/versionUpdateChecker/index.d.mts +1 -1
- package/dist/plugins/versionUpdateChecker/index.d.ts +1 -1
- package/dist/plugins/versionUpdateChecker/index.mjs +6 -6
- package/dist/shared/vite-plugin.B8FuZce1.d.cts +45 -0
- package/dist/shared/vite-plugin.B8FuZce1.d.mts +45 -0
- package/dist/shared/vite-plugin.B8FuZce1.d.ts +45 -0
- package/dist/shared/{vite-plugin.FfJ-Wwfu.d.cts → vite-plugin.BI9taN75.d.cts} +1 -22
- package/dist/shared/{vite-plugin.FfJ-Wwfu.d.mts → vite-plugin.BI9taN75.d.mts} +1 -22
- package/dist/shared/{vite-plugin.FfJ-Wwfu.d.ts → vite-plugin.BI9taN75.d.ts} +1 -22
- package/dist/shared/vite-plugin.CcvHfrL8.cjs +1 -0
- package/dist/shared/vite-plugin.CuXEJAWX.mjs +1 -0
- package/package.json +7 -17
- package/dist/common/compress/index.cjs +0 -1
- package/dist/common/compress/index.d.cts +0 -23
- package/dist/common/compress/index.d.mts +0 -23
- package/dist/common/compress/index.d.ts +0 -23
- package/dist/common/compress/index.mjs +0 -1
- package/dist/common/object/index.cjs +0 -1
- package/dist/common/object/index.d.cts +0 -30
- package/dist/common/object/index.d.mts +0 -30
- package/dist/common/object/index.d.ts +0 -30
- package/dist/common/object/index.mjs +0 -1
- package/dist/common/path/index.cjs +0 -1
- package/dist/common/path/index.d.cts +0 -22
- package/dist/common/path/index.d.mts +0 -22
- package/dist/common/path/index.d.ts +0 -22
- package/dist/common/path/index.mjs +0 -1
- package/dist/shared/vite-plugin.BCuhU1au.mjs +0 -7
- package/dist/shared/vite-plugin.BrI73DHA.cjs +0 -7
- package/dist/shared/vite-plugin.CLr0ttuO.d.cts +0 -135
- package/dist/shared/vite-plugin.CLr0ttuO.d.mts +0 -135
- package/dist/shared/vite-plugin.CLr0ttuO.d.ts +0 -135
- package/dist/shared/vite-plugin.CmtcnItg.d.cts +0 -261
- package/dist/shared/vite-plugin.CmtcnItg.d.mts +0 -261
- package/dist/shared/vite-plugin.CmtcnItg.d.ts +0 -261
- package/dist/shared/vite-plugin.DnFDPjNf.mjs +0 -1
- package/dist/shared/vite-plugin.Dumot0up.mjs +0 -1
- package/dist/shared/vite-plugin.soT9a-KD.cjs +0 -1
- package/dist/shared/vite-plugin.vwox4bU0.cjs +0 -1
|
@@ -1,94 +1,16 @@
|
|
|
1
1
|
export { V as Validator } from '../../shared/vite-plugin.DRRlWY8P.js';
|
|
2
|
-
export { E as EnvFieldRule, a as EnvType, b as EnvValidationResult, S as STRING_LIKE_TYPES, v as validateEnvironment, c as validateLength, d as validateRange, e as validateType, f as validateValue } from '../../shared/vite-plugin.CmtcnItg.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param name - 全局变量名
|
|
8
|
-
* @param fieldName - 字段名称,用于错误消息上下文(如 'globalName'、'defineName')
|
|
9
|
-
* @throws 当名称不合法时抛出带字段上下文的错误
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* validateGlobalName('__LOADING_MANAGER__', 'globalName')
|
|
14
|
-
* validateGlobalName('__APP_VERSION__', 'defineName')
|
|
15
|
-
* ```
|
|
4
|
+
* 验证全局变量名的合法性
|
|
16
5
|
*/
|
|
17
6
|
declare function validateGlobalName(name: string | undefined, fieldName: string): void;
|
|
18
7
|
/**
|
|
19
8
|
* 验证模板字符串不包含 script 标签(XSS 防护)
|
|
20
|
-
*
|
|
21
|
-
* @param template - 模板字符串
|
|
22
|
-
* @param fieldName - 字段名称,用于错误消息上下文
|
|
23
|
-
* @throws 当模板包含 `<script>` 标签时抛出错误
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* validateNoScriptInTemplate('<div>safe</div>', 'customTemplate')
|
|
28
|
-
* validateNoScriptInTemplate(options.customPromptTemplate, 'customPromptTemplate')
|
|
29
|
-
* ```
|
|
30
9
|
*/
|
|
31
10
|
declare function validateNoScriptInTemplate(template: string | undefined, fieldName: string): void;
|
|
32
11
|
/**
|
|
33
12
|
* 验证回调字段不包含 script 标签
|
|
34
|
-
*
|
|
35
|
-
* @param callbacks - 回调配置对象
|
|
36
|
-
* @param fields - 需要验证的回调字段名数组
|
|
37
|
-
* @param objectName - 回调所属对象名称,用于错误消息上下文
|
|
38
|
-
* @throws 当回调字段非字符串类型时抛出错误
|
|
39
|
-
* @throws 当回调字符串包含 `<script>` 标签时抛出错误
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* validateCallbackFields(callbacks, ['onShow', 'onHide'], 'callbacks')
|
|
44
|
-
* validateCallbackFields(options, ['onUpdateAvailable', 'onRefresh'], 'callbacks')
|
|
45
|
-
* ```
|
|
46
13
|
*/
|
|
47
14
|
declare function validateCallbackFields(callbacks: Record<string, any>, fields: string[], objectName: string): void;
|
|
48
|
-
/**
|
|
49
|
-
* 验证数值为非负数
|
|
50
|
-
*
|
|
51
|
-
* @param value - 待验证的数值
|
|
52
|
-
* @param fieldName - 字段名称,用于错误消息
|
|
53
|
-
* @throws 当值存在但不是数字或为负数时抛出错误
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* validateNonNegativeNumber(100, 'zIndex')
|
|
58
|
-
* validateNonNegativeNumber(-1, 'duration') // 抛出错误
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare function validateNonNegativeNumber(value: number | undefined, fieldName: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* 验证嵌套配置项的 duration 合法性
|
|
64
|
-
*
|
|
65
|
-
* @param config - 嵌套配置对象(包含 enabled 和 duration 字段)
|
|
66
|
-
* @param errorMsg - 验证失败时的错误提示信息
|
|
67
|
-
* @throws 当 duration 存在但不是非负数时抛出错误
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* validateNestedDuration({ enabled: true, duration: 300 }, 'minDisplayTime.duration 必须是非负数')
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
declare function validateNestedDuration(config: {
|
|
75
|
-
enabled?: boolean;
|
|
76
|
-
duration?: number;
|
|
77
|
-
} | undefined, errorMsg: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* 验证字符串值是否在允许的枚举列表中
|
|
80
|
-
*
|
|
81
|
-
* @param value - 待验证的值
|
|
82
|
-
* @param allowedValues - 允许的值列表
|
|
83
|
-
* @param fieldName - 字段名称,用于错误消息
|
|
84
|
-
* @throws 当值存在但不在允许列表中时抛出错误
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* validateEnumValue('center', ['center', 'top', 'bottom'], 'position')
|
|
89
|
-
* validateEnumValue('modal', ['modal', 'banner', 'toast'], 'promptStyle')
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare function validateEnumValue(value: string | undefined, allowedValues: string[], fieldName: string): void;
|
|
93
15
|
|
|
94
|
-
export { validateCallbackFields,
|
|
16
|
+
export { validateCallbackFields, validateGlobalName, validateNoScriptInTemplate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{V as Validator}from"../../shared/vite-plugin.DcExl6jd.mjs";
|
|
1
|
+
export{V as Validator}from"../../shared/vite-plugin.DcExl6jd.mjs";function F(u,t){if(u){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(u))throw new Error(`${t} "${u}" \u4E0D\u662F\u5408\u6CD5\u7684 JavaScript \u6807\u8BC6\u7B26\uFF0C\u5FC5\u987B\u4EE5\u5B57\u6BCD\u3001\u4E0B\u5212\u7EBF\u6216\u7F8E\u5143\u7B26\u5F00\u5934\uFF0C\u4EC5\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u548C\u7F8E\u5143\u7B26`);if(["__proto__","constructor","prototype"].includes(u))throw new Error(`${t} "${u}" \u662F JavaScript \u5185\u7F6E\u5C5E\u6027\uFF0C\u53EF\u80FD\u5BFC\u81F4\u539F\u578B\u6C61\u67D3\uFF0C\u8BF7\u4F7F\u7528\u5176\u4ED6\u540D\u79F0`)}}function i(u,t){if(u&&/<script\b/i.test(u))throw new Error(`${t} \u4E0D\u5141\u8BB8\u5305\u542B <script> \u6807\u7B7E`)}function E(u,t,o){for(const B of t){const r=u[B];if(r!==void 0&&typeof r!="string")throw new Error(`${o}.${B} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u7C7B\u578B`);if(r&&/<script\b/i.test(r))throw new Error(`${o}.${B} \u4E0D\u5141\u8BB8\u5305\u542B <script> \u6807\u7B7E`)}}export{E as validateCallbackFields,F as validateGlobalName,i as validateNoScriptInTemplate};
|
package/dist/factory/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const logger_index=require("../logger/index.cjs"),
|
|
1
|
+
"use strict";const logger_index=require("../logger/index.cjs"),validator=require("../shared/vite-plugin.Bcg6RW2N.cjs");function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function deepMerge(...n){const t={};for(const o of n)if(o)for(const e in o){if(!Object.prototype.hasOwnProperty.call(o,e))continue;const r=o[e],s=t[e];r!==void 0&&(i(r)&&i(s)?t[e]=deepMerge(s,r):t[e]=r)}return t}class BasePlugin{options;logger;validator;viteConfig=null;constructor(t,o){this.options=this.mergeOptions(t),this.logger=this.initLogger(o),this.validator=new validator.Validator(this.options),this.safeExecuteSync(()=>this.validateOptions(),"\u63D2\u4EF6\u914D\u7F6E\u9A8C\u8BC1")}getDefaultOptions(){return{}}mergeOptions(t){const o={enabled:!0,verbose:!0,errorStrategy:"throw"},e=this.getDefaultOptions();return deepMerge(o,e,t)}initLogger(t){return logger_index.Logger.create({name:this.getPluginName(),enabled:this.options.verbose,...t}).createPluginLogger(this.getPluginName())}validateOptions(){}getEnforce(){}onConfigResolved(t){this.viteConfig=t,this.logger.info("\u914D\u7F6E\u89E3\u6790\u5B8C\u6210\uFF0C\u63D2\u4EF6\u5DF2\u521D\u59CB\u5316")}destroy(){logger_index.Logger.unregister(this.getPluginName())}safeExecuteSync(t,o){try{return t()}catch(e){return this.handleError(e,o)}}async safeExecute(t,o){try{return await t()}catch(e){return this.handleError(e,o)}}handleError(t,o){let e=`${o}: `;switch(t instanceof Error?e+=t.message:typeof t=="string"?e+=t:e+=String(t),this.options.errorStrategy){case"throw":throw this.logger.error(e),t;case"log":case"ignore":this.logger.error(e);return;default:throw this.logger.error(e),t}}toPlugin(){const t={name:this.getPluginName(),enforce:this.getEnforce()};this.addPluginHooks(t);const o=t.configResolved;t.configResolved=s=>{this.options.enabled&&(this.onConfigResolved(s),typeof o=="function"&&o(s))};const e=this,r=t.closeBundle;return t.closeBundle=function(){typeof r=="function"&&r.call(this),e.destroy()},t}}function createPluginFactory(n,t){return o=>{const e=t?t(o):o,r=new n(e),s=r.toPlugin();return s.pluginInstance=r,s}}exports.BasePlugin=BasePlugin,exports.createPluginFactory=createPluginFactory;
|
package/dist/factory/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
-
import { P as PluginLogger,
|
|
2
|
+
import { P as PluginLogger, L as LoggerOptions } from '../shared/vite-plugin.B8FuZce1.cjs';
|
|
3
3
|
import { V as Validator } from '../shared/vite-plugin.DRRlWY8P.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
-
import { P as PluginLogger,
|
|
2
|
+
import { P as PluginLogger, L as LoggerOptions } from '../shared/vite-plugin.B8FuZce1.mjs';
|
|
3
3
|
import { V as Validator } from '../shared/vite-plugin.DRRlWY8P.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin, ResolvedConfig } from 'vite';
|
|
2
|
-
import { P as PluginLogger,
|
|
2
|
+
import { P as PluginLogger, L as LoggerOptions } from '../shared/vite-plugin.B8FuZce1.js';
|
|
3
3
|
import { V as Validator } from '../shared/vite-plugin.DRRlWY8P.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Logger as s}from"../logger/index.mjs";import{
|
|
1
|
+
import{Logger as s}from"../logger/index.mjs";import{V as a}from"../shared/vite-plugin.DcExl6jd.mjs";function u(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function g(...n){const t={};for(const o of n)if(o)for(const e in o){if(!Object.prototype.hasOwnProperty.call(o,e))continue;const r=o[e],i=t[e];r!==void 0&&(u(r)&&u(i)?t[e]=g(i,r):t[e]=r)}return t}class c{options;logger;validator;viteConfig=null;constructor(t,o){this.options=this.mergeOptions(t),this.logger=this.initLogger(o),this.validator=new a(this.options),this.safeExecuteSync(()=>this.validateOptions(),"\u63D2\u4EF6\u914D\u7F6E\u9A8C\u8BC1")}getDefaultOptions(){return{}}mergeOptions(t){const o={enabled:!0,verbose:!0,errorStrategy:"throw"},e=this.getDefaultOptions();return g(o,e,t)}initLogger(t){return s.create({name:this.getPluginName(),enabled:this.options.verbose,...t}).createPluginLogger(this.getPluginName())}validateOptions(){}getEnforce(){}onConfigResolved(t){this.viteConfig=t,this.logger.info("\u914D\u7F6E\u89E3\u6790\u5B8C\u6210\uFF0C\u63D2\u4EF6\u5DF2\u521D\u59CB\u5316")}destroy(){s.unregister(this.getPluginName())}safeExecuteSync(t,o){try{return t()}catch(e){return this.handleError(e,o)}}async safeExecute(t,o){try{return await t()}catch(e){return this.handleError(e,o)}}handleError(t,o){let e=`${o}: `;switch(t instanceof Error?e+=t.message:typeof t=="string"?e+=t:e+=String(t),this.options.errorStrategy){case"throw":throw this.logger.error(e),t;case"log":case"ignore":this.logger.error(e);return;default:throw this.logger.error(e),t}}toPlugin(){const t={name:this.getPluginName(),enforce:this.getEnforce()};this.addPluginHooks(t);const o=t.configResolved;t.configResolved=i=>{this.options.enabled&&(this.onConfigResolved(i),typeof o=="function"&&o(i))};const e=this,r=t.closeBundle;return t.closeBundle=function(){typeof r=="function"&&r.call(this),e.destroy()},t}}function l(n,t){return o=>{const e=t?t(o):o,r=new n(e),i=r.toPlugin();return i.pluginInstance=r,i}}export{c as BasePlugin,l as createPluginFactory};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const common_format_index=require("./common/format/index.cjs"),common_fs_index=require("./common/fs/index.cjs"),common_html_index=require("./common/html/index.cjs"),common_script_index=require("./common/script/index.cjs"),common_ui_index=require("./common/ui/index.cjs"),validator=require("./shared/vite-plugin.Bcg6RW2N.cjs"),common_validation_index=require("./common/validation/index.cjs"),factory_index=require("./factory/index.cjs"),logger_index=require("./logger/index.cjs"),plugins_autoImport_index=require("./plugins/autoImport/index.cjs"),plugins_buildProgress_index=require("./plugins/buildProgress/index.cjs"),plugins_bundleAnalyzer_index=require("./plugins/bundleAnalyzer/index.cjs"),plugins_compressAssets_index=require("./plugins/compressAssets/index.cjs"),plugins_copyFile_index=require("./plugins/copyFile/index.cjs"),plugins_envGuard_index=require("./plugins/envGuard/index.cjs"),plugins_faviconManager_index=require("./plugins/faviconManager/index.cjs"),plugins_generateRouter_index=require("./plugins/generateRouter/index.cjs"),plugins_generateVersion_index=require("./plugins/generateVersion/index.cjs"),plugins_htmlInject_index=require("./plugins/htmlInject/index.cjs"),plugins_loadingManager_index=require("./plugins/loadingManager/index.cjs"),plugins_versionUpdateChecker_index=require("./plugins/versionUpdateChecker/index.cjs"),security=require("./shared/vite-plugin.CcvHfrL8.cjs");require("fs"),require("path"),require("node:fs"),require("node:path"),require("node:zlib"),require("node:util"),require("node:stream/promises"),require("crypto"),exports.formatDate=common_format_index.formatDate,exports.formatFileSize=common_format_index.formatFileSize,exports.getDateFormatParams=common_format_index.getDateFormatParams,exports.parseTemplate=common_format_index.parseTemplate,exports.checkSourceExists=common_fs_index.checkSourceExists,exports.copySourceToTarget=common_fs_index.copySourceToTarget,exports.scanDirectory=common_fs_index.scanDirectory,exports.shouldUpdateFileContent=common_fs_index.shouldUpdateFileContent,exports.writeFileContent=common_fs_index.writeFileContent,exports.writeFileSyncSafely=common_fs_index.writeFileSyncSafely,exports.writeJsonReport=common_fs_index.writeJsonReport,exports.injectBeforeTag=common_html_index.injectBeforeTag,exports.injectHeadAndBody=common_html_index.injectHeadAndBody,exports.makeCallback=common_script_index.makeCallback,exports.ANSI=common_ui_index.ANSI,exports.Validator=validator.Validator,exports.validateCallbackFields=common_validation_index.validateCallbackFields,exports.validateGlobalName=common_validation_index.validateGlobalName,exports.validateNoScriptInTemplate=common_validation_index.validateNoScriptInTemplate,exports.BasePlugin=factory_index.BasePlugin,exports.createPluginFactory=factory_index.createPluginFactory,exports.Logger=logger_index.Logger,exports.autoImport=plugins_autoImport_index.autoImport,exports.buildProgress=plugins_buildProgress_index.buildProgress,exports.bundleAnalyzer=plugins_bundleAnalyzer_index.bundleAnalyzer,exports.compressAssets=plugins_compressAssets_index.compressAssets,exports.copyFile=plugins_copyFile_index.copyFile,exports.envGuard=plugins_envGuard_index.envGuard,exports.faviconManager=plugins_faviconManager_index.faviconManager,exports.generateRouter=plugins_generateRouter_index.generateRouter,exports.generateVersion=plugins_generateVersion_index.generateVersion,exports.htmlInject=plugins_htmlInject_index.htmlInject,exports.loadingManager=plugins_loadingManager_index.loadingManager,exports.versionUpdateChecker=plugins_versionUpdateChecker_index.versionUpdateChecker,exports.escapeHtmlAttr=security.escapeHtmlAttr,exports.sanitizeContent=security.sanitizeContent;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { isNodeModule } from './common/path/index.cjs';
|
|
7
|
-
export { containsScriptTag, makeCallback, validateIdentifierName } from './common/script/index.cjs';
|
|
8
|
-
export { ANSI, SPINNER_FRAMES, stripAnsi } from './common/ui/index.cjs';
|
|
1
|
+
export { DateFormatOptions, formatDate, formatFileSize, getDateFormatParams, parseTemplate } from './common/format/index.cjs';
|
|
2
|
+
export { CopyOptions, CopyResult, ScanDirectoryOptions, ScannedFile, checkSourceExists, copySourceToTarget, scanDirectory, shouldUpdateFileContent, writeFileContent, writeFileSyncSafely, writeJsonReport } from './common/fs/index.cjs';
|
|
3
|
+
export { SanitizeRuleOptions, escapeHtmlAttr, injectBeforeTag, injectHeadAndBody, sanitizeContent } from './common/html/index.cjs';
|
|
4
|
+
export { makeCallback } from './common/script/index.cjs';
|
|
5
|
+
export { ANSI } from './common/ui/index.cjs';
|
|
9
6
|
export { V as Validator } from './shared/vite-plugin.DRRlWY8P.cjs';
|
|
10
|
-
export { validateCallbackFields,
|
|
11
|
-
export { E as EnvFieldRule, a as EnvType, b as EnvValidationResult, S as STRING_LIKE_TYPES, v as validateEnvironment, c as validateLength, d as validateRange, e as validateType, f as validateValue } from './shared/vite-plugin.CmtcnItg.cjs';
|
|
7
|
+
export { validateCallbackFields, validateGlobalName, validateNoScriptInTemplate } from './common/validation/index.cjs';
|
|
12
8
|
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.cjs';
|
|
13
|
-
export {
|
|
9
|
+
export { Logger } from './logger/index.cjs';
|
|
10
|
+
export { AutoImportOptions, ImportMapping, ResolvedImport, ScannedModule, TransformResult, autoImport } from './plugins/autoImport/index.cjs';
|
|
14
11
|
export { BuildPhase, BuildProgressOptions, ProgressFormat, ProgressTheme, buildProgress } from './plugins/buildProgress/index.cjs';
|
|
15
12
|
export { BundleAnalysisResult, BundleAnalyzerOptions, BundleOutputFormat, ChunkStats, ComparisonDiff, FileTypeDistribution, ModuleStats, SizeWarning, bundleAnalyzer } from './plugins/bundleAnalyzer/index.cjs';
|
|
16
13
|
export { CompressAlgorithm, CompressAssetsOptions, CompressStats, CompressSummary, compressAssets } from './plugins/compressAssets/index.cjs';
|
|
@@ -22,5 +19,6 @@ export { GenerateVersionOptions, OutputType, VersionFormat, VersionInfo, generat
|
|
|
22
19
|
export { HtmlInjectOptions, InjectRule, InjectionLogEntry, htmlInject } from './plugins/htmlInject/index.cjs';
|
|
23
20
|
export { AutoBindMode, AutoHideOn, DebounceHide, DelayShow, LoadingCallbacks, LoadingManager, LoadingManagerOptions, LoadingPosition, LoadingStyle, MinDisplayTime, RequestFilter, SpinnerType, TransitionConfig, loadingManager } from './plugins/loadingManager/index.cjs';
|
|
24
21
|
export { PromptStyle, VersionSource, VersionUpdateCheckerOptions, versionUpdateChecker } from './plugins/versionUpdateChecker/index.cjs';
|
|
25
|
-
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition,
|
|
22
|
+
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition, S as SecurityConfig, b as SelectorMatch } from './shared/vite-plugin.BI9taN75.cjs';
|
|
23
|
+
export { L as LoggerOptions, P as PluginLogger } from './shared/vite-plugin.B8FuZce1.cjs';
|
|
26
24
|
import 'vite';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { isNodeModule } from './common/path/index.mjs';
|
|
7
|
-
export { containsScriptTag, makeCallback, validateIdentifierName } from './common/script/index.mjs';
|
|
8
|
-
export { ANSI, SPINNER_FRAMES, stripAnsi } from './common/ui/index.mjs';
|
|
1
|
+
export { DateFormatOptions, formatDate, formatFileSize, getDateFormatParams, parseTemplate } from './common/format/index.mjs';
|
|
2
|
+
export { CopyOptions, CopyResult, ScanDirectoryOptions, ScannedFile, checkSourceExists, copySourceToTarget, scanDirectory, shouldUpdateFileContent, writeFileContent, writeFileSyncSafely, writeJsonReport } from './common/fs/index.mjs';
|
|
3
|
+
export { SanitizeRuleOptions, escapeHtmlAttr, injectBeforeTag, injectHeadAndBody, sanitizeContent } from './common/html/index.mjs';
|
|
4
|
+
export { makeCallback } from './common/script/index.mjs';
|
|
5
|
+
export { ANSI } from './common/ui/index.mjs';
|
|
9
6
|
export { V as Validator } from './shared/vite-plugin.DRRlWY8P.mjs';
|
|
10
|
-
export { validateCallbackFields,
|
|
11
|
-
export { E as EnvFieldRule, a as EnvType, b as EnvValidationResult, S as STRING_LIKE_TYPES, v as validateEnvironment, c as validateLength, d as validateRange, e as validateType, f as validateValue } from './shared/vite-plugin.CmtcnItg.mjs';
|
|
7
|
+
export { validateCallbackFields, validateGlobalName, validateNoScriptInTemplate } from './common/validation/index.mjs';
|
|
12
8
|
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.mjs';
|
|
13
|
-
export {
|
|
9
|
+
export { Logger } from './logger/index.mjs';
|
|
10
|
+
export { AutoImportOptions, ImportMapping, ResolvedImport, ScannedModule, TransformResult, autoImport } from './plugins/autoImport/index.mjs';
|
|
14
11
|
export { BuildPhase, BuildProgressOptions, ProgressFormat, ProgressTheme, buildProgress } from './plugins/buildProgress/index.mjs';
|
|
15
12
|
export { BundleAnalysisResult, BundleAnalyzerOptions, BundleOutputFormat, ChunkStats, ComparisonDiff, FileTypeDistribution, ModuleStats, SizeWarning, bundleAnalyzer } from './plugins/bundleAnalyzer/index.mjs';
|
|
16
13
|
export { CompressAlgorithm, CompressAssetsOptions, CompressStats, CompressSummary, compressAssets } from './plugins/compressAssets/index.mjs';
|
|
@@ -22,5 +19,6 @@ export { GenerateVersionOptions, OutputType, VersionFormat, VersionInfo, generat
|
|
|
22
19
|
export { HtmlInjectOptions, InjectRule, InjectionLogEntry, htmlInject } from './plugins/htmlInject/index.mjs';
|
|
23
20
|
export { AutoBindMode, AutoHideOn, DebounceHide, DelayShow, LoadingCallbacks, LoadingManager, LoadingManagerOptions, LoadingPosition, LoadingStyle, MinDisplayTime, RequestFilter, SpinnerType, TransitionConfig, loadingManager } from './plugins/loadingManager/index.mjs';
|
|
24
21
|
export { PromptStyle, VersionSource, VersionUpdateCheckerOptions, versionUpdateChecker } from './plugins/versionUpdateChecker/index.mjs';
|
|
25
|
-
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition,
|
|
22
|
+
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition, S as SecurityConfig, b as SelectorMatch } from './shared/vite-plugin.BI9taN75.mjs';
|
|
23
|
+
export { L as LoggerOptions, P as PluginLogger } from './shared/vite-plugin.B8FuZce1.mjs';
|
|
26
24
|
import 'vite';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { isNodeModule } from './common/path/index.js';
|
|
7
|
-
export { containsScriptTag, makeCallback, validateIdentifierName } from './common/script/index.js';
|
|
8
|
-
export { ANSI, SPINNER_FRAMES, stripAnsi } from './common/ui/index.js';
|
|
1
|
+
export { DateFormatOptions, formatDate, formatFileSize, getDateFormatParams, parseTemplate } from './common/format/index.js';
|
|
2
|
+
export { CopyOptions, CopyResult, ScanDirectoryOptions, ScannedFile, checkSourceExists, copySourceToTarget, scanDirectory, shouldUpdateFileContent, writeFileContent, writeFileSyncSafely, writeJsonReport } from './common/fs/index.js';
|
|
3
|
+
export { SanitizeRuleOptions, escapeHtmlAttr, injectBeforeTag, injectHeadAndBody, sanitizeContent } from './common/html/index.js';
|
|
4
|
+
export { makeCallback } from './common/script/index.js';
|
|
5
|
+
export { ANSI } from './common/ui/index.js';
|
|
9
6
|
export { V as Validator } from './shared/vite-plugin.DRRlWY8P.js';
|
|
10
|
-
export { validateCallbackFields,
|
|
11
|
-
export { E as EnvFieldRule, a as EnvType, b as EnvValidationResult, S as STRING_LIKE_TYPES, v as validateEnvironment, c as validateLength, d as validateRange, e as validateType, f as validateValue } from './shared/vite-plugin.CmtcnItg.js';
|
|
7
|
+
export { validateCallbackFields, validateGlobalName, validateNoScriptInTemplate } from './common/validation/index.js';
|
|
12
8
|
export { BasePlugin, BasePluginOptions, OptionsNormalizer, PluginFactory, PluginWithInstance, createPluginFactory } from './factory/index.js';
|
|
13
|
-
export {
|
|
9
|
+
export { Logger } from './logger/index.js';
|
|
10
|
+
export { AutoImportOptions, ImportMapping, ResolvedImport, ScannedModule, TransformResult, autoImport } from './plugins/autoImport/index.js';
|
|
14
11
|
export { BuildPhase, BuildProgressOptions, ProgressFormat, ProgressTheme, buildProgress } from './plugins/buildProgress/index.js';
|
|
15
12
|
export { BundleAnalysisResult, BundleAnalyzerOptions, BundleOutputFormat, ChunkStats, ComparisonDiff, FileTypeDistribution, ModuleStats, SizeWarning, bundleAnalyzer } from './plugins/bundleAnalyzer/index.js';
|
|
16
13
|
export { CompressAlgorithm, CompressAssetsOptions, CompressStats, CompressSummary, compressAssets } from './plugins/compressAssets/index.js';
|
|
@@ -22,5 +19,6 @@ export { GenerateVersionOptions, OutputType, VersionFormat, VersionInfo, generat
|
|
|
22
19
|
export { HtmlInjectOptions, InjectRule, InjectionLogEntry, htmlInject } from './plugins/htmlInject/index.js';
|
|
23
20
|
export { AutoBindMode, AutoHideOn, DebounceHide, DelayShow, LoadingCallbacks, LoadingManager, LoadingManagerOptions, LoadingPosition, LoadingStyle, MinDisplayTime, RequestFilter, SpinnerType, TransitionConfig, loadingManager } from './plugins/loadingManager/index.js';
|
|
24
21
|
export { PromptStyle, VersionSource, VersionUpdateCheckerOptions, versionUpdateChecker } from './plugins/versionUpdateChecker/index.js';
|
|
25
|
-
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition,
|
|
22
|
+
export { C as ConditionType, D as DualInjectResult, H as HtmlInjectResult, I as InjectCondition, a as InjectPosition, S as SecurityConfig, b as SelectorMatch } from './shared/vite-plugin.BI9taN75.js';
|
|
23
|
+
export { L as LoggerOptions, P as PluginLogger } from './shared/vite-plugin.B8FuZce1.js';
|
|
26
24
|
import 'vite';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{formatDate,formatFileSize,getDateFormatParams,parseTemplate}from"./common/format/index.mjs";export{checkSourceExists,copySourceToTarget,scanDirectory,shouldUpdateFileContent,writeFileContent,writeFileSyncSafely,writeJsonReport}from"./common/fs/index.mjs";export{injectBeforeTag,injectHeadAndBody}from"./common/html/index.mjs";export{makeCallback}from"./common/script/index.mjs";export{ANSI}from"./common/ui/index.mjs";export{V as Validator}from"./shared/vite-plugin.DcExl6jd.mjs";export{validateCallbackFields,validateGlobalName,validateNoScriptInTemplate}from"./common/validation/index.mjs";export{BasePlugin,createPluginFactory}from"./factory/index.mjs";export{Logger}from"./logger/index.mjs";export{autoImport}from"./plugins/autoImport/index.mjs";export{buildProgress}from"./plugins/buildProgress/index.mjs";export{bundleAnalyzer}from"./plugins/bundleAnalyzer/index.mjs";export{compressAssets}from"./plugins/compressAssets/index.mjs";export{copyFile}from"./plugins/copyFile/index.mjs";export{envGuard}from"./plugins/envGuard/index.mjs";export{faviconManager}from"./plugins/faviconManager/index.mjs";export{generateRouter}from"./plugins/generateRouter/index.mjs";export{generateVersion}from"./plugins/generateVersion/index.mjs";export{htmlInject}from"./plugins/htmlInject/index.mjs";export{loadingManager}from"./plugins/loadingManager/index.mjs";export{versionUpdateChecker}from"./plugins/versionUpdateChecker/index.mjs";export{e as escapeHtmlAttr,s as sanitizeContent}from"./shared/vite-plugin.CuXEJAWX.mjs";import"fs";import"path";import"node:fs";import"node:path";import"node:zlib";import"node:util";import"node:stream/promises";import"crypto";
|
package/dist/logger/index.d.cts
CHANGED
|
@@ -1 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
import { L as LoggerOptions, P as PluginLogger } from '../shared/vite-plugin.B8FuZce1.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 日志工具类(单例模式)
|
|
5
|
+
* @description 全局单例日志管理器,统一管理所有插件的日志输出
|
|
6
|
+
*/
|
|
7
|
+
declare class Logger {
|
|
8
|
+
/**
|
|
9
|
+
* 单例实例
|
|
10
|
+
*/
|
|
11
|
+
private static instance;
|
|
12
|
+
/**
|
|
13
|
+
* 库名称
|
|
14
|
+
*/
|
|
15
|
+
private readonly libName;
|
|
16
|
+
/**
|
|
17
|
+
* 插件日志配置映射表
|
|
18
|
+
* @description 存储每个插件的日志开关状态
|
|
19
|
+
*/
|
|
20
|
+
private pluginConfigs;
|
|
21
|
+
/**
|
|
22
|
+
* 日志类型映射
|
|
23
|
+
*/
|
|
24
|
+
private readonly logTypes;
|
|
25
|
+
/**
|
|
26
|
+
* 私有构造函数,防止外部实例化
|
|
27
|
+
*/
|
|
28
|
+
private constructor();
|
|
29
|
+
/**
|
|
30
|
+
* 获取单例实例
|
|
31
|
+
* @returns Logger 单例实例
|
|
32
|
+
*/
|
|
33
|
+
private static getInstance;
|
|
34
|
+
/**
|
|
35
|
+
* 创建日志记录器(工厂方法)
|
|
36
|
+
* @param options 配置选项
|
|
37
|
+
* @returns Logger 单例实例
|
|
38
|
+
* @description 为插件创建日志记录器,实际返回单例实例并注册插件配置
|
|
39
|
+
*/
|
|
40
|
+
static create(options: LoggerOptions): Logger;
|
|
41
|
+
/**
|
|
42
|
+
* 注册插件日志配置
|
|
43
|
+
* @param pluginName 插件名称
|
|
44
|
+
* @param enabled 是否启用日志
|
|
45
|
+
*/
|
|
46
|
+
private registerPlugin;
|
|
47
|
+
/**
|
|
48
|
+
* 注销插件日志配置
|
|
49
|
+
* @param pluginName 插件名称
|
|
50
|
+
*/
|
|
51
|
+
private unregisterPlugin;
|
|
52
|
+
/**
|
|
53
|
+
* 注销指定插件的日志配置
|
|
54
|
+
* @param pluginName 插件名称
|
|
55
|
+
* @description 从单例中移除指定插件的日志配置,通常在插件销毁时调用
|
|
56
|
+
*/
|
|
57
|
+
static unregister(pluginName: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* 销毁单例实例,释放所有资源
|
|
60
|
+
* @description 清除所有已注册的插件配置,重置单例实例。主要用于测试场景
|
|
61
|
+
*/
|
|
62
|
+
static destroy(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 生成日志前缀
|
|
65
|
+
* @param pluginName 插件名称
|
|
66
|
+
* @returns 格式化的日志前缀
|
|
67
|
+
*/
|
|
68
|
+
private formatPrefix;
|
|
69
|
+
/**
|
|
70
|
+
* 检查插件日志是否启用
|
|
71
|
+
* @param pluginName 插件名称
|
|
72
|
+
* @returns 是否启用
|
|
73
|
+
*/
|
|
74
|
+
private isPluginEnabled;
|
|
75
|
+
/**
|
|
76
|
+
* 统一日志输出方法
|
|
77
|
+
* @param pluginName 插件名称
|
|
78
|
+
* @param type 日志类型
|
|
79
|
+
* @param message 日志消息
|
|
80
|
+
* @param data 附加数据
|
|
81
|
+
*/
|
|
82
|
+
private log;
|
|
83
|
+
/**
|
|
84
|
+
* 创建插件日志代理对象
|
|
85
|
+
* @param pluginName 插件名称
|
|
86
|
+
* @returns 插件日志代理对象
|
|
87
|
+
* @internal 供 BasePlugin 内部使用
|
|
88
|
+
*/
|
|
89
|
+
createPluginLogger(pluginName: string): PluginLogger;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Logger, LoggerOptions, PluginLogger };
|
package/dist/logger/index.d.mts
CHANGED
|
@@ -1 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
import { L as LoggerOptions, P as PluginLogger } from '../shared/vite-plugin.B8FuZce1.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 日志工具类(单例模式)
|
|
5
|
+
* @description 全局单例日志管理器,统一管理所有插件的日志输出
|
|
6
|
+
*/
|
|
7
|
+
declare class Logger {
|
|
8
|
+
/**
|
|
9
|
+
* 单例实例
|
|
10
|
+
*/
|
|
11
|
+
private static instance;
|
|
12
|
+
/**
|
|
13
|
+
* 库名称
|
|
14
|
+
*/
|
|
15
|
+
private readonly libName;
|
|
16
|
+
/**
|
|
17
|
+
* 插件日志配置映射表
|
|
18
|
+
* @description 存储每个插件的日志开关状态
|
|
19
|
+
*/
|
|
20
|
+
private pluginConfigs;
|
|
21
|
+
/**
|
|
22
|
+
* 日志类型映射
|
|
23
|
+
*/
|
|
24
|
+
private readonly logTypes;
|
|
25
|
+
/**
|
|
26
|
+
* 私有构造函数,防止外部实例化
|
|
27
|
+
*/
|
|
28
|
+
private constructor();
|
|
29
|
+
/**
|
|
30
|
+
* 获取单例实例
|
|
31
|
+
* @returns Logger 单例实例
|
|
32
|
+
*/
|
|
33
|
+
private static getInstance;
|
|
34
|
+
/**
|
|
35
|
+
* 创建日志记录器(工厂方法)
|
|
36
|
+
* @param options 配置选项
|
|
37
|
+
* @returns Logger 单例实例
|
|
38
|
+
* @description 为插件创建日志记录器,实际返回单例实例并注册插件配置
|
|
39
|
+
*/
|
|
40
|
+
static create(options: LoggerOptions): Logger;
|
|
41
|
+
/**
|
|
42
|
+
* 注册插件日志配置
|
|
43
|
+
* @param pluginName 插件名称
|
|
44
|
+
* @param enabled 是否启用日志
|
|
45
|
+
*/
|
|
46
|
+
private registerPlugin;
|
|
47
|
+
/**
|
|
48
|
+
* 注销插件日志配置
|
|
49
|
+
* @param pluginName 插件名称
|
|
50
|
+
*/
|
|
51
|
+
private unregisterPlugin;
|
|
52
|
+
/**
|
|
53
|
+
* 注销指定插件的日志配置
|
|
54
|
+
* @param pluginName 插件名称
|
|
55
|
+
* @description 从单例中移除指定插件的日志配置,通常在插件销毁时调用
|
|
56
|
+
*/
|
|
57
|
+
static unregister(pluginName: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* 销毁单例实例,释放所有资源
|
|
60
|
+
* @description 清除所有已注册的插件配置,重置单例实例。主要用于测试场景
|
|
61
|
+
*/
|
|
62
|
+
static destroy(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 生成日志前缀
|
|
65
|
+
* @param pluginName 插件名称
|
|
66
|
+
* @returns 格式化的日志前缀
|
|
67
|
+
*/
|
|
68
|
+
private formatPrefix;
|
|
69
|
+
/**
|
|
70
|
+
* 检查插件日志是否启用
|
|
71
|
+
* @param pluginName 插件名称
|
|
72
|
+
* @returns 是否启用
|
|
73
|
+
*/
|
|
74
|
+
private isPluginEnabled;
|
|
75
|
+
/**
|
|
76
|
+
* 统一日志输出方法
|
|
77
|
+
* @param pluginName 插件名称
|
|
78
|
+
* @param type 日志类型
|
|
79
|
+
* @param message 日志消息
|
|
80
|
+
* @param data 附加数据
|
|
81
|
+
*/
|
|
82
|
+
private log;
|
|
83
|
+
/**
|
|
84
|
+
* 创建插件日志代理对象
|
|
85
|
+
* @param pluginName 插件名称
|
|
86
|
+
* @returns 插件日志代理对象
|
|
87
|
+
* @internal 供 BasePlugin 内部使用
|
|
88
|
+
*/
|
|
89
|
+
createPluginLogger(pluginName: string): PluginLogger;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Logger, LoggerOptions, PluginLogger };
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
import { L as LoggerOptions, P as PluginLogger } from '../shared/vite-plugin.B8FuZce1.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 日志工具类(单例模式)
|
|
5
|
+
* @description 全局单例日志管理器,统一管理所有插件的日志输出
|
|
6
|
+
*/
|
|
7
|
+
declare class Logger {
|
|
8
|
+
/**
|
|
9
|
+
* 单例实例
|
|
10
|
+
*/
|
|
11
|
+
private static instance;
|
|
12
|
+
/**
|
|
13
|
+
* 库名称
|
|
14
|
+
*/
|
|
15
|
+
private readonly libName;
|
|
16
|
+
/**
|
|
17
|
+
* 插件日志配置映射表
|
|
18
|
+
* @description 存储每个插件的日志开关状态
|
|
19
|
+
*/
|
|
20
|
+
private pluginConfigs;
|
|
21
|
+
/**
|
|
22
|
+
* 日志类型映射
|
|
23
|
+
*/
|
|
24
|
+
private readonly logTypes;
|
|
25
|
+
/**
|
|
26
|
+
* 私有构造函数,防止外部实例化
|
|
27
|
+
*/
|
|
28
|
+
private constructor();
|
|
29
|
+
/**
|
|
30
|
+
* 获取单例实例
|
|
31
|
+
* @returns Logger 单例实例
|
|
32
|
+
*/
|
|
33
|
+
private static getInstance;
|
|
34
|
+
/**
|
|
35
|
+
* 创建日志记录器(工厂方法)
|
|
36
|
+
* @param options 配置选项
|
|
37
|
+
* @returns Logger 单例实例
|
|
38
|
+
* @description 为插件创建日志记录器,实际返回单例实例并注册插件配置
|
|
39
|
+
*/
|
|
40
|
+
static create(options: LoggerOptions): Logger;
|
|
41
|
+
/**
|
|
42
|
+
* 注册插件日志配置
|
|
43
|
+
* @param pluginName 插件名称
|
|
44
|
+
* @param enabled 是否启用日志
|
|
45
|
+
*/
|
|
46
|
+
private registerPlugin;
|
|
47
|
+
/**
|
|
48
|
+
* 注销插件日志配置
|
|
49
|
+
* @param pluginName 插件名称
|
|
50
|
+
*/
|
|
51
|
+
private unregisterPlugin;
|
|
52
|
+
/**
|
|
53
|
+
* 注销指定插件的日志配置
|
|
54
|
+
* @param pluginName 插件名称
|
|
55
|
+
* @description 从单例中移除指定插件的日志配置,通常在插件销毁时调用
|
|
56
|
+
*/
|
|
57
|
+
static unregister(pluginName: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* 销毁单例实例,释放所有资源
|
|
60
|
+
* @description 清除所有已注册的插件配置,重置单例实例。主要用于测试场景
|
|
61
|
+
*/
|
|
62
|
+
static destroy(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 生成日志前缀
|
|
65
|
+
* @param pluginName 插件名称
|
|
66
|
+
* @returns 格式化的日志前缀
|
|
67
|
+
*/
|
|
68
|
+
private formatPrefix;
|
|
69
|
+
/**
|
|
70
|
+
* 检查插件日志是否启用
|
|
71
|
+
* @param pluginName 插件名称
|
|
72
|
+
* @returns 是否启用
|
|
73
|
+
*/
|
|
74
|
+
private isPluginEnabled;
|
|
75
|
+
/**
|
|
76
|
+
* 统一日志输出方法
|
|
77
|
+
* @param pluginName 插件名称
|
|
78
|
+
* @param type 日志类型
|
|
79
|
+
* @param message 日志消息
|
|
80
|
+
* @param data 附加数据
|
|
81
|
+
*/
|
|
82
|
+
private log;
|
|
83
|
+
/**
|
|
84
|
+
* 创建插件日志代理对象
|
|
85
|
+
* @param pluginName 插件名称
|
|
86
|
+
* @returns 插件日志代理对象
|
|
87
|
+
* @internal 供 BasePlugin 内部使用
|
|
88
|
+
*/
|
|
89
|
+
createPluginLogger(pluginName: string): PluginLogger;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Logger, LoggerOptions, PluginLogger };
|