@rexeus/typeweaver-server 0.5.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.
@@ -0,0 +1 @@
1
+ {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js":{"bytes":322,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true}],"format":"esm"},"src/RouterGenerator.ts":{"bytes":3869,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-core","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true},{"path":"/Users/denniswentzien/Development/rexeus/typeweaver-5/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1036,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"src/RouterGenerator.ts","kind":"import-statement","original":"./RouterGenerator"},{"path":"/Users/denniswentzien/Development/rexeus/typeweaver-5/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-core","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":585},"src/RouterGenerator.ts":{"bytesInOutput":2864}},"bytes":3547}}}
@@ -0,0 +1,43 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by typeweaver.
4
+ * DO NOT EDIT. Instead, modify the source definition file and generate again.
5
+ *
6
+ * @generated by @rexeus/typeweaver
7
+ */
8
+
9
+ import { HttpMethod, TypeweaverRouter, type RequestHandler, type TypeweaverRouterOptions } from "<%- coreDir %>/lib/server";
10
+ <% for (const operation of operations) { %>
11
+ import type { I<%- operation.className %>Request } from "./<%- operation.className %>Request";
12
+ import { <%- operation.className %>RequestValidator } from "./<%- operation.className %>RequestValidator";
13
+ import type { <%- operation.className %>Response } from "./<%- operation.className %>Response";
14
+ <% } %>
15
+
16
+ export type Server<%- pascalCaseEntityName %>ApiHandler<
17
+ TState extends Record<string, unknown> = Record<string, unknown>,
18
+ > = {
19
+ <% for (const operation of operations) { %>
20
+ <%- operation.handlerName %>: RequestHandler<I<%- operation.className %>Request, <%- operation.className %>Response, TState>;
21
+ <% } %>
22
+ };
23
+
24
+ export class <%- pascalCaseEntityName %>Router<
25
+ TState extends Record<string, unknown> = Record<string, unknown>,
26
+ > extends TypeweaverRouter<Server<%- pascalCaseEntityName %>ApiHandler<TState>> {
27
+ public constructor(options: TypeweaverRouterOptions<Server<%- pascalCaseEntityName %>ApiHandler<TState>>) {
28
+ super(options);
29
+ this.setupRoutes();
30
+ }
31
+
32
+ protected setupRoutes(): void {
33
+ <% for (const operation of operations) { %>
34
+ this.route(
35
+ HttpMethod.<%- operation.method %>,
36
+ '<%- operation.path %>',
37
+ new <%- operation.className %>RequestValidator(),
38
+ this.requestHandlers.<%- operation.handlerName %>.bind(this.requestHandlers)
39
+ );
40
+
41
+ <% } %>
42
+ }
43
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@rexeus/typeweaver-server",
3
+ "version": "0.5.1",
4
+ "description": "Generates a lightweight, dependency-free server with built-in routing and middleware from your API definitions. Powered by Typeweaver.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "package.json",
25
+ "README.md",
26
+ "LICENSE",
27
+ "NOTICE"
28
+ ],
29
+ "scripts": {
30
+ "typecheck": "tsc --noEmit",
31
+ "format": "prettier --write .",
32
+ "build": "tsup && mkdir -p ./dist/templates ./dist/lib && cp -r ./src/templates/* ./dist/templates/ && cp -r ./src/lib/* ./dist/lib/ && cp ../../LICENSE ../../NOTICE ./dist/",
33
+ "test": "vitest --run",
34
+ "prepack": "npm run build",
35
+ "preversion": "npm run build"
36
+ },
37
+ "keywords": [
38
+ "typeweaver",
39
+ "plugin",
40
+ "server",
41
+ "router",
42
+ "middleware",
43
+ "api",
44
+ "http"
45
+ ],
46
+ "author": "Dennis Wentzien <dw@rexeus.com>",
47
+ "license": "Apache-2.0",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/rexeus/typeweaver.git",
51
+ "directory": "packages/server"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/rexeus/typeweaver/issues"
55
+ },
56
+ "homepage": "https://github.com/rexeus/typeweaver#readme",
57
+ "peerDependencies": {
58
+ "@rexeus/typeweaver-core": "workspace:^",
59
+ "@rexeus/typeweaver-gen": "workspace:^"
60
+ },
61
+ "devDependencies": {
62
+ "@rexeus/typeweaver-core": "workspace:^",
63
+ "@rexeus/typeweaver-gen": "workspace:^",
64
+ "get-port": "^7.1.0",
65
+ "test-utils": "file:../test-utils",
66
+ "tsx": "^4.21.0"
67
+ },
68
+ "dependencies": {
69
+ "case": "^1.6.3"
70
+ }
71
+ }