@rexeus/typeweaver-hono 0.9.1 → 0.10.0

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
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
2
  //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -25,8 +26,6 @@ node_path = __toESM(node_path);
25
26
  let node_url = require("node:url");
26
27
  let _rexeus_typeweaver_gen = require("@rexeus/typeweaver-gen");
27
28
  let _rexeus_typeweaver_core = require("@rexeus/typeweaver-core");
28
- let case$1 = require("case");
29
- case$1 = __toESM(case$1);
30
29
  //#region src/honoRouterGenerator.ts
31
30
  function generate(context) {
32
31
  const moduleDir = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
@@ -34,7 +33,7 @@ function generate(context) {
34
33
  for (const resource of context.normalizedSpec.resources) writeHonoRouter(resource, templateFile, context);
35
34
  }
36
35
  function writeHonoRouter(resource, templateFile, context) {
37
- const pascalCaseEntityName = case$1.default.pascal(resource.name);
36
+ const pascalCaseEntityName = (0, _rexeus_typeweaver_gen.toPascalCase)(resource.name);
38
37
  const outputDir = context.getResourceOutputDir(resource.name);
39
38
  const outputPath = node_path.default.join(outputDir, `${pascalCaseEntityName}Hono.ts`);
40
39
  const operations = resource.operations.filter((operation) => operation.method !== _rexeus_typeweaver_core.HttpMethod.HEAD).map((operation) => createOperationData(operation)).sort((a, b) => (0, _rexeus_typeweaver_gen.compareRoutes)(a, b));
@@ -49,7 +48,7 @@ function writeHonoRouter(resource, templateFile, context) {
49
48
  }
50
49
  function createOperationData(operation) {
51
50
  const operationId = operation.operationId;
52
- const className = case$1.default.pascal(operationId);
51
+ const className = (0, _rexeus_typeweaver_gen.toPascalCase)(operationId);
53
52
  return {
54
53
  operationId,
55
54
  className,
@@ -70,4 +69,4 @@ var HonoPlugin = class extends _rexeus_typeweaver_gen.BasePlugin {
70
69
  }
71
70
  };
72
71
  //#endregion
73
- module.exports = HonoPlugin;
72
+ exports.HonoPlugin = HonoPlugin;
package/dist/index.d.cts CHANGED
@@ -5,5 +5,6 @@ declare class HonoPlugin extends BasePlugin {
5
5
  name: string;
6
6
  generate(context: GeneratorContext): void;
7
7
  }
8
- export = HonoPlugin;
8
+ //#endregion
9
+ export { HonoPlugin };
9
10
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQqB,UAAA,SAAmB,UAAA;EAC/B,IAAA;EAES,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,UAAA,SAAmB,UAAA;EACvB,IAAA;EAES,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -6,5 +6,5 @@ declare class HonoPlugin extends BasePlugin {
6
6
  generate(context: GeneratorContext): void;
7
7
  }
8
8
  //#endregion
9
- export { HonoPlugin as default };
9
+ export { HonoPlugin };
10
10
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQqB,UAAA,SAAmB,UAAA;EAC/B,IAAA;EAES,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,UAAA,SAAmB,UAAA;EACvB,IAAA;EAES,QAAA,CAAS,OAAA,EAAS,gBAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- import { BasePlugin, compareRoutes } from "@rexeus/typeweaver-gen";
3
+ import { BasePlugin, compareRoutes, toPascalCase } from "@rexeus/typeweaver-gen";
4
4
  import { HttpMethod } from "@rexeus/typeweaver-core";
5
- import Case from "case";
6
5
  //#region src/honoRouterGenerator.ts
7
6
  function generate(context) {
8
7
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
@@ -10,7 +9,7 @@ function generate(context) {
10
9
  for (const resource of context.normalizedSpec.resources) writeHonoRouter(resource, templateFile, context);
11
10
  }
12
11
  function writeHonoRouter(resource, templateFile, context) {
13
- const pascalCaseEntityName = Case.pascal(resource.name);
12
+ const pascalCaseEntityName = toPascalCase(resource.name);
14
13
  const outputDir = context.getResourceOutputDir(resource.name);
15
14
  const outputPath = path.join(outputDir, `${pascalCaseEntityName}Hono.ts`);
16
15
  const operations = resource.operations.filter((operation) => operation.method !== HttpMethod.HEAD).map((operation) => createOperationData(operation)).sort((a, b) => compareRoutes(a, b));
@@ -25,7 +24,7 @@ function writeHonoRouter(resource, templateFile, context) {
25
24
  }
26
25
  function createOperationData(operation) {
27
26
  const operationId = operation.operationId;
28
- const className = Case.pascal(operationId);
27
+ const className = toPascalCase(operationId);
29
28
  return {
30
29
  operationId,
31
30
  className,
@@ -46,6 +45,6 @@ var HonoPlugin = class extends BasePlugin {
46
45
  }
47
46
  };
48
47
  //#endregion
49
- export { HonoPlugin as default };
48
+ export { HonoPlugin };
50
49
 
51
50
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/honoRouterGenerator.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { HttpMethod } from \"@rexeus/typeweaver-core\";\nimport { compareRoutes } from \"@rexeus/typeweaver-gen\";\nimport type {\n GeneratorContext,\n NormalizedOperation,\n NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\nimport Case from \"case\";\n\nexport function generate(context: GeneratorContext): void {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n const templateFile = path.join(moduleDir, \"templates\", \"HonoRouter.ejs\");\n\n for (const resource of context.normalizedSpec.resources) {\n writeHonoRouter(resource, templateFile, context);\n }\n}\n\nfunction writeHonoRouter(\n resource: NormalizedResource,\n templateFile: string,\n context: GeneratorContext\n): void {\n const pascalCaseEntityName = Case.pascal(resource.name);\n const outputDir = context.getResourceOutputDir(resource.name);\n const outputPath = path.join(outputDir, `${pascalCaseEntityName}Hono.ts`);\n\n const operations = resource.operations\n // Hono handles HEAD requests automatically, so we skip them\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: path.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) {\n const operationId = operation.operationId;\n const className = Case.pascal(operationId);\n const handlerName = `handle${className}Request`;\n\n return {\n operationId,\n className,\n handlerName,\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 generateHonoRouters } from \"./honoRouterGenerator\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport default class HonoPlugin extends BasePlugin {\n public name = \"hono\";\n\n public override generate(context: GeneratorContext): void {\n const libSourceDir = path.join(moduleDir, \"lib\");\n this.copyLibFiles(context, libSourceDir, this.name);\n\n generateHonoRouters(context);\n }\n}\n"],"mappings":";;;;;;AAWA,SAAgB,SAAS,SAAiC;CACxD,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC9D,MAAM,eAAe,KAAK,KAAK,WAAW,aAAa,iBAAiB;AAExE,MAAK,MAAM,YAAY,QAAQ,eAAe,UAC5C,iBAAgB,UAAU,cAAc,QAAQ;;AAIpD,SAAS,gBACP,UACA,cACA,SACM;CACN,MAAM,uBAAuB,KAAK,OAAO,SAAS,KAAK;CACvD,MAAM,YAAY,QAAQ,qBAAqB,SAAS,KAAK;CAC7D,MAAM,aAAa,KAAK,KAAK,WAAW,GAAG,qBAAqB,SAAS;CAEzE,MAAM,aAAa,SAAS,WAEzB,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,KAAK,SAAS,WAAW,QAAQ,UAAU;EACpD,YAAY,SAAS;EACrB;EACA;EACD,CAAC;CAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,SAAQ,UAAU,cAAc,QAAQ;;AAG1C,SAAS,oBAAoB,WAAgC;CAC3D,MAAM,cAAc,UAAU;CAC9B,MAAM,YAAY,KAAK,OAAO,YAAY;AAG1C,QAAO;EACL;EACA;EACA,aALkB,SAAS,UAAU;EAMrC,QAAQ,UAAU;EAClB,MAAM,UAAU;EACjB;;;;ACnDH,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,IAAqB,aAArB,cAAwC,WAAW;CACjD,OAAc;CAEd,SAAyB,SAAiC;EACxD,MAAM,eAAe,KAAK,KAAK,WAAW,MAAM;AAChD,OAAK,aAAa,SAAS,cAAc,KAAK,KAAK;AAEnD,WAAoB,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/honoRouterGenerator.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { HttpMethod } from \"@rexeus/typeweaver-core\";\nimport { compareRoutes, toPascalCase } from \"@rexeus/typeweaver-gen\";\nimport type {\n GeneratorContext,\n NormalizedOperation,\n NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\n\nexport function generate(context: GeneratorContext): void {\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n const templateFile = path.join(moduleDir, \"templates\", \"HonoRouter.ejs\");\n\n for (const resource of context.normalizedSpec.resources) {\n writeHonoRouter(resource, templateFile, context);\n }\n}\n\nfunction writeHonoRouter(\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}Hono.ts`);\n\n const operations = resource.operations\n // Hono handles HEAD requests automatically, so we skip them\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: path.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) {\n const operationId = operation.operationId;\n const className = toPascalCase(operationId);\n const handlerName = `handle${className}Request`;\n\n return {\n operationId,\n className,\n handlerName,\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 generateHonoRouters } from \"./honoRouterGenerator\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport class HonoPlugin extends BasePlugin {\n public name = \"hono\";\n\n public override generate(context: GeneratorContext): void {\n const libSourceDir = path.join(moduleDir, \"lib\");\n this.copyLibFiles(context, libSourceDir, this.name);\n\n generateHonoRouters(context);\n }\n}\n"],"mappings":";;;;;AAUA,SAAgB,SAAS,SAAiC;CACxD,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC9D,MAAM,eAAe,KAAK,KAAK,WAAW,aAAa,iBAAiB;AAExE,MAAK,MAAM,YAAY,QAAQ,eAAe,UAC5C,iBAAgB,UAAU,cAAc,QAAQ;;AAIpD,SAAS,gBACP,UACA,cACA,SACM;CACN,MAAM,uBAAuB,aAAa,SAAS,KAAK;CACxD,MAAM,YAAY,QAAQ,qBAAqB,SAAS,KAAK;CAC7D,MAAM,aAAa,KAAK,KAAK,WAAW,GAAG,qBAAqB,SAAS;CAEzE,MAAM,aAAa,SAAS,WAEzB,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,KAAK,SAAS,WAAW,QAAQ,UAAU;EACpD,YAAY,SAAS;EACrB;EACA;EACD,CAAC;CAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,SAAQ,UAAU,cAAc,QAAQ;;AAG1C,SAAS,oBAAoB,WAAgC;CAC3D,MAAM,cAAc,UAAU;CAC9B,MAAM,YAAY,aAAa,YAAY;AAG3C,QAAO;EACL;EACA;EACA,aALkB,SAAS,UAAU;EAMrC,QAAQ,UAAU;EAClB,MAAM,UAAU;EACjB;;;;AClDH,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,IAAa,aAAb,cAAgC,WAAW;CACzC,OAAc;CAEd,SAAyB,SAAiC;EACxD,MAAM,eAAe,KAAK,KAAK,WAAW,MAAM;AAChD,OAAK,aAAa,SAAS,cAAc,KAAK,KAAK;AAEnD,WAAoB,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexeus/typeweaver-hono",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Generates Hono routers and handlers straight from your API definitions. Powered by Typeweaver 🧵✨",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,17 +47,14 @@
47
47
  "homepage": "https://github.com/rexeus/typeweaver#readme",
48
48
  "peerDependencies": {
49
49
  "hono": "^4.11.0",
50
- "@rexeus/typeweaver-core": "^0.9.1",
51
- "@rexeus/typeweaver-gen": "^0.9.1"
50
+ "@rexeus/typeweaver-core": "^0.10.0",
51
+ "@rexeus/typeweaver-gen": "^0.10.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "hono": "^4.12.9",
55
55
  "test-utils": "file:../test-utils",
56
- "@rexeus/typeweaver-core": "^0.9.1",
57
- "@rexeus/typeweaver-gen": "^0.9.1"
58
- },
59
- "dependencies": {
60
- "case": "^1.6.3"
56
+ "@rexeus/typeweaver-gen": "^0.10.0",
57
+ "@rexeus/typeweaver-core": "^0.10.0"
61
58
  },
62
59
  "scripts": {
63
60
  "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",