vite-plugin-performance 2.0.1 → 2.0.3

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 (2) hide show
  1. package/dist/index.mjs +27 -27
  2. package/package.json +17 -3
package/dist/index.mjs CHANGED
@@ -56,11 +56,28 @@ function isPromiseLike(value) {
56
56
  return typeof value === "object" && value !== null && "then" in value;
57
57
  }
58
58
 
59
- function wrapPlugin(maybePlugin, options) {
60
- const resolvedOptions = resolveOptions(options);
61
- const plugins = ensureArray(maybePlugin);
62
- const wrapped = plugins.map((plugin) => wrapSinglePlugin(plugin, resolvedOptions));
63
- return Array.isArray(maybePlugin) ? wrapped : wrapped[0];
59
+ function resolveHooks(plugin, hooks) {
60
+ if (hooks === "all") {
61
+ return Object.keys(plugin).filter((key) => typeof plugin[key] === "function");
62
+ }
63
+ return [...hooks];
64
+ }
65
+ function reportExecution(params) {
66
+ const { pluginName, hookName, args, start, options } = params;
67
+ const duration = Math.max(0, options.clock() - start);
68
+ const context = {
69
+ pluginName,
70
+ hookName,
71
+ args,
72
+ duration
73
+ };
74
+ if (duration >= options.threshold) {
75
+ if (!options.silent) {
76
+ const message = options.formatter(context);
77
+ options.logger(message, context);
78
+ }
79
+ options.onHookExecution?.(context);
80
+ }
64
81
  }
65
82
  function wrapSinglePlugin(plugin, options) {
66
83
  const wrapped = { ...plugin };
@@ -95,28 +112,11 @@ function wrapSinglePlugin(plugin, options) {
95
112
  }
96
113
  return wrapped;
97
114
  }
98
- function resolveHooks(plugin, hooks) {
99
- if (hooks === "all") {
100
- return Object.keys(plugin).filter((key) => typeof plugin[key] === "function");
101
- }
102
- return [...hooks];
103
- }
104
- function reportExecution(params) {
105
- const { pluginName, hookName, args, start, options } = params;
106
- const duration = Math.max(0, options.clock() - start);
107
- const context = {
108
- pluginName,
109
- hookName,
110
- args,
111
- duration
112
- };
113
- if (duration >= options.threshold) {
114
- if (!options.silent) {
115
- const message = options.formatter(context);
116
- options.logger(message, context);
117
- }
118
- options.onHookExecution?.(context);
119
- }
115
+ function wrapPlugin(maybePlugin, options) {
116
+ const resolvedOptions = resolveOptions(options);
117
+ const plugins = ensureArray(maybePlugin);
118
+ const wrapped = plugins.map((plugin) => wrapSinglePlugin(plugin, resolvedOptions));
119
+ return Array.isArray(maybePlugin) ? wrapped : wrapped[0];
120
120
  }
121
121
 
122
122
  export { DEFAULT_PLUGIN_HOOKS, DEFAULT_THRESHOLD, resolveOptions, wrapPlugin };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "vite-plugin-performance",
3
3
  "type": "module",
4
- "version": "2.0.1",
5
- "description": "vite-plugin-performance",
4
+ "version": "2.0.3",
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",
8
+ "homepage": "https://github.com/weapp-vite/weapp-vite#readme",
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "git+https://github.com/weapp-vite/weapp-vite.git",
@@ -13,7 +14,15 @@
13
14
  "bugs": {
14
15
  "url": "https://github.com/weapp-vite/weapp-vite/issues"
15
16
  },
16
- "keywords": [],
17
+ "keywords": [
18
+ "weapp-vite",
19
+ "weapp",
20
+ "wechat",
21
+ "mini-program",
22
+ "miniprogram",
23
+ "vite",
24
+ "runtime"
25
+ ],
17
26
  "sideEffects": false,
18
27
  "exports": {
19
28
  ".": {
@@ -30,12 +39,17 @@
30
39
  "engines": {
31
40
  "node": "^20.19.0 || >=22.12.0"
32
41
  },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "registry": "https://registry.npmjs.org"
45
+ },
33
46
  "scripts": {
34
47
  "dev": "unbuild --stub",
35
48
  "build:watch": "unbuild --watch --sourcemap",
36
49
  "build": "unbuild",
37
50
  "test": "vitest run",
38
51
  "test:dev": "vitest",
52
+ "typecheck": "tsc --noEmit",
39
53
  "release": "pnpm publish",
40
54
  "lint": "eslint .",
41
55
  "lint:fix": "eslint . --fix"