diff --git a/bun.lockb b/bun.lockb index 65bd725..b739688 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 5d7e2b5..b37641a 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,6 @@ "typeforge": "^0.0.19" }, "devDependencies": { - "@types/bun": "^1.1.2", "@types/lodash": "^4.17.0", "@types/node": "^20.12.12", "esbuild": "^0.21.5", diff --git a/src/bun.ts b/src/bun.ts new file mode 100644 index 0000000..67adaee --- /dev/null +++ b/src/bun.ts @@ -0,0 +1,44 @@ +type SupportedCryptoAlgorithms = + | "blake2b256" + | "blake2b512" + | "md4" + | "md5" + | "ripemd160" + | "sha1" + | "sha224" + | "sha256" + | "sha384" + | "sha512" + | "sha512-224" + | "sha512-256" + | "sha3-224" + | "sha3-256" + | "sha3-384" + | "sha3-512" + | "shake128" + | "shake256"; + +type BlobOrStringOrBuffer = + | string + | NodeJS.TypedArray + | ArrayBufferLike + | Blob + + type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary"; + type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1"; + type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; + type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; + +export declare const Bun: { + file: (path: string | URL, options?: BlobPropertyBag) => { + arrayBuffer: () => Promise + }, + + CryptoHasher: { + new(algorithm: SupportedCryptoAlgorithms): { + update: (input: BlobOrStringOrBuffer, inputEncoding?: Encoding) => { + digest: (encoding: "base64" | "hex") => string + } + } + } +} \ No newline at end of file diff --git a/src/crypto/crypto.bun.ts b/src/crypto/crypto.bun.ts index 72984ca..62f6db9 100644 --- a/src/crypto/crypto.bun.ts +++ b/src/crypto/crypto.bun.ts @@ -1 +1,3 @@ +import { Bun } from "../bun" + export const md5Checksum = (content: string) => new Bun.CryptoHasher("md5").update(content).digest("base64") \ No newline at end of file diff --git a/src/file/file.bun.ts b/src/file/file.bun.ts index 026a326..d616a2d 100644 --- a/src/file/file.bun.ts +++ b/src/file/file.bun.ts @@ -1,3 +1,5 @@ +import { Bun } from "../bun" + export const readFile = async (path: string) => { return Buffer.from(await Bun.file(path).arrayBuffer()) } \ No newline at end of file diff --git a/src/http/httpHandler/httpHandler.ts b/src/http/httpHandler/httpHandler.ts index e60a3d2..69f642b 100644 --- a/src/http/httpHandler/httpHandler.ts +++ b/src/http/httpHandler/httpHandler.ts @@ -1,6 +1,5 @@ // [ Modules ] /////////////////////////////////////////////////////////////////// import { parseBEDEV1ErrorFromStringAndHeaders, parseBEDEV2ErrorFromStringAndHeaders } from "parse-roblox-errors" -import { HBAClient } from "roblox-bat" import { HttpError, HttpResponse } from "../http.utils" import { FetchAdapter } from "../httpAdapters/fetchHttpAdapter" diff --git a/src/queries/cloud/usersQuery.ts b/src/queries/cloud/usersQuery.ts index e960da7..692469b 100644 --- a/src/queries/cloud/usersQuery.ts +++ b/src/queries/cloud/usersQuery.ts @@ -13,6 +13,7 @@ type UnionKeepTypes = U extends ToKeep ? U : never type UnionRemoveTypes = U extends ToKeep ? never : U +// @ts-ignore | ignored type UserInfoField = ArrayToUnion type UserThumbnailField = "thumbnail" | `thumbnail/${UserThumbnailSize}` | `thumbnail/${UserThumbnailSize}/${"PNG" | "JPEG"}` | `thumbnail/${UserThumbnailSize}/${"PNG" | "JPEG"}/${"ROUND" | "SQUARE"}` type UsersField = UnionPrettify diff --git a/tsconfig.json b/tsconfig.json index d027dc6..1692dde 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,6 @@ "compilerOptions": { /* Base Options: */ "esModuleInterop": true, - "skipLibCheck": true, "target": "es2022", "allowJs": true, "resolveJsonModule": true, @@ -13,7 +12,7 @@ "declaration": true, "outDir": "dist", // Output directory - "rootDirs": ["src"], // Source directory + "rootDir": "src", // Source directory /* Strictness */ "strict": true, @@ -26,11 +25,10 @@ "moduleResolution": "Bundler", "jsx": "preserve", - "types": [ "node", "bun" ], "typeRoots": ["./node_modules/@types"] }, "include": [ "./src" ], - "exclude": ["node_modules"], + "exclude": ["node_modules", "node_modules/@types"], }