@kikiutils/shared 11.0.0 → 13.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.
- package/README.md +10 -1
- package/dist/buffer.d.ts +7 -3
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +42 -0
- package/dist/buffer.js.map +1 -0
- package/dist/clipboard.d.ts +8 -6
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +86 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/consola.d.ts +8 -2
- package/dist/consola.d.ts.map +1 -1
- package/dist/consola.js +32 -0
- package/dist/consola.js.map +1 -0
- package/dist/crypto-hash.d.ts +16 -26
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/crypto-hash.js +37 -0
- package/dist/crypto-hash.js.map +1 -0
- package/dist/datetime.d.ts +13 -9
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +131 -0
- package/dist/datetime.js.map +1 -0
- package/dist/element-plus.d.ts +8 -4
- package/dist/element-plus.d.ts.map +1 -1
- package/dist/element-plus.js +37 -0
- package/dist/element-plus.js.map +1 -0
- package/dist/enum.d.ts +6 -3
- package/dist/enum.d.ts.map +1 -1
- package/dist/enum.js +108 -0
- package/dist/enum.js.map +1 -0
- package/dist/env.d.ts +12 -9
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +51 -0
- package/dist/env.js.map +1 -0
- package/dist/general.d.ts +5 -2
- package/dist/general.d.ts.map +1 -1
- package/dist/general.js +8 -0
- package/dist/general.js.map +1 -0
- package/dist/hash.d.ts +7 -4
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +20 -0
- package/dist/hash.js.map +1 -0
- package/dist/math.d.ts +20 -17
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +36 -0
- package/dist/math.js.map +1 -0
- package/dist/number.d.ts +7 -2
- package/dist/number.d.ts.map +1 -1
- package/dist/number.js +32 -0
- package/dist/number.js.map +1 -0
- package/dist/object.d.ts +4 -1
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +42 -0
- package/dist/object.js.map +1 -0
- package/dist/pino.d.ts +8 -2
- package/dist/pino.d.ts.map +1 -1
- package/dist/pino.js +40 -0
- package/dist/pino.js.map +1 -0
- package/dist/random.d.ts +4 -1
- package/dist/random.d.ts.map +1 -1
- package/dist/random.js +31 -0
- package/dist/random.js.map +1 -0
- package/dist/storage/enhanced/local/core.d.ts +45 -42
- package/dist/storage/enhanced/local/core.d.ts.map +1 -1
- package/dist/storage/enhanced/local/core.js +63 -0
- package/dist/storage/enhanced/local/core.js.map +1 -0
- package/dist/storage/enhanced/local/index.d.ts +3 -3
- package/dist/storage/enhanced/local/index.js +4 -0
- package/dist/storage/enhanced/local/keyed-store.d.ts +14 -11
- package/dist/storage/enhanced/local/keyed-store.d.ts.map +1 -1
- package/dist/storage/enhanced/local/keyed-store.js +36 -0
- package/dist/storage/enhanced/local/keyed-store.js.map +1 -0
- package/dist/storage/enhanced/redis/core.d.ts +64 -59
- package/dist/storage/enhanced/redis/core.d.ts.map +1 -1
- package/dist/storage/enhanced/redis/core.js +85 -0
- package/dist/storage/enhanced/redis/core.js.map +1 -0
- package/dist/storage/enhanced/redis/index.d.ts +3 -3
- package/dist/storage/enhanced/redis/index.js +4 -0
- package/dist/storage/enhanced/redis/keyed-store.d.ts +19 -14
- package/dist/storage/enhanced/redis/keyed-store.d.ts.map +1 -1
- package/dist/storage/enhanced/redis/keyed-store.js +41 -0
- package/dist/storage/enhanced/redis/keyed-store.js.map +1 -0
- package/dist/storage/lru/keyed-store.d.ts +21 -16
- package/dist/storage/lru/keyed-store.d.ts.map +1 -1
- package/dist/storage/lru/keyed-store.js +40 -0
- package/dist/storage/lru/keyed-store.js.map +1 -0
- package/dist/string.d.ts +5 -2
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +42 -0
- package/dist/string.js.map +1 -0
- package/dist/url.d.ts +4 -1
- package/dist/url.d.ts.map +1 -1
- package/dist/url.js +21 -0
- package/dist/url.js.map +1 -0
- package/dist/vue.d.ts +10 -5
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +58 -0
- package/dist/vue.js.map +1 -0
- package/dist/web.d.ts +5 -2
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +32 -0
- package/dist/web.js.map +1 -0
- package/package.json +108 -32
- package/src/hash.ts +19 -5
- package/src/vue.ts +1 -1
- package/src/web.ts +1 -1
- package/dist/buffer.cjs +0 -43
- package/dist/buffer.cjs.map +0 -1
- package/dist/buffer.mjs +0 -41
- package/dist/buffer.mjs.map +0 -1
- package/dist/clipboard.cjs +0 -91
- package/dist/clipboard.cjs.map +0 -1
- package/dist/clipboard.mjs +0 -88
- package/dist/clipboard.mjs.map +0 -1
- package/dist/consola.cjs +0 -35
- package/dist/consola.cjs.map +0 -1
- package/dist/consola.mjs +0 -32
- package/dist/consola.mjs.map +0 -1
- package/dist/crypto-hash.cjs +0 -61
- package/dist/crypto-hash.cjs.map +0 -1
- package/dist/crypto-hash.mjs +0 -50
- package/dist/crypto-hash.mjs.map +0 -1
- package/dist/datetime.cjs +0 -134
- package/dist/datetime.cjs.map +0 -1
- package/dist/datetime.mjs +0 -130
- package/dist/datetime.mjs.map +0 -1
- package/dist/element-plus.cjs +0 -37
- package/dist/element-plus.cjs.map +0 -1
- package/dist/element-plus.mjs +0 -35
- package/dist/element-plus.mjs.map +0 -1
- package/dist/enum.cjs +0 -112
- package/dist/enum.cjs.map +0 -1
- package/dist/enum.mjs +0 -108
- package/dist/enum.mjs.map +0 -1
- package/dist/env.cjs +0 -53
- package/dist/env.cjs.map +0 -1
- package/dist/env.mjs +0 -50
- package/dist/env.mjs.map +0 -1
- package/dist/general.cjs +0 -10
- package/dist/general.cjs.map +0 -1
- package/dist/general.mjs +0 -8
- package/dist/general.mjs.map +0 -1
- package/dist/hash.cjs +0 -28
- package/dist/hash.cjs.map +0 -1
- package/dist/hash.mjs +0 -23
- package/dist/hash.mjs.map +0 -1
- package/dist/math.cjs +0 -38
- package/dist/math.cjs.map +0 -1
- package/dist/math.mjs +0 -36
- package/dist/math.mjs.map +0 -1
- package/dist/number.cjs +0 -32
- package/dist/number.cjs.map +0 -1
- package/dist/number.mjs +0 -30
- package/dist/number.mjs.map +0 -1
- package/dist/object.cjs +0 -55
- package/dist/object.cjs.map +0 -1
- package/dist/object.mjs +0 -53
- package/dist/object.mjs.map +0 -1
- package/dist/pino.cjs +0 -42
- package/dist/pino.cjs.map +0 -1
- package/dist/pino.mjs +0 -39
- package/dist/pino.mjs.map +0 -1
- package/dist/random.cjs +0 -31
- package/dist/random.cjs.map +0 -1
- package/dist/random.mjs +0 -29
- package/dist/random.mjs.map +0 -1
- package/dist/storage/enhanced/local/core.cjs +0 -105
- package/dist/storage/enhanced/local/core.cjs.map +0 -1
- package/dist/storage/enhanced/local/core.mjs +0 -103
- package/dist/storage/enhanced/local/core.mjs.map +0 -1
- package/dist/storage/enhanced/local/index.cjs +0 -10
- package/dist/storage/enhanced/local/index.cjs.map +0 -1
- package/dist/storage/enhanced/local/index.d.ts.map +0 -1
- package/dist/storage/enhanced/local/index.mjs +0 -3
- package/dist/storage/enhanced/local/index.mjs.map +0 -1
- package/dist/storage/enhanced/local/keyed-store.cjs +0 -41
- package/dist/storage/enhanced/local/keyed-store.cjs.map +0 -1
- package/dist/storage/enhanced/local/keyed-store.mjs +0 -39
- package/dist/storage/enhanced/local/keyed-store.mjs.map +0 -1
- package/dist/storage/enhanced/redis/core.cjs +0 -144
- package/dist/storage/enhanced/redis/core.cjs.map +0 -1
- package/dist/storage/enhanced/redis/core.mjs +0 -142
- package/dist/storage/enhanced/redis/core.mjs.map +0 -1
- package/dist/storage/enhanced/redis/index.cjs +0 -10
- package/dist/storage/enhanced/redis/index.cjs.map +0 -1
- package/dist/storage/enhanced/redis/index.d.ts.map +0 -1
- package/dist/storage/enhanced/redis/index.mjs +0 -3
- package/dist/storage/enhanced/redis/index.mjs.map +0 -1
- package/dist/storage/enhanced/redis/keyed-store.cjs +0 -46
- package/dist/storage/enhanced/redis/keyed-store.cjs.map +0 -1
- package/dist/storage/enhanced/redis/keyed-store.mjs +0 -44
- package/dist/storage/enhanced/redis/keyed-store.mjs.map +0 -1
- package/dist/storage/lru/keyed-store.cjs +0 -49
- package/dist/storage/lru/keyed-store.cjs.map +0 -1
- package/dist/storage/lru/keyed-store.mjs +0 -47
- package/dist/storage/lru/keyed-store.mjs.map +0 -1
- package/dist/string.cjs +0 -45
- package/dist/string.cjs.map +0 -1
- package/dist/string.mjs +0 -43
- package/dist/string.mjs.map +0 -1
- package/dist/url.cjs +0 -21
- package/dist/url.cjs.map +0 -1
- package/dist/url.mjs +0 -19
- package/dist/url.mjs.map +0 -1
- package/dist/vue.cjs +0 -64
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.mjs +0 -59
- package/dist/vue.mjs.map +0 -1
- package/dist/web.cjs +0 -35
- package/dist/web.cjs.map +0 -1
- package/dist/web.mjs +0 -32
- package/dist/web.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/shared",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "13.0.0",
|
|
4
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.",
|
|
5
6
|
"author": "kiki-kanri",
|
|
6
7
|
"license": "MIT",
|
|
@@ -32,31 +33,43 @@
|
|
|
32
33
|
],
|
|
33
34
|
"sideEffects": false,
|
|
34
35
|
"exports": {
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"./
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"./
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
"./buffer": "./dist/buffer.js",
|
|
37
|
+
"./clipboard": "./dist/clipboard.js",
|
|
38
|
+
"./consola": "./dist/consola.js",
|
|
39
|
+
"./crypto-hash": "./dist/crypto-hash.js",
|
|
40
|
+
"./datetime": "./dist/datetime.js",
|
|
41
|
+
"./element-plus": "./dist/element-plus.js",
|
|
42
|
+
"./enum": "./dist/enum.js",
|
|
43
|
+
"./env": "./dist/env.js",
|
|
44
|
+
"./general": "./dist/general.js",
|
|
45
|
+
"./hash": "./dist/hash.js",
|
|
46
|
+
"./math": "./dist/math.js",
|
|
47
|
+
"./number": "./dist/number.js",
|
|
48
|
+
"./object": "./dist/object.js",
|
|
49
|
+
"./pino": "./dist/pino.js",
|
|
50
|
+
"./random": "./dist/random.js",
|
|
51
|
+
"./storage/enhanced/local": "./dist/storage/enhanced/local/index.js",
|
|
52
|
+
"./storage/enhanced/local/core": "./dist/storage/enhanced/local/core.js",
|
|
53
|
+
"./storage/enhanced/local/keyed-store": "./dist/storage/enhanced/local/keyed-store.js",
|
|
54
|
+
"./storage/enhanced/redis": "./dist/storage/enhanced/redis/index.js",
|
|
55
|
+
"./storage/enhanced/redis/core": "./dist/storage/enhanced/redis/core.js",
|
|
56
|
+
"./storage/enhanced/redis/keyed-store": "./dist/storage/enhanced/redis/keyed-store.js",
|
|
57
|
+
"./storage/lru/keyed-store": "./dist/storage/lru/keyed-store.js",
|
|
58
|
+
"./string": "./dist/string.js",
|
|
59
|
+
"./url": "./dist/url.js",
|
|
60
|
+
"./vue": "./dist/vue.js",
|
|
61
|
+
"./web": "./dist/web.js",
|
|
62
|
+
"./package.json": "./package.json"
|
|
50
63
|
},
|
|
51
64
|
"files": [
|
|
52
65
|
"./dist",
|
|
53
66
|
"./src"
|
|
54
67
|
],
|
|
55
68
|
"engines": {
|
|
56
|
-
"node": ">=
|
|
69
|
+
"node": ">=22.0.0"
|
|
57
70
|
},
|
|
58
71
|
"scripts": {
|
|
59
|
-
"build": "
|
|
72
|
+
"build": "tsdown",
|
|
60
73
|
"bumplog": "changelogen --bump --hideAuthorEmail",
|
|
61
74
|
"depcheck": "depcheck",
|
|
62
75
|
"lint": "eslint --max-warnings 0",
|
|
@@ -68,32 +81,95 @@
|
|
|
68
81
|
"typecheck": "tsc --noEmit",
|
|
69
82
|
"unused-exports": "ts-unused-exports ./tsconfig.json"
|
|
70
83
|
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"@noble/hashes": "^2.0.0",
|
|
86
|
+
"async-validator": "^4.2.5",
|
|
87
|
+
"consola": "^3.4.2",
|
|
88
|
+
"date-fns": "^4.1.0",
|
|
89
|
+
"decimal.js": "^10.6.0",
|
|
90
|
+
"element-plus": "^2.11.1",
|
|
91
|
+
"ioredis": "^5.7.0",
|
|
92
|
+
"lru-cache": "^11.1.0",
|
|
93
|
+
"millify": "^6.1.0",
|
|
94
|
+
"pino": "^9.9.0",
|
|
95
|
+
"pino-pretty": "^13.1.1",
|
|
96
|
+
"superjson": "^2.2.2",
|
|
97
|
+
"vue": "^3.5.20",
|
|
98
|
+
"vue-router": "^4.5.1"
|
|
99
|
+
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"@noble/hashes": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"async-validator": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"consola": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"date-fns": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"decimal.js": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"element-plus": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
119
|
+
"ioredis": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
122
|
+
"lru-cache": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"millify": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"pino": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"pino-pretty": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"superjson": {
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"vue": {
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"vue-router": {
|
|
141
|
+
"optional": true
|
|
142
|
+
}
|
|
143
|
+
},
|
|
71
144
|
"devDependencies": {
|
|
72
|
-
"@kikiutils/changelogen": "^0.
|
|
73
|
-
"@kikiutils/eslint-config": "^1.
|
|
145
|
+
"@kikiutils/changelogen": "^0.9.0",
|
|
146
|
+
"@kikiutils/eslint-config": "^2.1.1",
|
|
74
147
|
"@kikiutils/tsconfigs": "^5.0.4",
|
|
75
|
-
"@noble/hashes": "^
|
|
76
|
-
"@types/node": "^24.
|
|
148
|
+
"@noble/hashes": "^2.0.0",
|
|
149
|
+
"@types/node": "^24.3.3",
|
|
77
150
|
"@vitest/coverage-v8": "^3.2.4",
|
|
78
151
|
"async-validator": "^4.2.5",
|
|
79
152
|
"consola": "^3.4.2",
|
|
80
|
-
"cross-env": "^
|
|
153
|
+
"cross-env": "^10.0.0",
|
|
81
154
|
"date-fns": "^4.1.0",
|
|
82
155
|
"decimal.js": "^10.6.0",
|
|
83
156
|
"depcheck": "^1.4.7",
|
|
84
|
-
"element-plus": "^2.
|
|
85
|
-
"ioredis": "^5.
|
|
86
|
-
"jsdom": "^
|
|
87
|
-
"lru-cache": "^11.1
|
|
157
|
+
"element-plus": "^2.11.2",
|
|
158
|
+
"ioredis": "^5.7.0",
|
|
159
|
+
"jsdom": "^27.0.0",
|
|
160
|
+
"lru-cache": "^11.2.1",
|
|
88
161
|
"millify": "^6.1.0",
|
|
89
|
-
"pino": "^9.
|
|
90
|
-
"pino-pretty": "^13.
|
|
162
|
+
"pino": "^9.9.5",
|
|
163
|
+
"pino-pretty": "^13.1.1",
|
|
164
|
+
"publint": "^0.3.12",
|
|
91
165
|
"superjson": "^2.2.2",
|
|
92
|
-
"ts-project-builder": "^5.0.2",
|
|
93
166
|
"ts-unused-exports": "^11.0.1",
|
|
94
|
-
"
|
|
167
|
+
"tsconfck": "^3.1.6",
|
|
168
|
+
"tsdown": "^0.15.1",
|
|
169
|
+
"typescript": "^5.9.2",
|
|
170
|
+
"unplugin-unused": "^0.5.3",
|
|
95
171
|
"vitest": "^3.2.4",
|
|
96
|
-
"vue": "^3.5.
|
|
172
|
+
"vue": "^3.5.21",
|
|
97
173
|
"vue-router": "^4.5.1"
|
|
98
174
|
},
|
|
99
175
|
"pnpm": {
|
package/src/hash.ts
CHANGED
|
@@ -18,9 +18,23 @@ import {
|
|
|
18
18
|
sha3_384,
|
|
19
19
|
sha3_512,
|
|
20
20
|
} from '@noble/hashes/sha3';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
bytesToHex,
|
|
23
|
+
utf8ToBytes,
|
|
24
|
+
} from '@noble/hashes/utils';
|
|
25
|
+
|
|
26
|
+
export function sha3224(data: string | Uint8Array) {
|
|
27
|
+
return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function sha3256(data: string | Uint8Array) {
|
|
31
|
+
return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function sha3384(data: string | Uint8Array) {
|
|
35
|
+
return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
36
|
+
}
|
|
22
37
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export const sha3512 = (data: string | Uint8Array) => bytesToHex(sha3_512(data));
|
|
38
|
+
export function sha3512(data: string | Uint8Array) {
|
|
39
|
+
return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
40
|
+
}
|
package/src/vue.ts
CHANGED
package/src/web.ts
CHANGED
package/dist/buffer.cjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const node_buffer = require('node:buffer');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Converts a Blob, Buffer, or File to a Buffer.
|
|
7
|
-
*
|
|
8
|
-
* This function provides a unified way to convert various binary data types
|
|
9
|
-
* to Node.js Buffer. If the input is already a Buffer, it returns it as-is.
|
|
10
|
-
* For Blob or File inputs, it converts them to Buffer via ArrayBuffer.
|
|
11
|
-
*
|
|
12
|
-
* @param {Blob | Buffer | File} input - The input to convert to Buffer
|
|
13
|
-
*
|
|
14
|
-
* @returns {Promise<Buffer>} A Promise that resolves to a Buffer
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { toBuffer } from '@kikiutils/shared/general';
|
|
19
|
-
*
|
|
20
|
-
* // Convert a Buffer (returns as-is)
|
|
21
|
-
* const buffer = Buffer.from('Hello World');
|
|
22
|
-
* const result1 = await toBuffer(buffer);
|
|
23
|
-
* console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>
|
|
24
|
-
*
|
|
25
|
-
* // Convert a Blob
|
|
26
|
-
* const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });
|
|
27
|
-
* const result2 = await toBuffer(blob);
|
|
28
|
-
* console.log(result2.toString()); // 'Hello from Blob'
|
|
29
|
-
*
|
|
30
|
-
* // Convert a File
|
|
31
|
-
* const file = new File(['File content'], 'test.txt', { type: 'text/plain' });
|
|
32
|
-
* const result3 = await toBuffer(file);
|
|
33
|
-
* console.log(result3.toString()); // 'File content'
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
async function toBuffer(input) {
|
|
37
|
-
if (node_buffer.Buffer.isBuffer(input))
|
|
38
|
-
return input;
|
|
39
|
-
return node_buffer.Buffer.from(await input.arrayBuffer());
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.toBuffer = toBuffer;
|
|
43
|
-
//# sourceMappingURL=buffer.cjs.map
|
package/dist/buffer.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.cjs","sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport type {\n Blob as NodeBlob,\n File as NodeFile,\n} from 'node:buffer';\n\n/**\n * Converts a Blob, Buffer, or File to a Buffer.\n *\n * This function provides a unified way to convert various binary data types\n * to Node.js Buffer. If the input is already a Buffer, it returns it as-is.\n * For Blob or File inputs, it converts them to Buffer via ArrayBuffer.\n *\n * @param {Blob | Buffer | File} input - The input to convert to Buffer\n *\n * @returns {Promise<Buffer>} A Promise that resolves to a Buffer\n *\n * @example\n * ```typescript\n * import { toBuffer } from '@kikiutils/shared/general';\n *\n * // Convert a Buffer (returns as-is)\n * const buffer = Buffer.from('Hello World');\n * const result1 = await toBuffer(buffer);\n * console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>\n *\n * // Convert a Blob\n * const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });\n * const result2 = await toBuffer(blob);\n * console.log(result2.toString()); // 'Hello from Blob'\n *\n * // Convert a File\n * const file = new File(['File content'], 'test.txt', { type: 'text/plain' });\n * const result3 = await toBuffer(file);\n * console.log(result3.toString()); // 'File content'\n * ```\n */\nexport async function toBuffer(input: Blob | Buffer | File | NodeBlob | NodeFile) {\n if (Buffer.isBuffer(input)) return input;\n return Buffer.from(await input.arrayBuffer());\n}\n"],"names":["Buffer"],"mappings":";;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,QAAQ,CAAC,KAAiD,EAAA;AAC5E,IAAA,IAAIA,kBAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;IACxC,OAAOA,kBAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;AACjD;;;;"}
|
package/dist/buffer.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Converts a Blob, Buffer, or File to a Buffer.
|
|
5
|
-
*
|
|
6
|
-
* This function provides a unified way to convert various binary data types
|
|
7
|
-
* to Node.js Buffer. If the input is already a Buffer, it returns it as-is.
|
|
8
|
-
* For Blob or File inputs, it converts them to Buffer via ArrayBuffer.
|
|
9
|
-
*
|
|
10
|
-
* @param {Blob | Buffer | File} input - The input to convert to Buffer
|
|
11
|
-
*
|
|
12
|
-
* @returns {Promise<Buffer>} A Promise that resolves to a Buffer
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { toBuffer } from '@kikiutils/shared/general';
|
|
17
|
-
*
|
|
18
|
-
* // Convert a Buffer (returns as-is)
|
|
19
|
-
* const buffer = Buffer.from('Hello World');
|
|
20
|
-
* const result1 = await toBuffer(buffer);
|
|
21
|
-
* console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>
|
|
22
|
-
*
|
|
23
|
-
* // Convert a Blob
|
|
24
|
-
* const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });
|
|
25
|
-
* const result2 = await toBuffer(blob);
|
|
26
|
-
* console.log(result2.toString()); // 'Hello from Blob'
|
|
27
|
-
*
|
|
28
|
-
* // Convert a File
|
|
29
|
-
* const file = new File(['File content'], 'test.txt', { type: 'text/plain' });
|
|
30
|
-
* const result3 = await toBuffer(file);
|
|
31
|
-
* console.log(result3.toString()); // 'File content'
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
async function toBuffer(input) {
|
|
35
|
-
if (Buffer.isBuffer(input))
|
|
36
|
-
return input;
|
|
37
|
-
return Buffer.from(await input.arrayBuffer());
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { toBuffer };
|
|
41
|
-
//# sourceMappingURL=buffer.mjs.map
|
package/dist/buffer.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.mjs","sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport type {\n Blob as NodeBlob,\n File as NodeFile,\n} from 'node:buffer';\n\n/**\n * Converts a Blob, Buffer, or File to a Buffer.\n *\n * This function provides a unified way to convert various binary data types\n * to Node.js Buffer. If the input is already a Buffer, it returns it as-is.\n * For Blob or File inputs, it converts them to Buffer via ArrayBuffer.\n *\n * @param {Blob | Buffer | File} input - The input to convert to Buffer\n *\n * @returns {Promise<Buffer>} A Promise that resolves to a Buffer\n *\n * @example\n * ```typescript\n * import { toBuffer } from '@kikiutils/shared/general';\n *\n * // Convert a Buffer (returns as-is)\n * const buffer = Buffer.from('Hello World');\n * const result1 = await toBuffer(buffer);\n * console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>\n *\n * // Convert a Blob\n * const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });\n * const result2 = await toBuffer(blob);\n * console.log(result2.toString()); // 'Hello from Blob'\n *\n * // Convert a File\n * const file = new File(['File content'], 'test.txt', { type: 'text/plain' });\n * const result3 = await toBuffer(file);\n * console.log(result3.toString()); // 'File content'\n * ```\n */\nexport async function toBuffer(input: Blob | Buffer | File | NodeBlob | NodeFile) {\n if (Buffer.isBuffer(input)) return input;\n return Buffer.from(await input.arrayBuffer());\n}\n"],"names":[],"mappings":";;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,QAAQ,CAAC,KAAiD,EAAA;AAC5E,IAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;AACjD;;;;"}
|
package/dist/clipboard.cjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Attempts to copy a Blob (e.g. image, plain text, HTML) to the user's clipboard using the ClipboardItem API.
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ Usage Notes:
|
|
7
|
-
* - Must be called in a **secure context** (HTTPS or localhost).
|
|
8
|
-
* - Must be called **in response to a user interaction** (e.g. click, input).
|
|
9
|
-
* - Not supported in Safari and some older browsers.
|
|
10
|
-
*
|
|
11
|
-
* @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content)
|
|
12
|
-
* @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor
|
|
13
|
-
*
|
|
14
|
-
* @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
|
|
15
|
-
* - `{ ok: true }` if the copy succeeded
|
|
16
|
-
* - `{ ok: false, error }` if the copy failed, with the error included
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { copyBlobToClipboard } from '@kikiutils/shared/clipboard';
|
|
21
|
-
*
|
|
22
|
-
* const blob = new Blob(['Hello world'], { type: 'text/plain' });
|
|
23
|
-
* const result = await copyBlobToClipboard(blob);
|
|
24
|
-
* if (result.ok) {
|
|
25
|
-
* console.log('Copied blob!');
|
|
26
|
-
* } else {
|
|
27
|
-
* console.error('Copy failed:', result.error);
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
async function copyBlobToClipboard(blob, options) {
|
|
32
|
-
if (!navigator.clipboard?.write) {
|
|
33
|
-
return {
|
|
34
|
-
error: new Error('Clipboard.write is not supported in this browser'),
|
|
35
|
-
ok: false,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const item = new ClipboardItem({ [blob.type]: blob }, options);
|
|
40
|
-
await navigator.clipboard.write([item]);
|
|
41
|
-
return { ok: true };
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
return {
|
|
45
|
-
error,
|
|
46
|
-
ok: false,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Attempts to copy the given text to the user's clipboard using the modern Clipboard API.
|
|
52
|
-
*
|
|
53
|
-
* ⚠️ Usage Notes:
|
|
54
|
-
* - Must be called in a **secure context** (HTTPS or localhost).
|
|
55
|
-
* - Must be called **in response to a user interaction** (e.g. click, input).
|
|
56
|
-
* - Not supported in some older browsers (especially legacy Safari).
|
|
57
|
-
*
|
|
58
|
-
* @param {string} text - The string to be copied to the clipboard
|
|
59
|
-
*
|
|
60
|
-
* @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
|
|
61
|
-
* - `{ ok: true }` if the copy succeeded
|
|
62
|
-
* - `{ ok: false, error }` if the copy failed, with the error included
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* import { copyTextToClipboard } from '@kikiutils/shared/clipboard';
|
|
67
|
-
*
|
|
68
|
-
* const result = await copyTextToClipboard('Hello!');
|
|
69
|
-
* if (result.ok) {
|
|
70
|
-
* console.log('Copied!');
|
|
71
|
-
* } else {
|
|
72
|
-
* console.error('Copy failed:', result.error);
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
async function copyTextToClipboard(text) {
|
|
77
|
-
try {
|
|
78
|
-
await navigator.clipboard.writeText(text);
|
|
79
|
-
return { ok: true };
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
return {
|
|
83
|
-
error,
|
|
84
|
-
ok: false,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
exports.copyBlobToClipboard = copyBlobToClipboard;
|
|
90
|
-
exports.copyTextToClipboard = copyTextToClipboard;
|
|
91
|
-
//# sourceMappingURL=clipboard.cjs.map
|
package/dist/clipboard.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.cjs","sources":["../src/clipboard.ts"],"sourcesContent":["type CopyResult =\n | { error: unknown; ok: false }\n | { ok: true };\n\n/**\n * Attempts to copy a Blob (e.g. image, plain text, HTML) to the user's clipboard using the ClipboardItem API.\n *\n * ⚠️ Usage Notes:\n * - Must be called in a **secure context** (HTTPS or localhost).\n * - Must be called **in response to a user interaction** (e.g. click, input).\n * - Not supported in Safari and some older browsers.\n *\n * @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content)\n * @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor\n *\n * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:\n * - `{ ok: true }` if the copy succeeded\n * - `{ ok: false, error }` if the copy failed, with the error included\n *\n * @example\n * ```typescript\n * import { copyBlobToClipboard } from '@kikiutils/shared/clipboard';\n *\n * const blob = new Blob(['Hello world'], { type: 'text/plain' });\n * const result = await copyBlobToClipboard(blob);\n * if (result.ok) {\n * console.log('Copied blob!');\n * } else {\n * console.error('Copy failed:', result.error);\n * }\n * ```\n */\nexport async function copyBlobToClipboard(blob: Blob, options?: ClipboardItemOptions): Promise<CopyResult> {\n if (!navigator.clipboard?.write) {\n return {\n error: new Error('Clipboard.write is not supported in this browser'),\n ok: false,\n };\n }\n\n try {\n const item = new ClipboardItem({ [blob.type]: blob }, options);\n await navigator.clipboard.write([item]);\n return { ok: true };\n } catch (error) {\n return {\n error,\n ok: false,\n };\n }\n}\n\n/**\n * Attempts to copy the given text to the user's clipboard using the modern Clipboard API.\n *\n * ⚠️ Usage Notes:\n * - Must be called in a **secure context** (HTTPS or localhost).\n * - Must be called **in response to a user interaction** (e.g. click, input).\n * - Not supported in some older browsers (especially legacy Safari).\n *\n * @param {string} text - The string to be copied to the clipboard\n *\n * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:\n * - `{ ok: true }` if the copy succeeded\n * - `{ ok: false, error }` if the copy failed, with the error included\n *\n * @example\n * ```typescript\n * import { copyTextToClipboard } from '@kikiutils/shared/clipboard';\n *\n * const result = await copyTextToClipboard('Hello!');\n * if (result.ok) {\n * console.log('Copied!');\n * } else {\n * console.error('Copy failed:', result.error);\n * }\n * ```\n */\nexport async function copyTextToClipboard(text: string): Promise<CopyResult> {\n try {\n await navigator.clipboard.writeText(text);\n return { ok: true };\n } catch (error) {\n return {\n error,\n ok: false,\n };\n }\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACI,eAAe,mBAAmB,CAAC,IAAU,EAAE,OAA8B,EAAA;AAChF,IAAA,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE;QAC7B,OAAO;AACH,YAAA,KAAK,EAAE,IAAI,KAAK,CAAC,kDAAkD,CAAC;AACpE,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AAEA,IAAA,IAAI;AACA,QAAA,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC;QAC9D,MAAM,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;AACvC,QAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE;IACvB;IAAE,OAAO,KAAK,EAAE;QACZ,OAAO;YACH,KAAK;AACL,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACI,eAAe,mBAAmB,CAAC,IAAY,EAAA;AAClD,IAAA,IAAI;QACA,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AACzC,QAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE;IACvB;IAAE,OAAO,KAAK,EAAE;QACZ,OAAO;YACH,KAAK;AACL,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AACJ;;;;;"}
|
package/dist/clipboard.mjs
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attempts to copy a Blob (e.g. image, plain text, HTML) to the user's clipboard using the ClipboardItem API.
|
|
3
|
-
*
|
|
4
|
-
* ⚠️ Usage Notes:
|
|
5
|
-
* - Must be called in a **secure context** (HTTPS or localhost).
|
|
6
|
-
* - Must be called **in response to a user interaction** (e.g. click, input).
|
|
7
|
-
* - Not supported in Safari and some older browsers.
|
|
8
|
-
*
|
|
9
|
-
* @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content)
|
|
10
|
-
* @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor
|
|
11
|
-
*
|
|
12
|
-
* @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
|
|
13
|
-
* - `{ ok: true }` if the copy succeeded
|
|
14
|
-
* - `{ ok: false, error }` if the copy failed, with the error included
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { copyBlobToClipboard } from '@kikiutils/shared/clipboard';
|
|
19
|
-
*
|
|
20
|
-
* const blob = new Blob(['Hello world'], { type: 'text/plain' });
|
|
21
|
-
* const result = await copyBlobToClipboard(blob);
|
|
22
|
-
* if (result.ok) {
|
|
23
|
-
* console.log('Copied blob!');
|
|
24
|
-
* } else {
|
|
25
|
-
* console.error('Copy failed:', result.error);
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
async function copyBlobToClipboard(blob, options) {
|
|
30
|
-
if (!navigator.clipboard?.write) {
|
|
31
|
-
return {
|
|
32
|
-
error: new Error('Clipboard.write is not supported in this browser'),
|
|
33
|
-
ok: false,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const item = new ClipboardItem({ [blob.type]: blob }, options);
|
|
38
|
-
await navigator.clipboard.write([item]);
|
|
39
|
-
return { ok: true };
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
return {
|
|
43
|
-
error,
|
|
44
|
-
ok: false,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Attempts to copy the given text to the user's clipboard using the modern Clipboard API.
|
|
50
|
-
*
|
|
51
|
-
* ⚠️ Usage Notes:
|
|
52
|
-
* - Must be called in a **secure context** (HTTPS or localhost).
|
|
53
|
-
* - Must be called **in response to a user interaction** (e.g. click, input).
|
|
54
|
-
* - Not supported in some older browsers (especially legacy Safari).
|
|
55
|
-
*
|
|
56
|
-
* @param {string} text - The string to be copied to the clipboard
|
|
57
|
-
*
|
|
58
|
-
* @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
|
|
59
|
-
* - `{ ok: true }` if the copy succeeded
|
|
60
|
-
* - `{ ok: false, error }` if the copy failed, with the error included
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* import { copyTextToClipboard } from '@kikiutils/shared/clipboard';
|
|
65
|
-
*
|
|
66
|
-
* const result = await copyTextToClipboard('Hello!');
|
|
67
|
-
* if (result.ok) {
|
|
68
|
-
* console.log('Copied!');
|
|
69
|
-
* } else {
|
|
70
|
-
* console.error('Copy failed:', result.error);
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
async function copyTextToClipboard(text) {
|
|
75
|
-
try {
|
|
76
|
-
await navigator.clipboard.writeText(text);
|
|
77
|
-
return { ok: true };
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
return {
|
|
81
|
-
error,
|
|
82
|
-
ok: false,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { copyBlobToClipboard, copyTextToClipboard };
|
|
88
|
-
//# sourceMappingURL=clipboard.mjs.map
|
package/dist/clipboard.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.mjs","sources":["../src/clipboard.ts"],"sourcesContent":["type CopyResult =\n | { error: unknown; ok: false }\n | { ok: true };\n\n/**\n * Attempts to copy a Blob (e.g. image, plain text, HTML) to the user's clipboard using the ClipboardItem API.\n *\n * ⚠️ Usage Notes:\n * - Must be called in a **secure context** (HTTPS or localhost).\n * - Must be called **in response to a user interaction** (e.g. click, input).\n * - Not supported in Safari and some older browsers.\n *\n * @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content)\n * @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor\n *\n * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:\n * - `{ ok: true }` if the copy succeeded\n * - `{ ok: false, error }` if the copy failed, with the error included\n *\n * @example\n * ```typescript\n * import { copyBlobToClipboard } from '@kikiutils/shared/clipboard';\n *\n * const blob = new Blob(['Hello world'], { type: 'text/plain' });\n * const result = await copyBlobToClipboard(blob);\n * if (result.ok) {\n * console.log('Copied blob!');\n * } else {\n * console.error('Copy failed:', result.error);\n * }\n * ```\n */\nexport async function copyBlobToClipboard(blob: Blob, options?: ClipboardItemOptions): Promise<CopyResult> {\n if (!navigator.clipboard?.write) {\n return {\n error: new Error('Clipboard.write is not supported in this browser'),\n ok: false,\n };\n }\n\n try {\n const item = new ClipboardItem({ [blob.type]: blob }, options);\n await navigator.clipboard.write([item]);\n return { ok: true };\n } catch (error) {\n return {\n error,\n ok: false,\n };\n }\n}\n\n/**\n * Attempts to copy the given text to the user's clipboard using the modern Clipboard API.\n *\n * ⚠️ Usage Notes:\n * - Must be called in a **secure context** (HTTPS or localhost).\n * - Must be called **in response to a user interaction** (e.g. click, input).\n * - Not supported in some older browsers (especially legacy Safari).\n *\n * @param {string} text - The string to be copied to the clipboard\n *\n * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:\n * - `{ ok: true }` if the copy succeeded\n * - `{ ok: false, error }` if the copy failed, with the error included\n *\n * @example\n * ```typescript\n * import { copyTextToClipboard } from '@kikiutils/shared/clipboard';\n *\n * const result = await copyTextToClipboard('Hello!');\n * if (result.ok) {\n * console.log('Copied!');\n * } else {\n * console.error('Copy failed:', result.error);\n * }\n * ```\n */\nexport async function copyTextToClipboard(text: string): Promise<CopyResult> {\n try {\n await navigator.clipboard.writeText(text);\n return { ok: true };\n } catch (error) {\n return {\n error,\n ok: false,\n };\n }\n}\n"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACI,eAAe,mBAAmB,CAAC,IAAU,EAAE,OAA8B,EAAA;AAChF,IAAA,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE;QAC7B,OAAO;AACH,YAAA,KAAK,EAAE,IAAI,KAAK,CAAC,kDAAkD,CAAC;AACpE,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AAEA,IAAA,IAAI;AACA,QAAA,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC;QAC9D,MAAM,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;AACvC,QAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE;IACvB;IAAE,OAAO,KAAK,EAAE;QACZ,OAAO;YACH,KAAK;AACL,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACI,eAAe,mBAAmB,CAAC,IAAY,EAAA;AAClD,IAAA,IAAI;QACA,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AACzC,QAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE;IACvB;IAAE,OAAO,KAAK,EAAE;QACZ,OAAO;YACH,KAAK;AACL,YAAA,EAAE,EAAE,KAAK;SACZ;IACL;AACJ;;;;"}
|
package/dist/consola.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const consola = require('consola');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A consola logger instance.
|
|
7
|
-
*
|
|
8
|
-
* The logger's level is determined based on the `CONSOLA_LOGGER_LEVEL` and `NODE_ENV` environment variables.
|
|
9
|
-
* If `CONSOLA_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,
|
|
10
|
-
* the level will be set to `0`.
|
|
11
|
-
*
|
|
12
|
-
* To manually change the level, assign the desired level to `logger.level`.
|
|
13
|
-
*
|
|
14
|
-
* See available levels [here](https://github.com/unjs/consola?tab=readme-ov-file#log-level).
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { logger } from '@kikiutils/shared/consola';
|
|
19
|
-
*
|
|
20
|
-
* logger.info('test'); // ℹ test 3:56:30 AM
|
|
21
|
-
*
|
|
22
|
-
* // Manually change the level
|
|
23
|
-
* logger.level = 3;
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
const consolaLogger = consola.createConsola();
|
|
27
|
-
const logger = consolaLogger;
|
|
28
|
-
if (process.env.CONSOLA_LOGGER_LEVEL !== undefined)
|
|
29
|
-
consolaLogger.level = +process.env.CONSOLA_LOGGER_LEVEL;
|
|
30
|
-
else
|
|
31
|
-
consolaLogger.level = process.env.NODE_ENV === 'production' ? 0 : consolaLogger.level;
|
|
32
|
-
|
|
33
|
-
exports.consolaLogger = consolaLogger;
|
|
34
|
-
exports.logger = logger;
|
|
35
|
-
//# sourceMappingURL=consola.cjs.map
|
package/dist/consola.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consola.cjs","sources":["../src/consola.ts"],"sourcesContent":["import { createConsola } from 'consola';\n\n/**\n * A consola logger instance.\n *\n * The logger's level is determined based on the `CONSOLA_LOGGER_LEVEL` and `NODE_ENV` environment variables.\n * If `CONSOLA_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,\n * the level will be set to `0`.\n *\n * To manually change the level, assign the desired level to `logger.level`.\n *\n * See available levels [here](https://github.com/unjs/consola?tab=readme-ov-file#log-level).\n *\n * @example\n * ```typescript\n * import { logger } from '@kikiutils/shared/consola';\n *\n * logger.info('test'); // ℹ test 3:56:30 AM\n *\n * // Manually change the level\n * logger.level = 3;\n * ```\n */\nexport const consolaLogger = createConsola();\nexport const logger = consolaLogger;\nif (process.env.CONSOLA_LOGGER_LEVEL !== undefined) consolaLogger.level = +process.env.CONSOLA_LOGGER_LEVEL;\nelse consolaLogger.level = process.env.NODE_ENV === 'production' ? 0 : consolaLogger.level;\n"],"names":["createConsola"],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,aAAa,GAAGA,qBAAa;AACnC,MAAM,MAAM,GAAG;AACtB,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,SAAS;IAAE,aAAa,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB;;IACtG,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK;;;;;"}
|
package/dist/consola.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createConsola } from 'consola';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A consola logger instance.
|
|
5
|
-
*
|
|
6
|
-
* The logger's level is determined based on the `CONSOLA_LOGGER_LEVEL` and `NODE_ENV` environment variables.
|
|
7
|
-
* If `CONSOLA_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,
|
|
8
|
-
* the level will be set to `0`.
|
|
9
|
-
*
|
|
10
|
-
* To manually change the level, assign the desired level to `logger.level`.
|
|
11
|
-
*
|
|
12
|
-
* See available levels [here](https://github.com/unjs/consola?tab=readme-ov-file#log-level).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { logger } from '@kikiutils/shared/consola';
|
|
17
|
-
*
|
|
18
|
-
* logger.info('test'); // ℹ test 3:56:30 AM
|
|
19
|
-
*
|
|
20
|
-
* // Manually change the level
|
|
21
|
-
* logger.level = 3;
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
const consolaLogger = createConsola();
|
|
25
|
-
const logger = consolaLogger;
|
|
26
|
-
if (process.env.CONSOLA_LOGGER_LEVEL !== undefined)
|
|
27
|
-
consolaLogger.level = +process.env.CONSOLA_LOGGER_LEVEL;
|
|
28
|
-
else
|
|
29
|
-
consolaLogger.level = process.env.NODE_ENV === 'production' ? 0 : consolaLogger.level;
|
|
30
|
-
|
|
31
|
-
export { consolaLogger, logger };
|
|
32
|
-
//# sourceMappingURL=consola.mjs.map
|
package/dist/consola.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consola.mjs","sources":["../src/consola.ts"],"sourcesContent":["import { createConsola } from 'consola';\n\n/**\n * A consola logger instance.\n *\n * The logger's level is determined based on the `CONSOLA_LOGGER_LEVEL` and `NODE_ENV` environment variables.\n * If `CONSOLA_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,\n * the level will be set to `0`.\n *\n * To manually change the level, assign the desired level to `logger.level`.\n *\n * See available levels [here](https://github.com/unjs/consola?tab=readme-ov-file#log-level).\n *\n * @example\n * ```typescript\n * import { logger } from '@kikiutils/shared/consola';\n *\n * logger.info('test'); // ℹ test 3:56:30 AM\n *\n * // Manually change the level\n * logger.level = 3;\n * ```\n */\nexport const consolaLogger = createConsola();\nexport const logger = consolaLogger;\nif (process.env.CONSOLA_LOGGER_LEVEL !== undefined) consolaLogger.level = +process.env.CONSOLA_LOGGER_LEVEL;\nelse consolaLogger.level = process.env.NODE_ENV === 'production' ? 0 : consolaLogger.level;\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,aAAa,GAAG,aAAa;AACnC,MAAM,MAAM,GAAG;AACtB,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,SAAS;IAAE,aAAa,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB;;IACtG,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK;;;;"}
|