bilitoolkit-runtime 0.0.1
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/biliapi.d.ts +12 -0
- package/dist/biliapi.js +78 -0
- package/dist/biliapi.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hzhilong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserInfoWithCookie, BiliClient } from '@ybgnb/bili-api';
|
|
2
|
+
|
|
3
|
+
declare const publicClient: BiliClient;
|
|
4
|
+
declare const biliClientStore: {
|
|
5
|
+
get: (user?: UserInfoWithCookie | null) => Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 创建远程调用的 BiliClient,调用接口时支持传入 AbortSignal
|
|
9
|
+
*/
|
|
10
|
+
declare function createBiliClient(clientIdOrUser: string | UserInfoWithCookie): Promise<BiliClient>;
|
|
11
|
+
|
|
12
|
+
export { biliClientStore, createBiliClient, publicClient };
|
package/dist/biliapi.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// src/biliapi/client.ts
|
|
2
|
+
import { BiliClient } from "@ybgnb/bili-api";
|
|
3
|
+
import { unwrapBizResult } from "@ybgnb/utils";
|
|
4
|
+
var publicClient = new BiliClient();
|
|
5
|
+
var allClient = /* @__PURE__ */ new Map();
|
|
6
|
+
var biliClientStore = {
|
|
7
|
+
get: async (user) => {
|
|
8
|
+
if (!user || !user.mid) throw new Error("\u7528\u6237\u672A\u767B\u5F55");
|
|
9
|
+
if (allClient.has(user.mid)) return allClient.get(user.mid);
|
|
10
|
+
const client = await window.toolkitApi.bili.createBiliClient({
|
|
11
|
+
context: {
|
|
12
|
+
userCookie: user.userCookie
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
if (!client) throw new Error("\u5185\u90E8\u9519\u8BEF\uFF0C\u521B\u5EFA BiliClient \u5931\u8D25");
|
|
16
|
+
allClient.set(user.mid, client.id);
|
|
17
|
+
return client.id;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var noop = () => {
|
|
21
|
+
};
|
|
22
|
+
var ignoredProps = /* @__PURE__ */ new Set(["then", "catch", "finally", "toJSON", "toString", "valueOf"]);
|
|
23
|
+
function createBiliClientProxy(clientId, path = []) {
|
|
24
|
+
return new Proxy(noop, {
|
|
25
|
+
get(target, prop) {
|
|
26
|
+
if (typeof prop === "symbol") {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
if (path.length === 0 && ignoredProps.has(prop)) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return createBiliClientProxy(clientId, path.concat(prop));
|
|
33
|
+
},
|
|
34
|
+
async apply(target, thisArg, args) {
|
|
35
|
+
let abortSignal = void 0;
|
|
36
|
+
let abortSignalId = void 0;
|
|
37
|
+
let abortListener;
|
|
38
|
+
if (args && args.length > 0) {
|
|
39
|
+
for (const arg of args) {
|
|
40
|
+
if (typeof arg === "object" && "signal" in arg && arg.signal instanceof AbortSignal) {
|
|
41
|
+
abortSignal = arg.signal;
|
|
42
|
+
abortSignalId = crypto.randomUUID();
|
|
43
|
+
arg.signal = abortSignalId;
|
|
44
|
+
abortListener = () => {
|
|
45
|
+
window.toolkitApi.bili.abortBiliApi(abortSignalId);
|
|
46
|
+
};
|
|
47
|
+
abortSignal.addEventListener("abort", abortListener);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const bizResult = await window.toolkitApi.bili.invokeBiliApi(
|
|
53
|
+
{
|
|
54
|
+
clientId
|
|
55
|
+
},
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
path.join("."),
|
|
58
|
+
...args
|
|
59
|
+
);
|
|
60
|
+
return unwrapBizResult(bizResult);
|
|
61
|
+
} finally {
|
|
62
|
+
if (abortListener && abortSignal) {
|
|
63
|
+
abortSignal.removeEventListener("abort", abortListener);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async function createBiliClient(clientIdOrUser) {
|
|
70
|
+
const finialClientId = typeof clientIdOrUser === "string" ? clientIdOrUser : await biliClientStore.get(clientIdOrUser);
|
|
71
|
+
return createBiliClientProxy(finialClientId);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
biliClientStore,
|
|
75
|
+
createBiliClient,
|
|
76
|
+
publicClient
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=biliapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/biliapi/client.ts"],"sourcesContent":["import { BiliClient, type UserInfoWithCookie } from '@ybgnb/bili-api'\nimport { unwrapBizResult } from '@ybgnb/utils'\n\nexport const publicClient = new BiliClient()\n\nconst allClient = new Map<number, string>()\n\nexport const biliClientStore = {\n get: async (user?: UserInfoWithCookie | null) => {\n if (!user || !user.mid) throw new Error('用户未登录')\n\n if (allClient.has(user.mid)) return allClient.get(user.mid)!\n\n const client = await window.toolkitApi.bili.createBiliClient({\n context: {\n userCookie: user.userCookie,\n },\n })\n\n if (!client) throw new Error('内部错误,创建 BiliClient 失败')\n\n allClient.set(user.mid, client.id)\n return client.id\n },\n}\n\nconst noop = () => {}\nconst ignoredProps = new Set(['then', 'catch', 'finally', 'toJSON', 'toString', 'valueOf'])\nfunction createBiliClientProxy(clientId: string, path: string[] = []): BiliClient {\n return new Proxy(noop, {\n get(target, prop) {\n if (typeof prop === 'symbol') {\n return undefined\n }\n if (path.length === 0 && ignoredProps.has(prop)) {\n return undefined\n }\n return createBiliClientProxy(clientId, path.concat(prop))\n },\n\n async apply(target, thisArg, args) {\n let abortSignal: AbortSignal | undefined = undefined\n let abortSignalId = undefined\n let abortListener\n if (args && args.length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const arg of args as Array<any>) {\n if (typeof arg === 'object' && 'signal' in arg && arg.signal instanceof AbortSignal) {\n abortSignal = arg.signal as AbortSignal\n abortSignalId = crypto.randomUUID()\n arg.signal = abortSignalId\n abortListener = () => {\n window.toolkitApi.bili.abortBiliApi(abortSignalId!)\n }\n abortSignal.addEventListener('abort', abortListener)\n }\n }\n }\n\n try {\n const bizResult = await window.toolkitApi.bili.invokeBiliApi(\n {\n clientId,\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n path.join('.') as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(args as any),\n )\n return unwrapBizResult(bizResult)\n } finally {\n if (abortListener && abortSignal) {\n abortSignal.removeEventListener('abort', abortListener)\n }\n }\n },\n }) as unknown as BiliClient\n}\n\n/**\n * 创建远程调用的 BiliClient,调用接口时支持传入 AbortSignal\n */\nexport async function createBiliClient(clientIdOrUser: string | UserInfoWithCookie): Promise<BiliClient> {\n const finialClientId = typeof clientIdOrUser === 'string' ? clientIdOrUser : await biliClientStore.get(clientIdOrUser)\n return createBiliClientProxy(finialClientId)\n}\n"],"mappings":";AAAA,SAAS,kBAA2C;AACpD,SAAS,uBAAuB;AAEzB,IAAM,eAAe,IAAI,WAAW;AAE3C,IAAM,YAAY,oBAAI,IAAoB;AAEnC,IAAM,kBAAkB;AAAA,EAC7B,KAAK,OAAO,SAAqC;AAC/C,QAAI,CAAC,QAAQ,CAAC,KAAK,IAAK,OAAM,IAAI,MAAM,gCAAO;AAE/C,QAAI,UAAU,IAAI,KAAK,GAAG,EAAG,QAAO,UAAU,IAAI,KAAK,GAAG;AAE1D,UAAM,SAAS,MAAM,OAAO,WAAW,KAAK,iBAAiB;AAAA,MAC3D,SAAS;AAAA,QACP,YAAY,KAAK;AAAA,MACnB;AAAA,IACF,CAAC;AAED,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,oEAAuB;AAEpD,cAAU,IAAI,KAAK,KAAK,OAAO,EAAE;AACjC,WAAO,OAAO;AAAA,EAChB;AACF;AAEA,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,eAAe,oBAAI,IAAI,CAAC,QAAQ,SAAS,WAAW,UAAU,YAAY,SAAS,CAAC;AAC1F,SAAS,sBAAsB,UAAkB,OAAiB,CAAC,GAAe;AAChF,SAAO,IAAI,MAAM,MAAM;AAAA,IACrB,IAAI,QAAQ,MAAM;AAChB,UAAI,OAAO,SAAS,UAAU;AAC5B,eAAO;AAAA,MACT;AACA,UAAI,KAAK,WAAW,KAAK,aAAa,IAAI,IAAI,GAAG;AAC/C,eAAO;AAAA,MACT;AACA,aAAO,sBAAsB,UAAU,KAAK,OAAO,IAAI,CAAC;AAAA,IAC1D;AAAA,IAEA,MAAM,MAAM,QAAQ,SAAS,MAAM;AACjC,UAAI,cAAuC;AAC3C,UAAI,gBAAgB;AACpB,UAAI;AACJ,UAAI,QAAQ,KAAK,SAAS,GAAG;AAE3B,mBAAW,OAAO,MAAoB;AACpC,cAAI,OAAO,QAAQ,YAAY,YAAY,OAAO,IAAI,kBAAkB,aAAa;AACnF,0BAAc,IAAI;AAClB,4BAAgB,OAAO,WAAW;AAClC,gBAAI,SAAS;AACb,4BAAgB,MAAM;AACpB,qBAAO,WAAW,KAAK,aAAa,aAAc;AAAA,YACpD;AACA,wBAAY,iBAAiB,SAAS,aAAa;AAAA,UACrD;AAAA,QACF;AAAA,MACF;AAEA,UAAI;AACF,cAAM,YAAY,MAAM,OAAO,WAAW,KAAK;AAAA,UAC7C;AAAA,YACE;AAAA,UACF;AAAA;AAAA,UAEA,KAAK,KAAK,GAAG;AAAA,UAEb,GAAI;AAAA,QACN;AACA,eAAO,gBAAgB,SAAS;AAAA,MAClC,UAAE;AACA,YAAI,iBAAiB,aAAa;AAChC,sBAAY,oBAAoB,SAAS,aAAa;AAAA,QACxD;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAKA,eAAsB,iBAAiB,gBAAkE;AACvG,QAAM,iBAAiB,OAAO,mBAAmB,WAAW,iBAAiB,MAAM,gBAAgB,IAAI,cAAc;AACrH,SAAO,sBAAsB,cAAc;AAC7C;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as bilitoolkit_types from 'bilitoolkit-types';
|
|
2
|
+
import * as _ybgnb_utils from '@ybgnb/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 将数据处理转成可安全传给 IPC 的形式
|
|
6
|
+
* @param obj
|
|
7
|
+
*/
|
|
8
|
+
declare const toIPC: (obj: unknown) => any;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 初始化并返回 API 代理对象
|
|
12
|
+
*/
|
|
13
|
+
declare function setupToolkitApi(): bilitoolkit_types.ToolkitApi;
|
|
14
|
+
|
|
15
|
+
declare const appLogger: _ybgnb_utils.Logger<"trace" | "debug" | "info" | "warn" | "error">;
|
|
16
|
+
|
|
17
|
+
export { appLogger, setupToolkitApi, toIPC };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/utils/ipc.ts
|
|
2
|
+
import { toRaw } from "vue";
|
|
3
|
+
import { cloneDeepWith } from "lodash-es";
|
|
4
|
+
var toIPC = (obj) => {
|
|
5
|
+
return cloneDeepWith(toRaw(obj), (val) => {
|
|
6
|
+
if (typeof val === "function" || val instanceof Window || val instanceof Element) {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/api/proxy.ts
|
|
13
|
+
import { unwrapBizResult } from "@ybgnb/utils";
|
|
14
|
+
var noop = () => {
|
|
15
|
+
};
|
|
16
|
+
function createIpcApiProxy(path = []) {
|
|
17
|
+
return new Proxy(noop, {
|
|
18
|
+
get(target, key) {
|
|
19
|
+
if (typeof key !== "string") return void 0;
|
|
20
|
+
if (key === "__proto__" || key === "constructor") {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
return createIpcApiProxy(path.concat(key));
|
|
24
|
+
},
|
|
25
|
+
async apply(_, __, args) {
|
|
26
|
+
const apiPath = path.join(".");
|
|
27
|
+
try {
|
|
28
|
+
let expandedApi = void 0;
|
|
29
|
+
for (let i = 0; i < path.length; i++) {
|
|
30
|
+
const key = path[i];
|
|
31
|
+
if (i === 0) {
|
|
32
|
+
if (window.__toolkitApi && key in window.__toolkitApi) {
|
|
33
|
+
expandedApi = window.__toolkitApi[key];
|
|
34
|
+
} else {
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (expandedApi && typeof expandedApi === "object" && key in expandedApi) {
|
|
39
|
+
expandedApi = expandedApi[key];
|
|
40
|
+
} else {
|
|
41
|
+
expandedApi = void 0;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const ipcArgs = args.map((arg) => {
|
|
47
|
+
if (typeof arg === "function") {
|
|
48
|
+
return arg;
|
|
49
|
+
} else {
|
|
50
|
+
return toIPC(arg);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
if (typeof expandedApi === "function") {
|
|
54
|
+
return unwrapBizResult(await expandedApi(...ipcArgs));
|
|
55
|
+
}
|
|
56
|
+
return unwrapBizResult(await window.__toolkitInvoke(apiPath, ...ipcArgs));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.error(`[${apiPath}]`, args, e);
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/api/setup.ts
|
|
66
|
+
function setupToolkitApi() {
|
|
67
|
+
if (window.toolkitApi) return window.toolkitApi;
|
|
68
|
+
let _toolkitApi;
|
|
69
|
+
Object.defineProperty(window, "toolkitApi", {
|
|
70
|
+
get() {
|
|
71
|
+
if (!_toolkitApi) {
|
|
72
|
+
_toolkitApi = createIpcApiProxy([]);
|
|
73
|
+
}
|
|
74
|
+
return _toolkitApi;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return window.toolkitApi;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/logger/logger.ts
|
|
81
|
+
import { serializeError, createLogger } from "@ybgnb/utils";
|
|
82
|
+
var appLogger = createLogger(
|
|
83
|
+
async () => {
|
|
84
|
+
return await window.toolkitApi.system.getLogLevel();
|
|
85
|
+
},
|
|
86
|
+
(logLevel, ...args) => {
|
|
87
|
+
console[logLevel](`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, ...args);
|
|
88
|
+
window.toolkitApi.system.saveLog({
|
|
89
|
+
level: logLevel,
|
|
90
|
+
data: args.map((arg) => {
|
|
91
|
+
if (arg instanceof Error) return JSON.stringify(serializeError(arg));
|
|
92
|
+
return JSON.stringify(arg);
|
|
93
|
+
})
|
|
94
|
+
}).catch();
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
export {
|
|
98
|
+
appLogger,
|
|
99
|
+
setupToolkitApi,
|
|
100
|
+
toIPC
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/ipc.ts","../src/api/proxy.ts","../src/api/setup.ts","../src/logger/logger.ts"],"sourcesContent":["import { toRaw } from 'vue'\nimport { cloneDeepWith } from 'lodash-es'\n\n/**\n * 将数据处理转成可安全传给 IPC 的形式\n * @param obj\n */\nexport const toIPC = (obj: unknown) => {\n return cloneDeepWith(toRaw(obj), (val: unknown) => {\n if (typeof val === 'function' || val instanceof Window || val instanceof Element) {\n return undefined\n }\n })\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ToolkitApi } from 'bilitoolkit-types'\nimport { toIPC } from '../utils/ipc.js'\nimport { type BizResult, unwrapBizResult } from '@ybgnb/utils'\n\nconst noop = () => {}\n\n/**\n * IPC 调用代理生成器\n */\nexport function createIpcApiProxy<T extends ToolkitApi>(path: string[] = []) {\n return new Proxy(noop, {\n get(target, key: unknown) {\n if (typeof key !== 'string') return undefined\n\n // 保护关键属性\n if (key === '__proto__' || key === 'constructor') {\n return undefined\n }\n\n return createIpcApiProxy(path.concat(key))\n },\n\n async apply(_, __, args: unknown[]) {\n const apiPath = path.join('.')\n try {\n let expandedApi: any = undefined\n\n for (let i = 0; i < path.length; i++) {\n const key = path[i]\n if (i === 0) {\n if (window.__toolkitApi && key in window.__toolkitApi) {\n expandedApi = window.__toolkitApi[key as keyof T]\n } else {\n break\n }\n } else {\n if (expandedApi && typeof expandedApi === 'object' && key in expandedApi) {\n expandedApi = (expandedApi as Record<string, any>)[key]\n } else {\n expandedApi = undefined\n break\n }\n }\n }\n\n const ipcArgs = args.map((arg) => {\n if (typeof arg === 'function') {\n return arg\n } else {\n return toIPC(arg)\n }\n })\n\n if (typeof expandedApi === 'function') {\n return unwrapBizResult((await expandedApi(...ipcArgs)) as BizResult<any>)\n }\n\n return unwrapBizResult((await window.__toolkitInvoke(apiPath, ...ipcArgs)) as BizResult<any>)\n } catch (e) {\n console.error(`[${apiPath}]`, args, e)\n throw e\n }\n },\n }) as any\n}\n","import { createIpcApiProxy } from './proxy.js'\n\n/**\n * 初始化并返回 API 代理对象\n */\nexport function setupToolkitApi() {\n if (window.toolkitApi) return window.toolkitApi\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _toolkitApi: any\n Object.defineProperty(window, 'toolkitApi', {\n get() {\n if (!_toolkitApi) {\n _toolkitApi = createIpcApiProxy([])\n }\n\n return _toolkitApi!\n },\n })\n\n return window.toolkitApi\n}\n","import { serializeError, createLogger } from '@ybgnb/utils'\n\nexport const appLogger = createLogger(\n async () => {\n return await window.toolkitApi.system.getLogLevel()\n },\n (logLevel, ...args) => {\n console[logLevel](`[${new Date().toLocaleString()}]`, ...args)\n window.toolkitApi.system\n .saveLog({\n level: logLevel,\n data: args.map((arg) => {\n if (arg instanceof Error) return JSON.stringify(serializeError(arg))\n return JSON.stringify(arg)\n }),\n })\n .catch()\n },\n)\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAMvB,IAAM,QAAQ,CAAC,QAAiB;AACrC,SAAO,cAAc,MAAM,GAAG,GAAG,CAAC,QAAiB;AACjD,QAAI,OAAO,QAAQ,cAAc,eAAe,UAAU,eAAe,SAAS;AAChF,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;;;ACVA,SAAyB,uBAAuB;AAEhD,IAAM,OAAO,MAAM;AAAC;AAKb,SAAS,kBAAwC,OAAiB,CAAC,GAAG;AAC3E,SAAO,IAAI,MAAM,MAAM;AAAA,IACrB,IAAI,QAAQ,KAAc;AACxB,UAAI,OAAO,QAAQ,SAAU,QAAO;AAGpC,UAAI,QAAQ,eAAe,QAAQ,eAAe;AAChD,eAAO;AAAA,MACT;AAEA,aAAO,kBAAkB,KAAK,OAAO,GAAG,CAAC;AAAA,IAC3C;AAAA,IAEA,MAAM,MAAM,GAAG,IAAI,MAAiB;AAClC,YAAM,UAAU,KAAK,KAAK,GAAG;AAC7B,UAAI;AACF,YAAI,cAAmB;AAEvB,iBAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,gBAAM,MAAM,KAAK,CAAC;AAClB,cAAI,MAAM,GAAG;AACX,gBAAI,OAAO,gBAAgB,OAAO,OAAO,cAAc;AACrD,4BAAc,OAAO,aAAa,GAAc;AAAA,YAClD,OAAO;AACL;AAAA,YACF;AAAA,UACF,OAAO;AACL,gBAAI,eAAe,OAAO,gBAAgB,YAAY,OAAO,aAAa;AACxE,4BAAe,YAAoC,GAAG;AAAA,YACxD,OAAO;AACL,4BAAc;AACd;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,UAAU,KAAK,IAAI,CAAC,QAAQ;AAChC,cAAI,OAAO,QAAQ,YAAY;AAC7B,mBAAO;AAAA,UACT,OAAO;AACL,mBAAO,MAAM,GAAG;AAAA,UAClB;AAAA,QACF,CAAC;AAED,YAAI,OAAO,gBAAgB,YAAY;AACrC,iBAAO,gBAAiB,MAAM,YAAY,GAAG,OAAO,CAAoB;AAAA,QAC1E;AAEA,eAAO,gBAAiB,MAAM,OAAO,gBAAgB,SAAS,GAAG,OAAO,CAAoB;AAAA,MAC9F,SAAS,GAAG;AACV,gBAAQ,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC;AACrC,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;AC5DO,SAAS,kBAAkB;AAChC,MAAI,OAAO,WAAY,QAAO,OAAO;AAErC,MAAI;AACJ,SAAO,eAAe,QAAQ,cAAc;AAAA,IAC1C,MAAM;AACJ,UAAI,CAAC,aAAa;AAChB,sBAAc,kBAAkB,CAAC,CAAC;AAAA,MACpC;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AAED,SAAO,OAAO;AAChB;;;ACpBA,SAAS,gBAAgB,oBAAoB;AAEtC,IAAM,YAAY;AAAA,EACvB,YAAY;AACV,WAAO,MAAM,OAAO,WAAW,OAAO,YAAY;AAAA,EACpD;AAAA,EACA,CAAC,aAAa,SAAS;AACrB,YAAQ,QAAQ,EAAE,KAAI,oBAAI,KAAK,GAAE,eAAe,CAAC,KAAK,GAAG,IAAI;AAC7D,WAAO,WAAW,OACf,QAAQ;AAAA,MACP,OAAO;AAAA,MACP,MAAM,KAAK,IAAI,CAAC,QAAQ;AACtB,YAAI,eAAe,MAAO,QAAO,KAAK,UAAU,eAAe,GAAG,CAAC;AACnE,eAAO,KAAK,UAAU,GAAG;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC,EACA,MAAM;AAAA,EACX;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bilitoolkit-runtime",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": "hzhilong",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "『哔哩工具姬』运行时库,封装 API 调用与共享逻辑",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./biliapi": {
|
|
16
|
+
"types": "./dist/biliapi.d.ts",
|
|
17
|
+
"import": "./dist/biliapi.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/hzhilong/bilitoolkit-runtime"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"BiliToolkit",
|
|
29
|
+
"哔哩工具姬"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/hzhilong/bilitoolkit-runtime/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/hzhilong/bilitoolkit-runtime#readme",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"eslint": "^9.35.0",
|
|
38
|
+
"eslint-config-prettier": "^10.1.8",
|
|
39
|
+
"prettier": "^3.8.1",
|
|
40
|
+
"tsup": "^8.5.1",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"typescript-eslint": "^8.43.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"lodash-es": "^4.17.21",
|
|
46
|
+
"vue": "^3.5.34",
|
|
47
|
+
"@ybgnb/bili-api": "^0.0.3",
|
|
48
|
+
"bilitoolkit-types": "^0.0.1"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@ybgnb/utils": "^0.2.8"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"check": "tsc -p tsconfig.dev.json --noEmit && eslint .",
|
|
55
|
+
"lint": "eslint . --fix",
|
|
56
|
+
"format": "prettier --write src/",
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"npm login": "npm login",
|
|
59
|
+
"pnpm publish": "pnpm publish --access public"
|
|
60
|
+
}
|
|
61
|
+
}
|