@rexeus/typeweaver-server 0.10.0 → 0.10.2

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/dist/index.cjs CHANGED
@@ -80,6 +80,7 @@ const moduleDir = node_path.default.dirname((0, node_url.fileURLToPath)(require(
80
80
  */
81
81
  var ServerPlugin = class extends _rexeus_typeweaver_gen.BasePlugin {
82
82
  name = "server";
83
+ depends = ["types"];
83
84
  /**
84
85
  * Generates the server runtime and typed routers for all resources.
85
86
  *
package/dist/index.d.cts CHANGED
@@ -10,6 +10,7 @@ import { BasePlugin, GeneratorContext } from "@rexeus/typeweaver-gen";
10
10
  */
11
11
  declare class ServerPlugin extends BasePlugin {
12
12
  name: string;
13
+ depends: string[];
13
14
  /**
14
15
  * Generates the server runtime and typed routers for all resources.
15
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;AAeA;;;;;;cAAa,YAAA,SAAqB,UAAA;EACzB,IAAA;EAOkB;;;;;EAAT,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;AAeA;;;;;;cAAa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,OAAA;EAOS;;;;;EAAT,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -10,6 +10,7 @@ import { BasePlugin, GeneratorContext } from "@rexeus/typeweaver-gen";
10
10
  */
11
11
  declare class ServerPlugin extends BasePlugin {
12
12
  name: string;
13
+ depends: string[];
13
14
  /**
14
15
  * Generates the server runtime and typed routers for all resources.
15
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;AAeA;;;;;;cAAa,YAAA,SAAqB,UAAA;EACzB,IAAA;EAOkB;;;;;EAAT,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;AAeA;;;;;;cAAa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,OAAA;EAOS;;;;;EAAT,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -56,6 +56,7 @@ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
56
56
  */
57
57
  var ServerPlugin = class extends BasePlugin {
58
58
  name = "server";
59
+ depends = ["types"];
59
60
  /**
60
61
  * Generates the server runtime and typed routers for all resources.
61
62
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/routerGenerator.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { HttpMethod } from \"@rexeus/typeweaver-core\";\nimport { compareRoutes, relative, toPascalCase } from \"@rexeus/typeweaver-gen\";\nimport type {\n GeneratorContext,\n NormalizedOperation,\n NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\n\ntype OperationData = {\n readonly operationId: string;\n readonly className: string;\n readonly handlerName: string;\n readonly method: string;\n readonly path: string;\n};\n\n/**\n * Generates TypeweaverRouter subclasses from API definitions.\n *\n * For each resource (e.g., `Todo`, `Account`), produces a `<ResourceName>Router.ts`\n * file that extends `TypeweaverRouter` and registers all operations as routes.\n */\n\n/**\n * Generates router files for all resources in the given context.\n *\n * @param context - The generator context containing resources, templates, and output configuration\n */\nexport function generate(context: GeneratorContext): void {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n const templateFile = path.join(moduleDir, \"templates\", \"Router.ejs\");\n\n for (const resource of context.normalizedSpec.resources) {\n writeRouter(resource, templateFile, context);\n }\n}\n\nfunction writeRouter(\n resource: NormalizedResource,\n templateFile: string,\n context: GeneratorContext\n): void {\n const pascalCaseEntityName = toPascalCase(resource.name);\n const outputDir = context.getResourceOutputDir(resource.name);\n const outputPath = path.join(outputDir, `${pascalCaseEntityName}Router.ts`);\n\n const operations = resource.operations\n .filter(operation => operation.method !== HttpMethod.HEAD)\n .map(operation => createOperationData(operation))\n .sort((a, b) => compareRoutes(a, b));\n\n const content = context.renderTemplate(templateFile, {\n coreDir: relative(outputDir, context.outputDir),\n entityName: resource.name,\n pascalCaseEntityName,\n operations,\n });\n\n const relativePath = path.relative(context.outputDir, outputPath);\n context.writeFile(relativePath, content);\n}\n\nfunction createOperationData(operation: NormalizedOperation): OperationData {\n const operationId = operation.operationId;\n const className = toPascalCase(operationId);\n\n return {\n operationId,\n className,\n handlerName: `handle${className}Request`,\n method: operation.method,\n path: operation.path,\n };\n}\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { BasePlugin } from \"@rexeus/typeweaver-gen\";\nimport type { GeneratorContext } from \"@rexeus/typeweaver-gen\";\nimport { generate as generateRouters } from \"./routerGenerator\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Typeweaver plugin that generates a lightweight, dependency-free server\n * with built-in routing and middleware support.\n *\n * Copies the runtime library files (`TypeweaverApp`, `TypeweaverRouter`, `Router`,\n * `Middleware`, etc.) and generates typed router classes for each resource.\n */\nexport class ServerPlugin extends BasePlugin {\n public name = \"server\";\n\n /**\n * Generates the server runtime and typed routers for all resources.\n *\n * @param context - The generator context\n */\n public override generate(context: GeneratorContext): void {\n const libSourceDir = path.join(moduleDir, \"lib\");\n this.copyLibFiles(context, libSourceDir, this.name);\n\n generateRouters(context);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,SAAgB,SAAS,SAAiC;CACxD,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC9D,MAAM,eAAe,KAAK,KAAK,WAAW,aAAa,aAAa;AAEpE,MAAK,MAAM,YAAY,QAAQ,eAAe,UAC5C,aAAY,UAAU,cAAc,QAAQ;;AAIhD,SAAS,YACP,UACA,cACA,SACM;CACN,MAAM,uBAAuB,aAAa,SAAS,KAAK;CACxD,MAAM,YAAY,QAAQ,qBAAqB,SAAS,KAAK;CAC7D,MAAM,aAAa,KAAK,KAAK,WAAW,GAAG,qBAAqB,WAAW;CAE3E,MAAM,aAAa,SAAS,WACzB,QAAO,cAAa,UAAU,WAAW,WAAW,KAAK,CACzD,KAAI,cAAa,oBAAoB,UAAU,CAAC,CAChD,MAAM,GAAG,MAAM,cAAc,GAAG,EAAE,CAAC;CAEtC,MAAM,UAAU,QAAQ,eAAe,cAAc;EACnD,SAAS,SAAS,WAAW,QAAQ,UAAU;EAC/C,YAAY,SAAS;EACrB;EACA;EACD,CAAC;CAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,SAAQ,UAAU,cAAc,QAAQ;;AAG1C,SAAS,oBAAoB,WAA+C;CAC1E,MAAM,cAAc,UAAU;CAC9B,MAAM,YAAY,aAAa,YAAY;AAE3C,QAAO;EACL;EACA;EACA,aAAa,SAAS,UAAU;EAChC,QAAQ,UAAU;EAClB,MAAM,UAAU;EACjB;;;;ACpEH,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;;;;;;;;AAS9D,IAAa,eAAb,cAAkC,WAAW;CAC3C,OAAc;;;;;;CAOd,SAAyB,SAAiC;EACxD,MAAM,eAAe,KAAK,KAAK,WAAW,MAAM;AAChD,OAAK,aAAa,SAAS,cAAc,KAAK,KAAK;AAEnD,WAAgB,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/routerGenerator.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { HttpMethod } from \"@rexeus/typeweaver-core\";\nimport { compareRoutes, relative, toPascalCase } from \"@rexeus/typeweaver-gen\";\nimport type {\n GeneratorContext,\n NormalizedOperation,\n NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\n\ntype OperationData = {\n readonly operationId: string;\n readonly className: string;\n readonly handlerName: string;\n readonly method: string;\n readonly path: string;\n};\n\n/**\n * Generates TypeweaverRouter subclasses from API definitions.\n *\n * For each resource (e.g., `Todo`, `Account`), produces a `<ResourceName>Router.ts`\n * file that extends `TypeweaverRouter` and registers all operations as routes.\n */\n\n/**\n * Generates router files for all resources in the given context.\n *\n * @param context - The generator context containing resources, templates, and output configuration\n */\nexport function generate(context: GeneratorContext): void {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n const templateFile = path.join(moduleDir, \"templates\", \"Router.ejs\");\n\n for (const resource of context.normalizedSpec.resources) {\n writeRouter(resource, templateFile, context);\n }\n}\n\nfunction writeRouter(\n resource: NormalizedResource,\n templateFile: string,\n context: GeneratorContext\n): void {\n const pascalCaseEntityName = toPascalCase(resource.name);\n const outputDir = context.getResourceOutputDir(resource.name);\n const outputPath = path.join(outputDir, `${pascalCaseEntityName}Router.ts`);\n\n const operations = resource.operations\n .filter(operation => operation.method !== HttpMethod.HEAD)\n .map(operation => createOperationData(operation))\n .sort((a, b) => compareRoutes(a, b));\n\n const content = context.renderTemplate(templateFile, {\n coreDir: relative(outputDir, context.outputDir),\n entityName: resource.name,\n pascalCaseEntityName,\n operations,\n });\n\n const relativePath = path.relative(context.outputDir, outputPath);\n context.writeFile(relativePath, content);\n}\n\nfunction createOperationData(operation: NormalizedOperation): OperationData {\n const operationId = operation.operationId;\n const className = toPascalCase(operationId);\n\n return {\n operationId,\n className,\n handlerName: `handle${className}Request`,\n method: operation.method,\n path: operation.path,\n };\n}\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { BasePlugin } from \"@rexeus/typeweaver-gen\";\nimport type { GeneratorContext } from \"@rexeus/typeweaver-gen\";\nimport { generate as generateRouters } from \"./routerGenerator.js\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Typeweaver plugin that generates a lightweight, dependency-free server\n * with built-in routing and middleware support.\n *\n * Copies the runtime library files (`TypeweaverApp`, `TypeweaverRouter`, `Router`,\n * `Middleware`, etc.) and generates typed router classes for each resource.\n */\nexport class ServerPlugin extends BasePlugin {\n public name = \"server\";\n public override depends = [\"types\"];\n\n /**\n * Generates the server runtime and typed routers for all resources.\n *\n * @param context - The generator context\n */\n public override generate(context: GeneratorContext): void {\n const libSourceDir = path.join(moduleDir, \"lib\");\n this.copyLibFiles(context, libSourceDir, this.name);\n\n generateRouters(context);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,SAAgB,SAAS,SAAiC;CACxD,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC9D,MAAM,eAAe,KAAK,KAAK,WAAW,aAAa,aAAa;AAEpE,MAAK,MAAM,YAAY,QAAQ,eAAe,UAC5C,aAAY,UAAU,cAAc,QAAQ;;AAIhD,SAAS,YACP,UACA,cACA,SACM;CACN,MAAM,uBAAuB,aAAa,SAAS,KAAK;CACxD,MAAM,YAAY,QAAQ,qBAAqB,SAAS,KAAK;CAC7D,MAAM,aAAa,KAAK,KAAK,WAAW,GAAG,qBAAqB,WAAW;CAE3E,MAAM,aAAa,SAAS,WACzB,QAAO,cAAa,UAAU,WAAW,WAAW,KAAK,CACzD,KAAI,cAAa,oBAAoB,UAAU,CAAC,CAChD,MAAM,GAAG,MAAM,cAAc,GAAG,EAAE,CAAC;CAEtC,MAAM,UAAU,QAAQ,eAAe,cAAc;EACnD,SAAS,SAAS,WAAW,QAAQ,UAAU;EAC/C,YAAY,SAAS;EACrB;EACA;EACD,CAAC;CAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,SAAQ,UAAU,cAAc,QAAQ;;AAG1C,SAAS,oBAAoB,WAA+C;CAC1E,MAAM,cAAc,UAAU;CAC9B,MAAM,YAAY,aAAa,YAAY;AAE3C,QAAO;EACL;EACA;EACA,aAAa,SAAS,UAAU;EAChC,QAAQ,UAAU;EAClB,MAAM,UAAU;EACjB;;;;ACpEH,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;;;;;;;;AAS9D,IAAa,eAAb,cAAkC,WAAW;CAC3C,OAAc;CACd,UAA0B,CAAC,QAAQ;;;;;;CAOnC,SAAyB,SAAiC;EACxD,MAAM,eAAe,KAAK,KAAK,WAAW,MAAM;AAChD,OAAK,aAAa,SAAS,cAAc,KAAK,KAAK;AAEnD,WAAgB,QAAQ"}
@@ -17,7 +17,7 @@ import {
17
17
  BodyParseError,
18
18
  PayloadTooLargeError,
19
19
  ResponseSerializationError,
20
- } from "./Errors";
20
+ } from "./Errors.js";
21
21
 
22
22
  export type FetchApiAdapterOptions = {
23
23
  readonly maxBodySize?: number;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
9
- import type { ServerContext } from "./ServerContext";
9
+ import type { ServerContext } from "./ServerContext.js";
10
10
 
11
11
  /**
12
12
  * A middleware function that processes requests in the pipeline.
@@ -10,8 +10,8 @@ import {
10
10
  internalServerErrorDefaultError,
11
11
  payloadTooLargeDefaultError,
12
12
  } from "@rexeus/typeweaver-core";
13
- import { PayloadTooLargeError } from "./Errors";
14
- import type { TypeweaverApp } from "./TypeweaverApp";
13
+ import { PayloadTooLargeError } from "./Errors.js";
14
+ import type { TypeweaverApp } from "./TypeweaverApp.js";
15
15
  import type { IncomingMessage, ServerResponse } from "node:http";
16
16
 
17
17
  /**
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { IHttpRequest, IHttpResponse } from "@rexeus/typeweaver-core";
9
- import type { ServerContext } from "./ServerContext";
9
+ import type { ServerContext } from "./ServerContext.js";
10
10
 
11
11
  /**
12
12
  * A type-safe request handler function.
@@ -14,8 +14,8 @@ import type {
14
14
  RequestValidationError,
15
15
  ResponseValidationError,
16
16
  } from "@rexeus/typeweaver-core";
17
- import type { RequestHandler } from "./RequestHandler";
18
- import type { ServerContext } from "./ServerContext";
17
+ import type { RequestHandler } from "./RequestHandler.js";
18
+ import type { ServerContext } from "./ServerContext.js";
19
19
 
20
20
  /**
21
21
  * Metadata about a matched route, available in middleware and handlers via `ctx.route`.
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import type { IHttpRequest } from "@rexeus/typeweaver-core";
9
- import type { RouteMetadata } from "./Router";
10
- import type { StateMap } from "./StateMap";
9
+ import type { RouteMetadata } from "./Router.js";
10
+ import type { StateMap } from "./StateMap.js";
11
11
 
12
12
  /**
13
13
  * Context object passed through the middleware pipeline and to request handlers.
@@ -6,9 +6,9 @@
6
6
  */
7
7
 
8
8
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
9
- import type { Middleware } from "./Middleware";
10
- import type { ServerContext } from "./ServerContext";
11
- import type { TypeweaverApp } from "./TypeweaverApp";
9
+ import type { Middleware } from "./Middleware.js";
10
+ import type { ServerContext } from "./ServerContext.js";
11
+ import type { TypeweaverApp } from "./TypeweaverApp.js";
12
12
 
13
13
  /**
14
14
  * A middleware descriptor carrying compile-time metadata about what state
@@ -18,13 +18,13 @@ import {
18
18
  validationDefaultError,
19
19
  } from "@rexeus/typeweaver-core";
20
20
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
21
- import { BodyParseError, PayloadTooLargeError } from "./Errors";
22
- import { FetchApiAdapter } from "./FetchApiAdapter";
23
- import { executeMiddlewarePipeline } from "./Middleware";
24
- import { Router } from "./Router";
25
- import { StateMap } from "./StateMap";
26
- import type { Middleware } from "./Middleware";
27
- import type { RequestHandler } from "./RequestHandler";
21
+ import { BodyParseError, PayloadTooLargeError } from "./Errors.js";
22
+ import { FetchApiAdapter } from "./FetchApiAdapter.js";
23
+ import { executeMiddlewarePipeline } from "./Middleware.js";
24
+ import { Router } from "./Router.js";
25
+ import { StateMap } from "./StateMap.js";
26
+ import type { Middleware } from "./Middleware.js";
27
+ import type { RequestHandler } from "./RequestHandler.js";
28
28
  import type {
29
29
  HttpResponseErrorHandler,
30
30
  ResponseValidationErrorHandler,
@@ -32,10 +32,13 @@ import type {
32
32
  RouteMatch,
33
33
  UnknownErrorHandler,
34
34
  RequestValidationErrorHandler,
35
- } from "./Router";
36
- import type { ServerContext } from "./ServerContext";
37
- import type { StateRequirementError, TypedMiddleware } from "./TypedMiddleware";
38
- import type { TypeweaverRouter } from "./TypeweaverRouter";
35
+ } from "./Router.js";
36
+ import type { ServerContext } from "./ServerContext.js";
37
+ import type {
38
+ StateRequirementError,
39
+ TypedMiddleware,
40
+ } from "./TypedMiddleware.js";
41
+ import type { TypeweaverRouter } from "./TypeweaverRouter.js";
39
42
 
40
43
  /**
41
44
  * The main application class that provides routing, middleware, and
@@ -12,7 +12,7 @@ import type {
12
12
  IRequestValidator,
13
13
  IResponseValidator,
14
14
  } from "@rexeus/typeweaver-core";
15
- import type { RequestHandler } from "./RequestHandler";
15
+ import type { RequestHandler } from "./RequestHandler.js";
16
16
  import type {
17
17
  HttpResponseErrorHandler,
18
18
  ResponseValidationErrorHandler,
@@ -20,7 +20,7 @@ import type {
20
20
  RouterErrorConfig,
21
21
  UnknownErrorHandler,
22
22
  RequestValidationErrorHandler,
23
- } from "./Router";
23
+ } from "./Router.js";
24
24
 
25
25
  /**
26
26
  * Configuration options for TypeweaverRouter instances.
package/dist/lib/index.ts CHANGED
@@ -7,11 +7,11 @@
7
7
 
8
8
  /* oxlint-disable import/max-dependencies */
9
9
 
10
- export { TypeweaverApp, type TypeweaverAppOptions } from "./TypeweaverApp";
10
+ export { TypeweaverApp, type TypeweaverAppOptions } from "./TypeweaverApp.js";
11
11
  export {
12
12
  TypeweaverRouter,
13
13
  type TypeweaverRouterOptions,
14
- } from "./TypeweaverRouter";
14
+ } from "./TypeweaverRouter.js";
15
15
  export { HttpMethod } from "@rexeus/typeweaver-core";
16
16
  export type {
17
17
  HttpResponseErrorHandler,
@@ -19,25 +19,25 @@ export type {
19
19
  ResponseValidationErrorHandler,
20
20
  RouteMetadata,
21
21
  UnknownErrorHandler,
22
- } from "./Router";
23
- export type { ServerContext } from "./ServerContext";
24
- export type { RequestHandler } from "./RequestHandler";
25
- export { StateMap } from "./StateMap";
22
+ } from "./Router.js";
23
+ export type { ServerContext } from "./ServerContext.js";
24
+ export type { RequestHandler } from "./RequestHandler.js";
25
+ export { StateMap } from "./StateMap.js";
26
26
  export {
27
27
  defineMiddleware,
28
28
  type InferState,
29
29
  type NextFn,
30
30
  type StateRequirementError,
31
31
  type TypedMiddleware,
32
- } from "./TypedMiddleware";
32
+ } from "./TypedMiddleware.js";
33
33
  export {
34
34
  BodyParseError,
35
35
  PayloadTooLargeError,
36
36
  ResponseSerializationError,
37
- } from "./Errors";
38
- export { FetchApiAdapter } from "./FetchApiAdapter";
39
- export { nodeAdapter, type NodeAdapterOptions } from "./NodeAdapter";
40
- export { pathMatcher } from "./PathMatcher";
37
+ } from "./Errors.js";
38
+ export { FetchApiAdapter } from "./FetchApiAdapter.js";
39
+ export { nodeAdapter, type NodeAdapterOptions } from "./NodeAdapter.js";
40
+ export { pathMatcher } from "./PathMatcher.js";
41
41
  export {
42
42
  basicAuth,
43
43
  type BasicAuthOptions,
@@ -56,4 +56,4 @@ export {
56
56
  scoped,
57
57
  secureHeaders,
58
58
  type SecureHeadersOptions,
59
- } from "./middleware/index";
59
+ } from "./middleware/index.js";
@@ -3,8 +3,8 @@ import {
3
3
  unauthorizedDefaultError,
4
4
  } from "@rexeus/typeweaver-core";
5
5
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
6
- import { defineMiddleware } from "../TypedMiddleware";
7
- import type { ServerContext } from "../ServerContext";
6
+ import { defineMiddleware } from "../TypedMiddleware.js";
7
+ import type { ServerContext } from "../ServerContext.js";
8
8
 
9
9
  export type BasicAuthOptions = {
10
10
  readonly verifyCredentials: (
@@ -3,8 +3,8 @@ import {
3
3
  unauthorizedDefaultError,
4
4
  } from "@rexeus/typeweaver-core";
5
5
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
6
- import { defineMiddleware } from "../TypedMiddleware";
7
- import type { ServerContext } from "../ServerContext";
6
+ import { defineMiddleware } from "../TypedMiddleware.js";
7
+ import type { ServerContext } from "../ServerContext.js";
8
8
 
9
9
  export type BearerAuthOptions = {
10
10
  readonly verifyToken: (
@@ -1,5 +1,5 @@
1
1
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
2
- import { defineMiddleware } from "../TypedMiddleware";
2
+ import { defineMiddleware } from "../TypedMiddleware.js";
3
3
 
4
4
  export type CorsOptions = {
5
5
  readonly origin?:
@@ -1,8 +1,8 @@
1
- export { basicAuth, type BasicAuthOptions } from "./basicAuth";
2
- export { bearerAuth, type BearerAuthOptions } from "./bearerAuth";
3
- export { cors, type CorsOptions } from "./cors";
4
- export { logger, type LogData, type LoggerOptions } from "./logger";
5
- export { poweredBy, type PoweredByOptions } from "./poweredBy";
6
- export { requestId, type RequestIdOptions } from "./requestId";
7
- export { scoped, except } from "./scoped";
8
- export { secureHeaders, type SecureHeadersOptions } from "./secureHeaders";
1
+ export { basicAuth, type BasicAuthOptions } from "./basicAuth.js";
2
+ export { bearerAuth, type BearerAuthOptions } from "./bearerAuth.js";
3
+ export { cors, type CorsOptions } from "./cors.js";
4
+ export { logger, type LogData, type LoggerOptions } from "./logger.js";
5
+ export { poweredBy, type PoweredByOptions } from "./poweredBy.js";
6
+ export { requestId, type RequestIdOptions } from "./requestId.js";
7
+ export { scoped, except } from "./scoped.js";
8
+ export { secureHeaders, type SecureHeadersOptions } from "./secureHeaders.js";
@@ -1,4 +1,4 @@
1
- import { defineMiddleware } from "../TypedMiddleware";
1
+ import { defineMiddleware } from "../TypedMiddleware.js";
2
2
 
3
3
  export type LogData = {
4
4
  readonly method: string;
@@ -1,5 +1,5 @@
1
1
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
2
- import { defineMiddleware } from "../TypedMiddleware";
2
+ import { defineMiddleware } from "../TypedMiddleware.js";
3
3
 
4
4
  export type PoweredByOptions = {
5
5
  readonly name?: string;
@@ -1,5 +1,5 @@
1
1
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
2
- import { defineMiddleware } from "../TypedMiddleware";
2
+ import { defineMiddleware } from "../TypedMiddleware.js";
3
3
 
4
4
  export type RequestIdOptions = {
5
5
  readonly headerName?: string;
@@ -1,6 +1,6 @@
1
- import { pathMatcher } from "../PathMatcher";
2
- import { defineMiddleware } from "../TypedMiddleware";
3
- import type { TypedMiddleware } from "../TypedMiddleware";
1
+ import { pathMatcher } from "../PathMatcher.js";
2
+ import { defineMiddleware } from "../TypedMiddleware.js";
3
+ import type { TypedMiddleware } from "../TypedMiddleware.js";
4
4
 
5
5
  /**
6
6
  * Restricts a middleware to only run on paths matching the given patterns.
@@ -1,5 +1,5 @@
1
1
  import type { IHttpResponse } from "@rexeus/typeweaver-core";
2
- import { defineMiddleware } from "../TypedMiddleware";
2
+ import { defineMiddleware } from "../TypedMiddleware.js";
3
3
 
4
4
  export type SecureHeadersOptions = {
5
5
  readonly contentTypeOptions?: string | false;
@@ -6,12 +6,12 @@
6
6
  * @generated by @rexeus/typeweaver
7
7
  */
8
8
 
9
- import { HttpMethod, TypeweaverRouter, type RequestHandler, type TypeweaverRouterOptions } from "<%- coreDir %>/lib/server";
9
+ import { HttpMethod, TypeweaverRouter, type RequestHandler, type TypeweaverRouterOptions } from "<%- coreDir %>/lib/server/index.js";
10
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
- import { <%- operation.className %>ResponseValidator } from "./<%- operation.className %>ResponseValidator";
11
+ import type { I<%- operation.className %>Request } from "./<%- operation.className %>Request.js";
12
+ import { <%- operation.className %>RequestValidator } from "./<%- operation.className %>RequestValidator.js";
13
+ import type { <%- operation.className %>Response } from "./<%- operation.className %>Response.js";
14
+ import { <%- operation.className %>ResponseValidator } from "./<%- operation.className %>ResponseValidator.js";
15
15
  <% } %>
16
16
 
17
17
  export type Server<%- pascalCaseEntityName %>ApiHandler<
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexeus/typeweaver-server",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Generates a lightweight, dependency-free server with built-in routing and middleware from your API definitions. Powered by Typeweaver.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,20 +47,20 @@
47
47
  },
48
48
  "homepage": "https://github.com/rexeus/typeweaver#readme",
49
49
  "peerDependencies": {
50
- "@rexeus/typeweaver-core": "^0.10.0",
51
- "@rexeus/typeweaver-gen": "^0.10.0"
50
+ "@rexeus/typeweaver-core": "^0.10.2",
51
+ "@rexeus/typeweaver-gen": "^0.10.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "get-port": "^7.2.0",
55
55
  "test-utils": "file:../test-utils",
56
56
  "tsx": "^4.21.0",
57
- "@rexeus/typeweaver-core": "^0.10.0",
58
- "@rexeus/typeweaver-gen": "^0.10.0"
57
+ "@rexeus/typeweaver-core": "^0.10.2",
58
+ "@rexeus/typeweaver-gen": "^0.10.2"
59
59
  },
60
60
  "scripts": {
61
61
  "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
62
62
  "format": "oxfmt",
63
- "build": "tsdown && mkdir -p ./dist/templates ./dist/lib && cp -r ./src/templates/* ./dist/templates/ && cp -r ./src/lib/* ./dist/lib/ && cp ../../LICENSE ../../NOTICE ./dist/",
63
+ "build": "tsdown",
64
64
  "test": "vitest --run",
65
65
  "preversion": "npm run build"
66
66
  }