From c113cec3c357cf2b477b58625e3cb50e7a41521d Mon Sep 17 00:00:00 2001 From: Cat++ <69035887+catplvsplus@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:48:54 +0800 Subject: [PATCH 1/3] refactor: update package configuration for module support and build process - Changed package type to "module" and updated main and module entry points to use .cjs and .mjs extensions. - Updated exports to reflect new module structure. - Replaced build script to use tsup for building the project. - Updated import paths in source files to include .js extensions for compatibility with ES modules. - Removed obsolete esm.mts file. - Added tsup configuration file for streamlined build process. - Adjusted TypeScript configuration to include source files and exclude build config. --- package-lock.json | 1432 +++++++++++++++++++++++- package.json | 16 +- src/classes/Bin.ts | 8 +- src/classes/BinFile.ts | 8 +- src/classes/Client.ts | 10 +- src/classes/REST.ts | 4 +- src/classes/builders/BinBuilder.ts | 4 +- src/classes/builders/BinFileBuilder.ts | 4 +- src/esm.mts | 1 - src/index.ts | 28 +- src/types/apiTypes.ts | 2 +- tsconfig.json | 3 +- tsup.config.ts | 20 + 13 files changed, 1480 insertions(+), 60 deletions(-) delete mode 100644 src/esm.mts create mode 100644 tsup.config.ts diff --git a/package-lock.json b/package-lock.json index 4d8d66d..a0cf9f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ }, "devDependencies": { "rimraf": "^5.0.1", + "tsup": "^8.5.1", "typescript": "^5.0.4" } }, @@ -34,6 +35,448 @@ "node": ">=16.9.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.0.tgz", + "integrity": "sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.0.tgz", + "integrity": "sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.0.tgz", + "integrity": "sha512-CC3vt4+1xZrs97/PKDkl0yN7w8edvU2vZvAFGD16n9F0Cvniy5qvzRXjfO1l94efczkkQE6g1x0i73Qf5uthOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.0.tgz", + "integrity": "sha512-wurMkF1nmQajBO1+0CJmcN17U4BP6GqNSROP8t0X/Jiw2ltYGLHpEksp9MpoBqkrFR3kv2/te6Sha26k3+yZ9Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.0.tgz", + "integrity": "sha512-uJOQKYCcHhg07DL7i8MzjvS2LaP7W7Pn/7uA0B5S1EnqAirJtbyw4yC5jQ5qcFjHK9l6o/MX9QisBg12kNkdHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.0.tgz", + "integrity": "sha512-8mG6arH3yB/4ZXiEnXof5MK72dE6zM9cDvUcPtxhUZsDjESl9JipZYW60C3JGreKCEP+p8P/72r69m4AZGJd5g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.0.tgz", + "integrity": "sha512-9FHtyO988CwNMMOE3YIeci+UV+x5Zy8fI2qHNpsEtSF83YPBmE8UWmfYAQg6Ux7Gsmd4FejZqnEUZCMGaNQHQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.0.tgz", + "integrity": "sha512-zCMeMXI4HS/tXvJz8vWGexpZj2YVtRAihHLk1imZj4efx1BQzN76YFeKqlDr3bUWI26wHwLWPd3rwh6pe4EV7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.0.tgz", + "integrity": "sha512-t76XLQDpxgmq2cNXKTVEB7O7YMb42atj2Re2Haf45HkaUpjM2J0UuJZDuaGbPbamzZ7bawyGFUkodL+zcE+jvQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.0.tgz", + "integrity": "sha512-AS18v0V+vZiLJyi/4LphvBE+OIX682Pu7ZYNsdUHyUKSoRwdnOsMf6FDekwoAFKej14WAkOef3zAORJgAtXnlQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.0.tgz", + "integrity": "sha512-Mz1jxqm/kfgKkc/KLHC5qIujMvnnarD9ra1cEcrs7qshTUSksPihGrWHVG5+osAIQ68577Zpww7SGapmzSt4Nw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.0.tgz", + "integrity": "sha512-QbEREjdJeIreIAbdG2hLU1yXm1uu+LTdzoq1KCo4G4pFOLlvIspBm36QrQOar9LFduavoWX2msNFAAAY9j4BDg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.0.tgz", + "integrity": "sha512-sJz3zRNe4tO2wxvDpH/HYJilb6+2YJxo/ZNbVdtFiKDufzWq4JmKAiHy9iGoLjAV7r/W32VgaHGkk35cUXlNOg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.0.tgz", + "integrity": "sha512-z9N10FBD0DCS2dmSABDBb5TLAyF1/ydVb+N4pi88T45efQ/w4ohr/F/QYCkxDPnkhkp6AIpIcQKQ8F0ANoA2JA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.0.tgz", + "integrity": "sha512-pQdyAIZ0BWIC5GyvVFn5awDiO14TkT/19FTmFcPdDec94KJ1uZcmFs21Fo8auMXzD4Tt+diXu1LW1gHus9fhFQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.0.tgz", + "integrity": "sha512-hPlRWR4eIDDEci953RI1BLZitgi5uqcsjKMxwYfmi4LcwyWo2IcRP+lThVnKjNtk90pLS8nKdroXYOqW+QQH+w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.0.tgz", + "integrity": "sha512-1hBWx4OUJE2cab++aVZ7pObD6s+DK4mPGpemtnAORBvb5l/g5xFGk0vc0PjSkrDs0XaXj9yyob3d14XqvnQ4gw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.0.tgz", + "integrity": "sha512-6m0sfQfxfQfy1qRuecMkJlf1cIzTOgyaeXaiVaaki8/v+WB+U4hc6ik15ZW6TAllRlg/WuQXxWj1jx6C+dfy3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.0.tgz", + "integrity": "sha512-xbbOdfn06FtcJ9d0ShxxvSn2iUsGd/lgPIO2V3VZIPDbEaIj1/3nBBe1AwuEZKXVXkMmpr6LUAgMkLD/4D2PPA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.0.tgz", + "integrity": "sha512-fWgqR8uNbCQ/GGv0yhzttj6sU/9Z5/Sv/VGU3F5OuXK6J6SlriONKrQ7tNlwBrJZXRYk5jUhuWvF7GYzGguBZQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.0.tgz", + "integrity": "sha512-aCwlRdSNMNxkGGqQajMUza6uXzR/U0dIl1QmLjPtRbLOx3Gy3otfFu/VjATy4yQzo9yFDGTxYDo1FfAD9oRD2A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.0.tgz", + "integrity": "sha512-nyvsBccxNAsNYz2jVFYwEGuRRomqZ149A39SHWk4hV0jWxKM0hjBPm3AmdxcbHiFLbBSwG6SbpIcUbXjgyECfA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.0.tgz", + "integrity": "sha512-Q1KY1iJafM+UX6CFEL+F4HRTgygmEW568YMqDA5UV97AuZSm21b7SXIrRJDwXWPzr8MGr75fUZPV67FdtMHlHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.0.tgz", + "integrity": "sha512-W1eyGNi6d+8kOmZIwi/EDjrL9nxQIQ0MiGqe/AWc6+IaHloxHSGoeRgDRKHFISThLmsewZ5nHFvGFWdBYlgKPg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.0.tgz", + "integrity": "sha512-30z1aKL9h22kQhilnYkORFYt+3wp7yZsHWus+wSKAJR8JtdfI76LJ4SBdMsCopTR3z/ORqVu5L1vtnHZWVj4cQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.0.tgz", + "integrity": "sha512-aIitBcjQeyOhMTImhLZmtxfdOcuNRpwlPNmlFKPcHQYPhEssw75Cl1TSXJXpMkzaua9FUetx/4OQKq7eJul5Cg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@falloutstudios/sourcebin.js": { "resolved": "", "link": true @@ -43,26 +486,393 @@ "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", + "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", + "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", + "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", + "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", + "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", + "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", + "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", + "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", + "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", + "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", + "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", + "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", + "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", + "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", + "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", + "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", + "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", + "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", + "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", + "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", + "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">=14" + "node": ">=0.4.0" } }, "node_modules/ansi-regex": { @@ -89,6 +899,13 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -119,6 +936,48 @@ "balanced-match": "^1.0.0" } }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -148,6 +1007,33 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -162,6 +1048,24 @@ "node": ">= 8" } }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -182,6 +1086,49 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/esbuild": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.0.tgz", + "integrity": "sha512-jd0f4NHbD6cALCyGElNpGAOtWxSq46l9X/sWB0Nzd5er4Kz2YTm+Vl0qKFT9KUJvD8+fiO8AvoHhFvEatfVixA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.0", + "@esbuild/android-arm": "0.27.0", + "@esbuild/android-arm64": "0.27.0", + "@esbuild/android-x64": "0.27.0", + "@esbuild/darwin-arm64": "0.27.0", + "@esbuild/darwin-x64": "0.27.0", + "@esbuild/freebsd-arm64": "0.27.0", + "@esbuild/freebsd-x64": "0.27.0", + "@esbuild/linux-arm": "0.27.0", + "@esbuild/linux-arm64": "0.27.0", + "@esbuild/linux-ia32": "0.27.0", + "@esbuild/linux-loong64": "0.27.0", + "@esbuild/linux-mips64el": "0.27.0", + "@esbuild/linux-ppc64": "0.27.0", + "@esbuild/linux-riscv64": "0.27.0", + "@esbuild/linux-s390x": "0.27.0", + "@esbuild/linux-x64": "0.27.0", + "@esbuild/netbsd-arm64": "0.27.0", + "@esbuild/netbsd-x64": "0.27.0", + "@esbuild/openbsd-arm64": "0.27.0", + "@esbuild/openbsd-x64": "0.27.0", + "@esbuild/openharmony-arm64": "0.27.0", + "@esbuild/sunos-x64": "0.27.0", + "@esbuild/win32-arm64": "0.27.0", + "@esbuild/win32-ia32": "0.27.0", + "@esbuild/win32-x64": "0.27.0" + } + }, "node_modules/example": { "resolved": "example", "link": true @@ -216,6 +1163,36 @@ "node": ">=8" } }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, "node_modules/follow-redirects": { "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", @@ -264,6 +1241,21 @@ "node": ">= 6" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/glob": { "version": "10.2.6", "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz", @@ -319,6 +1311,16 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/kleur": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", @@ -327,6 +1329,36 @@ "node": ">=6" } }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/lru-cache": { "version": "9.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.1.tgz", @@ -336,6 +1368,16 @@ "node": "14 || >=16.14" } }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -379,6 +1421,48 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mlly": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz", + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.15.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.1" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -404,6 +1488,99 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, "node_modules/prompt-sync": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz", @@ -436,6 +1613,30 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/rimraf": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", @@ -454,6 +1655,48 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", + "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.53.3", + "@rollup/rollup-android-arm64": "4.53.3", + "@rollup/rollup-darwin-arm64": "4.53.3", + "@rollup/rollup-darwin-x64": "4.53.3", + "@rollup/rollup-freebsd-arm64": "4.53.3", + "@rollup/rollup-freebsd-x64": "4.53.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", + "@rollup/rollup-linux-arm-musleabihf": "4.53.3", + "@rollup/rollup-linux-arm64-gnu": "4.53.3", + "@rollup/rollup-linux-arm64-musl": "4.53.3", + "@rollup/rollup-linux-loong64-gnu": "4.53.3", + "@rollup/rollup-linux-ppc64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-musl": "4.53.3", + "@rollup/rollup-linux-s390x-gnu": "4.53.3", + "@rollup/rollup-linux-x64-gnu": "4.53.3", + "@rollup/rollup-linux-x64-musl": "4.53.3", + "@rollup/rollup-openharmony-arm64": "4.53.3", + "@rollup/rollup-win32-arm64-msvc": "4.53.3", + "@rollup/rollup-win32-ia32-msvc": "4.53.3", + "@rollup/rollup-win32-x64-gnu": "4.53.3", + "@rollup/rollup-win32-x64-msvc": "4.53.3", + "fsevents": "~2.3.2" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -487,6 +1730,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -583,6 +1836,146 @@ "node": ">=8" } }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tsup": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", + "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.27.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "^0.7.6", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, "node_modules/typescript": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", @@ -596,6 +1989,13 @@ "node": ">=12.20" } }, + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "dev": true, + "license": "MIT" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 546d06e..d1e1ccd 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,15 @@ "description": "A simple https://sourceb.in api library", "version": "2.2.0", "license": "GPL-3.0", - "main": "./dist/index.js", - "module": "./dist/esm.mjs", + "type": "module", "types": "./dist/index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", "exports": { ".": { - "import": "./dist/esm.mjs", - "require": "./dist/index.js", - "types": "./dist/index.d.ts" + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" } }, "keywords": [ @@ -23,8 +24,7 @@ "README.md" ], "scripts": { - "clean": "npx rimraf dist", - "build": "npm run clean && npx tsc" + "build": "tsup" }, "dependencies": { "@discordjs/collection": "^1.5.1", @@ -32,7 +32,7 @@ "fallout-utility": "^2.5.0" }, "devDependencies": { - "rimraf": "^5.0.1", + "tsup": "^8.5.1", "typescript": "^5.0.4" }, "workspaces": [ diff --git a/src/classes/Bin.ts b/src/classes/Bin.ts index 1442918..bebebef 100644 --- a/src/classes/Bin.ts +++ b/src/classes/Bin.ts @@ -1,8 +1,8 @@ import { Nothing } from 'fallout-utility'; -import { APIBinFileData, APIGetBinResponse } from '../types/apiTypes'; -import { BinFile } from './BinFile'; -import { Client } from './Client'; -import { LongSourcebinURL, ShortSourcebinURL } from '..'; +import { APIBinFileData, APIGetBinResponse } from '../types/apiTypes.js'; +import { BinFile } from './BinFile.js'; +import { Client } from './Client.js'; +import { LongSourcebinURL, ShortSourcebinURL } from '../types/options.js'; import { AxiosRequestConfig } from 'axios'; export interface BinOptions extends Nothing & { files: (Omit & { content?: string; })[] }> { diff --git a/src/classes/BinFile.ts b/src/classes/BinFile.ts index 8c2069b..b30ad61 100644 --- a/src/classes/BinFile.ts +++ b/src/classes/BinFile.ts @@ -1,7 +1,7 @@ -import { LanguageType } from '../types/languages'; -import { APIBinFileData } from '../types/apiTypes'; -import { Bin } from './Bin'; -import { Client } from '..'; +import { LanguageType } from '../types/languages.js'; +import { APIBinFileData } from '../types/apiTypes.js'; +import { Bin } from './Bin.js'; +import { Client } from '../classes/Client.js'; export class BinFile implements APIBinFileData { private _content: string|null = null; diff --git a/src/classes/Client.ts b/src/classes/Client.ts index 357ce78..1bc7782 100644 --- a/src/classes/Client.ts +++ b/src/classes/Client.ts @@ -1,10 +1,10 @@ import { Collection } from '@discordjs/collection'; -import { APIBinData } from '../types/apiTypes'; -import { Bin, BinOptions } from './Bin'; -import { APICreateBinResponse } from '../types/apiTypes'; +import { APIBinData } from '../types/apiTypes.js'; +import { Bin, BinOptions } from './Bin.js'; +import { APICreateBinResponse } from '../types/apiTypes.js'; import { JSONEncodable, trimChars } from 'fallout-utility'; -import { REST } from './REST'; -import { SourcebinURL } from '..'; +import { REST } from './REST.js'; +import { SourcebinURL } from '../types/options.js'; export interface ClientOptions { token?: string; diff --git a/src/classes/REST.ts b/src/classes/REST.ts index c36cd20..9724add 100644 --- a/src/classes/REST.ts +++ b/src/classes/REST.ts @@ -1,7 +1,7 @@ -import { APIBinData, APICreateBinResponse, APIDeleteBinResponse, APIFetchUserResponse, APIGetBinResponse } from '../types/apiTypes'; +import { APIBinData, APICreateBinResponse, APIDeleteBinResponse, APIFetchUserResponse, APIGetBinResponse } from '../types/apiTypes.js'; import { JSONEncodable, isJSONEncodable } from 'fallout-utility'; import axios, { AxiosRequestConfig } from 'axios'; -import { Client } from './Client'; +import { Client } from './Client.js'; export class REST { constructor(readonly accessToken?: string) {} diff --git a/src/classes/builders/BinBuilder.ts b/src/classes/builders/BinBuilder.ts index e7b7881..d4e6b03 100644 --- a/src/classes/builders/BinBuilder.ts +++ b/src/classes/builders/BinBuilder.ts @@ -1,6 +1,6 @@ import { RestOrArray, normalizeArray, JSONEncodable, isJSONEncodable } from 'fallout-utility'; -import { APIBinData, APIBinFileData } from '../../types/apiTypes'; -import { BinFileBuilder } from './BinFileBuilder'; +import { APIBinData, APIBinFileData } from '../../types/apiTypes.js'; +import { BinFileBuilder } from './BinFileBuilder.js'; export class BinBuilder { private data: APIBinData = { files: [] }; diff --git a/src/classes/builders/BinFileBuilder.ts b/src/classes/builders/BinFileBuilder.ts index 5191ec2..1e14143 100644 --- a/src/classes/builders/BinFileBuilder.ts +++ b/src/classes/builders/BinFileBuilder.ts @@ -1,5 +1,5 @@ -import { LanguageType } from '../..'; -import { APIBinFileData } from '../../types/apiTypes'; +import { LanguageType } from '../../types/languages.js'; +import { APIBinFileData } from '../../types/apiTypes.js'; export class BinFileBuilder { private data: APIBinFileData = { content: '' }; diff --git a/src/esm.mts b/src/esm.mts deleted file mode 100644 index 833b6a2..0000000 --- a/src/esm.mts +++ /dev/null @@ -1 +0,0 @@ -export * from './index.js'; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6fc5018..6eacf7f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,18 @@ -import { BinBuilder } from './classes/builders/BinBuilder'; -import { SourcebinURL } from './types/options'; -import { APIBinData } from './types/apiTypes'; -import { Client } from './classes/Client'; -import { Bin } from './classes/Bin'; +import { BinBuilder } from './classes/builders/BinBuilder.js'; +import { SourcebinURL } from './types/options.js'; +import { APIBinData } from './types/apiTypes.js'; +import { Client } from './classes/Client.js'; +import { Bin } from './classes/Bin.js'; -export * from './classes/builders/BinBuilder'; -export * from './classes/builders/BinFileBuilder'; -export * from './classes/Bin'; -export * from './classes/BinFile'; -export * from './classes/Client'; -export * from './classes/REST'; -export * from './types/apiTypes'; -export * from './types/languages'; -export * from './types/options'; +export * from './classes/builders/BinBuilder.js'; +export * from './classes/builders/BinFileBuilder.js'; +export * from './classes/Bin.js'; +export * from './classes/BinFile.js'; +export * from './classes/Client.js'; +export * from './classes/REST.js'; +export * from './types/apiTypes.js'; +export * from './types/languages.js'; +export * from './types/options.js'; /** * @param bin Bin data diff --git a/src/types/apiTypes.ts b/src/types/apiTypes.ts index 2704e28..bd2cc54 100644 --- a/src/types/apiTypes.ts +++ b/src/types/apiTypes.ts @@ -1,4 +1,4 @@ -import { LanguageType } from './languages'; +import { LanguageType } from './languages.js'; export interface APICreateBinResponse { key: string; diff --git a/tsconfig.json b/tsconfig.json index 8d09b40..665e6b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,6 @@ { + "include": ["./src/**/*"], + "exclude": ["./tsup.config.ts"], "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -7,7 +9,6 @@ "moduleResolution": "NodeNext", "forceConsistentCasingInFileNames": true, "declaration": true, - "experimentalDecorators": true, "esModuleInterop": true, "skipLibCheck": true, "sourceMap": true, diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..1e1b320 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,20 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + external: [], + noExternal: [], + platform: 'node', + format: ['esm', 'cjs'], + skipNodeModulesBundle: true, + target: 'esnext', + clean: true, + splitting: false, + keepNames: true, + dts: true, + sourcemap: true, + esbuildPlugins: [], + treeshake: true, + outDir: './dist', + tsconfig: 'tsconfig.json' +}) \ No newline at end of file From c0bc960e29f451ea44b9c58d1923cabb557825b4 Mon Sep 17 00:00:00 2001 From: Cat++ <69035887+catplvsplus@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:52:30 +0800 Subject: [PATCH 2/3] clean --- package.json | 2 +- src/classes/Bin.ts | 80 ---- src/classes/BinFile.ts | 39 -- src/classes/Client.ts | 102 ----- src/classes/REST.ts | 70 ---- src/classes/builders/BinBuilder.ts | 38 -- src/classes/builders/BinFileBuilder.ts | 30 -- src/index.ts | 41 -- src/types/apiTypes.ts | 46 --- src/types/languages.ts | 551 ------------------------- src/types/options.ts | 13 - 11 files changed, 1 insertion(+), 1011 deletions(-) delete mode 100644 src/classes/Bin.ts delete mode 100644 src/classes/BinFile.ts delete mode 100644 src/classes/Client.ts delete mode 100644 src/classes/REST.ts delete mode 100644 src/classes/builders/BinBuilder.ts delete mode 100644 src/classes/builders/BinFileBuilder.ts delete mode 100644 src/types/apiTypes.ts delete mode 100644 src/types/languages.ts delete mode 100644 src/types/options.ts diff --git a/package.json b/package.json index d1e1ccd..7355c40 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@falloutstudios/sourcebin.js", + "name": "srcbin.js", "description": "A simple https://sourceb.in api library", "version": "2.2.0", "license": "GPL-3.0", diff --git a/src/classes/Bin.ts b/src/classes/Bin.ts deleted file mode 100644 index bebebef..0000000 --- a/src/classes/Bin.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Nothing } from 'fallout-utility'; -import { APIBinFileData, APIGetBinResponse } from '../types/apiTypes.js'; -import { BinFile } from './BinFile.js'; -import { Client } from './Client.js'; -import { LongSourcebinURL, ShortSourcebinURL } from '../types/options.js'; -import { AxiosRequestConfig } from 'axios'; - -export interface BinOptions extends Nothing & { files: (Omit & { content?: string; })[] }> { - client?: Client; -} - -export class Bin implements Omit { - public hits!: number; - public _id!: string; - public key!: string; - public title?: string; - public created!: Date; - public description?: string; - public files: BinFile[] = []; - public client?: Client; - - get url(): LongSourcebinURL { - return `https://sourceb.in/${this.key}`; - } - - get shortURL(): ShortSourcebinURL { - return `https://srcb.in/${this.key}`; - } - - constructor(options: BinOptions, contents?: { content: string; index: number; }[]) { - this._updateData(options, contents); - } - - public async fetch(requestOptions?: AxiosRequestConfig): Promise { - const data = await Client.getBin(this.key, requestOptions); - this._updateData(data); - - return this; - } - - public async fetchFileContents(): Promise { - return Promise.all(this.files.map(async f => f.fetchContent())); - } - - public async delete(): Promise { - const data = await this.client?.deleteBin(this.key); - if (!data?.success) throw new Error('Unable to delete bin.', { cause: data }); - - this.client?.cache.delete(this.key); - } - - public toJSON(): Omit & { files: APIBinFileData[] } { - return { - hits: this.hits, - _id: this._id, - key: this.key, - created: this.created.toISOString(), - title: this.title, - description: this.description, - files: this.files.map(f => f.toJSON()) - }; - } - - public _updateData(data: BinOptions, contents?: { content: string; index: number; }[]): void { - this.hits = data.hits ?? this.hits; - this._id = data._id ?? this._id; - this.key = data.key ?? this.key; - this.created = data.created ? new Date(data.created) : this.created; - this.title = data.title ?? this.title; - this.description = data.description ?? this.description; - this.files = data.files?.map((f, i) => { - const content = contents?.find(c => c.index === i)?.content; - if (content) f.content = content; - - return new BinFile(this, i, f); - }) ?? this.files; - - this.client = data.client; - } -} \ No newline at end of file diff --git a/src/classes/BinFile.ts b/src/classes/BinFile.ts deleted file mode 100644 index b30ad61..0000000 --- a/src/classes/BinFile.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { LanguageType } from '../types/languages.js'; -import { APIBinFileData } from '../types/apiTypes.js'; -import { Bin } from './Bin.js'; -import { Client } from '../classes/Client.js'; - -export class BinFile implements APIBinFileData { - private _content: string|null = null; - - readonly name?: string; - readonly languageId?: LanguageType; - - get content() { - return this._content || ''; - } - - get language() { - return typeof this.languageId === 'number' ? LanguageType[this.languageId] as (keyof typeof LanguageType) : undefined; - } - - constructor(readonly bin: Bin, readonly index: number, file: Partial) { - this.name = file.name; - this._content = file.content || null; - this.languageId = file.languageId; - } - - public async fetchContent(): Promise { - const content = await Client.getBinContent(this.bin.key, this.index); - this._content = content; - return content; - } - - public toJSON(): APIBinFileData { - return { - name: this.name, - content: this.content, - languageId: this.languageId - }; - } -} \ No newline at end of file diff --git a/src/classes/Client.ts b/src/classes/Client.ts deleted file mode 100644 index 1bc7782..0000000 --- a/src/classes/Client.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { Collection } from '@discordjs/collection'; -import { APIBinData } from '../types/apiTypes.js'; -import { Bin, BinOptions } from './Bin.js'; -import { APICreateBinResponse } from '../types/apiTypes.js'; -import { JSONEncodable, trimChars } from 'fallout-utility'; -import { REST } from './REST.js'; -import { SourcebinURL } from '../types/options.js'; - -export interface ClientOptions { - token?: string; - cacheBins?: boolean; -} - -export class Client extends REST { - readonly cache: Collection = new Collection(); - - constructor(readonly options?: ClientOptions) { - super(options?.token); - } - - /** - * Creates new bin - * @param bin Bin data or builder - * @param fetchContent Whether fetch content of bin after creation - */ - public async createBin(bin: APIBinData|JSONEncodable, fetchContent?: true): Promise; - public async createBin(bin: APIBinData|JSONEncodable, fetchContent?: false): Promise; - public async createBin(bin: APIBinData|JSONEncodable, fetchContent: boolean = true): Promise { - const response = await Client.createBin(bin, this.requestOptions); - if (!fetchContent) return response; - - return this.fetchBin(response.key); - } - - /** - * Fetch bin data - * @param key Bin key or url - * @param cache Adds the fetched bin to cache if enabled - */ - public async fetchBin(key: string, cache: boolean = true): Promise { - key = Client.isSourcebinURL(key) ? Client.getKeyFromURL(key) : key; - - const data = await Client.getBin(key, this.requestOptions) as Omit; - - const bin = new Bin({ ...data, client: this }); - - await bin.fetchFileContents(); - - if (cache) this.addBinToCache(bin); - return bin; - } - - /** - * Fetch user bins - * @param cache Adds the feetched bins to cache if enabled - */ - public async fetchUserBins(cache: boolean = true): Promise { - const rawBins = await this.getUserBins(); - const bins = await Promise.all(rawBins.map(async (data: Omit) => { - const bin = new Bin({ ...data, client: this }); - await bin.fetchFileContents(); - return bin; - })); - - if (cache) bins.forEach(b => this.addBinToCache(b)); - return bins; - } - - /** - * Retrieves the bin data from cache or fetch from api - * @param key Bin key or url - */ - public async resolveBin(key: string): Promise { - key = Client.isSourcebinURL(key) ? Client.getKeyFromURL(key) : key; - - return this.cache.get(key) ?? this.fetchBin(key); - } - - protected addBinToCache(bin: Bin): void { - const cached = this.cache.get(bin.key); - - if (cached) cached._updateData(bin.toJSON()); - if (this.options?.cacheBins !== false) this.cache.set(bin.key, bin); - } - - public static isSourcebinURL(url: string): url is SourcebinURL { - try { - const parsed = new URL(url); - - return (['sourceb.in', 'srcb.in'].includes(parsed.hostname)) && trimChars(parsed.pathname, '/').length === 10; - } catch(err) { - return false; - } - } - - public static getKeyFromURL(url: string): string { - if (!this.isSourcebinURL(url)) throw new Error('Invalid sourceb.in link'); - - const parsed = new URL(url); - return trimChars(parsed.pathname, '/'); - } -} \ No newline at end of file diff --git a/src/classes/REST.ts b/src/classes/REST.ts deleted file mode 100644 index 9724add..0000000 --- a/src/classes/REST.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { APIBinData, APICreateBinResponse, APIDeleteBinResponse, APIFetchUserResponse, APIGetBinResponse } from '../types/apiTypes.js'; -import { JSONEncodable, isJSONEncodable } from 'fallout-utility'; -import axios, { AxiosRequestConfig } from 'axios'; -import { Client } from './Client.js'; - -export class REST { - constructor(readonly accessToken?: string) {} - - get requestOptions() { - const options: AxiosRequestConfig = {}; - - if (!this.accessToken) return options; - - options.headers = { Cookie: `access_token=${this.accessToken};` }; - options.withCredentials = true; - - return options; - }; - - public async getUser(requestOptions?: AxiosRequestConfig): Promise { - return axios.get(`https://sourceb.in/api/user`, { ...this.requestOptions, ...requestOptions }).then(d => d.data); - } - - public async getUserBins(requestOptions?: AxiosRequestConfig): Promise { - return axios.get(`https://sourceb.in/api/user/bins`, { ...this.requestOptions, ...requestOptions }).then(d => d.data); - } - - /** - * Deletes bin - * @param key Bin key or url - * @param requestOptions Additional axios options - */ - public async deleteBin(key: string, requestOptions?: AxiosRequestConfig): Promise { - key = Client.isSourcebinURL(key) ? Client.getKeyFromURL(key) : key; - - return axios.delete(`https://sourceb.in/api/bins/${key}`, { ...this.requestOptions, ...requestOptions }).then(d => d.data); - } - - /** - * Fetch bin - * @param bin Bin data or builder - * @param requestOptions Additional axios options - */ - public static async createBin(bin: APIBinData|JSONEncodable, requestOptions?: AxiosRequestConfig): Promise { - return axios.post(`https://sourceb.in/api/bins`, isJSONEncodable(bin) ? bin.toJSON() : bin, requestOptions).then(d => d.data); - } - - /** - * Get raw bin data - * @param key Bin key or url - * @param requestOptions Additional axios options - */ - public static async getBin(key: string, requestOptions?: AxiosRequestConfig): Promise { - key = Client.isSourcebinURL(key) ? Client.getKeyFromURL(key) : key; - - return axios.get(`https://sourceb.in/api/bins/${key}`, requestOptions).then(d => d.data); - } - - /** - * Get bin content - * @param key Bin key or url - * @param index Bin file index - * @param requestOptions Additional axios options - */ - public static async getBinContent(key: string, index: number, requestOptions?: AxiosRequestConfig): Promise { - key = Client.isSourcebinURL(key) ? Client.getKeyFromURL(key) : key; - - return axios.get(`https://cdn.sourceb.in/bins/${key}/${index}`, requestOptions).then(d => d.data); - } -} \ No newline at end of file diff --git a/src/classes/builders/BinBuilder.ts b/src/classes/builders/BinBuilder.ts deleted file mode 100644 index d4e6b03..0000000 --- a/src/classes/builders/BinBuilder.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { RestOrArray, normalizeArray, JSONEncodable, isJSONEncodable } from 'fallout-utility'; -import { APIBinData, APIBinFileData } from '../../types/apiTypes.js'; -import { BinFileBuilder } from './BinFileBuilder.js'; - -export class BinBuilder { - private data: APIBinData = { files: [] }; - - public setTitle(title?: string|null): this { - this.data.title = title || undefined; - return this; - } - - public setDescription(description?: string|null): this { - this.data.description = description || undefined; - return this; - } - - public addFile(file: ((f: BinFileBuilder) => BinFileBuilder)|JSONEncodable): this { - this.data.files.push(isJSONEncodable(file) ? file.toJSON() : file(new BinFileBuilder()).toJSON()); - return this; - } - - public addFiles(...files: RestOrArray>): this { - files = normalizeArray(files); - this.data.files.push(...files.map(f => isJSONEncodable(f) ? f.toJSON() : f)); - return this; - } - - public setFiles(...files: RestOrArray>): this { - files = normalizeArray(files); - this.data.files = files.map(f => isJSONEncodable(f) ? f.toJSON() : f); - return this; - } - - public toJSON(): APIBinData { - return this.data; - } -} \ No newline at end of file diff --git a/src/classes/builders/BinFileBuilder.ts b/src/classes/builders/BinFileBuilder.ts deleted file mode 100644 index 1e14143..0000000 --- a/src/classes/builders/BinFileBuilder.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LanguageType } from '../../types/languages.js'; -import { APIBinFileData } from '../../types/apiTypes.js'; - -export class BinFileBuilder { - private data: APIBinFileData = { content: '' }; - - public setName(name?: string|null): this { - this.data.name = name || undefined; - return this; - } - - public setContent(content: string): this { - this.data.content = content; - return this; - } - - public setLanguage(language?: LanguageType|(keyof typeof LanguageType)|null): this { - this.data.languageId = typeof language === 'number' - ? language - : typeof language === 'string' - ? LanguageType[language] - : undefined; - - return this; - } - - public toJSON(): APIBinFileData { - return this.data; - } -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6eacf7f..e69de29 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,41 +0,0 @@ -import { BinBuilder } from './classes/builders/BinBuilder.js'; -import { SourcebinURL } from './types/options.js'; -import { APIBinData } from './types/apiTypes.js'; -import { Client } from './classes/Client.js'; -import { Bin } from './classes/Bin.js'; - -export * from './classes/builders/BinBuilder.js'; -export * from './classes/builders/BinFileBuilder.js'; -export * from './classes/Bin.js'; -export * from './classes/BinFile.js'; -export * from './classes/Client.js'; -export * from './classes/REST.js'; -export * from './types/apiTypes.js'; -export * from './types/languages.js'; -export * from './types/options.js'; - -/** - * @param bin Bin data - */ -export const create = (bin: APIBinData|BinBuilder) => Client.createBin(bin); - -/** - * @param key Bin key or url - */ -export const get = async (key: string) => new Bin(await Client.getBin(key)); - -/** - * @param key Bin key or url - * @param index Bin file index - */ -export const fetchContent = (key: string, index: number = 0) => Client.getBinContent(key, index); - -/** - * @param url Could be a sourcebin url - */ -export const isSourcebin = (url: string): url is SourcebinURL => Client.isSourcebinURL(url); - -/** - * @param url Sourcebin url - */ -export const getKeyFromURL = (url: string) => Client.getKeyFromURL(url); diff --git a/src/types/apiTypes.ts b/src/types/apiTypes.ts deleted file mode 100644 index bd2cc54..0000000 --- a/src/types/apiTypes.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { LanguageType } from './languages.js'; - -export interface APICreateBinResponse { - key: string; - languages: LanguageType[]; -} - -export interface APIGetBinResponse extends Omit { - hits: number; - _id: string; - key: string; - files: Omit[]; - created: string; -} - -export interface APIDeleteBinResponse { - success: boolean; -} - -export interface APIFetchUserResponse { - username: string; - about: { - avatarURL?: string; - bio?: string; - website?: string; - location?: string; - }; - oauth: { - discord?: string; - github?: string; - }; - plan: string; - createdAt: string; -} - -export interface APIBinData { - title?: string; - description?: string; - files: APIBinFileData[]; -} - -export interface APIBinFileData { - name?: string; - content: string; - languageId?: LanguageType; -} \ No newline at end of file diff --git a/src/types/languages.ts b/src/types/languages.ts deleted file mode 100644 index a4947db..0000000 --- a/src/types/languages.ts +++ /dev/null @@ -1,551 +0,0 @@ -export enum LanguageType { - "1C Enterprise"=0, - "4D"=577529595, - "ABAP"=1, - "ABNF"=429, - "AGS Script"=2, - "AMPL"=3, - "ANTLR"=4, - "API Blueprint"=5, - "APL"=6, - "ASN.1"=7, - "ASP"=8, - "ATS"=9, - "ActionScript"=10, - "Ada"=11, - "Adobe Font Metrics"=147198098, - "Agda"=12, - "Alloy"=13, - "Alpine Abuild"=14, - "Altium Designer"=187772328, - "AngelScript"=389477596, - "Ant Build System"=15, - "ApacheConf"=16, - "Apex"=17, - "Apollo Guidance Computer"=18, - "AppleScript"=19, - "Arc"=20, - "AsciiDoc"=22, - "AspectJ"=23, - "Assembly"=24, - "Asymptote"=591605007, - "Augeas"=25, - "AutoHotkey"=26, - "AutoIt"=27, - "Awk"=28, - "Ballerina"=720859680, - "Batchfile"=29, - "Befunge"=30, - "BibTeX"=982188347, - "Bison"=31, - "BitBake"=32, - "Blade"=33, - "BlitzBasic"=34, - "BlitzMax"=35, - "Bluespec"=36, - "Boo"=37, - "Brainfuck"=38, - "Brightscript"=39, - "C"=41, - "C#"=42, - "C++"=43, - "C-ObjDump"=44, - "C2hs Haskell"=45, - "CLIPS"=46, - "CMake"=47, - "COBOL"=48, - "COLLADA"=49, - "CSON"=424, - "CSS"=50, - "CSV"=51, - "CWeb"=657332628, - "Cabal Config"=677095381, - "Cap'n Proto"=52, - "CartoCSS"=53, - "Ceylon"=54, - "Chapel"=55, - "Charity"=56, - "ChucK"=57, - "Cirru"=58, - "Clarion"=59, - "Clean"=60, - "Click"=61, - "Clojure"=62, - "Closure Templates"=357046146, - "Cloud Firestore Security Rules"=407996372, - "CoNLL-U"=421026389, - "CoffeeScript"=63, - "ColdFusion"=64, - "ColdFusion CFC"=65, - "Common Lisp"=66, - "Common Workflow Language"=988547172, - "Component Pascal"=67, - "Cool"=68, - "Coq"=69, - "Cpp-ObjDump"=70, - "Creole"=71, - "Crystal"=72, - "Csound"=73, - "Csound Document"=74, - "Csound Score"=75, - "Cuda"=77, - "Cycript"=78, - "Cython"=79, - "D"=80, - "D-ObjDump"=81, - "DIGITAL Command Language"=82, - "DM"=83, - "DNS Zone"=84, - "DTrace"=85, - "Darcs Patch"=86, - "Dart"=87, - "DataWeave"=974514097, - "Dhall"=793969321, - "Diff"=88, - "DirectX 3D File"=201049282, - "Dockerfile"=89, - "Dogescript"=90, - "Dylan"=91, - "E"=92, - "EBNF"=430, - "ECL"=93, - "ECLiPSe"=94, - "EJS"=95, - "EML"=529653389, - "EQ"=96, - "Eagle"=97, - "Easybuild"=342840477, - "Ecere Projects"=98, - "EditorConfig"=96139566, - "Edje Data Collection"=342840478, - "Eiffel"=99, - "Elixir"=100, - "Elm"=101, - "Emacs Lisp"=102, - "EmberScript"=103, - "Erlang"=104, - "F#"=105, - "F*"=336943375, - "FIGlet Font"=686129783, - "FLUX"=106, - "Factor"=108, - "Fancy"=109, - "Fantom"=110, - "Faust"=622529198, - "Filebench WML"=111, - "Filterscript"=112, - "Formatted"=113, - "Forth"=114, - "Fortran"=107, - "FreeMarker"=115, - "Frege"=116, - "G-code"=117, - "GAML"=290345951, - "GAMS"=118, - "GAP"=119, - "GCC Machine Description"=121, - "GDB"=122, - "GDScript"=123, - "GLSL"=124, - "GN"=302957008, - "Game Maker Language"=125, - "Genie"=792408528, - "Genshi"=126, - "Gentoo Ebuild"=127, - "Gentoo Eclass"=128, - "Gerber Image"=404627610, - "Gettext Catalog"=129, - "Gherkin"=76, - "Git Attributes"=956324166, - "Git Config"=807968997, - "Glyph"=130, - "Glyph Bitmap Distribution Format"=997665271, - "Gnuplot"=131, - "Go"=132, - "Golo"=133, - "Gosu"=134, - "Grace"=135, - "Gradle"=136, - "Grammatical Framework"=137, - "Graph Modeling Language"=138, - "GraphQL"=139, - "Graphviz (DOT)"=140, - "Groovy"=142, - "Groovy Server Pages"=143, - "HAProxy"=366607477, - "HCL"=144, - "HLSL"=145, - "HTML"=146, - "HTML+Django"=147, - "HTML+ECR"=148, - "HTML+EEX"=149, - "HTML+ERB"=150, - "HTML+PHP"=151, - "HTML+Razor"=479039817, - "HTTP"=152, - "HXML"=786683730, - "Hack"=153, - "Haml"=154, - "Handlebars"=155, - "Harbour"=156, - "Haskell"=157, - "Haxe"=158, - "HiveQL"=931814087, - "HolyC"=928121743, - "Hy"=159, - "HyPhy"=160, - "IDL"=161, - "IGOR Pro"=162, - "INI"=163, - "IRC log"=164, - "Idris"=165, - "Ignore List"=74444240, - "Inform 7"=166, - "Inno Setup"=167, - "Io"=168, - "Ioke"=169, - "Isabelle"=170, - "Isabelle ROOT"=171, - "J"=172, - "JFlex"=173, - "JSON"=174, - "JSON with Comments"=423, - "JSON5"=175, - "JSONLD"=176, - "JSONiq"=177, - "JSX"=178, - "Jasmin"=180, - "Java"=181, - "Java Properties"=519377561, - "Java Server Pages"=182, - "JavaScript"=183, - "JavaScript+ERB"=914318960, - "Jison"=284531423, - "Jison Lex"=406395330, - "Jolie"=998078858, - "Jsonnet"=664885656, - "Julia"=184, - "Jupyter Notebook"=185, - "KRL"=186, - "KiCad Layout"=187, - "KiCad Legacy Layout"=140848857, - "KiCad Schematic"=622447435, - "Kit"=188, - "Kotlin"=189, - "LFE"=190, - "LLVM"=191, - "LOLCODE"=192, - "LSL"=193, - "LTspice Symbol"=1013566805, - "LabVIEW"=194, - "Lasso"=195, - "Latte"=196, - "Lean"=197, - "Less"=198, - "Lex"=199, - "LilyPond"=200, - "Limbo"=201, - "Linker Script"=202, - "Linux Kernel Module"=203, - "Liquid"=204, - "Literate Agda"=205, - "Literate CoffeeScript"=206, - "Literate Haskell"=207, - "LiveScript"=208, - "Logos"=209, - "Logtalk"=210, - "LookML"=211, - "LoomScript"=212, - "Lua"=213, - "M"=214, - "M4"=215, - "M4Sugar"=216, - "MATLAB"=225, - "MAXScript"=217, - "MLIR"=448253929, - "MQL4"=426, - "MQL5"=427, - "MTML"=218, - "MUF"=219, - "Makefile"=220, - "Mako"=221, - "Markdown"=222, - "Marko"=932782397, - "Mask"=223, - "Mathematica"=224, - "Maven POM"=226, - "Max"=227, - "MediaWiki"=228, - "Mercury"=229, - "Meson"=799141244, - "Metal"=230, - "Microsoft Developer Studio Project"=800983837, - "MiniD"=231, - "Mirah"=232, - "Modelica"=233, - "Modula-2"=234, - "Modula-3"=564743864, - "Module Management System"=235, - "Monkey"=236, - "Moocode"=237, - "MoonScript"=238, - "Motorola 68K Assembly"=477582706, - "Muse"=474864066, - "Myghty"=239, - "NCL"=240, - "NL"=241, - "NPM Config"=685022663, - "NSIS"=242, - "Nearley"=521429430, - "Nemerle"=243, - "NetLinx"=244, - "NetLinx+ERB"=245, - "NetLogo"=246, - "NewLisp"=247, - "Nextflow"=506780613, - "Nginx"=248, - "Nim"=249, - "Ninja"=250, - "Nit"=251, - "Nix"=252, - "Nu"=253, - "NumPy"=254, - "OCaml"=255, - "ObjDump"=256, - "Object Data Instance Notation"=985227236, - "ObjectScript"=202735509, - "Objective-C"=257, - "Objective-C++"=258, - "Objective-J"=259, - "Odin"=889244082, - "Omgrofl"=260, - "Opa"=261, - "Opal"=262, - "Open Policy Agent"=840483232, - "OpenCL"=263, - "OpenEdge ABL"=264, - "OpenRC runscript"=265, - "OpenSCAD"=266, - "OpenStep Property List"=598917541, - "OpenType Feature File"=374317347, - "Org"=267, - "Ox"=268, - "Oxygene"=269, - "Oz"=270, - "P4"=348895984, - "PHP"=272, - "PLSQL"=273, - "PLpgSQL"=274, - "POV-Ray SDL"=275, - "Pan"=276, - "Papyrus"=277, - "Parrot"=278, - "Parrot Assembly"=279, - "Parrot Internal Representation"=280, - "Pascal"=281, - "Pawn"=271, - "Pep8"=840372442, - "Perl"=282, - "Pic"=425, - "Pickle"=284, - "PicoLisp"=285, - "PigLatin"=286, - "Pike"=287, - "Pod"=288, - "Pod 6"=155357471, - "PogoScript"=289, - "Pony"=290, - "PostCSS"=262764437, - "PostScript"=291, - "PowerBuilder"=292, - "PowerShell"=293, - "Prisma"=499933428, - "Processing"=294, - "Proguard"=716513858, - "Prolog"=295, - "Propeller Spin"=296, - "Protocol Buffer"=297, - "Public Key"=298, - "Pug"=179, - "Puppet"=299, - "Pure Data"=300, - "PureBasic"=301, - "PureScript"=302, - "Python"=303, - "Python console"=428, - "Python traceback"=304, - "QML"=305, - "QMake"=306, - "Quake"=375265331, - "R"=307, - "RAML"=308, - "RDoc"=309, - "REALbasic"=310, - "REXX"=311, - "RHTML"=312, - "RMarkdown"=313, - "RPC"=1031374237, - "RPM Spec"=314, - "RUNOFF"=315, - "Racket"=316, - "Ragel"=317, - "Raku"=283, - "Rascal"=173616037, - "Raw token data"=318, - "Readline Config"=538732839, - "Reason"=869538413, - "Rebol"=319, - "Red"=320, - "Redcode"=321, - "Regular Expression"=363378884, - "Ren'Py"=322, - "RenderScript"=323, - "Rich Text Format"=51601661, - "Ring"=431, - "Riot"=878396783, - "RobotFramework"=324, - "Roff"=141, - "Roff Manpage"=612669833, - "Rouge"=325, - "Ruby"=326, - "Rust"=327, - "SAS"=328, - "SCSS"=329, - "SMT"=330, - "SPARQL"=331, - "SQF"=332, - "SQL"=333, - "SQLPL"=334, - "SRecode Template"=335, - "SSH Config"=554920715, - "STON"=336, - "SVG"=337, - "SWIG"=1066250075, - "Sage"=338, - "SaltStack"=339, - "Sass"=340, - "Scala"=341, - "Scaml"=342, - "Scheme"=343, - "Scilab"=344, - "Self"=345, - "ShaderLab"=664257356, - "Shell"=346, - "ShellSession"=347, - "Shen"=348, - "Slash"=349, - "Slice"=894641667, - "Slim"=350, - "SmPL"=164123055, - "Smali"=351, - "Smalltalk"=352, - "Smarty"=353, - "Solidity"=237469032, - "SourcePawn"=354, - "Spline Font Database"=767169629, - "Squirrel"=355, - "Stan"=356, - "Standard ML"=357, - "Starlark"=960266174, - "Stata"=358, - "Stylus"=359, - "SubRip Text"=360, - "SugarSS"=826404698, - "SuperCollider"=361, - "Svelte"=928734530, - "Swift"=362, - "SystemVerilog"=363, - "TI Program"=422, - "TLA"=364, - "TOML"=365, - "TSQL"=918334941, - "TSX"=94901924, - "TXL"=366, - "Tcl"=367, - "Tcsh"=368, - "TeX"=369, - "Tea"=370, - "Terra"=371, - "Texinfo"=988020015, - "Text"=372, - "Textile"=373, - "Thrift"=374, - "Turing"=375, - "Turtle"=376, - "Twig"=377, - "Type Language"=632765617, - "TypeScript"=378, - "Unified Parallel C"=379, - "Unity3D Asset"=380, - "Unix Assembly"=120, - "Uno"=381, - "UnrealScript"=382, - "UrWeb"=383, - "V"=603371597, - "VBA"=399230729, - "VBScript"=408016005, - "VCL"=384, - "VHDL"=385, - "Vala"=386, - "Verilog"=387, - "Vim Snippet"=81265970, - "Vim script"=388, - "Visual Basic .NET"=389, - "Volt"=390, - "Vue"=391, - "Wavefront Material"=392, - "Wavefront Object"=393, - "Web Ontology Language"=394, - "WebAssembly"=956556503, - "WebIDL"=395, - "WebVTT"=658679714, - "Wget Config"=668457123, - "Windows Registry Entries"=969674868, - "Wollok"=632745969, - "World of Warcraft Addon Data"=396, - "X BitMap"=782911107, - "X Font Directory Index"=208700028, - "X PixMap"=781846279, - "X10"=397, - "XC"=398, - "XCompose"=225167241, - "XML"=399, - "XML Property List"=75622871, - "XPages"=400, - "XProc"=401, - "XQuery"=402, - "XS"=403, - "XSLT"=404, - "Xojo"=405, - "Xtend"=406, - "YAML"=407, - "YANG"=408, - "YARA"=805122868, - "YASnippet"=378760102, - "Yacc"=409, - "ZAP"=952972794, - "ZIL"=973483626, - "Zeek"=40, - "ZenScript"=494938890, - "Zephir"=410, - "Zig"=646424281, - "Zimpl"=411, - "cURL Config"=992375436, - "desktop"=412, - "dircolors"=691605112, - "eC"=413, - "edn"=414, - "fish"=415, - "mIRC Script"=517654727, - "mcfunction"=462488745, - "mupad"=416, - "nanorc"=775996197, - "nesC"=417, - "ooc"=418, - "q"=970539067, - "reStructuredText"=419, - "sed"=847830017, - "wdl"=374521672, - "wisp"=420, - "xBase"=421 -} \ No newline at end of file diff --git a/src/types/options.ts b/src/types/options.ts deleted file mode 100644 index 472d87a..0000000 --- a/src/types/options.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { If } from 'fallout-utility'; - -export type SourcebinURL = ShortSourcebinURL|LongSourcebinURL; -export type ShortSourcebinURL = `${If}srcb.in/${string}`; -export type LongSourcebinURL = `${If}sourceb.in/${string}`; - -export interface GetBinOptions { - key: string; - /** - * @default true - */ - fetchContent?: boolean; -} \ No newline at end of file From 3f42bc325502cf99220a63270123c8e059c5ec9a Mon Sep 17 00:00:00 2001 From: Cat++ <69035887+catplvsplus@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:06:42 +0800 Subject: [PATCH 3/3] feat: restructure codebase with new Client and REST classes, add Bin and BinFile models - Updated package.json to change module entry points from .mjs to .js and updated dependencies. - Introduced new classes: Bin, BinFile, Client, and REST to handle API interactions and data models. - Added API response and options structures for better type safety. - Implemented language type constants for file handling. - Modified tsconfig.json and tsup.config.ts for improved build configurations. --- example/package.json | 2 +- example/test.cjs | 14 + example/test.mjs | 7 +- package-lock.json | 676 +--------------------------------- package.json | 8 +- src/classes/Bin.ts | 47 +++ src/classes/BinFile.ts | 38 ++ src/classes/Client.ts | 67 ++++ src/classes/REST.ts | 122 ++++++ src/helpers/constants.ts | 551 +++++++++++++++++++++++++++ src/index.ts | 11 + src/structures/APIOptions.ts | 15 + src/structures/APIResponse.ts | 43 +++ tsconfig.json | 3 +- tsup.config.ts | 2 +- 15 files changed, 932 insertions(+), 674 deletions(-) create mode 100644 example/test.cjs create mode 100644 src/classes/Bin.ts create mode 100644 src/classes/BinFile.ts create mode 100644 src/classes/Client.ts create mode 100644 src/classes/REST.ts create mode 100644 src/helpers/constants.ts create mode 100644 src/structures/APIOptions.ts create mode 100644 src/structures/APIResponse.ts diff --git a/example/package.json b/example/package.json index 2666ab2..5319164 100644 --- a/example/package.json +++ b/example/package.json @@ -2,6 +2,6 @@ "type": "module", "private": true, "dependencies": { - "@falloutstudios/sourcebin.js": "../" + "srcbin.js": "../" } } \ No newline at end of file diff --git a/example/test.cjs b/example/test.cjs new file mode 100644 index 0000000..30d63d8 --- /dev/null +++ b/example/test.cjs @@ -0,0 +1,14 @@ +// @ts-check +const { srcbin } = require('srcbin.js'); + +const bin = await srcbin.createBin({ + title: 'Test', + files: [ + { + name: 'test.txt', + content: 'console.log(`Hellow, world!`)' + } + ] +}); + +console.log(bin); \ No newline at end of file diff --git a/example/test.mjs b/example/test.mjs index cfcc27a..293b7b0 100644 --- a/example/test.mjs +++ b/example/test.mjs @@ -1,10 +1,7 @@ // @ts-check -import { Client } from '@falloutstudios/sourcebin.js'; +import { srcbin } from 'srcbin.js'; -const sourcebin = new Client(); - - -const bin = await sourcebin.createBin({ +const bin = await srcbin.createBin({ title: 'Test', files: [ { diff --git a/package-lock.json b/package-lock.json index a0cf9f0..04bf32b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,38 +1,39 @@ { - "name": "@falloutstudios/sourcebin.js", + "name": "srcbin.js", "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@falloutstudios/sourcebin.js", + "name": "srcbin.js", "version": "2.2.0", "license": "GPL-3.0", "workspaces": [ "./example/" ], "dependencies": { - "@discordjs/collection": "^1.5.1", - "axios": "^1.4.0", - "fallout-utility": "^2.5.0" + "@discordjs/collection": "^2.1.1" }, "devDependencies": { - "rimraf": "^5.0.1", "tsup": "^8.5.1", "typescript": "^5.0.4" } }, "example": { "dependencies": { - "@falloutstudios/sourcebin.js": "../" + "srcbin.js": "../" } }, "node_modules/@discordjs/collection": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.1.tgz", - "integrity": "sha512-aWEc9DCf3TMDe9iaJoOnO2+JVAjeRNuRxPZQA6GVvBf+Z3gqUuWYBy2NWh4+5CLYq5uoc3MOvUQ5H5m8CJBqOA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.1.1.tgz", + "integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==", + "license": "Apache-2.0", "engines": { - "node": ">=16.9.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/discordjs/discord.js?sponsor" } }, "node_modules/@esbuild/aix-ppc64": { @@ -477,27 +478,6 @@ "node": ">=18" } }, - "node_modules/@falloutstudios/sourcebin.js": { - "resolved": "", - "link": true - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -537,16 +517,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.53.3", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", @@ -875,30 +845,6 @@ "node": ">=0.4.0" } }, - "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -906,36 +852,6 @@ "dev": true, "license": "MIT" }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/axios": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", - "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/bundle-require": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", @@ -978,35 +894,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", @@ -1034,20 +921,6 @@ "node": "^14.18.0 || >=16.10.0" } }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1066,26 +939,6 @@ } } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, "node_modules/esbuild": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.0.tgz", @@ -1133,36 +986,6 @@ "resolved": "example", "link": true }, - "node_modules/fallout-utility": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/fallout-utility/-/fallout-utility-2.5.0.tgz", - "integrity": "sha512-pjx5TgTFhgPxw+qwg5/to6OQ2n44xlE/KX6eLJexa+YUJ1r+xpIxLK3XPm1s3Alih9DAXQnH+pf8yrmXjsl5kA==", - "dependencies": { - "ansi-regex": "^5.0.1", - "kleur": "^4.1.5", - "prompt-sync": "^4.2.0", - "strip-ansi": "^6.0.1" - } - }, - "node_modules/fallout-utility/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/fallout-utility/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -1193,54 +1016,6 @@ "rollup": "^4.34.8" } }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1256,61 +1031,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/glob": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz", - "integrity": "sha512-U/rnDpXJGF414QQQZv5uVsabTVxMSwzS5CH0p3DRCIV6ownl4f7PzGnkGmvlum2wB+9RlJWJZ6ACU1INnBqiPA==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.7.0" - }, - "bin": { - "glob": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/jackspeak": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", - "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, "node_modules/joycon": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", @@ -1321,14 +1041,6 @@ "node": ">=10" } }, - "node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "engines": { - "node": ">=6" - } - }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", @@ -1359,15 +1071,6 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/lru-cache": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.1.tgz", - "integrity": "sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/magic-string": { "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", @@ -1378,49 +1081,6 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", - "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", - "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/mlly": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz", @@ -1463,31 +1123,6 @@ "node": ">=0.10.0" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.2.tgz", - "integrity": "sha512-qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg==", - "dev": true, - "dependencies": { - "lru-cache": "^9.1.1", - "minipass": "^5.0.0 || ^6.0.2" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/pathe": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", @@ -1581,38 +1216,6 @@ } } }, - "node_modules/prompt-sync": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz", - "integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==", - "dependencies": { - "strip-ansi": "^5.0.0" - } - }, - "node_modules/prompt-sync/node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "engines": { - "node": ">=6" - } - }, - "node_modules/prompt-sync/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -1637,24 +1240,6 @@ "node": ">=8" } }, - "node_modules/rimraf": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", - "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", - "dev": true, - "dependencies": { - "glob": "^10.2.5" - }, - "bin": { - "rimraf": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/rollup": { "version": "4.53.3", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", @@ -1697,39 +1282,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", - "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/source-map": { "version": "0.7.6", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", @@ -1740,101 +1292,9 @@ "node": ">= 12" } }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", - "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } + "node_modules/srcbin.js": { + "resolved": "", + "link": true }, "node_modules/sucrase": { "version": "3.35.1", @@ -1995,112 +1455,6 @@ "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", "dev": true, "license": "MIT" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } } } } diff --git a/package.json b/package.json index 7355c40..c81da47 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "type": "module", "types": "./dist/index.d.ts", "main": "./dist/index.cjs", - "module": "./dist/index.mjs", + "module": "./dist/index.js", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.mjs", + "import": "./dist/index.js", "require": "./dist/index.cjs" } }, @@ -27,9 +27,7 @@ "build": "tsup" }, "dependencies": { - "@discordjs/collection": "^1.5.1", - "axios": "^1.4.0", - "fallout-utility": "^2.5.0" + "@discordjs/collection": "^2.1.1" }, "devDependencies": { "tsup": "^8.5.1", diff --git a/src/classes/Bin.ts b/src/classes/Bin.ts new file mode 100644 index 0000000..ed1c511 --- /dev/null +++ b/src/classes/Bin.ts @@ -0,0 +1,47 @@ +import type { APIResponse } from '../structures/APIResponse.js'; +import { BinFile } from './BinFile.js'; +import type { Client } from './Client.js'; +import type { REST } from './REST.js'; + +export class Bin implements APIResponse.GetBin { + public _id!: string; + public hits!: number; + public key!: string; + public title?: string; + public description?: string; + public files: BinFile[] = []; + public created!: string; + + get createdAt() { + return new Date(this.created); + } + + constructor(public readonly client: Client, data: APIResponse.GetBin) { + this._patch(data); + } + + public async fetch(options?: REST['options']): Promise { + const data = this.client.rest.getBin(this.key, options); + return data.then(bin => this._patch(bin)); + } + + public async fetchFiles(options?: REST['options'] & { force?: boolean; }): Promise { + await Promise.all(this.files.map(file => file.fetch(options))); + return this; + } + + public async delete(options?: REST['options']): Promise { + return this.client.rest.deleteBin(this.key, options); + } + + private _patch(data: APIResponse.GetBin): this { + Object.assign(this, data); + + this.files = this.files.map(file => new BinFile(this, file)); + return this; + } + + public static _patch(bin: Bin, data: APIResponse.GetBin): Bin { + return bin._patch(data); + } +} \ No newline at end of file diff --git a/src/classes/BinFile.ts b/src/classes/BinFile.ts new file mode 100644 index 0000000..1ab22d3 --- /dev/null +++ b/src/classes/BinFile.ts @@ -0,0 +1,38 @@ +import { LanguageType } from '../helpers/constants.js'; +import type { APIOptions } from '../structures/APIOptions.js'; +import type { APIResponse } from '../structures/APIResponse.js'; +import type { Bin } from './Bin.js'; +import type { REST } from './REST.js'; + +export class BinFile implements APIResponse.GetBinFile { + public name?: string; + public languageId!: APIResponse.GetBinFile['languageId']; + public content: string|null = null; + + public language() { + return typeof this.languageId === 'number' ? LanguageType[this.languageId] : this.languageId; + } + + constructor(public readonly bin: Bin, data: APIResponse.GetBinFile) { + Object.assign(this, data); + } + + public async fetch(options?: REST['options'] & { force?: boolean; }): Promise { + if (options?.force != true && this.content !== null) { + return this.content; + } + + return this.bin.client.rest.getBinContent(this.bin.key, options); + } + + public toJSON(full?: false): APIResponse.GetBinFile + public toJSON(full?: true): APIOptions.BinFile + public toJSON(full?: boolean): APIResponse.GetBinFile|APIOptions.BinFile + public toJSON(full: boolean = false): APIResponse.GetBinFile|APIOptions.BinFile { + return { + name: this.name, + languageId: this.languageId, + ...(full ? { content: this.content || '' } : {}) + }; + } +} \ No newline at end of file diff --git a/src/classes/Client.ts b/src/classes/Client.ts new file mode 100644 index 0000000..443c3d0 --- /dev/null +++ b/src/classes/Client.ts @@ -0,0 +1,67 @@ +import { Collection } from '@discordjs/collection'; +import { REST } from './REST.js'; +import { Bin } from './Bin.js'; +import type { APIResponse } from '../structures/APIResponse.js'; +import type { APIOptions } from '../structures/APIOptions.js'; + +export class Client { + public rest: REST; + public cache: Collection|null; + public user: APIResponse.GetUser|null = null; + + public autoFetchFiles: boolean; + + constructor(options?: Client.Options) { + this.rest = new REST(options); + this.cache = options?.cache === true ? new Collection() : options?.cache || null; + this.autoFetchFiles = options?.autoFetchFiles ?? false; + } + + public async getUser(options?: REST.Options['options'] & { force?: boolean; }): Promise { + if (options?.force != true && this.user) { + return this.user; + } + + return this.rest.getUser(options); + } + + public async createBin(bin: APIOptions.Bin, options?: REST.Options['options'] & { autoFetchFiles?: boolean; }): Promise { + const data = await this.rest.createBin(bin, options); + + return this.getBin(data.key, options); + } + + public async getUserBins(options?: REST.Options['options'] & { autoFetchFiles?: boolean; }): Promise { + return Promise.all((await this.rest.getUserBins(options)).map(bin => this._resolveBin(bin, options))); + } + + public async getBin(key: string, options?: REST.Options['options'] & { force?: boolean; autoFetchFiles?: boolean; }): Promise { + let bin = this.cache?.get(key); + if (bin && options?.force !== true) return bin; + + return this._resolveBin(await this.rest.getBin(key, options), options); + } + + private async _resolveBin(data: APIResponse.GetBin, options?: REST.Options['options'] & { autoFetchFiles?: boolean; }): Promise { + let bin: Bin = this.cache?.get(data.key) ?? new Bin(this, data); + + Bin._patch(bin, data); + Reflect.set(bin, 'client', this); + + if (this.autoFetchFiles ?? this.autoFetchFiles) { + await Promise.all(bin.files.map(f => f.fetch(options))); + } + + if (this.cache) this.cache.set(data.key, bin); + + return bin; + } + +} + +export namespace Client { + export interface Options extends REST.Options { + cache?: boolean|Collection; + autoFetchFiles?: boolean; + } +} \ No newline at end of file diff --git a/src/classes/REST.ts b/src/classes/REST.ts new file mode 100644 index 0000000..a05ea01 --- /dev/null +++ b/src/classes/REST.ts @@ -0,0 +1,122 @@ +import type { APIOptions } from '../structures/APIOptions.js'; +import type { APIResponse } from '../structures/APIResponse.js'; + +export class REST implements REST.Options { + public accessToken?: string; + public base: string; + public fetch: REST.Fetch; + public options: Omit; + + constructor(options?: REST.Options) { + this.accessToken = options?.accessToken; + this.base = options?.base ?? 'https://sourceb.in'; + this.fetch = options?.fetch ?? fetch; + this.options = options?.options ?? {}; + } + + public async getUser(options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/user`, + this.mergeOptions(this.options, options, { + headers: { + 'Accept': 'application/json', + }, + method: 'GET', + }) + ); + + return response.json(); + } + + public async getUserBins(options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/user/bins`, + this.mergeOptions(this.options, options, { + headers: { + 'Accept': 'application/json', + }, + method: 'GET', + }) + ); + + return response.json(); + } + + public async getBin(key: string, options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/bins/${key}`, + this.mergeOptions(this.options, options, { + headers: { + 'Accept': 'application/json', + }, + method: 'GET', + }) + ); + + return response.json(); + } + + public async deleteBin(key: string, options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/bins/${key}`, + this.mergeOptions(this.options, options, { + headers: { + 'Accept': 'application/json', + }, + method: 'DELETE', + }) + ); + + return response.json(); + } + + public async createBin(bin: APIOptions.Bin, options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/bins`, + this.mergeOptions(this.options, options, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + body: JSON.stringify(bin), + }) + ); + + return response.json(); + } + + public async getBinContent(key: string, options?: REST.Options['options']): Promise { + const response = await this.fetch( + `${this.base}/api/bins/${key}/content`, + this.mergeOptions(this.options, options, { + headers: { + 'Accept': 'plain/text', + }, + method: 'GET', + }) + ); + + return response.text(); + } + + private mergeOptions(...options: (RequestInit|undefined)[]): RequestInit { + const opts = { ...options.reduce((a, b) => ({ ...a, ...b }), {}) }; + + opts.headers = new Headers(opts.headers); + opts.headers.set('Cookie', `access_token=${this.accessToken};${opts.headers?.get('Cookie') ?? ''}`); + + return opts; + } +} + +export namespace REST { + export interface Options { + accessToken?: string; + base?: string; + fetch?: Fetch; + options?: Omit; + } + + export type Fetch = (url: RequestInfo|URL, init?: RequestInit) => Promise; +} \ No newline at end of file diff --git a/src/helpers/constants.ts b/src/helpers/constants.ts new file mode 100644 index 0000000..a4947db --- /dev/null +++ b/src/helpers/constants.ts @@ -0,0 +1,551 @@ +export enum LanguageType { + "1C Enterprise"=0, + "4D"=577529595, + "ABAP"=1, + "ABNF"=429, + "AGS Script"=2, + "AMPL"=3, + "ANTLR"=4, + "API Blueprint"=5, + "APL"=6, + "ASN.1"=7, + "ASP"=8, + "ATS"=9, + "ActionScript"=10, + "Ada"=11, + "Adobe Font Metrics"=147198098, + "Agda"=12, + "Alloy"=13, + "Alpine Abuild"=14, + "Altium Designer"=187772328, + "AngelScript"=389477596, + "Ant Build System"=15, + "ApacheConf"=16, + "Apex"=17, + "Apollo Guidance Computer"=18, + "AppleScript"=19, + "Arc"=20, + "AsciiDoc"=22, + "AspectJ"=23, + "Assembly"=24, + "Asymptote"=591605007, + "Augeas"=25, + "AutoHotkey"=26, + "AutoIt"=27, + "Awk"=28, + "Ballerina"=720859680, + "Batchfile"=29, + "Befunge"=30, + "BibTeX"=982188347, + "Bison"=31, + "BitBake"=32, + "Blade"=33, + "BlitzBasic"=34, + "BlitzMax"=35, + "Bluespec"=36, + "Boo"=37, + "Brainfuck"=38, + "Brightscript"=39, + "C"=41, + "C#"=42, + "C++"=43, + "C-ObjDump"=44, + "C2hs Haskell"=45, + "CLIPS"=46, + "CMake"=47, + "COBOL"=48, + "COLLADA"=49, + "CSON"=424, + "CSS"=50, + "CSV"=51, + "CWeb"=657332628, + "Cabal Config"=677095381, + "Cap'n Proto"=52, + "CartoCSS"=53, + "Ceylon"=54, + "Chapel"=55, + "Charity"=56, + "ChucK"=57, + "Cirru"=58, + "Clarion"=59, + "Clean"=60, + "Click"=61, + "Clojure"=62, + "Closure Templates"=357046146, + "Cloud Firestore Security Rules"=407996372, + "CoNLL-U"=421026389, + "CoffeeScript"=63, + "ColdFusion"=64, + "ColdFusion CFC"=65, + "Common Lisp"=66, + "Common Workflow Language"=988547172, + "Component Pascal"=67, + "Cool"=68, + "Coq"=69, + "Cpp-ObjDump"=70, + "Creole"=71, + "Crystal"=72, + "Csound"=73, + "Csound Document"=74, + "Csound Score"=75, + "Cuda"=77, + "Cycript"=78, + "Cython"=79, + "D"=80, + "D-ObjDump"=81, + "DIGITAL Command Language"=82, + "DM"=83, + "DNS Zone"=84, + "DTrace"=85, + "Darcs Patch"=86, + "Dart"=87, + "DataWeave"=974514097, + "Dhall"=793969321, + "Diff"=88, + "DirectX 3D File"=201049282, + "Dockerfile"=89, + "Dogescript"=90, + "Dylan"=91, + "E"=92, + "EBNF"=430, + "ECL"=93, + "ECLiPSe"=94, + "EJS"=95, + "EML"=529653389, + "EQ"=96, + "Eagle"=97, + "Easybuild"=342840477, + "Ecere Projects"=98, + "EditorConfig"=96139566, + "Edje Data Collection"=342840478, + "Eiffel"=99, + "Elixir"=100, + "Elm"=101, + "Emacs Lisp"=102, + "EmberScript"=103, + "Erlang"=104, + "F#"=105, + "F*"=336943375, + "FIGlet Font"=686129783, + "FLUX"=106, + "Factor"=108, + "Fancy"=109, + "Fantom"=110, + "Faust"=622529198, + "Filebench WML"=111, + "Filterscript"=112, + "Formatted"=113, + "Forth"=114, + "Fortran"=107, + "FreeMarker"=115, + "Frege"=116, + "G-code"=117, + "GAML"=290345951, + "GAMS"=118, + "GAP"=119, + "GCC Machine Description"=121, + "GDB"=122, + "GDScript"=123, + "GLSL"=124, + "GN"=302957008, + "Game Maker Language"=125, + "Genie"=792408528, + "Genshi"=126, + "Gentoo Ebuild"=127, + "Gentoo Eclass"=128, + "Gerber Image"=404627610, + "Gettext Catalog"=129, + "Gherkin"=76, + "Git Attributes"=956324166, + "Git Config"=807968997, + "Glyph"=130, + "Glyph Bitmap Distribution Format"=997665271, + "Gnuplot"=131, + "Go"=132, + "Golo"=133, + "Gosu"=134, + "Grace"=135, + "Gradle"=136, + "Grammatical Framework"=137, + "Graph Modeling Language"=138, + "GraphQL"=139, + "Graphviz (DOT)"=140, + "Groovy"=142, + "Groovy Server Pages"=143, + "HAProxy"=366607477, + "HCL"=144, + "HLSL"=145, + "HTML"=146, + "HTML+Django"=147, + "HTML+ECR"=148, + "HTML+EEX"=149, + "HTML+ERB"=150, + "HTML+PHP"=151, + "HTML+Razor"=479039817, + "HTTP"=152, + "HXML"=786683730, + "Hack"=153, + "Haml"=154, + "Handlebars"=155, + "Harbour"=156, + "Haskell"=157, + "Haxe"=158, + "HiveQL"=931814087, + "HolyC"=928121743, + "Hy"=159, + "HyPhy"=160, + "IDL"=161, + "IGOR Pro"=162, + "INI"=163, + "IRC log"=164, + "Idris"=165, + "Ignore List"=74444240, + "Inform 7"=166, + "Inno Setup"=167, + "Io"=168, + "Ioke"=169, + "Isabelle"=170, + "Isabelle ROOT"=171, + "J"=172, + "JFlex"=173, + "JSON"=174, + "JSON with Comments"=423, + "JSON5"=175, + "JSONLD"=176, + "JSONiq"=177, + "JSX"=178, + "Jasmin"=180, + "Java"=181, + "Java Properties"=519377561, + "Java Server Pages"=182, + "JavaScript"=183, + "JavaScript+ERB"=914318960, + "Jison"=284531423, + "Jison Lex"=406395330, + "Jolie"=998078858, + "Jsonnet"=664885656, + "Julia"=184, + "Jupyter Notebook"=185, + "KRL"=186, + "KiCad Layout"=187, + "KiCad Legacy Layout"=140848857, + "KiCad Schematic"=622447435, + "Kit"=188, + "Kotlin"=189, + "LFE"=190, + "LLVM"=191, + "LOLCODE"=192, + "LSL"=193, + "LTspice Symbol"=1013566805, + "LabVIEW"=194, + "Lasso"=195, + "Latte"=196, + "Lean"=197, + "Less"=198, + "Lex"=199, + "LilyPond"=200, + "Limbo"=201, + "Linker Script"=202, + "Linux Kernel Module"=203, + "Liquid"=204, + "Literate Agda"=205, + "Literate CoffeeScript"=206, + "Literate Haskell"=207, + "LiveScript"=208, + "Logos"=209, + "Logtalk"=210, + "LookML"=211, + "LoomScript"=212, + "Lua"=213, + "M"=214, + "M4"=215, + "M4Sugar"=216, + "MATLAB"=225, + "MAXScript"=217, + "MLIR"=448253929, + "MQL4"=426, + "MQL5"=427, + "MTML"=218, + "MUF"=219, + "Makefile"=220, + "Mako"=221, + "Markdown"=222, + "Marko"=932782397, + "Mask"=223, + "Mathematica"=224, + "Maven POM"=226, + "Max"=227, + "MediaWiki"=228, + "Mercury"=229, + "Meson"=799141244, + "Metal"=230, + "Microsoft Developer Studio Project"=800983837, + "MiniD"=231, + "Mirah"=232, + "Modelica"=233, + "Modula-2"=234, + "Modula-3"=564743864, + "Module Management System"=235, + "Monkey"=236, + "Moocode"=237, + "MoonScript"=238, + "Motorola 68K Assembly"=477582706, + "Muse"=474864066, + "Myghty"=239, + "NCL"=240, + "NL"=241, + "NPM Config"=685022663, + "NSIS"=242, + "Nearley"=521429430, + "Nemerle"=243, + "NetLinx"=244, + "NetLinx+ERB"=245, + "NetLogo"=246, + "NewLisp"=247, + "Nextflow"=506780613, + "Nginx"=248, + "Nim"=249, + "Ninja"=250, + "Nit"=251, + "Nix"=252, + "Nu"=253, + "NumPy"=254, + "OCaml"=255, + "ObjDump"=256, + "Object Data Instance Notation"=985227236, + "ObjectScript"=202735509, + "Objective-C"=257, + "Objective-C++"=258, + "Objective-J"=259, + "Odin"=889244082, + "Omgrofl"=260, + "Opa"=261, + "Opal"=262, + "Open Policy Agent"=840483232, + "OpenCL"=263, + "OpenEdge ABL"=264, + "OpenRC runscript"=265, + "OpenSCAD"=266, + "OpenStep Property List"=598917541, + "OpenType Feature File"=374317347, + "Org"=267, + "Ox"=268, + "Oxygene"=269, + "Oz"=270, + "P4"=348895984, + "PHP"=272, + "PLSQL"=273, + "PLpgSQL"=274, + "POV-Ray SDL"=275, + "Pan"=276, + "Papyrus"=277, + "Parrot"=278, + "Parrot Assembly"=279, + "Parrot Internal Representation"=280, + "Pascal"=281, + "Pawn"=271, + "Pep8"=840372442, + "Perl"=282, + "Pic"=425, + "Pickle"=284, + "PicoLisp"=285, + "PigLatin"=286, + "Pike"=287, + "Pod"=288, + "Pod 6"=155357471, + "PogoScript"=289, + "Pony"=290, + "PostCSS"=262764437, + "PostScript"=291, + "PowerBuilder"=292, + "PowerShell"=293, + "Prisma"=499933428, + "Processing"=294, + "Proguard"=716513858, + "Prolog"=295, + "Propeller Spin"=296, + "Protocol Buffer"=297, + "Public Key"=298, + "Pug"=179, + "Puppet"=299, + "Pure Data"=300, + "PureBasic"=301, + "PureScript"=302, + "Python"=303, + "Python console"=428, + "Python traceback"=304, + "QML"=305, + "QMake"=306, + "Quake"=375265331, + "R"=307, + "RAML"=308, + "RDoc"=309, + "REALbasic"=310, + "REXX"=311, + "RHTML"=312, + "RMarkdown"=313, + "RPC"=1031374237, + "RPM Spec"=314, + "RUNOFF"=315, + "Racket"=316, + "Ragel"=317, + "Raku"=283, + "Rascal"=173616037, + "Raw token data"=318, + "Readline Config"=538732839, + "Reason"=869538413, + "Rebol"=319, + "Red"=320, + "Redcode"=321, + "Regular Expression"=363378884, + "Ren'Py"=322, + "RenderScript"=323, + "Rich Text Format"=51601661, + "Ring"=431, + "Riot"=878396783, + "RobotFramework"=324, + "Roff"=141, + "Roff Manpage"=612669833, + "Rouge"=325, + "Ruby"=326, + "Rust"=327, + "SAS"=328, + "SCSS"=329, + "SMT"=330, + "SPARQL"=331, + "SQF"=332, + "SQL"=333, + "SQLPL"=334, + "SRecode Template"=335, + "SSH Config"=554920715, + "STON"=336, + "SVG"=337, + "SWIG"=1066250075, + "Sage"=338, + "SaltStack"=339, + "Sass"=340, + "Scala"=341, + "Scaml"=342, + "Scheme"=343, + "Scilab"=344, + "Self"=345, + "ShaderLab"=664257356, + "Shell"=346, + "ShellSession"=347, + "Shen"=348, + "Slash"=349, + "Slice"=894641667, + "Slim"=350, + "SmPL"=164123055, + "Smali"=351, + "Smalltalk"=352, + "Smarty"=353, + "Solidity"=237469032, + "SourcePawn"=354, + "Spline Font Database"=767169629, + "Squirrel"=355, + "Stan"=356, + "Standard ML"=357, + "Starlark"=960266174, + "Stata"=358, + "Stylus"=359, + "SubRip Text"=360, + "SugarSS"=826404698, + "SuperCollider"=361, + "Svelte"=928734530, + "Swift"=362, + "SystemVerilog"=363, + "TI Program"=422, + "TLA"=364, + "TOML"=365, + "TSQL"=918334941, + "TSX"=94901924, + "TXL"=366, + "Tcl"=367, + "Tcsh"=368, + "TeX"=369, + "Tea"=370, + "Terra"=371, + "Texinfo"=988020015, + "Text"=372, + "Textile"=373, + "Thrift"=374, + "Turing"=375, + "Turtle"=376, + "Twig"=377, + "Type Language"=632765617, + "TypeScript"=378, + "Unified Parallel C"=379, + "Unity3D Asset"=380, + "Unix Assembly"=120, + "Uno"=381, + "UnrealScript"=382, + "UrWeb"=383, + "V"=603371597, + "VBA"=399230729, + "VBScript"=408016005, + "VCL"=384, + "VHDL"=385, + "Vala"=386, + "Verilog"=387, + "Vim Snippet"=81265970, + "Vim script"=388, + "Visual Basic .NET"=389, + "Volt"=390, + "Vue"=391, + "Wavefront Material"=392, + "Wavefront Object"=393, + "Web Ontology Language"=394, + "WebAssembly"=956556503, + "WebIDL"=395, + "WebVTT"=658679714, + "Wget Config"=668457123, + "Windows Registry Entries"=969674868, + "Wollok"=632745969, + "World of Warcraft Addon Data"=396, + "X BitMap"=782911107, + "X Font Directory Index"=208700028, + "X PixMap"=781846279, + "X10"=397, + "XC"=398, + "XCompose"=225167241, + "XML"=399, + "XML Property List"=75622871, + "XPages"=400, + "XProc"=401, + "XQuery"=402, + "XS"=403, + "XSLT"=404, + "Xojo"=405, + "Xtend"=406, + "YAML"=407, + "YANG"=408, + "YARA"=805122868, + "YASnippet"=378760102, + "Yacc"=409, + "ZAP"=952972794, + "ZIL"=973483626, + "Zeek"=40, + "ZenScript"=494938890, + "Zephir"=410, + "Zig"=646424281, + "Zimpl"=411, + "cURL Config"=992375436, + "desktop"=412, + "dircolors"=691605112, + "eC"=413, + "edn"=414, + "fish"=415, + "mIRC Script"=517654727, + "mcfunction"=462488745, + "mupad"=416, + "nanorc"=775996197, + "nesC"=417, + "ooc"=418, + "q"=970539067, + "reStructuredText"=419, + "sed"=847830017, + "wdl"=374521672, + "wisp"=420, + "xBase"=421 +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e69de29..ffc5927 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1,11 @@ +import { Client } from './classes/Client.js'; + +export * from './classes/Bin.js'; +export * from './classes/BinFile.js'; +export * from './classes/Client.js'; +export * from './classes/REST.js'; +export * from './helpers/constants.js'; +export * from './structures/APIResponse.js'; +export * from './structures/APIOptions.js'; + +export const srcbin = new Client(); \ No newline at end of file diff --git a/src/structures/APIOptions.ts b/src/structures/APIOptions.ts new file mode 100644 index 0000000..f42587d --- /dev/null +++ b/src/structures/APIOptions.ts @@ -0,0 +1,15 @@ +import type { LanguageType } from '../helpers/constants.js'; + +export namespace APIOptions { + export interface Bin { + title?: string; + description?: string; + files: BinFile[]; + } + + export interface BinFile { + name?: string; + content: string; + languageId?: LanguageType|number; + } +} \ No newline at end of file diff --git a/src/structures/APIResponse.ts b/src/structures/APIResponse.ts new file mode 100644 index 0000000..4ab15af --- /dev/null +++ b/src/structures/APIResponse.ts @@ -0,0 +1,43 @@ +import type { LanguageType } from '../helpers/constants.js'; + +export namespace APIResponse { + export interface CreateBin { + key: string; + languages: LanguageType[]; + } + + export interface GetBin { + _id: string; + hits: number; + key: string; + title?: string; + description?: string; + files: GetBinFile[]; + created: string; + } + + export interface GetBinFile { + name?: string; + languageId: LanguageType|number; + } + + export interface DeleteBin { + success: boolean; + } + + export interface GetUser { + username: string; + about: { + avatarURL?: string; + bio?: string; + website?: string; + location?: string; + }; + oauth: { + discord?: string; + github?: string; + }; + plan: string; + createdAt: string; + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 665e6b1..53c94c8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "include": ["./src/**/*"], - "exclude": ["./tsup.config.ts"], + "exclude": ["tsup.config.ts"], "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -8,6 +8,7 @@ "module": "NodeNext", "moduleResolution": "NodeNext", "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, "declaration": true, "esModuleInterop": true, "skipLibCheck": true, diff --git a/tsup.config.ts b/tsup.config.ts index 1e1b320..c1d89b6 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -4,7 +4,7 @@ export default defineConfig({ entry: ['src/index.ts'], external: [], noExternal: [], - platform: 'node', + platform: 'browser', format: ['esm', 'cjs'], skipNodeModulesBundle: true, target: 'esnext',