Skip to content

Commit 37023fd

Browse files
committed
refactor: reorganize the directory file structure
1 parent 100eb5e commit 37023fd

File tree

85 files changed

+1386
-439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1386
-439
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/* v8 ignore start */
2-
31
import type { Node } from "ts-morph";
4-
import type { OperationData, ParseContext } from "@/types";
2+
import type { OperationData, ParseContext } from "@/types/parser";
53

64
/**
75
* 代码分析器抽象基类,用于分析代码结构并提取API信息
6+
*
7+
* @category Analyzers
88
*/
99
export abstract class CodeAnalyzer {
1010
/**

src/analyzers/ExpressFrameworkAnalyzer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createParseContext, createProject } from "@tests/utils";
22
import type { Node } from "ts-morph";
33
import { SyntaxKind } from "typescript";
44
import { beforeEach, describe, expect, it } from "vitest";
5-
import { CodeAnalyzer } from "@/core/CodeAnalyzer";
6-
import type { OperationData, ParseContext } from "@/types";
5+
import { CodeAnalyzer } from "@/analyzers/CodeAnalyzer";
6+
import type { OperationData, ParseContext } from "@/types/parser";
77
import { ExpressFrameworkAnalyzer } from "./ExpressFrameworkAnalyzer";
88

99
class CustomTestAnalyzer extends CodeAnalyzer {

src/analyzers/ExpressFrameworkAnalyzer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { Node } from "ts-morph";
22
import { SyntaxKind } from "typescript";
33
import { VALID_HTTP_METHODS } from "@/constants";
4-
import { CodeAnalyzerRegistry } from "@/core/CodeAnalyzerRegistry";
5-
import { FrameworkAnalyzer } from "@/core/FrameworkAnalyzer";
6-
import type { OperationData, ParseContext } from "@/types";
4+
import { CodeAnalyzerRegistry } from "@/registry/CodeAnalyzerRegistry";
5+
import type { OperationData, ParseContext } from "@/types/parser";
76
import { ExpressRouteCodeAnalyzer } from "./ExpressRouteCodeAnalyzer";
87
import { ExpressZodValidationCodeAnalyzer } from "./ExpressZodValidationCodeAnalyzer";
8+
import { FrameworkAnalyzer } from "./FrameworkAnalyzer";
99

1010
/**
1111
* Express框架分析器,用于分析Express应用的各种节点类型。

src/analyzers/ExpressRouteCodeAnalyzer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createParseContext } from "@tests/utils";
22
import { SyntaxKind } from "typescript";
33
import { beforeEach, describe, expect, it } from "vitest";
4-
import type { ParseContext } from "@/types";
4+
import type { ParseContext } from "@/types/parser";
55
import { ExpressRouteCodeAnalyzer } from "./ExpressRouteCodeAnalyzer";
66

77
describe("ExpressRouteCodeAnalyzer", () => {

src/analyzers/ExpressRouteCodeAnalyzer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { basename, extname } from "node:path";
22
import { pascal } from "radashi";
33
import type { Node } from "ts-morph";
44
import { SyntaxKind } from "typescript";
5-
import type { HttpMethod } from "@/constants";
6-
import { CodeAnalyzer } from "@/core";
7-
import type { OperationData } from "@/types";
5+
import type { HttpMethod } from "@/types/common";
6+
import type { OperationData } from "@/types/parser";
7+
import { CodeAnalyzer } from "./CodeAnalyzer";
88

99
/**
1010
* 路由信息分析结果

src/analyzers/ExpressZodValidationCodeAnalyzer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createParseContext, createProject } from "@tests/utils";
22
import type { Project } from "ts-morph";
33
import { SyntaxKind } from "typescript";
44
import { beforeEach, describe, expect, it } from "vitest";
5-
import type { ParseContext } from "@/types";
5+
import type { ParseContext } from "@/types/parser";
66
import { ExpressZodValidationCodeAnalyzer } from "./ExpressZodValidationCodeAnalyzer";
77

88
describe("ExpressZodValidationCodeAnalyzer", () => {

src/analyzers/ExpressZodValidationCodeAnalyzer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import type { Node } from "ts-morph";
22
import { SyntaxKind } from "typescript";
33
import z from "zod/v4";
44
import type { JSONSchema } from "zod/v4/core";
5-
import type { ParameterIn } from "@/constants";
6-
import { CodeAnalyzer } from "@/core";
7-
import { isZodType } from "@/helpers";
5+
import { isZodType } from "@/helpers/zod";
6+
import type { ParameterIn } from "@/types/common";
87
import type {
98
ExampleObject,
10-
OperationData,
119
ParameterObject,
1210
RequestBodyObject,
1311
SchemaObject,
14-
} from "@/types";
12+
} from "@/types/openapi";
13+
import type { OperationData } from "@/types/parser";
14+
import { CodeAnalyzer } from "./CodeAnalyzer";
1515

1616
/**
1717
* Express Zod 验证中间件代码分析器,负责从 Express 路由中的 validateRequest 中间件调用中提取 Zod schema
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/* v8 ignore start */
2-
31
import type { Node } from "ts-morph";
4-
import type { OperationData, ParseContext } from "@/types";
2+
import type { OperationData, ParseContext } from "@/types/parser";
53

64
/**
75
* 框架分析器抽象基类,用于分析特定框架的代码结构并提取API信息
6+
*
7+
* @category Analyzers
88
*/
99
export abstract class FrameworkAnalyzer {
1010
/**

src/analyzers/index.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* v8 ignore start */
2-
31
/**
42
* 构建器基础接口,定义所有构建器的通用契约
3+
*
4+
* @category Builders
55
*/
66
export interface Builder<T> {
77
/**

0 commit comments

Comments
 (0)