vite-plugin-performance 2.0.9 → 2.1.0

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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
- //#region src/types.d.ts
3
2
  /**
4
3
  * @description Vite 插件 hook 名称
5
4
  */
@@ -55,8 +54,6 @@ export interface ResolvedWrapPluginOptions {
55
54
  onHookExecution?: (context: HookExecutionContext) => void;
56
55
  clock: HookClock;
57
56
  }
58
- //#endregion
59
- //#region src/constants.d.ts
60
57
  /**
61
58
  * @description 默认需要包裹的插件 hooks
62
59
  */
@@ -65,14 +62,9 @@ export declare const DEFAULT_PLUGIN_HOOKS: PluginHookName[];
65
62
  * @description 默认耗时阈值(毫秒)
66
63
  */
67
64
  export declare const DEFAULT_THRESHOLD = 0;
68
- //#endregion
69
- //#region src/options.d.ts
70
65
  /**
71
66
  * @description 解析插件配置并补全默认值
72
67
  */
73
68
  export declare function resolveOptions(options?: Partial<WrapPluginOptions>): ResolvedWrapPluginOptions;
74
- //#endregion
75
- //#region src/wrapPlugin.d.ts
76
69
  export declare function wrapPlugin(maybePlugin: Plugin, options?: Partial<WrapPluginOptions>): Plugin;
77
- export declare function wrapPlugin(maybePlugin: Plugin[], options?: Partial<WrapPluginOptions>): Plugin[];
78
- //#endregion
70
+ export declare function wrapPlugin(maybePlugin: Plugin[], options?: Partial<WrapPluginOptions>): Plugin[];
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/constants.ts
1
+ // src/constants.ts
2
2
  /**
3
3
  * @description 默认需要包裹的插件 hooks
4
4
  */
@@ -36,8 +36,7 @@ const DEFAULT_FORMATTER = ({ pluginName, hookName, duration }) => {
36
36
  const DEFAULT_LOGGER = (message) => {
37
37
  console.log(message);
38
38
  };
39
- //#endregion
40
- //#region src/options.ts
39
+ // src/options.ts
41
40
  const defaultClock = typeof globalThis !== "undefined" && typeof globalThis.performance?.now === "function" ? () => globalThis.performance.now() : () => Date.now();
42
41
  /**
43
42
  * @description 解析插件配置并补全默认值
@@ -60,8 +59,7 @@ function resolveOptions(options = {}) {
60
59
  function resolvePluginName(rawName) {
61
60
  return rawName && rawName.length > 0 ? rawName : ANONYMOUS_PLUGIN_NAME;
62
61
  }
63
- //#endregion
64
- //#region src/utils.ts
62
+ // src/utils.ts
65
63
  /**
66
64
  * @description 统一为数组
67
65
  */
@@ -74,8 +72,7 @@ function ensureArray(value) {
74
72
  function isPromiseLike(value) {
75
73
  return typeof value === "object" && value !== null && "then" in value;
76
74
  }
77
- //#endregion
78
- //#region src/wrapPlugin.ts
75
+ // src/wrapPlugin.ts
79
76
  function resolveHooks(plugin, hooks) {
80
77
  if (hooks === "all") return Object.keys(plugin).filter((key) => typeof plugin[key] === "function");
81
78
  return [...hooks];
@@ -143,5 +140,4 @@ function wrapPlugin(maybePlugin, options) {
143
140
  const wrapped = ensureArray(maybePlugin).map((plugin) => wrapSinglePlugin(plugin, resolvedOptions));
144
141
  return Array.isArray(maybePlugin) ? wrapped : wrapped[0];
145
142
  }
146
- //#endregion
147
143
  export { DEFAULT_PLUGIN_HOOKS, DEFAULT_THRESHOLD, resolveOptions, wrapPlugin };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-performance",
3
3
  "type": "module",
4
- "version": "2.0.9",
4
+ "version": "2.1.0",
5
5
  "description": "vite-plugin-performance tools and runtime components for modern WeChat and multi-platform mini-program development.",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "engines": {
40
- "node": "^20.19.0 || >=22.12.0"
40
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public",