@rexeus/typeweaver 0.5.1 → 0.6.1

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
@@ -56,6 +56,7 @@ Now you are ready to start building! Check out [Quickstart](#-get-started)
56
56
  | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
57
57
  | [@rexeus/typeweaver-types](https://github.com/rexeus/typeweaver/tree/main/packages/types/README.md) | Plugin for request/response types and validation - the foundation for all other plugins and always included | ![npm](https://img.shields.io/npm/v/@rexeus/typeweaver-types) |
58
58
  | [@rexeus/typeweaver-clients](https://github.com/rexeus/typeweaver/tree/main/packages/clients/README.md) | Plugin for HTTP clients using fetch | ![npm](https://img.shields.io/npm/v/@rexeus/typeweaver-clients) |
59
+ | [@rexeus/typeweaver-server](https://github.com/rexeus/typeweaver/tree/main/packages/server/README.md) | Plugin for a zero-dependency, Fetch API-native server with built-in routing and middleware | ![npm](https://img.shields.io/npm/v/@rexeus/typeweaver-server) |
59
60
  | [@rexeus/typeweaver-hono](https://github.com/rexeus/typeweaver/tree/main/packages/hono/README.md) | Plugin for Hono routers | ![npm](https://img.shields.io/npm/v/@rexeus/typeweaver-hono) |
60
61
  | [@rexeus/typeweaver-aws-cdk](https://github.com/rexeus/typeweaver/tree/main/packages/aws-cdk/README.md) | Plugin for AWS CDK constructs for API Gateway V2 | ![npm](https://img.shields.io/npm/v/@rexeus/typeweaver-aws-cdk) |
61
62
 
@@ -95,7 +96,7 @@ bunx typeweaver generate --input ./api/definition --output ./api/generated --plu
95
96
  - `--config, -c <path>`: Configuration file path (optional)
96
97
  - `--plugins, -p <plugins>`: Comma-separated list of plugins to use (e.g., "clients,hono" or "all"
97
98
  for all plugins)
98
- - `--prettier / --no-prettier`: Enable/disable code formatting with Prettier (default: true)
99
+ - `--format / --no-format`: Enable/disable code formatting with oxfmt (default: true)
99
100
  - `--clean / --no-clean`: Enable/disable output directory cleaning (default: true)
100
101
 
101
102
  ### 📝 Configuration File
@@ -107,7 +108,7 @@ export default {
107
108
  input: "./api/definition",
108
109
  output: "./api/generated",
109
110
  plugins: ["clients", "hono", "aws-cdk"],
110
- prettier: true,
111
+ format: true,
111
112
  clean: true,
112
113
  };
113
114
  ```
@@ -375,7 +376,7 @@ npx typeweaver generate --input ./api/definition --output ./api/generated --plug
375
376
  // api/user-handlers.ts
376
377
  import { HttpResponse, HttpStatusCode } from "@rexeus/typeweaver-core";
377
378
  import {
378
- type UserApiHandler,
379
+ type HonoUserApiHandler,
379
380
  type IGetUserRequest,
380
381
  GetUserResponse,
381
382
  GetUserSuccessResponse,
@@ -387,7 +388,7 @@ import {
387
388
  ListUserResponse,
388
389
  } from "./generated";
389
390
 
390
- export class UserHandlers implements UserApiHandler {
391
+ export class UserHandlers implements HonoUserApiHandler {
391
392
  public constructor() {}
392
393
 
393
394
  public async handleGetUserRequest(request: IGetUserRequest): Promise<GetUserResponse> {
@@ -476,7 +477,9 @@ import { UserClient, GetUserRequestCommand, UserNotFoundErrorResponse } from "./
476
477
  const client = new UserClient({ baseUrl: "http://localhost:3000" });
477
478
 
478
479
  try {
479
- const getUserRequestCommand = new GetUserRequestCommand({ param: { userId: "123" } });
480
+ const getUserRequestCommand = new GetUserRequestCommand({
481
+ param: { userId: "123" },
482
+ });
480
483
  const result = await client.send(getUserRequestCommand);
481
484
 
482
485
  console.log("Successfully fetched user:", result.body);
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync } from "node:fs";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const entry = resolve(__dirname, "../dist/entry.mjs");
9
+
10
+ if (!existsSync(entry)) {
11
+ console.error(
12
+ "TypeWeaver CLI has not been built yet.\n" +
13
+ "Run 'pnpm build' in the project root first."
14
+ );
15
+ process.exit(1);
16
+ }
17
+
18
+ await import(entry);