@b9g/platform-bun 0.1.13 → 0.1.15

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/README.md CHANGED
@@ -28,7 +28,7 @@ const platform = new BunPlatform({
28
28
 
29
29
  const server = platform.createServer(async (request) => {
30
30
  return new Response('Hello from Bun');
31
- }, { port: 3000, host: 'localhost' });
31
+ }, { port: 7777, host: 'localhost' });
32
32
 
33
33
  await server.listen();
34
34
  ```
@@ -60,7 +60,7 @@ Creates a new Bun platform instance.
60
60
  **Options:**
61
61
  - `cache`: Cache configuration (memory, filesystem)
62
62
  - `filesystem`: Filesystem configuration (local directory)
63
- - `port`: Default port (default: 3000)
63
+ - `port`: Default port (default: 7777)
64
64
  - `host`: Default host (default: localhost)
65
65
  - `cwd`: Working directory for file resolution
66
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/platform-bun",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Bun platform adapter for Shovel with hot reloading and built-in TypeScript/JSX support",
5
5
  "keywords": [
6
6
  "shovel",
@@ -11,11 +11,16 @@
11
11
  "typescript",
12
12
  "jsx"
13
13
  ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/bikeshaving/shovel.git",
17
+ "directory": "packages/platform-bun"
18
+ },
14
19
  "dependencies": {
15
- "@b9g/assets": "^0.2.0",
16
- "@b9g/cache": "^0.2.0",
17
- "@b9g/http-errors": "^0.2.0",
18
- "@b9g/platform": "^0.1.15",
20
+ "@b9g/assets": "^0.2.1",
21
+ "@b9g/cache": "^0.2.2",
22
+ "@b9g/http-errors": "^0.2.1",
23
+ "@b9g/platform": "^0.1.17",
19
24
  "@logtape/logtape": "^1.2.0"
20
25
  },
21
26
  "devDependencies": {
package/src/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  import { type PlatformDefaults, type Handler, type Server, type ServerOptions, type PlatformESBuildConfig, type EntryPoints, ServiceWorkerPool } from "@b9g/platform";
7
7
  import { type ShovelConfig } from "@b9g/platform/runtime";
8
8
  export interface BunPlatformOptions {
9
- /** Port for development server (default: 3000) */
9
+ /** Port for development server (default: 7777) */
10
10
  port?: number;
11
11
  /** Host for development server (default: localhost) */
12
12
  host?: string;
package/src/index.js CHANGED
@@ -139,7 +139,7 @@ var BunPlatform = class {
139
139
  this.name = "bun";
140
140
  const cwd = options.cwd || process.cwd();
141
141
  this.#options = {
142
- port: options.port ?? 3e3,
142
+ port: options.port ?? 7777,
143
143
  host: options.host ?? "localhost",
144
144
  workers: options.workers ?? 1,
145
145
  cwd,
@@ -270,8 +270,8 @@ self.onmessage = async (event) => {
270
270
  }
271
271
  };
272
272
 
273
- // Initialize worker runtime (installs ServiceWorker globals)
274
- const result = await initWorkerRuntime({config});
273
+ // Initialize worker runtime (usePostMessage: false \u2014 worker owns its server, no message loop)
274
+ const result = await initWorkerRuntime({config, usePostMessage: false});
275
275
  const registration = result.registration;
276
276
  databases = result.databases;
277
277
 
@@ -301,7 +301,8 @@ import {config} from "shovel:config";
301
301
  await configureLogging(config.logging);
302
302
 
303
303
  // Initialize worker runtime (installs ServiceWorker globals)
304
- const {registration, databases} = await initWorkerRuntime({config});
304
+ // Single-worker dev mode uses direct cache (no PostMessage overhead)
305
+ const {registration, databases} = await initWorkerRuntime({config, usePostMessage: config.workers > 1});
305
306
 
306
307
  // Import user code (registers event handlers)
307
308
  await import("${userEntryPath}");
@@ -368,7 +369,7 @@ process.on("SIGTERM", handleShutdown);
368
369
  getDefaults() {
369
370
  return {
370
371
  caches: {
371
- default: {
372
+ "*": {
372
373
  module: "@b9g/cache/memory",
373
374
  export: "MemoryCache"
374
375
  }
package/src/platform.js CHANGED
@@ -13,7 +13,8 @@ import {config} from "shovel:config";
13
13
  await configureLogging(config.logging);
14
14
 
15
15
  // Initialize worker runtime (installs ServiceWorker globals)
16
- const {registration, databases} = await initWorkerRuntime({config});
16
+ // Single-worker dev mode uses direct cache (no PostMessage overhead)
17
+ const {registration, databases} = await initWorkerRuntime({config, usePostMessage: config.workers > 1});
17
18
 
18
19
  // Import user code (registers event handlers)
19
20
  await import(${safePath});
@@ -50,8 +51,8 @@ self.onmessage = async (event) => {
50
51
  }
51
52
  };
52
53
 
53
- // Initialize worker runtime (installs ServiceWorker globals)
54
- const result = await initWorkerRuntime({config});
54
+ // Initialize worker runtime (usePostMessage: false \u2014 worker owns its server, no message loop)
55
+ const result = await initWorkerRuntime({config, usePostMessage: false});
55
56
  const registration = result.registration;
56
57
  databases = result.databases;
57
58
 
@@ -115,7 +116,7 @@ function getESBuildConfig() {
115
116
  function getDefaults() {
116
117
  return {
117
118
  caches: {
118
- default: {
119
+ "*": {
119
120
  module: "@b9g/cache/memory",
120
121
  export: "MemoryCache"
121
122
  }