hono-takibi 0.8.5 → 0.8.6

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.
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { fmt } from '../format/index.js';
3
3
  import { mkdir, writeFile } from '../fsp/index.js';
4
- import { zodOpenAPIHono } from '../generator/zod-openapi-hono/openapi/index.js';
4
+ import zodOpenAPIHono from '../generator/zod-openapi-hono/openapi/index.js';
5
5
  import { parseOpenAPI } from '../openapi/index.js';
6
6
  import { asyncAndThen, ok } from '../result/index.js';
7
7
  import { templateCode } from './template-code.js';
@@ -1,7 +1,7 @@
1
1
  import { wrap } from '../../../helper/wrap.js';
2
2
  import { zodToOpenAPI } from '../../../helper/zod-to-openapi.js';
3
3
  import { refSchema } from '../../../utils/index.js';
4
- import { zod } from '../index.js';
4
+ import zod from '../index.js';
5
5
  /**
6
6
  * Generates a Zod-compatible schema string for a given property.
7
7
  *
@@ -51,4 +51,4 @@ import type { Schema } from '../../openapi/index.js';
51
51
  * - Optimizes out redundant `.min()` when `.gt()` is used
52
52
  * - Logs unhandled cases to `console.warn`
53
53
  */
54
- export declare function zod(schema: Schema): string;
54
+ export default function zod(schema: Schema): string;
@@ -59,7 +59,7 @@ import { _enum, array, boolean, date, integer, number, object, string } from './
59
59
  * - Optimizes out redundant `.min()` when `.gt()` is used
60
60
  * - Logs unhandled cases to `console.warn`
61
61
  */
62
- export function zod(schema) {
62
+ export default function zod(schema) {
63
63
  if (schema === undefined)
64
64
  throw new Error('hono-takibi: only #/components/schemas/* is supported');
65
65
  /* $ref */
@@ -1,5 +1,5 @@
1
1
  import { wrap } from '../../../helper/wrap.js';
2
- import { zod } from '../index.js';
2
+ import zod from '../index.js';
3
3
  export function array(schema) {
4
4
  const array = `z.array(${schema.items ? zod(schema.items) : 'z.any()'})`;
5
5
  if (typeof schema.minItems === 'number' && typeof schema.maxItems === 'number') {
@@ -4,7 +4,7 @@ import { not } from '../../../helper/not.js';
4
4
  import { oneOf } from '../../../helper/oneof.js';
5
5
  import { wrap } from '../../../helper/wrap.js';
6
6
  import { propertiesSchema } from '../helper/properties-schema.js';
7
- import { zod } from '../index.js';
7
+ import zod from '../index.js';
8
8
  /**
9
9
  * Generates a Zod object schema from an OpenAPI schema definition.
10
10
  *
@@ -1,7 +1,7 @@
1
1
  import { resolveSchemasDependencies } from '../../../../helper/resolve-schemas-dependencies.js';
2
2
  import { zodToOpenAPI } from '../../../../helper/zod-to-openapi.js';
3
3
  import { zodToOpenAPISchema } from '../../../../helper/zod-to-openapi-schema.js';
4
- import { zod } from '../../../zod/index.js';
4
+ import zod from '../../../zod/index.js';
5
5
  /**
6
6
  * Converts OpenAPI component schemas to Zod-based TypeScript definitions.
7
7
  *
@@ -7,4 +7,4 @@ import type { OpenAPI } from '../../../openapi/index.js';
7
7
  * @param exportType - Whether to export inferred TypeScript types
8
8
  * @returns The generated TypeScript code string
9
9
  */
10
- export declare function zodOpenAPIHono(openapi: OpenAPI, exportSchema: boolean, exportType: boolean): string;
10
+ export default function zodOpenAPIHono(openapi: OpenAPI, exportSchema: boolean, exportType: boolean): string;
@@ -8,7 +8,7 @@ import { routeCode } from './route/index.js';
8
8
  * @param exportType - Whether to export inferred TypeScript types
9
9
  * @returns The generated TypeScript code string
10
10
  */
11
- export function zodOpenAPIHono(openapi, exportSchema, exportType) {
11
+ export default function zodOpenAPIHono(openapi, exportSchema, exportType) {
12
12
  const components = openapi.components
13
13
  ? componentsCode(openapi.components, exportSchema, exportType)
14
14
  : '';
@@ -1,6 +1,6 @@
1
1
  import { zodToOpenAPI } from '../../../../../helper/zod-to-openapi.js';
2
2
  import { getToSafeIdentifier } from '../../../../../utils/index.js';
3
- import { zod } from '../../../../zod/index.js';
3
+ import zod from '../../../../zod/index.js';
4
4
  import { queryParameter } from './index.js';
5
5
  /**
6
6
  * Converts OpenAPI component schemas into TypeScript code using Zod.
@@ -1,4 +1,4 @@
1
- import { zod } from '../generator/zod/index.js';
1
+ import zod from '../generator/zod/index.js';
2
2
  import { wrap } from './wrap.js';
3
3
  export function allOf(schema) {
4
4
  if (!schema.allOf || schema.allOf.length === 0) {
@@ -1,4 +1,4 @@
1
- import { zod } from '../generator/zod/index.js';
1
+ import zod from '../generator/zod/index.js';
2
2
  import { wrap } from './wrap.js';
3
3
  /**
4
4
  * Converts an OpenAPI `anyOf` schema into a Zod union expression.
@@ -1,4 +1,4 @@
1
- import { zod } from '../generator/zod/index.js';
1
+ import zod from '../generator/zod/index.js';
2
2
  import { wrap } from './wrap.js';
3
3
  /**
4
4
  * Converts an OpenAPI `oneOf` schema to a Zod union expression.
@@ -1,7 +1,7 @@
1
1
  import fsp from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fmt } from '../format/index.js';
4
- import { zodOpenAPIHono } from '../generator/zod-openapi-hono/openapi/index.js';
4
+ import zodOpenAPIHono from '../generator/zod-openapi-hono/openapi/index.js';
5
5
  import { parseOpenAPI } from '../openapi/index.js';
6
6
  export default async function HonoTakibiVite({ input, output, exportType = true, exportSchema = true, }) {
7
7
  const run = async () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hono-takibi",
3
3
  "description": "Hono Takibi is a CLI tool that generates Hono routes from OpenAPI specifications.",
4
- "version": "0.8.5",
4
+ "version": "0.8.6",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "keywords": [