keryx 0.31.0 → 0.32.0

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/classes/API.ts CHANGED
@@ -26,7 +26,7 @@ export enum RUN_MODE {
26
26
  export class API {
27
27
  /** The root directory of the user's application. Set this before calling `initialize()`. */
28
28
  rootDir: string;
29
- /** The root directory of the keryx package itself (auto-resolved from `import.meta.filename`). */
29
+ /** The root directory of the keryx package itself (auto-resolved from `import.meta.path`). */
30
30
  packageDir: string;
31
31
  /** Whether `initialize()` has completed successfully. */
32
32
  initialized: boolean;
@@ -50,7 +50,7 @@ export class API {
50
50
 
51
51
  constructor() {
52
52
  this.bootTime = new Date().getTime();
53
- this.packageDir = path.join(import.meta.filename, "..", "..");
53
+ this.packageDir = path.join(import.meta.path, "..", "..");
54
54
  this.rootDir = this.packageDir;
55
55
  this.logger = new Logger(config.logger);
56
56
 
@@ -10,7 +10,7 @@ import { globLoader } from "../util/glob";
10
10
 
11
11
  const namespace = "channels";
12
12
  const PRESENCE_KEY_PREFIX = "presence:";
13
- const LUA_DIR = join(import.meta.dirname, "..", "lua");
13
+ const LUA_DIR = join(import.meta.dir, "..", "lua");
14
14
 
15
15
  const ADD_PRESENCE_LUA = await Bun.file(
16
16
  join(LUA_DIR, "add-presence.lua"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keryx",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "start": "bun keryx.ts start",
78
78
  "dev": "bun --watch keryx.ts start",
79
79
  "migrations": "bun run migrations.ts",
80
- "test": "tsc && bunx --bun vitest run",
80
+ "test": "tsc && bun test",
81
81
  "compile": "bun build keryx.ts --compile --outfile keryx",
82
82
  "lint": "tsc && biome check .",
83
83
  "format": "tsc && biome check --write .",
@@ -100,18 +100,11 @@
100
100
  "peerDependencies": {
101
101
  "drizzle-orm": "^0.45.2",
102
102
  "drizzle-zod": "^0.8.3",
103
- "vitest": "^4.1.9",
104
103
  "zod": "^4.3.6"
105
104
  },
106
- "peerDependenciesMeta": {
107
- "vitest": {
108
- "optional": true
109
- }
110
- },
111
105
  "devDependencies": {
112
106
  "@types/bun": "^1.3.12",
113
107
  "drizzle-kit": "^0.31.10",
114
- "drizzle-zod": "^0.8.3",
115
- "vitest": "^4.1.9"
108
+ "drizzle-zod": "^0.8.3"
116
109
  }
117
110
  }
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, test } from "vitest";
1
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2
2
  import { api } from "keryx";
3
3
 
4
4
  beforeAll(async () => {
@@ -4,7 +4,7 @@ import { api } from "keryx";
4
4
  // actions, initializers, channels, etc. from this directory.
5
5
  // Every entry point (keryx.ts, migrations.ts, test setup) should
6
6
  // `import "./index"` to ensure rootDir is set before anything runs.
7
- api.rootDir = import.meta.dirname;
7
+ api.rootDir = import.meta.dir;
8
8
 
9
9
  // Re-export everything from keryx for convenience
10
10
  export * from "keryx";
package/testing/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll } from "vitest";
1
+ import { afterAll, beforeAll } from "bun:test";
2
2
  import { api } from "../api";
3
3
  import type { WebServer } from "../servers/web";
4
4
 
@@ -1,4 +1,4 @@
1
- import { expect } from "vitest";
1
+ import { expect } from "bun:test";
2
2
  import { api } from "../api";
3
3
  import type { WebServer } from "../servers/web";
4
4
 
@@ -24,13 +24,13 @@ export interface ComponentDef {
24
24
  }
25
25
 
26
26
  const generateTemplatesDir = path.join(
27
- import.meta.dirname,
27
+ import.meta.dir,
28
28
  "..",
29
29
  "templates",
30
30
  "generate",
31
31
  );
32
32
  const scaffoldTemplatesDir = path.join(
33
- import.meta.dirname,
33
+ import.meta.dir,
34
34
  "..",
35
35
  "templates",
36
36
  "scaffold",
@@ -20,7 +20,7 @@ export type OAuthTemplates = {
20
20
  lionSvg: string;
21
21
  };
22
22
 
23
- const frameworkTemplatesDir = import.meta.dirname + "/../templates";
23
+ const frameworkTemplatesDir = import.meta.dir + "/../templates";
24
24
 
25
25
  /**
26
26
  * Resolve a template file, checking the user's rootDir first, then falling back
package/util/scaffold.ts CHANGED
@@ -66,7 +66,7 @@ export async function generateOAuthTemplateContents(): Promise<
66
66
  "oauth-common.css",
67
67
  "lion.svg",
68
68
  ];
69
- const sourceDir = path.join(import.meta.dirname, "..", "templates");
69
+ const sourceDir = path.join(import.meta.dir, "..", "templates");
70
70
 
71
71
  for (const file of oauthTemplates) {
72
72
  const content = await Bun.file(path.join(sourceDir, file)).text();
@@ -85,7 +85,7 @@ export async function generateConfigFileContents(): Promise<
85
85
  Map<string, string>
86
86
  > {
87
87
  const result = new Map<string, string>();
88
- const configDir = path.join(import.meta.dirname, "..", "config");
88
+ const configDir = path.join(import.meta.dir, "..", "config");
89
89
  const glob = new Glob("**/*.ts");
90
90
 
91
91
  for await (const file of glob.scan(configDir)) {
@@ -140,7 +140,7 @@ export async function generateBuiltinActionContents(): Promise<
140
140
  > {
141
141
  const result = new Map<string, string>();
142
142
  const builtinActions = ["status.ts", "swagger.ts"];
143
- const actionsDir = path.join(import.meta.dirname, "..", "actions");
143
+ const actionsDir = path.join(import.meta.dir, "..", "actions");
144
144
 
145
145
  for (const file of builtinActions) {
146
146
  let content = await Bun.file(path.join(actionsDir, file)).text();
@@ -318,7 +318,6 @@ export async function scaffoldProject(
318
318
  start: "bun keryx.ts start",
319
319
  dev: "bun --watch keryx.ts start",
320
320
  ...(options.includeDb ? { migrations: "bun run migrations.ts" } : {}),
321
- test: "tsc && bunx --bun vitest run",
322
321
  lint: "tsc && biome check .",
323
322
  format: "tsc && biome check --write .",
324
323
  },
@@ -335,7 +334,6 @@ export async function scaffoldProject(
335
334
  devDependencies: {
336
335
  "@biomejs/biome": "^2.4.8",
337
336
  "@types/bun": "latest",
338
- vitest: "^4.1.9",
339
337
  ...(options.includeDb ? { "drizzle-kit": "^0.20.18" } : {}),
340
338
  },
341
339
  },
@@ -345,7 +343,6 @@ export async function scaffoldProject(
345
343
  );
346
344
 
347
345
  await write("tsconfig.json", generateTsconfigContents());
348
- await writeTemplate("vitest.config.ts", "vitest.config.ts.mustache");
349
346
  await write(
350
347
  "biome.json",
351
348
  JSON.stringify(
@@ -1,18 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- include: ["__tests__/**/*.test.ts"],
6
- globals: false,
7
- // Run on the Bun runtime via `bunx --bun vitest`. The forks pool keeps
8
- // Node/Bun process APIs available; file parallelism is disabled so test
9
- // files that boot the server don't race on the shared database/Redis.
10
- pool: "forks",
11
- fileParallelism: false,
12
- testTimeout: 15_000,
13
- hookTimeout: 60_000,
14
- // zod (and other CJS deps consumed via named imports) must be transformed
15
- // by Vite so the named-export interop works under the Bun runtime.
16
- server: { deps: { inline: ["zod"] } },
17
- },
18
- });