@gnosticdev/hono-actions 1.0.11 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -5
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -2301,13 +2301,18 @@ export async function buildRouter(){
2301
2301
  app.route('/', action)
2302
2302
  }
2303
2303
 
2304
- showRoutes(app)
2305
2304
  return app
2306
2305
  }
2307
2306
 
2308
2307
  export type HonoRouter = Awaited<ReturnType<typeof buildRouter>>
2309
2308
 
2310
2309
  const app = await buildRouter()
2310
+ console.log('------- Hono Routes -------
2311
+ ')
2312
+ showRoutes(app)
2313
+ console.log('
2314
+ ---------------------------
2315
+ ')
2311
2316
  export default app`;
2312
2317
  }
2313
2318
  var getAstroHandler = (adapter) => {
@@ -2332,7 +2337,7 @@ export { handler as ALL }
2332
2337
  throw new Error(`Unsupported adapter: ${adapter}`);
2333
2338
  }
2334
2339
  };
2335
- var getHonoClient = (port) => `
2340
+ var getHonoClient = (port, siteUrl) => `
2336
2341
  // Generated by Hono Actions Integration
2337
2342
  import type { HonoRouter } from './router.js'
2338
2343
  import { hc } from 'hono/client'
@@ -2349,7 +2354,7 @@ export function getBaseUrl() {
2349
2354
  }
2350
2355
 
2351
2356
  // server side (production) needs full url
2352
- return import.meta.env.SITE
2357
+ return ${siteUrl ?? "import.meta.env.SITE"}
2353
2358
  }
2354
2359
 
2355
2360
  export const honoClient = hc<HonoRouter>(getBaseUrl())
@@ -2432,7 +2437,10 @@ ${ACTION_PATTERNS.map((p) => ` - ${p}`).join("\n")}`
2432
2437
  codeGenDir.pathname,
2433
2438
  "client.ts"
2434
2439
  );
2435
- const clientContent = getHonoClient(config.server.port);
2440
+ const clientContent = getHonoClient(
2441
+ config.server.port,
2442
+ config.site
2443
+ );
2436
2444
  await fs.writeFile(clientPathAbs, clientContent, "utf-8");
2437
2445
  addVirtualImports(params, {
2438
2446
  name,
@@ -2455,7 +2463,7 @@ ${ACTION_PATTERNS.map((p) => ` - ${p}`).join("\n")}`
2455
2463
  injectTypes({
2456
2464
  filename: "actions.d.ts",
2457
2465
  content: `
2458
- declare module '@gnosticdev/hono-actions' {
2466
+ declare module '@gnosticdev/hono-actions/actions' {
2459
2467
  interface Bindings extends Env { ASTRO_LOCALS: App.Locals }
2460
2468
  interface HonoEnv { Bindings: Bindings }
2461
2469
  }
package/package.json CHANGED
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "description": "Define server actions with built-in validation, error handling, and a pre-built hono client for calling the routes.",
15
15
  "devDependencies": {
16
+ "@types/bun": "^1.2.21",
16
17
  "tsup": "^8.5.0",
17
18
  "typescript": "^5.9.2"
18
19
  },
@@ -53,5 +54,5 @@
53
54
  },
54
55
  "type": "module",
55
56
  "types": "./dist/index.d.ts",
56
- "version": "1.0.11"
57
+ "version": "1.0.13"
57
58
  }