bakit 2.0.0-alpha.32 → 2.0.0-alpha.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,55 +1,62 @@
1
1
  {
2
- "name": "bakit",
3
- "version": "2.0.0-alpha.32",
4
- "description": "A framework for discord.js",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "import": "./dist/index.js",
9
- "types": "./dist/index.d.ts"
10
- },
11
- "./register": "./dist/register.js"
12
- },
13
- "scripts": {
14
- "build": "tsup",
15
- "type-check": "tsc --noEmit",
16
- "test": "vitest run --pass-with-no-tests"
17
- },
18
- "bin": {
19
- "bakit": "./dist/cli.js"
20
- },
21
- "files": [
22
- "dist"
23
- ],
24
- "homepage": "https://github.com/louiszn/bakit#readme",
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/louiszn/bakit.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/louiszn/bakit/issues"
31
- },
32
- "keywords": [
33
- "discord.js",
34
- "discord-bot",
35
- "bakit",
36
- "framework"
37
- ],
38
- "author": "louiszn",
39
- "license": "MIT",
40
- "packageManager": "pnpm@10.15.0",
41
- "peerDependencies": {
42
- "discord.js": "^14.0.0"
43
- },
44
- "optionalDependencies": {
45
- "esbuild": "^0.27.0"
46
- },
47
- "dependencies": {
48
- "chokidar": "^5.0.0",
49
- "commander": "^14.0.2",
50
- "dotenv": "^17.2.1",
51
- "tiny-glob": "^0.2.9",
52
- "type-fest": "^4.41.0",
53
- "zod": "^4.1.12"
54
- }
55
- }
2
+ "name": "bakit",
3
+ "version": "2.0.0-alpha.33",
4
+ "description": "A framework for discordeno",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "types": "./dist/index.d.ts"
10
+ }
11
+ },
12
+ "bin": {
13
+ "bakit": "./dist/cli.js"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "homepage": "https://github.com/louiszn/bakit#readme",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/louiszn/bakit.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/louiszn/bakit/issues"
25
+ },
26
+ "keywords": [
27
+ "discord-bot",
28
+ "bakit",
29
+ "framework"
30
+ ],
31
+ "author": "louiszn",
32
+ "license": "MIT",
33
+ "peerDependencies": {
34
+ "@discordeno/bot": "^21.0.0",
35
+ "@discordeno/rest": "^21.0.0"
36
+ },
37
+ "optionalDependencies": {
38
+ "esbuild": "^0.27.0"
39
+ },
40
+ "dependencies": {
41
+ "@discordeno/gateway": "^21.0.0",
42
+ "@discordeno/types": "^21.0.0",
43
+ "@discordeno/utils": "^21.0.0",
44
+ "@fastify/formbody": "^8.0.2",
45
+ "chokidar": "^5.0.0",
46
+ "commander": "^14.0.2",
47
+ "dotenv": "^17.2.1",
48
+ "fastify": "^5.6.2",
49
+ "qs": "^6.14.0",
50
+ "tiny-glob": "^0.2.9",
51
+ "type-fest": "^4.41.0",
52
+ "zod": "^4.1.12"
53
+ },
54
+ "devDependencies": {
55
+ "@types/qs": "^6.14.0"
56
+ },
57
+ "scripts": {
58
+ "build": "tsup",
59
+ "type-check": "tsc --noEmit",
60
+ "test": "vitest run --pass-with-no-tests"
61
+ }
62
+ }
package/README.md DELETED
@@ -1,35 +0,0 @@
1
- # About us
2
-
3
- Bakit is a framework that makes building Discord bots easier.
4
- It's built on top of [discord.js](https://discord.js.org) and helps you handle the core system for your bot.
5
-
6
- <div align="center">
7
- <a href="https://npmjs.com/package/bakit"><img src="https://img.shields.io/npm/v/bakit?logo=npm" alt="npm" /></a>
8
- <a href="LICENSE"><img src="https://img.shields.io/github/license/louiszn/bakit" alt="License" /></a>
9
- <a href="https://discord.gg/pGnKbMfXke"><img src="https://img.shields.io/discord/1353321517437681724?logo=discord&logoColor=white" alt="Discord" /></a>
10
- </div>
11
-
12
- > [!CAUTION]
13
- > This package is currently being rewritten. Many features from beta v1 have not yet been migrated.
14
- > It is not production-ready, and use in production environments is strongly discouraged.
15
-
16
- ## Why Bakit?
17
-
18
- - 🧩 **Unified Command System** - write once for both slash and prefix command.
19
- - 🚀 **Clean API interfaces** - well-structured commands and events.
20
- - ⚡ **Lightweight** - minimal overhead, only what you need.
21
- - ✨ **TypeScript + ESM first** - modern JavaScript tooling out of the box.
22
-
23
- ## Documentation
24
-
25
- Official documentation is now at https://bakit.louiszn.xyz.
26
-
27
- # Contributing
28
-
29
- Contributions are always welcome! But before doing that, make sure you have already checked existing issues and pull requests before making a new one.
30
-
31
- # Support
32
-
33
- If you like Bakit and want to support its development, you can buy me a coffee:
34
-
35
- [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/louiszn)
package/dist/cli.js DELETED
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env node
2
- import { resolve, join } from 'path';
3
- import { existsSync } from 'fs';
4
- import { config } from 'dotenv';
5
- import { program } from 'commander';
6
- import { fork } from 'child_process';
7
- import chokidar from 'chokidar';
8
- import { loadConfig, RPC } from 'bakit';
9
-
10
- var DevProcessManager = class {
11
- constructor(options) {
12
- this.options = options;
13
- }
14
- rpc = null;
15
- restartTimer = null;
16
- start() {
17
- console.log("Starting bakit in dev mode..."), this.startChild(), this.startWatcher();
18
- }
19
- startChild() {
20
- if (this.rpc)
21
- return;
22
- let { entryFile } = this.options, child = fork(this.options.entryFile, {
23
- execArgv: ["--import", "bakit/register"],
24
- stdio: "inherit",
25
- env: {
26
- ...process.env,
27
- NODE_ENV: "development",
28
- BAKIT_ENTRY_FILE: entryFile
29
- }
30
- });
31
- this.rpc = new RPC(child), this.rpc.on("restart", (fileUpdated) => this.scheduleRestart(fileUpdated));
32
- }
33
- restartChild() {
34
- if (!this.rpc)
35
- return this.startChild();
36
- let child = this.rpc.transport;
37
- child.once("exit", () => {
38
- this.rpc = null, this.startChild();
39
- }), child.kill("SIGTERM");
40
- }
41
- startWatcher() {
42
- let { entryDirectory } = this.options, watcher = chokidar.watch(entryDirectory, {
43
- ignoreInitial: true,
44
- awaitWriteFinish: {
45
- stabilityThreshold: 200,
46
- pollInterval: 50
47
- }
48
- });
49
- watcher.on("change", (path) => this.onFileUpdate("fileChange", path)), watcher.on("unlink", (path) => this.onFileUpdate("fileRemove", path));
50
- }
51
- onFileUpdate(type, path) {
52
- try {
53
- this.rpc?.send(type, resolve(path));
54
- } catch {
55
- this.scheduleRestart(true);
56
- }
57
- }
58
- scheduleRestart(fileUpdated = false) {
59
- this.restartTimer && clearTimeout(this.restartTimer), this.restartTimer = setTimeout(() => {
60
- fileUpdated && console.log("File changes detected, restarting..."), this.restartChild(), this.restartTimer = null;
61
- }, 150);
62
- }
63
- };
64
- program.name("bakit");
65
- program.command("dev").action(async () => {
66
- config({ path: [".env.local", ".env"], quiet: true });
67
- let config$1 = await loadConfig(), entryDirectory = resolve(config$1.entryDirectory);
68
- new DevProcessManager({
69
- entryFile: getEntryFile(entryDirectory),
70
- entryDirectory
71
- }).start();
72
- });
73
- function getEntryFile(entryDirectory) {
74
- let index = join(entryDirectory, "index"), tsPath = index + ".ts";
75
- return existsSync(tsPath) ? tsPath : index + ".js";
76
- }
77
- program.parse();
package/dist/hooks.js DELETED
@@ -1,82 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { readFile } from 'fs/promises';
3
- import { Module } from 'module';
4
- import { dirname, resolve as resolve$1, basename } from 'path';
5
- import { fileURLToPath, pathToFileURL } from 'url';
6
- import { RPC } from 'bakit';
7
-
8
- // src/lib/loader/hooks.ts
9
- var EXTENSIONS = [".js", ".ts"], rpc, versions, esbuild;
10
- function isDevelopment() {
11
- return process.env.NODE_ENV === "development";
12
- }
13
- async function initialize({ port }) {
14
- rpc = new RPC(port), versions = /* @__PURE__ */ new Map(), rpc.on("unload", onUnload), isDevelopment() && (esbuild = await import('esbuild'));
15
- }
16
- async function resolve(specifier, context, nextResolve) {
17
- if (shouldSkip(specifier))
18
- return nextResolve(specifier, context);
19
- let url = specifier, parentURL = context.parentURL?.split("?")[0], baseDir = parentURL ? dirname(fileURLToPath(parentURL)) : process.cwd();
20
- if (specifier.startsWith(".")) {
21
- let absPath = resolve$1(baseDir, specifier);
22
- if (!existsSync(absPath) && absPath.endsWith(".js")) {
23
- let tsPath = absPath.slice(0, -3) + ".ts";
24
- existsSync(tsPath) && (absPath = tsPath);
25
- }
26
- url = pathToFileURL(absPath).href;
27
- }
28
- let urlObj = new URL(url);
29
- if (isDevelopment()) {
30
- let filePath = fileURLToPath(urlObj), version = createVersion(filePath);
31
- urlObj.searchParams.set("hmr", version), parentURL && rpc.send("dependencyAdd", {
32
- parentURL,
33
- url
34
- });
35
- }
36
- return {
37
- url: urlObj.href,
38
- shortCircuit: true,
39
- format: "module"
40
- };
41
- }
42
- async function load(url, context, nextLoad) {
43
- if (shouldSkip(url))
44
- return nextLoad(url, context);
45
- try {
46
- let cleanURL = url.split("?")[0], filePath = fileURLToPath(cleanURL ?? "");
47
- if (filePath.endsWith(".ts") && esbuild) {
48
- let raw = await readFile(filePath, "utf8");
49
- return {
50
- source: (await esbuild.transform(raw, {
51
- platform: "node",
52
- sourcefile: filePath,
53
- sourcemap: "inline",
54
- loader: "ts"
55
- })).code,
56
- format: "module",
57
- shortCircuit: !0
58
- };
59
- }
60
- } catch {
61
- }
62
- return nextLoad(url, context);
63
- }
64
- function createVersion(filename) {
65
- let version = versions.get(filename);
66
- return version || (version = Date.now().toString(), versions.set(filename, version)), version;
67
- }
68
- function shouldSkip(specifier) {
69
- if (Module.isBuiltin(specifier) || specifier.includes("/node_modules/"))
70
- return true;
71
- if (specifier.startsWith(".") || specifier.startsWith("file://")) {
72
- let filePath = specifier.startsWith("file://") ? fileURLToPath(specifier) : specifier, filename = basename(filePath);
73
- return !EXTENSIONS.some((ext) => filename.endsWith(ext));
74
- }
75
- return true;
76
- }
77
- function onUnload(id, path) {
78
- let deleted = versions.delete(resolve$1(path));
79
- rpc.success(id, deleted);
80
- }
81
-
82
- export { initialize, load, resolve };
package/dist/register.js DELETED
@@ -1,4 +0,0 @@
1
- import { Loader } from 'bakit';
2
-
3
- // src/lib/loader/register.ts
4
- Loader.init();