@zipbul/gildash 0.2.0 → 0.3.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/README.ko.md +454 -0
- package/README.md +65 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +6 -6
- package/dist/src/gildash.d.ts +34 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/parser/types.d.ts +18 -0
- package/dist/src/search/symbol-search.d.ts +3 -0
- package/dist/src/store/repositories/file.repository.d.ts +12 -0
- package/dist/src/store/repositories/symbol.repository.d.ts +1 -0
- package/package.json +6 -4
package/dist/src/gildash.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { extractRelations as defaultExtractRelations } from './extractor/relatio
|
|
|
8
8
|
import type { CodeRelation } from './extractor/types';
|
|
9
9
|
import { DbConnection } from './store/connection';
|
|
10
10
|
import { FileRepository } from './store/repositories/file.repository';
|
|
11
|
+
import type { FileRecord } from './store/repositories/file.repository';
|
|
11
12
|
import { SymbolRepository } from './store/repositories/symbol.repository';
|
|
12
13
|
import { RelationRepository } from './store/repositories/relation.repository';
|
|
13
14
|
import { ProjectWatcher } from './watcher/project-watcher';
|
|
@@ -75,7 +76,7 @@ interface GildashInternalOptions {
|
|
|
75
76
|
handleWatcherEvent?(event: FileChangeEvent): void;
|
|
76
77
|
};
|
|
77
78
|
repositoryFactory?: () => {
|
|
78
|
-
fileRepo: Pick<FileRepository, 'upsertFile' | 'getAllFiles' | 'getFilesMap' | 'deleteFile'>;
|
|
79
|
+
fileRepo: Pick<FileRepository, 'upsertFile' | 'getAllFiles' | 'getFilesMap' | 'deleteFile' | 'getFile'>;
|
|
79
80
|
symbolRepo: SymbolRepository;
|
|
80
81
|
relationRepo: RelationRepository;
|
|
81
82
|
parseCache: Pick<ParseCache, 'set' | 'get' | 'invalidate'>;
|
|
@@ -130,6 +131,7 @@ export declare class Gildash {
|
|
|
130
131
|
private readonly db;
|
|
131
132
|
private readonly symbolRepo;
|
|
132
133
|
private readonly relationRepo;
|
|
134
|
+
private readonly fileRepo;
|
|
133
135
|
private readonly parseCache;
|
|
134
136
|
private coordinator;
|
|
135
137
|
private watcher;
|
|
@@ -420,5 +422,36 @@ export declare class Gildash {
|
|
|
420
422
|
* ```
|
|
421
423
|
*/
|
|
422
424
|
hasCycle(project?: string): Promise<Result<boolean, GildashError>>;
|
|
425
|
+
/**
|
|
426
|
+
* Retrieve a previously-parsed AST from the internal LRU cache.
|
|
427
|
+
*
|
|
428
|
+
* Returns `undefined` if the file has not been parsed or was evicted from the cache.
|
|
429
|
+
* The returned object is shared with the internal cache — treat it as **read-only**.
|
|
430
|
+
*
|
|
431
|
+
* @param filePath - Absolute path of the file.
|
|
432
|
+
* @returns The cached {@link ParsedFile}, or `undefined` if not available.
|
|
433
|
+
*/
|
|
434
|
+
getParsedAst(filePath: string): ParsedFile | undefined;
|
|
435
|
+
/**
|
|
436
|
+
* Retrieve metadata for an indexed file.
|
|
437
|
+
*
|
|
438
|
+
* Returns the stored {@link FileRecord} including content hash, mtime, and size.
|
|
439
|
+
* Returns `null` if the file has not been indexed yet.
|
|
440
|
+
*
|
|
441
|
+
* @param filePath - Relative path from project root (as stored in the index).
|
|
442
|
+
* @param project - Project name. Defaults to the primary project.
|
|
443
|
+
* @returns The {@link FileRecord}, or `null` if not found.
|
|
444
|
+
*/
|
|
445
|
+
getFileInfo(filePath: string, project?: string): Result<FileRecord | null, GildashError>;
|
|
446
|
+
/**
|
|
447
|
+
* List all symbols declared in a specific file.
|
|
448
|
+
*
|
|
449
|
+
* Convenience wrapper around {@link searchSymbols} with a `filePath` filter.
|
|
450
|
+
*
|
|
451
|
+
* @param filePath - File path to query.
|
|
452
|
+
* @param project - Project name. Defaults to the primary project.
|
|
453
|
+
* @returns An array of {@link SymbolSearchResult} entries, or `Err<GildashError>`.
|
|
454
|
+
*/
|
|
455
|
+
getSymbolsByFile(filePath: string, project?: string): Result<SymbolSearchResult[], GildashError>;
|
|
423
456
|
}
|
|
424
457
|
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,3 +12,5 @@ export type { ProjectBoundary } from "./common/project-discovery";
|
|
|
12
12
|
export type { CodeRelation, SymbolKind } from "./extractor/types";
|
|
13
13
|
export type { SymbolStats } from "./store/repositories/symbol.repository";
|
|
14
14
|
export type { WatcherRole } from "./watcher/types";
|
|
15
|
+
export type { ParsedFile } from "./parser/types";
|
|
16
|
+
export type { FileRecord } from "./store/repositories/file.repository";
|
|
@@ -7,10 +7,28 @@ export interface SourceSpan {
|
|
|
7
7
|
start: SourcePosition;
|
|
8
8
|
end: SourcePosition;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* The result of parsing a TypeScript source file with oxc-parser.
|
|
12
|
+
*
|
|
13
|
+
* Returned by {@link Gildash.parseSource} and retrievable from the internal LRU
|
|
14
|
+
* cache via {@link Gildash.getParsedAst}.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The `program` field is an oxc-parser `Program` node.
|
|
18
|
+
* Consumers must add `oxc-parser` as a peer dependency to access the `Program` type.
|
|
19
|
+
*
|
|
20
|
+
* **The returned object is shared with the internal cache — treat it as read-only.**
|
|
21
|
+
* Mutating the AST may cause undefined behaviour in subsequent extraction operations.
|
|
22
|
+
*/
|
|
10
23
|
export interface ParsedFile {
|
|
24
|
+
/** Absolute path of the parsed file. */
|
|
11
25
|
filePath: string;
|
|
26
|
+
/** Root AST node produced by oxc-parser. */
|
|
12
27
|
program: Program;
|
|
28
|
+
/** Parse errors reported by oxc-parser (non-fatal). */
|
|
13
29
|
errors: readonly OxcError[];
|
|
30
|
+
/** Top-level comments found in the source. */
|
|
14
31
|
comments: readonly Comment[];
|
|
32
|
+
/** Raw source text that was parsed. */
|
|
15
33
|
sourceText: string;
|
|
16
34
|
}
|
|
@@ -8,6 +8,8 @@ import type { SymbolRecord } from '../store/repositories/symbol.repository';
|
|
|
8
8
|
export interface SymbolSearchQuery {
|
|
9
9
|
/** Full-text search on symbol names (prefix matching). */
|
|
10
10
|
text?: string;
|
|
11
|
+
/** Exact symbol name match. When `true`, `text` is treated as an exact name (not FTS prefix). */
|
|
12
|
+
exact?: boolean;
|
|
11
13
|
/** Restrict to a specific {@link SymbolKind}. */
|
|
12
14
|
kind?: SymbolKind;
|
|
13
15
|
/** Restrict to symbols declared in this file path. */
|
|
@@ -54,6 +56,7 @@ export interface SymbolSearchResult {
|
|
|
54
56
|
export interface ISymbolRepo {
|
|
55
57
|
searchByQuery(opts: {
|
|
56
58
|
ftsQuery?: string;
|
|
59
|
+
exactName?: string;
|
|
57
60
|
kind?: string;
|
|
58
61
|
filePath?: string;
|
|
59
62
|
isExported?: boolean;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { DbConnection } from '../connection';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata record for an indexed source file.
|
|
4
|
+
*
|
|
5
|
+
* Stored and retrieved by {@link FileRepository}.
|
|
6
|
+
* Exposed via {@link Gildash.getFileInfo}.
|
|
7
|
+
*/
|
|
2
8
|
export interface FileRecord {
|
|
9
|
+
/** Project name this file belongs to. */
|
|
3
10
|
project: string;
|
|
11
|
+
/** File path relative to the project root. */
|
|
4
12
|
filePath: string;
|
|
13
|
+
/** Last-modified timestamp in milliseconds since epoch. */
|
|
5
14
|
mtimeMs: number;
|
|
15
|
+
/** File size in bytes at the time of indexing. */
|
|
6
16
|
size: number;
|
|
17
|
+
/** SHA-256 content hash of the file at the time of indexing. */
|
|
7
18
|
contentHash: string;
|
|
19
|
+
/** ISO 8601 timestamp of the last index update. */
|
|
8
20
|
updatedAt: string;
|
|
9
21
|
}
|
|
10
22
|
export declare class FileRepository {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipbul/gildash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "TypeScript code indexing and dependency graph engine for Bun",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"test:coverage": "bun test --coverage",
|
|
39
39
|
"changeset": "changeset",
|
|
40
40
|
"version-packages": "changeset version",
|
|
41
|
-
"release": "changeset publish"
|
|
41
|
+
"release": "changeset publish",
|
|
42
|
+
"prepare": "husky"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@parcel/watcher": "^2.5.6",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"husky": "^9.1.7"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
|
-
"@zipbul/result": "^0.0.3"
|
|
60
|
+
"@zipbul/result": "^0.0.3",
|
|
61
|
+
"oxc-parser": ">=0.114.0"
|
|
60
62
|
}
|
|
61
|
-
}
|
|
63
|
+
}
|