@kikiutils/shared 18.2.0 → 19.0.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.
Files changed (160) hide show
  1. package/README.md +0 -7
  2. package/dist/buffer.d.ts +0 -2
  3. package/dist/buffer.d.ts.map +1 -1
  4. package/dist/buffer.js +1 -2
  5. package/dist/classes/enhanced-date.d.ts +0 -2
  6. package/dist/classes/enhanced-date.d.ts.map +1 -1
  7. package/dist/classes/enhanced-date.js +1 -2
  8. package/dist/classes/path.d.ts +2 -3
  9. package/dist/classes/path.d.ts.map +1 -1
  10. package/dist/classes/path.js +1 -2
  11. package/dist/classes/precision-number.d.ts +0 -2
  12. package/dist/classes/precision-number.d.ts.map +1 -1
  13. package/dist/classes/precision-number.js +1 -2
  14. package/dist/clipboard.d.ts +1 -2
  15. package/dist/clipboard.d.ts.map +1 -1
  16. package/dist/clipboard.js +1 -2
  17. package/dist/crypto-hash.d.ts +0 -2
  18. package/dist/crypto-hash.d.ts.map +1 -1
  19. package/dist/crypto-hash.js +1 -2
  20. package/dist/datetime.d.ts +0 -2
  21. package/dist/datetime.d.ts.map +1 -1
  22. package/dist/datetime.js +1 -2
  23. package/dist/element-plus.d.ts +0 -2
  24. package/dist/element-plus.d.ts.map +1 -1
  25. package/dist/element-plus.js +1 -2
  26. package/dist/enum.d.ts +0 -2
  27. package/dist/enum.d.ts.map +1 -1
  28. package/dist/enum.js +1 -2
  29. package/dist/env.d.ts +0 -2
  30. package/dist/env.d.ts.map +1 -1
  31. package/dist/env.js +1 -2
  32. package/dist/event-awaiter.d.ts +0 -2
  33. package/dist/event-awaiter.d.ts.map +1 -1
  34. package/dist/event-awaiter.js +1 -2
  35. package/dist/file.d.ts +25 -0
  36. package/dist/file.d.ts.map +1 -0
  37. package/dist/file.js +30 -0
  38. package/dist/file.js.map +1 -0
  39. package/dist/general.d.ts +0 -2
  40. package/dist/general.d.ts.map +1 -1
  41. package/dist/general.js +1 -2
  42. package/dist/hash.d.ts +0 -2
  43. package/dist/hash.d.ts.map +1 -1
  44. package/dist/hash.js +1 -2
  45. package/dist/logger/_internals/formatter.d.ts +13 -0
  46. package/dist/logger/_internals/formatter.d.ts.map +1 -0
  47. package/dist/logger/_internals/formatter.js +57 -0
  48. package/dist/logger/_internals/formatter.js.map +1 -0
  49. package/dist/logger/_internals/levels.d.ts +54 -0
  50. package/dist/logger/_internals/levels.d.ts.map +1 -0
  51. package/dist/logger/_internals/levels.js +59 -0
  52. package/dist/logger/_internals/levels.js.map +1 -0
  53. package/dist/logger/_internals/logger.d.ts +12 -0
  54. package/dist/logger/_internals/logger.d.ts.map +1 -0
  55. package/dist/logger/_internals/logger.js +147 -0
  56. package/dist/logger/_internals/logger.js.map +1 -0
  57. package/dist/logger/_internals/types.d.ts +12 -0
  58. package/dist/logger/_internals/types.d.ts.map +1 -0
  59. package/dist/logger/_internals/types.js +1 -0
  60. package/dist/logger/index.d.ts +10 -0
  61. package/dist/logger/index.d.ts.map +1 -0
  62. package/dist/logger/index.js +25 -0
  63. package/dist/logger/index.js.map +1 -0
  64. package/dist/logger/node/_internals/file-writer.d.ts +11 -0
  65. package/dist/logger/node/_internals/file-writer.d.ts.map +1 -0
  66. package/dist/logger/node/_internals/file-writer.js +188 -0
  67. package/dist/logger/node/_internals/file-writer.js.map +1 -0
  68. package/dist/logger/node/_internals/formatter.d.ts +4 -0
  69. package/dist/logger/node/_internals/formatter.d.ts.map +1 -0
  70. package/dist/logger/node/_internals/formatter.js +21 -0
  71. package/dist/logger/node/_internals/formatter.js.map +1 -0
  72. package/dist/logger/node/index.d.ts +10 -0
  73. package/dist/logger/node/index.d.ts.map +1 -0
  74. package/dist/logger/node/index.js +122 -0
  75. package/dist/logger/node/index.js.map +1 -0
  76. package/dist/logger/node/types.d.ts +43 -0
  77. package/dist/logger/node/types.d.ts.map +1 -0
  78. package/dist/logger/node/types.js +1 -0
  79. package/dist/logger/types.d.ts +49 -0
  80. package/dist/logger/types.d.ts.map +1 -0
  81. package/dist/logger/types.js +1 -0
  82. package/dist/math.d.ts +1 -2
  83. package/dist/math.d.ts.map +1 -1
  84. package/dist/math.js +1 -2
  85. package/dist/number.d.ts +0 -2
  86. package/dist/number.d.ts.map +1 -1
  87. package/dist/number.js +1 -2
  88. package/dist/random.d.ts +0 -2
  89. package/dist/random.d.ts.map +1 -1
  90. package/dist/random.js +1 -2
  91. package/dist/redis/script-runner.d.ts +0 -2
  92. package/dist/redis/script-runner.d.ts.map +1 -1
  93. package/dist/redis/script-runner.js +1 -2
  94. package/dist/storages/lru/keyed-store.d.ts +2 -2
  95. package/dist/storages/lru/keyed-store.d.ts.map +1 -1
  96. package/dist/storages/lru/keyed-store.js +6 -3
  97. package/dist/storages/lru/keyed-store.js.map +1 -1
  98. package/dist/storages/redis/keyed-store.d.ts +0 -2
  99. package/dist/storages/redis/keyed-store.d.ts.map +1 -1
  100. package/dist/storages/redis/keyed-store.js +1 -2
  101. package/dist/storages/redis/msgpack.d.ts +0 -2
  102. package/dist/storages/redis/msgpack.d.ts.map +1 -1
  103. package/dist/storages/redis/msgpack.js +1 -2
  104. package/dist/storages/redis/types.d.ts +0 -2
  105. package/dist/storages/redis/types.d.ts.map +1 -1
  106. package/dist/string.d.ts +0 -2
  107. package/dist/string.d.ts.map +1 -1
  108. package/dist/string.js +1 -2
  109. package/dist/time.d.ts +0 -2
  110. package/dist/time.d.ts.map +1 -1
  111. package/dist/time.js +1 -2
  112. package/dist/types/filtered-key-path.d.ts +1 -2
  113. package/dist/types/filtered-key-path.d.ts.map +1 -1
  114. package/dist/types/index.d.ts +0 -10
  115. package/dist/types/index.d.ts.map +1 -1
  116. package/dist/types/vue.d.ts +0 -2
  117. package/dist/types/vue.d.ts.map +1 -1
  118. package/dist/url.d.ts +0 -2
  119. package/dist/url.d.ts.map +1 -1
  120. package/dist/url.js +1 -2
  121. package/dist/vue.d.ts +0 -2
  122. package/dist/vue.d.ts.map +1 -1
  123. package/dist/vue.js +1 -2
  124. package/dist/web.d.ts +0 -2
  125. package/dist/web.d.ts.map +1 -1
  126. package/dist/web.js +1 -2
  127. package/package.json +78 -45
  128. package/src/file.ts +37 -0
  129. package/src/logger/_internals/formatter.ts +80 -0
  130. package/src/logger/_internals/levels.ts +60 -0
  131. package/src/logger/_internals/logger.ts +224 -0
  132. package/src/logger/_internals/types.ts +12 -0
  133. package/src/logger/index.ts +34 -0
  134. package/src/logger/node/_internals/file-writer.ts +298 -0
  135. package/src/logger/node/_internals/formatter.ts +33 -0
  136. package/src/logger/node/index.ts +175 -0
  137. package/src/logger/node/types.ts +58 -0
  138. package/src/logger/types.ts +59 -0
  139. package/src/storages/lru/keyed-store.ts +4 -0
  140. package/src/types/index.ts +0 -10
  141. package/dist/classes/ssh-client.d.ts +0 -39
  142. package/dist/classes/ssh-client.d.ts.map +0 -1
  143. package/dist/classes/ssh-client.js +0 -130
  144. package/dist/classes/ssh-client.js.map +0 -1
  145. package/dist/consola.d.ts +0 -24
  146. package/dist/consola.d.ts.map +0 -1
  147. package/dist/consola.js +0 -29
  148. package/dist/consola.js.map +0 -1
  149. package/dist/object.d.ts +0 -44
  150. package/dist/object.d.ts.map +0 -1
  151. package/dist/object.js +0 -59
  152. package/dist/object.js.map +0 -1
  153. package/dist/pino.d.ts +0 -25
  154. package/dist/pino.d.ts.map +0 -1
  155. package/dist/pino.js +0 -34
  156. package/dist/pino.js.map +0 -1
  157. package/src/classes/ssh-client.ts +0 -175
  158. package/src/consola.ts +0 -25
  159. package/src/object.ts +0 -78
  160. package/src/pino.ts +0 -33
package/dist/string.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/string.d.ts
2
1
  /**
3
2
  * Character-set presets supported by `randomString`.
4
3
  */
@@ -28,5 +27,4 @@ export type RandomStringMode = 'alphabetic' | 'alphanumeric' | 'lowercase' | 'lo
28
27
  * ```
29
28
  */
30
29
  export declare function randomString(length: number, mode?: RandomStringMode): string;
31
- //#endregion
32
30
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":";;;;YAGY;;;;;;;;;;;;;;;;;;;;;;;;;wBA8CI,aAAa,gBAAgB,OAAM"}
1
+ {"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":";;;YAGY;;;;;;;;;;;;;;;;;;;;;;;;;wBA8CI,aAAa,gBAAgB,OAAM"}
package/dist/string.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/string.ts
1
+ // src/string.ts
2
2
  const DIGITS = "0123456789";
3
3
  const LOWERCASE = "abcdefghijklmnopqrstuvwxyz";
4
4
  const UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -41,7 +41,6 @@ function randomString(length, mode = "alphabetic") {
41
41
  if (!charset) throw new Error(`Unsupported mode: ${mode}`);
42
42
  return Array.from({ length }, () => charset[Math.floor(Math.random() * charset.length)]).join("");
43
43
  }
44
- //#endregion
45
44
  export { randomString };
46
45
 
47
46
  //# sourceMappingURL=string.js.map
package/dist/time.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/time.d.ts
2
1
  /**
3
2
  * Waits until a duration elapses or cancellation occurs without rejecting on cancellation.
4
3
  *
@@ -45,5 +44,4 @@ export declare function delay(ms: number, signal?: AbortSignal): Promise<void>;
45
44
  * ```
46
45
  */
47
46
  export declare function delayOrThrow(ms: number, signal?: AbortSignal): Promise<void>;
48
- //#endregion
49
47
  //# sourceMappingURL=time.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBAoBgB,MAAM,YAAY,SAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;wBA2CzC,aAAa,YAAY,SAAS,cAAc"}
1
+ {"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAoBgB,MAAM,YAAY,SAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;wBA2CzC,aAAa,YAAY,SAAS,cAAc"}
package/dist/time.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/time.ts
1
+ // src/time.ts
2
2
  /**
3
3
  * Waits until a duration elapses or cancellation occurs without rejecting on cancellation.
4
4
  *
@@ -75,7 +75,6 @@ function delayOrThrow(ms, signal) {
75
75
  signal?.addEventListener("abort", onAbort, { once: true });
76
76
  });
77
77
  }
78
- //#endregion
79
78
  export { delay, delayOrThrow };
80
79
 
81
80
  //# sourceMappingURL=time.js.map
@@ -1,5 +1,4 @@
1
1
  import { ObjectId } from "bson";
2
- //#region src/types/filtered-key-path.d.ts
3
2
  type ConditionalPath<K extends number | string, V, U> = V extends U ? `${K}` : DefaultPath<K, V, U, never>;
4
3
  type DefaultPath<K extends number | string, V, U = never, RK = `${K}`> = V extends TerminalType ? RK : `${K}.${FilteredKeyPath<V, U>}`;
5
4
  /**
@@ -13,5 +12,5 @@ type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false
13
12
  type PathImpl<K extends number | string, V, U> = [U] extends [never] ? DefaultPath<K, V> : ConditionalPath<K, V, U>;
14
13
  type TerminalType = bigint | Blob | boolean | Date | File | null | number | ObjectId | RegExp | string | symbol | undefined;
15
14
  type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
16
- //#endregion
15
+ export {};
17
16
  //# sourceMappingURL=filtered-key-path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":";;KAKK,gBAAgB,2BAA2B,GAAG,KAAK,UAAU,OAAO,MAAM,YAAY,GAAG,GAAG;KAC5F,YACD,2BACA,GACA,WACA,QAAQ,OACR,UAAU,eAAe,QAAQ,KAAK,gBAAgB,GAAG;;;;;;;YAUjD,gBAAgB,GAAG,aAAa,UAAU,oBAAoB,MAAM,QAAQ,qBAAqB,KAAK,SAAS,OAAO,SAAS,QAAQ,YAAY,EAAE,IAAI,MAAK,SAAS,MAAM,iBAAiB,GAAG,SAAS,WAAW,MAAM,SAAS,QAAQ,YAAY,EAAE,IAAI,YAAW;KAGhR,QAAQ,UAAU,qCAAqC;KACvD,SAAS,2BAA2B,GAAG,MAAM,qBAAqB,YAAY,GAAG,KAAK,gBAAgB,GAAG,GAAG;KAC5G,wBAED,iBAEA,OACA,uBAGA,WACA;KAKC,SAAS,UAAU,sBAAsB,cAAc"}
1
+ {"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":";KAKK,gBAAgB,2BAA2B,GAAG,KAAK,UAAU,OAAO,MAAM,YAAY,GAAG,GAAG;KAC5F,YACD,2BACA,GACA,WACA,QAAQ,OACR,UAAU,eAAe,QAAQ,KAAK,gBAAgB,GAAG;;;;;;;YAUjD,gBAAgB,GAAG,aAAa,UAAU,oBAAoB,MAAM,QAAQ,qBAAqB,KAAK,SAAS,OAAO,SAAS,QAAQ,YAAY,EAAE,IAAI,MAAK,SAAS,MAAM,iBAAiB,GAAG,SAAS,WAAW,MAAM,SAAS,QAAQ,YAAY,EAAE,IAAI,YAAW;KAGhR,QAAQ,UAAU,qCAAqC;KACvD,SAAS,2BAA2B,GAAG,MAAM,qBAAqB,YAAY,GAAG,KAAK,gBAAgB,GAAG,GAAG;KAC5G,wBAED,iBAEA,OACA,uBAGA,WACA;KAKC,SAAS,UAAU,sBAAsB,cAAc"}
@@ -1,10 +1,5 @@
1
1
  import { FilteredKeyPath } from "./filtered-key-path.js";
2
2
  import { Blob as Blob$1, Buffer, File as File$1 } from "node:buffer";
3
- //#region src/types/index.d.ts
4
- /**
5
- * A generic string-keyed object for utility APIs that intentionally accept any value shape.
6
- */
7
- export type AnyRecord = Record<string, any>;
8
3
  /**
9
4
  * Binary-like inputs accepted by `toBuffer` across browser and Node.js runtimes.
10
5
  */
@@ -21,10 +16,6 @@ export type MaybePartial<T> = Partial<T> | T;
21
16
  * Accepts either a mutable value or a readonly view of that value.
22
17
  */
23
18
  export type MaybeReadonly<T> = Readonly<T> | T;
24
- /**
25
- * Number-like value represented as a number or a numeric string.
26
- */
27
- export type Numberish = number | string;
28
19
  /**
29
20
  * A `Record` where every key is optional.
30
21
  */
@@ -37,6 +28,5 @@ export type ReadonlyPartialRecord<K extends keyof any, T> = Readonly<PartialReco
37
28
  * A readonly `Record`.
38
29
  */
39
30
  export type ReadonlyRecord<K extends keyof any, T> = Readonly<Record<K, T>>;
40
- //#endregion
41
31
  export type { FilteredKeyPath };
42
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["NodeBlob","NodeFile"],"sources":["../../src/types/index.ts"],"mappings":";;;;;;YAWY,YAAY;;;;YAKZ,cAAc,cAAc,OAAO,SAAS,OAAOA,SAAWC,SAAW;;;;YAKzE;;;;YAKA,aAAa,KAAK,QAAQ,KAAK;;;;YAK/B,cAAc,KAAK,SAAS,KAAK;;;;YAKjC;;;;YAKA,cAAc,qBAAqB,KAAK,QAAQ,OAAO,GAAG;;;;YAK1D,sBAAsB,qBAAqB,KAAK,SAAS,cAAc,GAAG;;;;YAK1E,eAAe,qBAAqB,KAAK,SAAS,OAAO,GAAG"}
1
+ {"version":3,"file":"index.d.ts","names":["NodeBlob","NodeFile"],"sources":["../../src/types/index.ts"],"mappings":";;;;;YAWY,cAAc,cAAc,OAAO,SAAS,OAAOA,SAAWC,SAAW;;;;YAKzE;;;;YAKA,aAAa,KAAK,QAAQ,KAAK;;;;YAK/B,cAAc,KAAK,SAAS,KAAK;;;;YAKjC,cAAc,qBAAqB,KAAK,QAAQ,OAAO,GAAG;;;;YAK1D,sBAAsB,qBAAqB,KAAK,SAAS,cAAc,GAAG;;;;YAK1E,eAAe,qBAAqB,KAAK,SAAS,OAAO,GAAG"}
@@ -1,5 +1,4 @@
1
1
  import { GlobalComponents } from "vue";
2
- //#region src/types/vue.d.ts
3
2
  /**
4
3
  * A nullable reference to an instance of a globally registered Vue component.
5
4
  *
@@ -15,5 +14,4 @@ import { GlobalComponents } from "vue";
15
14
  * ```
16
15
  */
17
16
  export type ComponentRef<K extends keyof GlobalComponents> = InstanceType<GlobalComponents[K]> | null;
18
- //#endregion
19
17
  //# sourceMappingURL=vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue.d.ts","names":[],"sources":["../../src/types/vue.ts"],"mappings":";;;;;;;;;;;;;;;;YAgBY,aAAa,gBAAgB,oBAAoB,aAAa,iBAAiB"}
1
+ {"version":3,"file":"vue.d.ts","names":[],"sources":["../../src/types/vue.ts"],"mappings":";;;;;;;;;;;;;;;YAgBY,aAAa,gBAAgB,oBAAoB,aAAa,iBAAiB"}
package/dist/url.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/url.d.ts
2
1
  /**
3
2
  * Appends or updates the `redirect` query parameter on a given URL.
4
3
  *
@@ -39,5 +38,4 @@ export declare function isSafeRedirectPath(value: unknown): value is string;
39
38
  * @returns The validated input path, or the unvalidated fallback path.
40
39
  */
41
40
  export declare function normalizeRedirectPath(value: unknown, fallback?: string): string;
42
- //#endregion
43
41
  //# sourceMappingURL=url.d.ts.map
package/dist/url.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","names":[],"sources":["../src/url.ts"],"mappings":";;;;;;;;;;;;;;wBAagB,yBAAyB,aAAa;;;;;;;;;;;;;wBAwBtC,mBAAmB,iBAAiB;;;;;;;;;;;;;wBAoBpC,sBAAsB,gBAAgB"}
1
+ {"version":3,"file":"url.d.ts","names":[],"sources":["../src/url.ts"],"mappings":";;;;;;;;;;;;;wBAagB,yBAAyB,aAAa;;;;;;;;;;;;;wBAwBtC,mBAAmB,iBAAiB;;;;;;;;;;;;;wBAoBpC,sBAAsB,gBAAgB"}
package/dist/url.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/url.ts
1
+ // src/url.ts
2
2
  /**
3
3
  * Appends or updates the `redirect` query parameter on a given URL.
4
4
  *
@@ -56,7 +56,6 @@ function normalizeRedirectPath(value, fallback = "/") {
56
56
  const redirectPath = Array.isArray(value) ? value[0] : value;
57
57
  return isSafeRedirectPath(redirectPath) ? redirectPath : fallback;
58
58
  }
59
- //#endregion
60
59
  export { appendRedirectParamToUrl, isSafeRedirectPath, normalizeRedirectPath };
61
60
 
62
61
  //# sourceMappingURL=url.js.map
package/dist/vue.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Ref } from "vue";
2
- //#region src/vue.d.ts
3
2
  /**
4
3
  * Appends the current Vue Router route's `fullPath` as the `redirect` query parameter to the given URL.
5
4
  *
@@ -34,5 +33,4 @@ export declare function clearTimeoutRef(timeoutRef: Ref<null | ReturnType<typeof
34
33
  * @param containerRef - The reference to the scrollable element, or `null` while it is unavailable.
35
34
  */
36
35
  export declare function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<null | T>): void;
37
- //#endregion
38
36
  //# sourceMappingURL=vue.d.ts.map
package/dist/vue.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":";;;;;;;;;wBAgBgB,yCAAyC;;;;;;wBASzC,iBAAiB,aAAa,WAAW,kBAAkB;;;;;;wBAU3D,gBAAgB,YAAY,WAAW,kBAAkB;;;;;;;;;;;;;;wBAkBzD,kBAAkB,UAAU,UAAU,aAAa,cAAc,WAAW"}
1
+ {"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":";;;;;;;;wBAgBgB,yCAAyC;;;;;;wBASzC,iBAAiB,aAAa,WAAW,kBAAkB;;;;;;wBAU3D,gBAAgB,YAAY,WAAW,kBAAkB;;;;;;;;;;;;;;wBAkBzD,kBAAkB,UAAU,UAAU,aAAa,cAAc,WAAW"}
package/dist/vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { appendRedirectParamToUrl } from "./url.js";
2
2
  import { onActivated } from "vue";
3
3
  import { onBeforeRouteLeave, useRoute } from "vue-router";
4
- //#region src/vue.ts
4
+ // src/vue.ts
5
5
  /**
6
6
  * Appends the current Vue Router route's `fullPath` as the `redirect` query parameter to the given URL.
7
7
  *
@@ -56,7 +56,6 @@ function usePreserveScroll(containerRef) {
56
56
  scrollTop = containerRef.value?.scrollTop || 0;
57
57
  });
58
58
  }
59
- //#endregion
60
59
  export { appendRedirectParamFromCurrentRouteToUrl, clearIntervalRef, clearTimeoutRef, usePreserveScroll };
61
60
 
62
61
  //# sourceMappingURL=vue.js.map
package/dist/web.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/web.d.ts
2
1
  /**
3
2
  * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
4
3
  *
@@ -22,5 +21,4 @@ export declare function appendRedirectParamFromCurrentLocationToUrl(url: string)
22
21
  * when navigation is immediate.
23
22
  */
24
23
  export declare function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number): NodeJS.Timeout | undefined;
25
- //#endregion
26
24
  //# sourceMappingURL=web.d.ts.map
package/dist/web.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"mappings":";;;;;;;;wBASgB,4CAA4C;;;;;;;;;;;;;;;wBAmB5C,8CAA8C,aAAa,mBAAgB,OAAA"}
1
+ {"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"mappings":";;;;;;;wBASgB,4CAA4C;;;;;;;;;;;;;;;wBAmB5C,8CAA8C,aAAa,mBAAgB,OAAA"}
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { appendRedirectParamToUrl } from "./url.js";
2
- //#region src/web.ts
2
+ // src/web.ts
3
3
  /**
4
4
  * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
5
5
  *
@@ -29,7 +29,6 @@ function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
29
29
  if (delayMs === void 0) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));
30
30
  else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);
31
31
  }
32
- //#endregion
33
32
  export { appendRedirectParamFromCurrentLocationToUrl, assignUrlWithRedirectParamFromCurrentLocation };
34
33
 
35
34
  //# sourceMappingURL=web.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kikiutils/shared",
3
3
  "type": "module",
4
- "version": "18.2.0",
4
+ "version": "19.0.0",
5
5
  "description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
6
6
  "author": "kiki-kanri",
7
7
  "license": "MIT",
@@ -27,12 +27,60 @@
27
27
  "crypto",
28
28
  "hashing",
29
29
  "storage",
30
- "logging",
31
- "consola",
32
- "pino"
30
+ "logging"
33
31
  ],
34
32
  "sideEffects": false,
35
33
  "exports": {
34
+ "./logger": {
35
+ "types": "./dist/logger/index.d.ts",
36
+ "import": "./dist/logger/index.js",
37
+ "require": null
38
+ },
39
+ "./logger/_internals/formatter": {
40
+ "types": null,
41
+ "import": null,
42
+ "require": null
43
+ },
44
+ "./logger/_internals/levels": {
45
+ "types": null,
46
+ "import": null,
47
+ "require": null
48
+ },
49
+ "./logger/_internals/logger": {
50
+ "types": null,
51
+ "import": null,
52
+ "require": null
53
+ },
54
+ "./logger/_internals/types": {
55
+ "types": null,
56
+ "import": null,
57
+ "require": null
58
+ },
59
+ "./logger/index": {
60
+ "types": null,
61
+ "import": null,
62
+ "require": null
63
+ },
64
+ "./logger/node": {
65
+ "types": "./dist/logger/node/index.d.ts",
66
+ "import": "./dist/logger/node/index.js",
67
+ "require": null
68
+ },
69
+ "./logger/node/_internals/file-writer": {
70
+ "types": null,
71
+ "import": null,
72
+ "require": null
73
+ },
74
+ "./logger/node/_internals/formatter": {
75
+ "types": null,
76
+ "import": null,
77
+ "require": null
78
+ },
79
+ "./logger/node/index": {
80
+ "types": null,
81
+ "import": null,
82
+ "require": null
83
+ },
36
84
  "./package.json": "./package.json",
37
85
  "./types": {
38
86
  "types": "./dist/types/index.d.ts",
@@ -67,39 +115,30 @@
67
115
  "typecheck": "tsc -b --noEmit"
68
116
  },
69
117
  "peerDependencies": {
70
- "@noble/hashes": "^2.3.0",
71
- "@types/ssh2": "^1.15.5",
118
+ "@noble/hashes": "^2.4.0",
72
119
  "async-validator": "^4.2.5",
73
- "bson": "^7.3.2",
74
- "consola": "^3.4.2",
120
+ "bson": "^7.3.3",
75
121
  "date-fns": "^4.4.0",
76
122
  "decimal.js": "^10.6.0",
77
- "element-plus": "^2.14.4",
78
- "lru-cache": "^11.5.2",
123
+ "element-plus": "^2.14.7",
124
+ "file-type": "^22.2.0",
125
+ "lru-cache": "^11.5.3",
79
126
  "millify": "^6.1.0",
80
- "msgpackr": "^2.0.5",
81
- "node-ssh": "^13.2.1",
82
- "pino": "^10.3.1",
83
- "pino-pretty": "^13.1.3",
84
- "vue": "^3.5.41",
127
+ "msgpackr": "^2.1.0",
128
+ "rotating-file-stream": "^3.2.10",
129
+ "vue": "^3.5.44",
85
130
  "vue-router": ">= 4.6.4"
86
131
  },
87
132
  "peerDependenciesMeta": {
88
133
  "@noble/hashes": {
89
134
  "optional": true
90
135
  },
91
- "@types/ssh2": {
92
- "optional": true
93
- },
94
136
  "async-validator": {
95
137
  "optional": true
96
138
  },
97
139
  "bson": {
98
140
  "optional": true
99
141
  },
100
- "consola": {
101
- "optional": true
102
- },
103
142
  "date-fns": {
104
143
  "optional": true
105
144
  },
@@ -109,6 +148,9 @@
109
148
  "element-plus": {
110
149
  "optional": true
111
150
  },
151
+ "file-type": {
152
+ "optional": true
153
+ },
112
154
  "lru-cache": {
113
155
  "optional": true
114
156
  },
@@ -118,13 +160,7 @@
118
160
  "msgpackr": {
119
161
  "optional": true
120
162
  },
121
- "node-ssh": {
122
- "optional": true
123
- },
124
- "pino": {
125
- "optional": true
126
- },
127
- "pino-pretty": {
163
+ "rotating-file-stream": {
128
164
  "optional": true
129
165
  },
130
166
  "vue": {
@@ -135,36 +171,33 @@
135
171
  }
136
172
  },
137
173
  "devDependencies": {
138
- "@antfu/eslint-config": "^9.5.1",
139
- "@kikiutils/eslint-config": "^9.2.1",
174
+ "@antfu/eslint-config": "^10.0.0",
175
+ "@kikiutils/eslint-config": "^9.3.1",
140
176
  "@kikiutils/tsconfigs": "^7.0.0",
141
177
  "@noble/hashes": "^2.4.0",
142
- "@types/node": "^26.6.4",
143
- "@types/ssh2": "^1.15.6",
144
- "@vitest/coverage-v8": "^5.0.3",
178
+ "@types/node": "^26.6.5",
179
+ "@vitest/coverage-v8": "^5.0.5",
145
180
  "async-validator": "^4.2.5",
146
181
  "bson": "^7.3.3",
147
182
  "changelogen": "^0.6.2",
148
- "consola": "^3.4.2",
149
183
  "cross-env": "^10.1.0",
150
184
  "date-fns": "^4.4.0",
151
185
  "decimal.js": "^10.6.0",
152
186
  "element-plus": "^2.14.7",
153
- "eslint": "^10.12.0",
154
- "jsdom": "^30.1.1",
155
- "knip": "^6.39.0",
187
+ "eslint": "^10.13.0",
188
+ "file-type": "^22.2.0",
189
+ "jsdom": "^30.1.3",
190
+ "knip": "^6.42.1",
156
191
  "lru-cache": "^11.5.3",
157
192
  "millify": "^6.1.0",
158
- "msgpackr": "^2.1.0",
159
- "node-ssh": "^13.2.1",
160
- "pino": "^10.4.0",
161
- "pino-pretty": "^13.1.3",
193
+ "msgpackr": "^2.1.2",
162
194
  "publint": "^0.3.25",
163
- "tsdown": "^0.23.0",
195
+ "rotating-file-stream": "^3.2.10",
196
+ "tsdown": "^0.23.2",
164
197
  "typescript": "^6.0.3",
165
198
  "unplugin-unused": "^0.6.0",
166
- "vitest": "^5.0.3",
167
- "vue": "^3.5.43",
168
- "vue-router": "^5.3.1"
199
+ "vitest": "^5.0.5",
200
+ "vue": "^3.5.44",
201
+ "vue-router": "^5.4.0"
169
202
  }
170
203
  }
package/src/file.ts ADDED
@@ -0,0 +1,37 @@
1
+ import {
2
+ fileTypeFromBlob,
3
+ fileTypeFromBuffer,
4
+ } from 'file-type';
5
+
6
+ import type { BinaryInput } from './types';
7
+
8
+ /**
9
+ * Detects a lowercase MIME type from binary content rather than its name or declared type.
10
+ *
11
+ * @remarks
12
+ * Requires the optional `file-type` peer dependency. Only formats supported by its binary detection
13
+ * are recognized; this is not a general text-file detector or a guarantee that a file is safe.
14
+ * Blob and File inputs are read through the detector's tokenizer instead of being fully buffered up front.
15
+ * The amount of content inspected depends on its format; this does not impose a fixed read limit.
16
+ * Detection and input-reading errors propagate to the caller.
17
+ *
18
+ * @param input - The binary content to inspect.
19
+ *
20
+ * @returns The detected lowercase MIME type, or `undefined` when the content is not recognized.
21
+ *
22
+ * @example
23
+ *
24
+ * ```ts
25
+ * import { getFileMimeType } from '@kikiutils/shared/file';
26
+ *
27
+ * const mimeType = await getFileMimeType(file);
28
+ * ```
29
+ */
30
+ export async function getFileMimeType(input: BinaryInput) {
31
+ // The tokenizer only uses size, slice, and arrayBuffer; Node/DOM Blob stream typings differ.
32
+ const result = input instanceof ArrayBuffer || input instanceof Uint8Array
33
+ ? await fileTypeFromBuffer(input)
34
+ : await fileTypeFromBlob(input as Blob);
35
+
36
+ return result?.mime.toLowerCase();
37
+ }
@@ -0,0 +1,80 @@
1
+ import {
2
+ getLoggerStreamName,
3
+ loggerMethods,
4
+ } from './levels';
5
+ import type { LoggerRecord } from './types';
6
+
7
+ // Functions
8
+
9
+ /** Native console formatting keeps user strings literal and objects expandable. */
10
+ export function formatLoggerConsoleArgs(record: LoggerRecord): unknown[] {
11
+ if (typeof process !== 'undefined' && process.versions?.node) {
12
+ const target = process[getLoggerStreamName(record.type)];
13
+ const parts = formatLoggerParts(record, supportsLoggerColor(target));
14
+ return [
15
+ parts.map((part) => typeof part === 'string' ? '%s' : '%O').join(' '),
16
+ ...parts,
17
+ ];
18
+ }
19
+
20
+ const format: string[] = [];
21
+ const args: unknown[] = [];
22
+ const decorate = (text: string, color: string) => {
23
+ format.push('%c%s%c');
24
+ args.push(`color: ${color}`, text, '');
25
+ };
26
+
27
+ if (record.icons) decorate(loggerMethods[record.type].icon, loggerMethods[record.type].cssColor);
28
+ if (record.timestamp) decorate(formatLoggerTime(record.date), '#808080');
29
+ if (record.prefix) decorate(record.prefix, '#0891b2');
30
+ for (const arg of record.args) {
31
+ format.push(typeof arg === 'string' ? '%s' : '%o');
32
+ args.push(arg);
33
+ }
34
+
35
+ if (record.suffix) decorate(record.suffix, '#0891b2');
36
+ return [
37
+ format.join(' '),
38
+ ...args,
39
+ ];
40
+ }
41
+
42
+ /** Keeps data arguments intact so browser developer tools can expand objects. */
43
+ export function formatLoggerParts(record: LoggerRecord, colors = false): unknown[] {
44
+ const parts: unknown[] = [];
45
+ const paint = (text: string, color: string) => colors ? `\u001B[${color}m${text}\u001B[0m` : text;
46
+ if (record.icons) parts.push(paint(loggerMethods[record.type].icon, loggerMethods[record.type].ansiColor));
47
+ if (record.timestamp) parts.push(paint(formatLoggerTime(record.date), '90'));
48
+ if (record.prefix) parts.push(paint(record.prefix, '36'));
49
+ parts.push(...record.args);
50
+ if (record.suffix) parts.push(paint(record.suffix, '36'));
51
+ return parts;
52
+ }
53
+
54
+ /** Fixed local-time representation, deliberately without a per-second cache. */
55
+ export function formatLoggerTime(date: Date): string {
56
+ const pad = (value: number, width = 2) => String(value).padStart(width, '0');
57
+ const day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
58
+ const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
59
+ return `[${day} ${time}.${pad(date.getMilliseconds(), 3)}]`;
60
+ }
61
+
62
+ /** Use native terminal detection; redirected streams still honor FORCE_COLOR. */
63
+ export function supportsLoggerColor(target: { hasColors?: () => boolean; isTTY?: boolean }): boolean {
64
+ if (target.hasColors) return target.hasColors();
65
+ const forced = process.env.FORCE_COLOR;
66
+ if (forced !== undefined) {
67
+ return [
68
+ '',
69
+ '1',
70
+ '2',
71
+ '3',
72
+ 'true',
73
+ ].includes(forced);
74
+ }
75
+
76
+ return Boolean(target.isTTY)
77
+ && !process.env.NO_COLOR
78
+ && !process.env.NODE_DISABLE_COLORS
79
+ && process.env.TERM !== 'dumb';
80
+ }
@@ -0,0 +1,60 @@
1
+ import type { LoggerMethod } from '../types';
2
+
3
+ // Constants/Variables
4
+ export const loggerMethods = {
5
+ debug: {
6
+ ansiColor: '36',
7
+ consoleMethod: 'debug',
8
+ cssColor: '#0891b2',
9
+ icon: '⚙',
10
+ severity: 20,
11
+ },
12
+ error: {
13
+ ansiColor: '31',
14
+ consoleMethod: 'error',
15
+ cssColor: '#dc2626',
16
+ icon: '✖',
17
+ severity: 50,
18
+ },
19
+ fatal: {
20
+ ansiColor: '31',
21
+ consoleMethod: 'error',
22
+ cssColor: '#dc2626',
23
+ icon: '✖',
24
+ severity: 60,
25
+ },
26
+ info: {
27
+ ansiColor: '36',
28
+ consoleMethod: 'info',
29
+ cssColor: '#0891b2',
30
+ icon: 'ℹ',
31
+ severity: 30,
32
+ },
33
+ success: {
34
+ ansiColor: '32',
35
+ consoleMethod: 'info',
36
+ cssColor: '#16a34a',
37
+ icon: '✔',
38
+ severity: 30,
39
+ },
40
+ trace: {
41
+ ansiColor: '90',
42
+ consoleMethod: 'debug',
43
+ cssColor: '#808080',
44
+ icon: '·',
45
+ severity: 10,
46
+ },
47
+ warn: {
48
+ ansiColor: '33',
49
+ consoleMethod: 'warn',
50
+ cssColor: '#ca8a04',
51
+ icon: '⚠',
52
+ severity: 40,
53
+ },
54
+ } as const;
55
+
56
+ // Functions
57
+ export function getLoggerStreamName(type: LoggerMethod): 'stderr' | 'stdout' {
58
+ const method = loggerMethods[type].consoleMethod;
59
+ return method === 'warn' || method === 'error' ? 'stderr' : 'stdout';
60
+ }