@zipbul/gildash 0.13.0 → 0.15.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.js +9 -9
- package/dist/migrations/0008_external_imports.sql +26 -0
- package/dist/migrations/meta/_journal.json +7 -0
- package/dist/src/common/path-utils.d.ts +8 -0
- package/dist/src/errors.d.ts +0 -10
- package/dist/src/extractor/imports-extractor.d.ts +4 -2
- package/dist/src/extractor/relation-extractor.d.ts +2 -2
- package/dist/src/extractor/types.d.ts +5 -3
- package/dist/src/gildash/context.d.ts +1 -1
- package/dist/src/gildash/index.d.ts +1 -0
- package/dist/src/gildash/semantic-api.d.ts +2 -0
- package/dist/src/gildash/types.d.ts +15 -23
- package/dist/src/index.d.ts +8 -3
- package/dist/src/indexer/index-coordinator.d.ts +5 -4
- package/dist/src/indexer/relation-indexer.d.ts +6 -2
- package/dist/src/parser/ast-utils.d.ts +0 -4
- package/dist/src/parser/index.d.ts +1 -1
- package/dist/src/parser/jsdoc-parser.d.ts +1 -1
- package/dist/src/parser/parse-source.d.ts +1 -1
- package/dist/src/parser/types.d.ts +3 -1
- package/dist/src/search/annotation-search.d.ts +1 -1
- package/dist/src/search/relation-search.d.ts +9 -3
- package/dist/src/search/symbol-search.d.ts +50 -6
- package/dist/src/semantic/index.d.ts +8 -1
- package/dist/src/semantic/tsc-program.d.ts +1 -1
- package/dist/src/semantic/type-collector.d.ts +7 -0
- package/dist/src/semantic/types.d.ts +9 -0
- package/dist/src/store/connection.d.ts +1 -1
- package/dist/src/store/repositories/annotation.repository.d.ts +1 -1
- package/dist/src/store/repositories/relation.repository.d.ts +8 -3
- package/dist/src/store/repositories/symbol.repository.d.ts +1 -1
- package/dist/src/store/schema.d.ts +38 -2
- package/dist/src/watcher/project-watcher.d.ts +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_relations` (
|
|
3
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
4
|
+
`project` text NOT NULL,
|
|
5
|
+
`type` text NOT NULL,
|
|
6
|
+
`src_file_path` text NOT NULL,
|
|
7
|
+
`src_symbol_name` text,
|
|
8
|
+
`dst_project` text,
|
|
9
|
+
`dst_file_path` text,
|
|
10
|
+
`dst_symbol_name` text,
|
|
11
|
+
`meta_json` text,
|
|
12
|
+
`specifier` text,
|
|
13
|
+
`is_external` integer NOT NULL DEFAULT 0,
|
|
14
|
+
FOREIGN KEY (`project`,`src_file_path`) REFERENCES `files`(`project`,`file_path`) ON UPDATE no action ON DELETE cascade
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
INSERT INTO `__new_relations`("id", "project", "type", "src_file_path", "src_symbol_name", "dst_project", "dst_file_path", "dst_symbol_name", "meta_json", "specifier", "is_external") SELECT "id", "project", "type", "src_file_path", "src_symbol_name", "dst_project", "dst_file_path", "dst_symbol_name", "meta_json", NULL, 0 FROM `relations`;--> statement-breakpoint
|
|
18
|
+
DROP TABLE `relations`;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE `__new_relations` RENAME TO `relations`;--> statement-breakpoint
|
|
20
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
21
|
+
CREATE INDEX `idx_relations_src` ON `relations` (`project`,`src_file_path`);--> statement-breakpoint
|
|
22
|
+
CREATE INDEX `idx_relations_dst` ON `relations` (`dst_project`,`dst_file_path`);--> statement-breakpoint
|
|
23
|
+
CREATE INDEX `idx_relations_type` ON `relations` (`project`,`type`);--> statement-breakpoint
|
|
24
|
+
CREATE INDEX `idx_relations_project_type_src` ON `relations` (`project`,`type`,`src_file_path`);--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `idx_relations_specifier` ON `relations` (`project`,`specifier`);--> statement-breakpoint
|
|
26
|
+
INSERT OR REPLACE INTO sqlite_sequence (name, seq) SELECT 'relations', COALESCE(MAX(id), 0) FROM relations;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a file path to always use forward slashes.
|
|
3
|
+
*
|
|
4
|
+
* On Windows, Node.js `path.resolve` / `path.relative` return backslash
|
|
5
|
+
* separators. Gildash stores and returns forward-slash paths exclusively,
|
|
6
|
+
* so every path that enters the system must pass through this function.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePath(p: string): string;
|
|
1
9
|
export declare function toRelativePath(projectRoot: string, absolutePath: string): string;
|
|
2
10
|
export declare function toAbsolutePath(projectRoot: string, relativePath: string): string;
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -12,13 +12,3 @@ export declare class GildashError extends Error {
|
|
|
12
12
|
cause?: unknown;
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Factory function that creates a {@link GildashError} value.
|
|
17
|
-
*
|
|
18
|
-
* @param type - One of the {@link GildashErrorType} variants.
|
|
19
|
-
* @param message - Human-readable description of the error.
|
|
20
|
-
* @param cause - Optional root cause (any value). When `undefined`, the `cause`
|
|
21
|
-
* property is omitted from the returned object entirely.
|
|
22
|
-
* @deprecated Use `new GildashError(type, message, { cause })` instead.
|
|
23
|
-
*/
|
|
24
|
-
export declare function gildashError(type: GildashErrorType, message: string, cause?: unknown): GildashError;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Program } from 'oxc-parser';
|
|
1
|
+
import type { Program, EcmaScriptModule } from 'oxc-parser';
|
|
2
2
|
import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
3
3
|
import type { CodeRelation } from './types';
|
|
4
|
-
|
|
4
|
+
type ResolveImportFn = (currentFilePath: string, importPath: string, tsconfigPaths?: TsconfigPaths) => string[];
|
|
5
|
+
export declare function extractImports(ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths, resolveImportFn?: ResolveImportFn, module?: EcmaScriptModule): CodeRelation[];
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Program } from 'oxc-parser';
|
|
1
|
+
import type { Program, EcmaScriptModule } from 'oxc-parser';
|
|
2
2
|
import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
3
3
|
import type { CodeRelation } from './types';
|
|
4
4
|
export type ResolveImportFn = (currentFilePath: string, importPath: string, tsconfigPaths?: TsconfigPaths) => string[];
|
|
5
|
-
export declare function extractRelations(ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths, resolveImportFn?: ResolveImportFn): CodeRelation[];
|
|
5
|
+
export declare function extractRelations(ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths, resolveImportFn?: ResolveImportFn, module?: EcmaScriptModule): CodeRelation[];
|
|
@@ -11,7 +11,7 @@ import type { SourcePosition, SourceSpan } from '../parser/types';
|
|
|
11
11
|
* - `'enum'` — enum declarations
|
|
12
12
|
* - `'property'` — class properties and interface/type members
|
|
13
13
|
*/
|
|
14
|
-
export type SymbolKind = 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'property';
|
|
14
|
+
export type SymbolKind = 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'namespace' | 'property';
|
|
15
15
|
/**
|
|
16
16
|
* TypeScript declaration modifiers attached to a symbol.
|
|
17
17
|
*/
|
|
@@ -154,14 +154,16 @@ export interface CodeRelation {
|
|
|
154
154
|
srcFilePath: string;
|
|
155
155
|
/** Source symbol name, or `null` for module-level relationships. */
|
|
156
156
|
srcSymbolName: string | null;
|
|
157
|
-
/** File path of the target. */
|
|
158
|
-
dstFilePath: string;
|
|
157
|
+
/** File path of the target. `null` for external/unresolved imports. */
|
|
158
|
+
dstFilePath: string | null;
|
|
159
159
|
/** Target symbol name, or `null` for module-level imports. */
|
|
160
160
|
dstSymbolName: string | null;
|
|
161
161
|
/** Optional JSON-encoded metadata about the relation. */
|
|
162
162
|
metaJson?: string;
|
|
163
163
|
/** Parsed metadata object derived from `metaJson`. */
|
|
164
164
|
meta?: Record<string, unknown>;
|
|
165
|
+
/** Raw import specifier (e.g. `'lodash'`, `'./missing'`). Present for unresolved/external imports. */
|
|
166
|
+
specifier?: string;
|
|
165
167
|
}
|
|
166
168
|
export type AnnotationSource = 'jsdoc' | 'line' | 'block';
|
|
167
169
|
export interface ExtractedAnnotation {
|
|
@@ -57,7 +57,7 @@ export type CoordinatorLike = Pick<IndexCoordinator, 'fullIndex' | 'shutdown' |
|
|
|
57
57
|
handleWatcherEvent?(event: FileChangeEvent): void;
|
|
58
58
|
};
|
|
59
59
|
export type WatcherLike = Pick<ProjectWatcher, 'start' | 'close'>;
|
|
60
|
-
export type SemanticLayerLike = Pick<SemanticLayer, 'collectTypeAt' | 'collectFileTypes' | 'findReferences' | 'findImplementations' | 'isTypeAssignableTo' | 'isTypeAssignableToType' | 'getModuleInterface' | 'getSymbolNode' | 'getDiagnostics' | 'notifyFileChanged' | 'notifyFileDeleted' | 'dispose' | 'isDisposed' | 'lineColumnToPosition' | 'findNamePosition'>;
|
|
60
|
+
export type SemanticLayerLike = Pick<SemanticLayer, 'collectTypeAt' | 'collectFileTypes' | 'findReferences' | 'findImplementations' | 'isTypeAssignableTo' | 'isTypeAssignableToType' | 'getModuleInterface' | 'getSymbolNode' | 'getBaseTypes' | 'getDiagnostics' | 'notifyFileChanged' | 'notifyFileDeleted' | 'dispose' | 'isDisposed' | 'lineColumnToPosition' | 'findNamePosition'>;
|
|
61
61
|
/** Internal shared state for all Gildash API modules. */
|
|
62
62
|
export interface GildashContext {
|
|
63
63
|
readonly projectRoot: string;
|
|
@@ -118,6 +118,7 @@ export declare class Gildash {
|
|
|
118
118
|
lineColumnToPosition(filePath: string, line: number, column: number): number | null;
|
|
119
119
|
findNamePosition(filePath: string, declarationPos: number, name: string): number | null;
|
|
120
120
|
getSymbolNode(filePath: string, position: number): SymbolNode | null;
|
|
121
|
+
getBaseTypes(filePath: string, position: number): ResolvedType[] | null;
|
|
121
122
|
getSemanticDiagnostics(filePath: string, options?: GetDiagnosticsOptions): SemanticDiagnostic[];
|
|
122
123
|
diffSymbols(before: SymbolSearchResult[], after: SymbolSearchResult[]): SymbolDiff;
|
|
123
124
|
onIndexed(callback: (result: IndexResult) => void): () => void;
|
|
@@ -38,6 +38,8 @@ export declare function isTypeAssignableToAt(ctx: GildashContext, opts: {
|
|
|
38
38
|
}): boolean | null;
|
|
39
39
|
/** Retrieve the semantic module interface — exported symbols with resolved types. */
|
|
40
40
|
export declare function getSemanticModuleInterface(ctx: GildashContext, filePath: string): SemanticModuleInterface;
|
|
41
|
+
/** Retrieve the base types (supertypes) of a class/interface at a byte offset. */
|
|
42
|
+
export declare function getBaseTypes(ctx: GildashContext, filePath: string, position: number): ResolvedType[] | null;
|
|
41
43
|
/** Retrieve the resolved type at a byte offset without line/column conversion. */
|
|
42
44
|
export declare function getResolvedTypeAtPosition(ctx: GildashContext, filePath: string, position: number): ResolvedType | null;
|
|
43
45
|
/** Find all semantic references at a byte offset. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ParsedFile } from '../parser/types';
|
|
2
|
-
import type { SymbolSearchResult } from '../search/symbol-search';
|
|
3
|
-
import type { SymbolKind } from '../extractor/types';
|
|
2
|
+
import type { SymbolSearchResult, SymbolDetail } from '../search/symbol-search';
|
|
3
|
+
import type { SymbolKind, Decorator } from '../extractor/types';
|
|
4
4
|
import type { ResolvedType } from '../semantic/types';
|
|
5
5
|
/**
|
|
6
6
|
* Minimal logger interface accepted by {@link Gildash}.
|
|
@@ -52,32 +52,24 @@ export interface HeritageNode {
|
|
|
52
52
|
/**
|
|
53
53
|
* Full symbol detail including members, documentation, and type information.
|
|
54
54
|
* Returned by {@link Gildash.getFullSymbol}.
|
|
55
|
+
*
|
|
56
|
+
* Fields are lifted directly from {@link SymbolDetail} for convenient access.
|
|
55
57
|
*/
|
|
56
58
|
export interface FullSymbol extends SymbolSearchResult {
|
|
57
59
|
/** Class/interface members (methods, properties, constructors, accessors). */
|
|
58
|
-
members?:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
isReadonly?: boolean;
|
|
65
|
-
}>;
|
|
66
|
-
/** JSDoc comment attached to the symbol. */
|
|
67
|
-
jsDoc?: string;
|
|
68
|
-
/** Stringified parameter list (functions/methods). */
|
|
69
|
-
parameters?: string;
|
|
70
|
-
/** Stringified return type (functions/methods). */
|
|
60
|
+
members?: SymbolDetail['members'];
|
|
61
|
+
/** Parsed JSDoc comment attached to the symbol. */
|
|
62
|
+
jsDoc?: SymbolDetail['jsDoc'];
|
|
63
|
+
/** Function/method parameters. */
|
|
64
|
+
parameters?: SymbolDetail['parameters'];
|
|
65
|
+
/** Return type annotation as source text. */
|
|
71
66
|
returnType?: string;
|
|
72
|
-
/**
|
|
73
|
-
heritage?:
|
|
67
|
+
/** Heritage clauses (`extends` / `implements`). */
|
|
68
|
+
heritage?: SymbolDetail['heritage'];
|
|
74
69
|
/** Decorators applied to the symbol. */
|
|
75
|
-
decorators?:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}>;
|
|
79
|
-
/** Stringified type parameters (generic symbols). */
|
|
80
|
-
typeParameters?: string;
|
|
70
|
+
decorators?: Decorator[];
|
|
71
|
+
/** Generic type parameter names. */
|
|
72
|
+
typeParameters?: string[];
|
|
81
73
|
/** Resolved type from the Semantic Layer (available when `semantic: true`). */
|
|
82
74
|
resolvedType?: ResolvedType;
|
|
83
75
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { Gildash } from "./gildash";
|
|
2
2
|
export type { GildashOptions, Logger, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol } from "./gildash";
|
|
3
|
-
export { GildashError
|
|
3
|
+
export { GildashError } from "./errors";
|
|
4
4
|
export type { GildashErrorType } from "./errors";
|
|
5
5
|
export { symbolSearch } from "./search/symbol-search";
|
|
6
|
-
export type { SymbolSearchQuery, SymbolSearchResult } from "./search/symbol-search";
|
|
6
|
+
export type { SymbolSearchQuery, SymbolSearchResult, SymbolDetail } from "./search/symbol-search";
|
|
7
7
|
export { relationSearch } from "./search/relation-search";
|
|
8
8
|
export type { RelationSearchQuery, StoredCodeRelation } from "./search/relation-search";
|
|
9
9
|
export { DependencyGraph } from "./search/dependency-graph";
|
|
@@ -11,7 +11,7 @@ export { patternSearch } from "./search/pattern-search";
|
|
|
11
11
|
export type { PatternMatch, PatternSearchOptions } from "./search/pattern-search";
|
|
12
12
|
export type { IndexResult } from "./indexer/index-coordinator";
|
|
13
13
|
export type { ProjectBoundary } from "./common/project-discovery";
|
|
14
|
-
export type { CodeRelation, SymbolKind } from "./extractor/types";
|
|
14
|
+
export type { CodeRelation, SymbolKind, Decorator, Parameter, Heritage, Modifier, JsDocBlock, JsDocTag } from "./extractor/types";
|
|
15
15
|
export type { SymbolStats } from "./store/repositories/symbol.repository";
|
|
16
16
|
export type { WatcherRole } from "./watcher/types";
|
|
17
17
|
export type { ParsedFile } from "./parser/types";
|
|
@@ -21,3 +21,8 @@ export type { SymbolNode } from "./semantic/symbol-graph";
|
|
|
21
21
|
export type { AnnotationSource, ExtractedAnnotation } from "./extractor/types";
|
|
22
22
|
export type { AnnotationSearchQuery, AnnotationSearchResult } from "./search/annotation-search";
|
|
23
23
|
export type { SymbolChange, SymbolChangeType, SymbolChangeQueryOptions } from "./gildash/types";
|
|
24
|
+
export { buildLineOffsets, getLineColumn } from './parser/source-position';
|
|
25
|
+
export type { SourcePosition, SourceSpan } from './parser/types';
|
|
26
|
+
export type { Program, Node } from 'oxc-parser';
|
|
27
|
+
export { Visitor, visitorKeys } from 'oxc-parser';
|
|
28
|
+
export type { VisitorObject } from 'oxc-parser';
|
|
@@ -79,19 +79,19 @@ export interface IndexResult {
|
|
|
79
79
|
added: Array<{
|
|
80
80
|
type: string;
|
|
81
81
|
srcFilePath: string;
|
|
82
|
-
dstFilePath: string;
|
|
82
|
+
dstFilePath: string | null;
|
|
83
83
|
srcSymbolName: string | null;
|
|
84
84
|
dstSymbolName: string | null;
|
|
85
|
-
dstProject: string;
|
|
85
|
+
dstProject: string | null;
|
|
86
86
|
metaJson: string | null;
|
|
87
87
|
}>;
|
|
88
88
|
removed: Array<{
|
|
89
89
|
type: string;
|
|
90
90
|
srcFilePath: string;
|
|
91
|
-
dstFilePath: string;
|
|
91
|
+
dstFilePath: string | null;
|
|
92
92
|
srcSymbolName: string | null;
|
|
93
93
|
dstSymbolName: string | null;
|
|
94
|
-
dstProject: string;
|
|
94
|
+
dstProject: string | null;
|
|
95
95
|
metaJson: string | null;
|
|
96
96
|
}>;
|
|
97
97
|
};
|
|
@@ -132,6 +132,7 @@ export interface IndexCoordinatorOptions {
|
|
|
132
132
|
newDstProject?: string;
|
|
133
133
|
}): void;
|
|
134
134
|
deleteFileRelations(project: string, filePath: string): void;
|
|
135
|
+
deleteIncomingRelations(dstProject: string, dstFilePath: string): void;
|
|
135
136
|
getOutgoing(project: string, srcFilePath: string): RelationRecord[];
|
|
136
137
|
};
|
|
137
138
|
annotationRepo?: {
|
|
@@ -6,10 +6,12 @@ export interface RelationDbRow {
|
|
|
6
6
|
type: string;
|
|
7
7
|
srcFilePath: string;
|
|
8
8
|
srcSymbolName: string | null;
|
|
9
|
-
dstProject: string;
|
|
10
|
-
dstFilePath: string;
|
|
9
|
+
dstProject: string | null;
|
|
10
|
+
dstFilePath: string | null;
|
|
11
11
|
dstSymbolName: string | null;
|
|
12
12
|
metaJson: string | null;
|
|
13
|
+
specifier: string | null;
|
|
14
|
+
isExternal: number;
|
|
13
15
|
}
|
|
14
16
|
interface RelationRepoPart {
|
|
15
17
|
replaceFileRelations(project: string, filePath: string, relations: RelationDbRow[]): void;
|
|
@@ -25,6 +27,8 @@ export interface IndexFileRelationsOptions {
|
|
|
25
27
|
knownFiles?: Set<string>;
|
|
26
28
|
/** 프로젝트 경계 목록 (dstProject 결정용) */
|
|
27
29
|
boundaries?: ProjectBoundary[];
|
|
30
|
+
/** Pre-extracted module metadata for re-export pattern B/C detection. */
|
|
31
|
+
module?: import('oxc-parser').EcmaScriptModule;
|
|
28
32
|
}
|
|
29
33
|
export declare function indexFileRelations(opts: IndexFileRelationsOptions): number;
|
|
30
34
|
export {};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { QualifiedName } from '../extractor/types';
|
|
2
|
-
export declare function isNode(value: unknown): value is Record<string, unknown>;
|
|
3
|
-
export declare function isNodeArray(value: unknown): value is ReadonlyArray<unknown>;
|
|
4
|
-
export declare function visit(node: unknown, callback: (node: Record<string, unknown>) => void): void;
|
|
5
|
-
export declare function collectNodes(root: unknown, predicate: (node: Record<string, unknown>) => boolean): Record<string, unknown>[];
|
|
6
2
|
export declare function getNodeHeader(node: Record<string, unknown>, parent?: Record<string, unknown> | null): string;
|
|
7
3
|
export declare function isFunctionNode(node: Record<string, unknown>): boolean;
|
|
8
4
|
export declare function getNodeName(node: unknown): string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parseSource } from './parse-source';
|
|
2
2
|
export { ParseCache } from './parse-cache';
|
|
3
3
|
export { buildLineOffsets, getLineColumn, } from './source-position';
|
|
4
|
-
export {
|
|
4
|
+
export { getNodeHeader, isFunctionNode, getNodeName, getStringLiteralValue, getQualifiedName, } from './ast-utils';
|
|
5
5
|
export { parseJsDoc } from './jsdoc-parser';
|
|
6
6
|
export type { ParsedFile, SourcePosition, SourceSpan } from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Result } from '@zipbul/result';
|
|
2
2
|
import type { JsDocBlock } from '../extractor/types';
|
|
3
|
-
import {
|
|
3
|
+
import { GildashError } from '../errors';
|
|
4
4
|
export declare function parseJsDoc(commentText: string): Result<JsDocBlock, GildashError>;
|
|
@@ -2,5 +2,5 @@ import { type Result } from '@zipbul/result';
|
|
|
2
2
|
import { parseSync as defaultParseSync } from 'oxc-parser';
|
|
3
3
|
import type { ParserOptions } from 'oxc-parser';
|
|
4
4
|
import type { ParsedFile } from './types';
|
|
5
|
-
import {
|
|
5
|
+
import { GildashError } from '../errors';
|
|
6
6
|
export declare function parseSource(filePath: string, sourceText: string, options?: ParserOptions, parseSyncFn?: typeof defaultParseSync): Result<ParsedFile, GildashError>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Program, Comment, OxcError } from 'oxc-parser';
|
|
1
|
+
import type { Program, Comment, OxcError, EcmaScriptModule } from 'oxc-parser';
|
|
2
2
|
export interface SourcePosition {
|
|
3
3
|
line: number;
|
|
4
4
|
column: number;
|
|
@@ -31,4 +31,6 @@ export interface ParsedFile {
|
|
|
31
31
|
comments: readonly Comment[];
|
|
32
32
|
/** Raw source text that was parsed. */
|
|
33
33
|
sourceText: string;
|
|
34
|
+
/** Pre-extracted ESM module metadata (imports, exports, dynamic imports). */
|
|
35
|
+
module: EcmaScriptModule;
|
|
34
36
|
}
|
|
@@ -5,7 +5,7 @@ import type { RelationRecord } from '../store/repositories/relation.repository';
|
|
|
5
5
|
* as stored in the relation index.
|
|
6
6
|
*/
|
|
7
7
|
export interface StoredCodeRelation extends CodeRelation {
|
|
8
|
-
dstProject: string;
|
|
8
|
+
dstProject: string | null;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Filters for {@link relationSearch}.
|
|
@@ -31,8 +31,12 @@ export interface RelationSearchQuery {
|
|
|
31
31
|
type?: CodeRelation['type'];
|
|
32
32
|
/** Limit results to this project. */
|
|
33
33
|
project?: string;
|
|
34
|
-
/** Maximum number of results.
|
|
34
|
+
/** Maximum number of results. When omitted, no limit is applied. */
|
|
35
35
|
limit?: number;
|
|
36
|
+
/** Filter by raw import specifier. */
|
|
37
|
+
specifier?: string;
|
|
38
|
+
/** Filter by external package flag. */
|
|
39
|
+
isExternal?: boolean;
|
|
36
40
|
}
|
|
37
41
|
export interface IRelationRepo {
|
|
38
42
|
searchRelations(opts: {
|
|
@@ -43,7 +47,9 @@ export interface IRelationRepo {
|
|
|
43
47
|
dstProject?: string;
|
|
44
48
|
type?: string;
|
|
45
49
|
project?: string;
|
|
46
|
-
|
|
50
|
+
specifier?: string;
|
|
51
|
+
isExternal?: boolean;
|
|
52
|
+
limit?: number;
|
|
47
53
|
}): RelationRecord[];
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SymbolKind } from '../extractor/types';
|
|
1
|
+
import type { SymbolKind, Modifier, Decorator, JsDocBlock } from '../extractor/types';
|
|
2
2
|
import type { SymbolRecord } from '../store/repositories/symbol.repository';
|
|
3
3
|
/**
|
|
4
4
|
* Filters for {@link symbolSearch}.
|
|
@@ -18,7 +18,7 @@ export interface SymbolSearchQuery {
|
|
|
18
18
|
isExported?: boolean;
|
|
19
19
|
/** Limit results to this project. Defaults to the primary project. */
|
|
20
20
|
project?: string;
|
|
21
|
-
/** Maximum number of results.
|
|
21
|
+
/** Maximum number of results. When omitted, no limit is applied. */
|
|
22
22
|
limit?: number;
|
|
23
23
|
/**
|
|
24
24
|
* Filter by decorator name (LEG-1).
|
|
@@ -36,6 +36,48 @@ export interface SymbolSearchQuery {
|
|
|
36
36
|
*/
|
|
37
37
|
resolvedType?: string;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Typed detail fields stored in the symbol's `detailJson` column.
|
|
41
|
+
*
|
|
42
|
+
* These fields match what {@link buildDetailJson} in `symbol-indexer.ts` serialises.
|
|
43
|
+
* Not every field is present on every symbol — only the fields relevant to the
|
|
44
|
+
* symbol's kind are populated.
|
|
45
|
+
*/
|
|
46
|
+
export interface SymbolDetail {
|
|
47
|
+
/** Function/method parameters. */
|
|
48
|
+
parameters?: Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
type?: string;
|
|
51
|
+
isOptional: boolean;
|
|
52
|
+
defaultValue?: string;
|
|
53
|
+
decorators?: Decorator[];
|
|
54
|
+
}>;
|
|
55
|
+
/** Return type annotation as source text. */
|
|
56
|
+
returnType?: string;
|
|
57
|
+
/** Heritage clauses (`extends` / `implements`). */
|
|
58
|
+
heritage?: Array<{
|
|
59
|
+
kind: 'extends' | 'implements';
|
|
60
|
+
name: string;
|
|
61
|
+
typeArguments?: string[];
|
|
62
|
+
}>;
|
|
63
|
+
/** Decorators applied to this symbol. */
|
|
64
|
+
decorators?: Decorator[];
|
|
65
|
+
/** Generic type parameter names. */
|
|
66
|
+
typeParameters?: string[];
|
|
67
|
+
/** Declaration modifiers. */
|
|
68
|
+
modifiers?: Modifier[];
|
|
69
|
+
/** Class/interface members. */
|
|
70
|
+
members?: Array<{
|
|
71
|
+
name: string;
|
|
72
|
+
kind: string;
|
|
73
|
+
type?: string;
|
|
74
|
+
visibility?: string;
|
|
75
|
+
isStatic?: boolean;
|
|
76
|
+
isReadonly?: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
/** Parsed JSDoc comment associated with this symbol. */
|
|
79
|
+
jsDoc?: JsDocBlock;
|
|
80
|
+
}
|
|
39
81
|
/**
|
|
40
82
|
* A single result returned by {@link symbolSearch}.
|
|
41
83
|
*/
|
|
@@ -46,8 +88,10 @@ export interface SymbolSearchResult {
|
|
|
46
88
|
filePath: string;
|
|
47
89
|
/** Kind of the symbol (function, class, variable, etc.). */
|
|
48
90
|
kind: SymbolKind;
|
|
49
|
-
/** Symbol name. */
|
|
91
|
+
/** Symbol name (qualified for members, e.g. `"ClassName.methodName"`). */
|
|
50
92
|
name: string;
|
|
93
|
+
/** Unqualified member name (e.g. `"methodName"`), or `null` for top-level symbols. */
|
|
94
|
+
memberName: string | null;
|
|
51
95
|
/** Source location span (start/end line and column). */
|
|
52
96
|
span: {
|
|
53
97
|
start: {
|
|
@@ -65,8 +109,8 @@ export interface SymbolSearchResult {
|
|
|
65
109
|
signature: string | null;
|
|
66
110
|
/** Content-hash fingerprint for change detection. */
|
|
67
111
|
fingerprint: string | null;
|
|
68
|
-
/**
|
|
69
|
-
detail:
|
|
112
|
+
/** Typed detail fields parsed from the stored JSON. */
|
|
113
|
+
detail: SymbolDetail;
|
|
70
114
|
}
|
|
71
115
|
export interface ISymbolRepo {
|
|
72
116
|
searchByQuery(opts: {
|
|
@@ -76,7 +120,7 @@ export interface ISymbolRepo {
|
|
|
76
120
|
filePath?: string;
|
|
77
121
|
isExported?: boolean;
|
|
78
122
|
project?: string;
|
|
79
|
-
limit
|
|
123
|
+
limit?: number;
|
|
80
124
|
decorator?: string;
|
|
81
125
|
regex?: string;
|
|
82
126
|
resolvedType?: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 하나의 facade로 통합한다.
|
|
6
6
|
*/
|
|
7
7
|
import { type Result } from "@zipbul/result";
|
|
8
|
-
import {
|
|
8
|
+
import { GildashError } from "../errors";
|
|
9
9
|
import { type TscProgramOptions } from "./tsc-program";
|
|
10
10
|
import { TypeCollector } from "./type-collector";
|
|
11
11
|
import { SymbolGraph, type SymbolNode } from "./symbol-graph";
|
|
@@ -46,6 +46,13 @@ export declare class SemanticLayer {
|
|
|
46
46
|
anyConstituent?: boolean;
|
|
47
47
|
}): boolean | null;
|
|
48
48
|
getSymbolNode(filePath: string, position: number): SymbolNode | null;
|
|
49
|
+
/**
|
|
50
|
+
* Return the base types (supertypes) of the class/interface at the given position.
|
|
51
|
+
*
|
|
52
|
+
* Uses `checker.getBaseTypes()` which only works on interface/class types.
|
|
53
|
+
* Returns `null` if the type at position is not a class or interface.
|
|
54
|
+
*/
|
|
55
|
+
getBaseTypes(filePath: string, position: number): ResolvedType[] | null;
|
|
49
56
|
getModuleInterface(filePath: string): SemanticModuleInterface;
|
|
50
57
|
notifyFileChanged(filePath: string, content: string): void;
|
|
51
58
|
/**
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import ts from "typescript";
|
|
11
11
|
import { type Result } from "@zipbul/result";
|
|
12
|
-
import {
|
|
12
|
+
import { GildashError } from "../errors";
|
|
13
13
|
/**
|
|
14
14
|
* Reads a file at `path` and returns its content, or `undefined` if missing.
|
|
15
15
|
*/
|
|
@@ -4,8 +4,15 @@
|
|
|
4
4
|
* TscProgram에서 Program/TypeChecker를 가져와 AST를 탐색하고
|
|
5
5
|
* 각 심볼 위치의 타입을 ResolvedType으로 변환한다.
|
|
6
6
|
*/
|
|
7
|
+
import ts from "typescript";
|
|
7
8
|
import type { ResolvedType } from "./types";
|
|
8
9
|
import type { TscProgram } from "./tsc-program";
|
|
10
|
+
/**
|
|
11
|
+
* `ts.Type`을 `ResolvedType`으로 재귀 변환한다.
|
|
12
|
+
*
|
|
13
|
+
* 순환 타입에 대비해 `depth`로 재귀 깊이를 제한한다.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildResolvedType(checker: ts.TypeChecker, type: ts.Type, depth?: number): ResolvedType;
|
|
9
16
|
export declare class TypeCollector {
|
|
10
17
|
private readonly program;
|
|
11
18
|
constructor(program: TscProgram);
|
|
@@ -40,6 +40,15 @@ export interface ResolvedType {
|
|
|
40
40
|
* e.g. `Promise<string>` → `[{ text: "string", ... }]`
|
|
41
41
|
*/
|
|
42
42
|
typeArguments?: ResolvedType[];
|
|
43
|
+
/**
|
|
44
|
+
* Properties of an object type, enumerated via `checker.getPropertiesOfType()`.
|
|
45
|
+
* Only populated for non-union, non-intersection, non-primitive object types.
|
|
46
|
+
* Capped at 50 properties to avoid huge type expansions.
|
|
47
|
+
*/
|
|
48
|
+
properties?: Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
type: ResolvedType;
|
|
51
|
+
}>;
|
|
43
52
|
}
|
|
44
53
|
/**
|
|
45
54
|
* A single reference to a symbol, resolved via `LanguageService.findReferences`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Result } from '@zipbul/result';
|
|
2
2
|
import { type BunSQLiteDatabase } from 'drizzle-orm/bun-sqlite';
|
|
3
|
-
import {
|
|
3
|
+
import { GildashError } from '../errors';
|
|
4
4
|
import * as schema from './schema';
|
|
5
5
|
export interface DbConnectionOptions {
|
|
6
6
|
projectRoot: string;
|
|
@@ -4,10 +4,12 @@ export interface RelationRecord {
|
|
|
4
4
|
type: string;
|
|
5
5
|
srcFilePath: string;
|
|
6
6
|
srcSymbolName: string | null;
|
|
7
|
-
dstProject: string;
|
|
8
|
-
dstFilePath: string;
|
|
7
|
+
dstProject: string | null;
|
|
8
|
+
dstFilePath: string | null;
|
|
9
9
|
dstSymbolName: string | null;
|
|
10
10
|
metaJson: string | null;
|
|
11
|
+
specifier: string | null;
|
|
12
|
+
isExternal: number;
|
|
11
13
|
}
|
|
12
14
|
export declare class RelationRepository {
|
|
13
15
|
private readonly db;
|
|
@@ -20,6 +22,7 @@ export declare class RelationRepository {
|
|
|
20
22
|
}): RelationRecord[];
|
|
21
23
|
getByType(project: string, type: string): RelationRecord[];
|
|
22
24
|
deleteFileRelations(project: string, srcFilePath: string): void;
|
|
25
|
+
deleteIncomingRelations(dstProject: string, dstFilePath: string): void;
|
|
23
26
|
searchRelations(opts: {
|
|
24
27
|
srcFilePath?: string;
|
|
25
28
|
srcSymbolName?: string;
|
|
@@ -28,7 +31,9 @@ export declare class RelationRepository {
|
|
|
28
31
|
dstSymbolName?: string;
|
|
29
32
|
type?: string;
|
|
30
33
|
project?: string;
|
|
31
|
-
|
|
34
|
+
specifier?: string;
|
|
35
|
+
isExternal?: boolean;
|
|
36
|
+
limit?: number;
|
|
32
37
|
}): RelationRecord[];
|
|
33
38
|
retargetRelations(opts: {
|
|
34
39
|
dstProject: string;
|