@pawover/kit 0.4.0 → 0.4.2

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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/pawover"
7
7
  },
8
8
  "description": "一个基于 TypeScript 的开发工具包",
9
- "version": "0.4.0",
9
+ "version": "0.4.2",
10
10
  "type": "module",
11
11
  "engines": {
12
12
  "node": ">=22.20.0"
@@ -53,35 +53,41 @@
53
53
  "devDependencies": {
54
54
  "@commitlint/cli": "^21.2.1",
55
55
  "@commitlint/config-conventional": "^21.2.0",
56
- "@eslint-react/eslint-plugin": "^5.14.8",
56
+ "@eslint-react/eslint-plugin": "^5.18.0",
57
57
  "@pawover/eslint-rules": "^0.2.3",
58
- "@playwright/test": "^1.61.1",
58
+ "@playwright/test": "^1.62.0",
59
59
  "@stylistic/eslint-plugin": "^6.0.0-beta.5",
60
+ "@testing-library/react": "^16.3.2",
60
61
  "@types/fs-extra": "^11.0.4",
61
62
  "@types/node": "^26.1.1",
62
- "@vitejs/plugin-react": "^6.0.3",
63
+ "@types/react": "^19.2.17",
64
+ "@vitejs/plugin-react": "^6.0.4",
63
65
  "@vitest/browser-playwright": "^4.1.10",
66
+ "@vitest/coverage-v8": "^4.1.10",
67
+ "alova": "^3.5.1",
64
68
  "commitizen": "^4.3.2",
65
69
  "cz-customizable": "^7.5.4",
66
- "eslint": "^10.7.0",
70
+ "eslint": "^10.8.0",
67
71
  "eslint-plugin-antfu": "^3.2.3",
68
72
  "eslint-plugin-import-lite": "^0.6.0",
69
73
  "eslint-plugin-react-hooks": "^7.1.1",
70
- "fs-extra": "^11.3.6",
74
+ "fs-extra": "^11.4.0",
71
75
  "husky": "^9.1.7",
72
76
  "jsdom": "^29.1.1",
73
- "lint-staged": "^17.0.8",
74
- "prettier": "^3.9.5",
77
+ "lint-staged": "^17.2.0",
78
+ "mathjs": "^15.2.0",
79
+ "prettier": "^3.9.6",
80
+ "react-dom": "19.2.6",
75
81
  "rimraf": "^6.1.3",
76
- "taze": "^19.14.1",
77
- "tsdown": "^0.22.7",
78
- "turbo": "^2.10.5",
82
+ "taze": "^19.16.0",
83
+ "tsdown": "^0.22.14",
84
+ "turbo": "^2.10.7",
79
85
  "typescript": "^6.0.3",
80
- "typescript-eslint": "^8.64.0",
86
+ "typescript-eslint": "^8.65.0",
81
87
  "vitest": "^4.1.10"
82
88
  },
83
89
  "peerDependencies": {
84
- "alova": "^3.3.0",
90
+ "alova": "^3.5.1",
85
91
  "mathjs": "^15.0.0",
86
92
  "react": "^19.2.0",
87
93
  "vite": "^7 || ^8",
@@ -113,7 +119,14 @@
113
119
  }
114
120
  },
115
121
  "scripts": {
116
- "test": "vitest",
122
+ "test": "vitest run",
123
+ "test:watch": "vitest",
124
+ "test:coverage": "vitest run --coverage",
125
+ "test:unit": "vitest run test/unit",
126
+ "test:integration": "vitest run test/integration",
127
+ "test:types": "tsc -p test/tsconfig.json --noEmit",
128
+ "test:smoke": "node test/scripts/smoke.mjs",
129
+ "test:ci": "pnpm test:types && pnpm test && pnpm build && pnpm test:smoke && pnpm check:pack",
117
130
  "build": "turbo build",
118
131
  "build:force": "turbo build --force",
119
132
  "build:package": "turbo build:package && pnpm package",
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -11,7 +11,7 @@ function useLatest(value) {
11
11
  return ref;
12
12
  }
13
13
  //#endregion
14
- //#region ../utils/dist/stringUtil-voQaLOJj.js
14
+ //#region ../utils/dist/math-B5PyWuKn.js
15
15
  /**
16
16
  * 类型工具类
17
17
  */
@@ -273,6 +273,19 @@ var TypeUtil = class {
273
273
  return value === null;
274
274
  }
275
275
  /**
276
+ * 检查 value 是否为 null 或 undefined
277
+ * @param value 待检查值
278
+ * @returns 是否为 Nullish
279
+ * @example
280
+ * ```ts
281
+ * TypeUtil.isNullish(null); // true
282
+ * TypeUtil.isNullish(undefined); // true
283
+ * ```
284
+ */
285
+ static isNullish(value) {
286
+ return this.isNull(value) || this.isUndefined(value);
287
+ }
288
+ /**
276
289
  * 检查 value 是否为 Function
277
290
  * @param value 待检查值
278
291
  * @returns 是否为 Function
@@ -2056,12 +2069,12 @@ function useMount(effect) {
2056
2069
  }, [effectRef]);
2057
2070
  }
2058
2071
  //#endregion
2059
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
2072
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
2060
2073
  const globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
2061
2074
  return this;
2062
2075
  })();
2063
2076
  //#endregion
2064
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/function/noop.mjs
2077
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/function/noop.mjs
2065
2078
  /**
2066
2079
  * A no-operation function that does nothing.
2067
2080
  * This can be used as a placeholder or default function.
@@ -2073,7 +2086,7 @@ const globalThis_ = typeof globalThis === "object" && globalThis || typeof windo
2073
2086
  */
2074
2087
  function noop() {}
2075
2088
  //#endregion
2076
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
2089
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
2077
2090
  /**
2078
2091
  * Checks whether a value is a JavaScript primitive.
2079
2092
  * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
@@ -2099,7 +2112,7 @@ function isPrimitive(value) {
2099
2112
  return value == null || typeof value !== "object" && typeof value !== "function";
2100
2113
  }
2101
2114
  //#endregion
2102
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
2115
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
2103
2116
  /**
2104
2117
  * Checks if a value is a TypedArray.
2105
2118
  * @param x The value to check.
@@ -2119,7 +2132,7 @@ function isTypedArray(x) {
2119
2132
  return ArrayBuffer.isView(x) && !(x instanceof DataView);
2120
2133
  }
2121
2134
  //#endregion
2122
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/clone.mjs
2135
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/object/clone.mjs
2123
2136
  /**
2124
2137
  * Creates a shallow clone of the given object.
2125
2138
  *
@@ -2177,7 +2190,7 @@ function clone(obj) {
2177
2190
  return obj;
2178
2191
  }
2179
2192
  //#endregion
2180
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
2193
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
2181
2194
  /**
2182
2195
  * Checks if the given value is a Buffer instance.
2183
2196
  *
@@ -2200,12 +2213,12 @@ function isBuffer(x) {
2200
2213
  return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
2201
2214
  }
2202
2215
  //#endregion
2203
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
2216
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
2204
2217
  function getSymbols(object) {
2205
2218
  return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
2206
2219
  }
2207
2220
  //#endregion
2208
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
2221
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
2209
2222
  /**
2210
2223
  * Gets the `toStringTag` of `value`.
2211
2224
  *
@@ -2218,7 +2231,7 @@ function getTag(value) {
2218
2231
  return Object.prototype.toString.call(value);
2219
2232
  }
2220
2233
  //#endregion
2221
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
2234
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
2222
2235
  const regexpTag = "[object RegExp]";
2223
2236
  const stringTag = "[object String]";
2224
2237
  const numberTag = "[object Number]";
@@ -2245,7 +2258,7 @@ const bigInt64ArrayTag = "[object BigInt64Array]";
2245
2258
  const float32ArrayTag = "[object Float32Array]";
2246
2259
  const float64ArrayTag = "[object Float64Array]";
2247
2260
  //#endregion
2248
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
2261
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
2249
2262
  /**
2250
2263
  * Checks if a given value is a plain object.
2251
2264
  *
@@ -2295,13 +2308,13 @@ function isPlainObject(value) {
2295
2308
  return Object.prototype.toString.call(value) === "[object Object]";
2296
2309
  }
2297
2310
  //#endregion
2298
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
2311
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/util/eq.mjs
2299
2312
  /**
2300
2313
  * Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
2301
2314
  *
2302
- * @param {any} value - The value to compare.
2303
- * @param {any} other - The other value to compare.
2304
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2315
+ * @param value The value to compare.
2316
+ * @param other The other value to compare.
2317
+ * @returns Returns `true` if the values are equivalent, else `false`.
2305
2318
  *
2306
2319
  * @example
2307
2320
  * eq(1, 1); // true
@@ -2309,11 +2322,11 @@ function isPlainObject(value) {
2309
2322
  * eq(NaN, NaN); // true
2310
2323
  * eq('a', Object('a')); // false
2311
2324
  */
2312
- function isEqualsSameValueZero(value, other) {
2325
+ function eq(value, other) {
2313
2326
  return value === other || Number.isNaN(value) && Number.isNaN(other);
2314
2327
  }
2315
2328
  //#endregion
2316
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
2329
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
2317
2330
  /**
2318
2331
  * Compares two values for equality using a custom comparison function.
2319
2332
  *
@@ -2376,7 +2389,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
2376
2389
  if (aTag !== bTag) return false;
2377
2390
  switch (aTag) {
2378
2391
  case stringTag: return a.toString() === b.toString();
2379
- case numberTag: return isEqualsSameValueZero(a.valueOf(), b.valueOf());
2392
+ case numberTag: return eq(a.valueOf(), b.valueOf());
2380
2393
  case booleanTag:
2381
2394
  case dateTag:
2382
2395
  case symbolTag: return Object.is(a.valueOf(), b.valueOf());
@@ -2454,7 +2467,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
2454
2467
  }
2455
2468
  }
2456
2469
  //#endregion
2457
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isEqual.mjs
2470
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isEqual.mjs
2458
2471
  /**
2459
2472
  * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
2460
2473
  *