diff --git a/package.json b/package.json index 57a1f5b..d3ba86d 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,11 @@ "homepage": "https://github.com/yumi-team/meta-messenger.js", "license": "AGPL-3.0-or-later", "dependencies": { - "json-bigint": "^1.0.0", + "yumi-json-bigint": "^1.0.0", "koffi": "^2.15.1", "undici": "^7.20.0" }, "devDependencies": { - "@types/json-bigint": "^1.0.4", "@types/node": "^25.1.0", "@typescript-eslint/eslint-plugin": "^7.15.0", "@typescript-eslint/parser": "^7.15.0", diff --git a/src/json-bigint.d.ts b/src/json-bigint.d.ts new file mode 100644 index 0000000..f67f93f --- /dev/null +++ b/src/json-bigint.d.ts @@ -0,0 +1,55 @@ +/* + * meta-messenger.js + * Unofficial Meta Messenger Chat API for Node.js + * + * Copyright (c) 2026 Yumi Team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +declare module "yumi-json-bigint" { + export type JSONBigIntAction = "error" | "ignore" | "preserve"; + + export interface JSONBigIntOptions { + strict?: boolean; + storeAsString?: boolean; + alwaysParseAsBig?: boolean; + parseAsBigInt32?: boolean; + useNativeBigInt?: boolean; + protoAction?: JSONBigIntAction; + constructorAction?: JSONBigIntAction; + } + + export interface JSONBigInt { + parse(text: string, reviver?: (key: string, value: unknown) => unknown): unknown; + stringify( + value: unknown, + replacer?: ((key: string, value: unknown) => unknown) | Array, + space?: string | number, + ): string; + } + + export interface JSONBigIntStatic { + (options?: JSONBigIntOptions): JSONBigInt; + parse(text: string, reviver?: (key: string, value: unknown) => unknown): unknown; + stringify( + value: unknown, + replacer?: ((key: string, value: unknown) => unknown) | Array, + space?: string | number, + ): string; + } + + const JSONBigInt: JSONBigIntStatic; + export default JSONBigInt; +} diff --git a/src/native.ts b/src/native.ts index 2775590..c0c847d 100644 --- a/src/native.ts +++ b/src/native.ts @@ -22,8 +22,8 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import JSONBig from "json-bigint"; import koffi from "koffi"; +import JSONBig from "yumi-json-bigint"; // Configure json-bigint to use native BigInt const JSONBigNative = JSONBig({ useNativeBigInt: true });