@zipbul/gildash 0.0.2 → 0.1.2
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 +4 -4
- package/dist/index.js.map +11 -11
- package/dist/src/errors.d.ts +19 -39
- package/dist/src/gildash.d.ts +183 -44
- package/dist/src/index.d.ts +2 -1
- package/dist/src/parser/jsdoc-parser.d.ts +3 -1
- package/dist/src/parser/parse-source.d.ts +3 -1
- package/dist/src/store/connection.d.ts +3 -1
- package/dist/src/watcher/project-watcher.d.ts +4 -2
- package/package.json +6 -3
package/dist/src/errors.d.ts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Every error thrown by this library is an instance of `GildashError`.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* try {
|
|
8
|
-
* await Gildash.open({ projectRoot: '/path' });
|
|
9
|
-
* } catch (err) {
|
|
10
|
-
* if (err instanceof GildashError) {
|
|
11
|
-
* console.error('Gildash error:', err.message);
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
2
|
+
* Discriminated union type representing all possible error categories in Gildash.
|
|
15
3
|
*/
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
constructor(message: string, options?: ErrorOptions);
|
|
26
|
-
}
|
|
27
|
-
/** Thrown when symbol or relation extraction from a parsed AST fails. */
|
|
28
|
-
export declare class ExtractError extends GildashError {
|
|
29
|
-
constructor(message: string, options?: ErrorOptions);
|
|
30
|
-
}
|
|
31
|
-
/** Thrown when the indexing pipeline encounters an unrecoverable error. */
|
|
32
|
-
export declare class IndexError extends GildashError {
|
|
33
|
-
constructor(message: string, options?: ErrorOptions);
|
|
34
|
-
}
|
|
35
|
-
/** Thrown when a database (SQLite) operation fails. */
|
|
36
|
-
export declare class StoreError extends GildashError {
|
|
37
|
-
constructor(message: string, options?: ErrorOptions);
|
|
38
|
-
}
|
|
39
|
-
/** Thrown when a search query (symbol search, relation search) fails. */
|
|
40
|
-
export declare class SearchError extends GildashError {
|
|
41
|
-
constructor(message: string, options?: ErrorOptions);
|
|
4
|
+
export type GildashErrorType = 'watcher' | 'parse' | 'extract' | 'index' | 'store' | 'search' | 'closed' | 'validation' | 'close';
|
|
5
|
+
/**
|
|
6
|
+
* Plain-object error value used throughout Gildash's Result-based error handling.
|
|
7
|
+
* Produced by {@link gildashError} and carried as the `data` field of an `Err<GildashError>`.
|
|
8
|
+
*/
|
|
9
|
+
export interface GildashError {
|
|
10
|
+
type: GildashErrorType;
|
|
11
|
+
message: string;
|
|
12
|
+
cause?: unknown;
|
|
42
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Factory function that creates a {@link GildashError} value.
|
|
16
|
+
*
|
|
17
|
+
* @param type - One of the {@link GildashErrorType} variants.
|
|
18
|
+
* @param message - Human-readable description of the error.
|
|
19
|
+
* @param cause - Optional root cause (any value). When `undefined`, the `cause`
|
|
20
|
+
* property is omitted from the returned object entirely.
|
|
21
|
+
*/
|
|
22
|
+
export declare function gildashError(type: GildashErrorType, message: string, cause?: unknown): GildashError;
|
package/dist/src/gildash.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Result } from '@zipbul/result';
|
|
1
2
|
import type { ParsedFile } from './parser/types';
|
|
2
3
|
import { parseSource as defaultParseSource } from './parser/parse-source';
|
|
3
4
|
import { ParseCache } from './parser/parse-cache';
|
|
@@ -24,6 +25,7 @@ import type { SymbolSearchQuery, SymbolSearchResult } from './search/symbol-sear
|
|
|
24
25
|
import { relationSearch as defaultRelationSearch } from './search/relation-search';
|
|
25
26
|
import type { RelationSearchQuery } from './search/relation-search';
|
|
26
27
|
import type { SymbolStats } from './store/repositories/symbol.repository';
|
|
28
|
+
import { type GildashError } from './errors';
|
|
27
29
|
/**
|
|
28
30
|
* Minimal logger interface accepted by {@link Gildash}.
|
|
29
31
|
*
|
|
@@ -38,11 +40,18 @@ export interface Logger {
|
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* ```ts
|
|
41
|
-
*
|
|
43
|
+
* import { isErr } from '@zipbul/result';
|
|
44
|
+
*
|
|
45
|
+
* const result = await Gildash.open({
|
|
42
46
|
* projectRoot: '/absolute/path/to/project',
|
|
43
47
|
* extensions: ['.ts', '.tsx'],
|
|
44
48
|
* ignorePatterns: ['vendor'],
|
|
45
49
|
* });
|
|
50
|
+
* if (isErr(result)) {
|
|
51
|
+
* console.error(result.data.message);
|
|
52
|
+
* process.exit(1);
|
|
53
|
+
* }
|
|
54
|
+
* const ledger = result;
|
|
46
55
|
* ```
|
|
47
56
|
*/
|
|
48
57
|
export interface GildashOptions {
|
|
@@ -88,15 +97,30 @@ interface GildashInternalOptions {
|
|
|
88
97
|
* `Gildash` indexes TypeScript source code into a local SQLite database,
|
|
89
98
|
* watches for file changes, and provides search / dependency-graph queries.
|
|
90
99
|
*
|
|
100
|
+
* Every public method returns a `Result<T, GildashError>` — either the
|
|
101
|
+
* success value `T` directly, or an `Err<GildashError>` that can be checked
|
|
102
|
+
* with `isErr()` from `@zipbul/result`.
|
|
103
|
+
*
|
|
91
104
|
* Create an instance with the static {@link Gildash.open} factory.
|
|
92
105
|
* Always call {@link Gildash.close} when done to release resources.
|
|
93
106
|
*
|
|
94
107
|
* @example
|
|
95
108
|
* ```ts
|
|
96
109
|
* import { Gildash } from '@zipbul/gildash';
|
|
110
|
+
* import { isErr } from '@zipbul/result';
|
|
111
|
+
*
|
|
112
|
+
* const result = await Gildash.open({ projectRoot: '/my/project' });
|
|
113
|
+
* if (isErr(result)) {
|
|
114
|
+
* console.error(result.data.message);
|
|
115
|
+
* process.exit(1);
|
|
116
|
+
* }
|
|
117
|
+
* const ledger = result;
|
|
97
118
|
*
|
|
98
|
-
* const ledger = await Gildash.open({ projectRoot: '/my/project' });
|
|
99
119
|
* const symbols = ledger.searchSymbols({ text: 'handle', kind: 'function' });
|
|
120
|
+
* if (!isErr(symbols)) {
|
|
121
|
+
* symbols.forEach(s => console.log(s.name));
|
|
122
|
+
* }
|
|
123
|
+
*
|
|
100
124
|
* await ledger.close();
|
|
101
125
|
* ```
|
|
102
126
|
*/
|
|
@@ -133,18 +157,19 @@ export declare class Gildash {
|
|
|
133
157
|
* and begins watching for file changes.
|
|
134
158
|
*
|
|
135
159
|
* @param options - Configuration for the instance.
|
|
136
|
-
* @returns A fully-initialised `Gildash` ready for queries.
|
|
137
|
-
* @throws {Error} If `projectRoot` is not absolute or does not exist.
|
|
160
|
+
* @returns A fully-initialised `Gildash` ready for queries, or an `Err<GildashError>` on failure.
|
|
138
161
|
*
|
|
139
162
|
* @example
|
|
140
163
|
* ```ts
|
|
141
|
-
* const
|
|
164
|
+
* const result = await Gildash.open({
|
|
142
165
|
* projectRoot: '/home/user/my-app',
|
|
143
166
|
* extensions: ['.ts', '.tsx'],
|
|
144
167
|
* });
|
|
168
|
+
* if (isErr(result)) { console.error(result.data.message); process.exit(1); }
|
|
169
|
+
* const ledger = result;
|
|
145
170
|
* ```
|
|
146
171
|
*/
|
|
147
|
-
static open(options: GildashOptions & GildashInternalOptions): Promise<Gildash
|
|
172
|
+
static open(options: GildashOptions & GildashInternalOptions): Promise<Result<Gildash, GildashError>>;
|
|
148
173
|
/**
|
|
149
174
|
* Shut down the instance and release all resources.
|
|
150
175
|
*
|
|
@@ -152,9 +177,20 @@ export declare class Gildash {
|
|
|
152
177
|
* releases the watcher ownership role, and closes the database.
|
|
153
178
|
* Calling `close()` more than once is safe (subsequent calls are no-ops).
|
|
154
179
|
*
|
|
155
|
-
* @
|
|
180
|
+
* @returns `void` on success, or `Err<GildashError>` with `type='close'` if one or more
|
|
181
|
+
* sub-systems failed during shutdown. The `cause` field contains an array of
|
|
182
|
+
* individual errors from each failed sub-system.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const closeResult = await ledger.close();
|
|
187
|
+
* if (isErr(closeResult)) {
|
|
188
|
+
* console.error('Close failed:', closeResult.data.message);
|
|
189
|
+
* // closeResult.data.cause is unknown[] of per-subsystem errors
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
156
192
|
*/
|
|
157
|
-
close(): Promise<void
|
|
193
|
+
close(): Promise<Result<void, GildashError>>;
|
|
158
194
|
/**
|
|
159
195
|
* Register a callback that fires after each indexing run completes.
|
|
160
196
|
*
|
|
@@ -174,38 +210,86 @@ export declare class Gildash {
|
|
|
174
210
|
/**
|
|
175
211
|
* Parse a TypeScript source string into an AST and cache the result.
|
|
176
212
|
*
|
|
213
|
+
* On success the result is automatically stored in the internal LRU parse cache
|
|
214
|
+
* so that subsequent calls to extraction methods can reuse it.
|
|
215
|
+
*
|
|
177
216
|
* @param filePath - File path used as the cache key and for diagnostics.
|
|
178
217
|
* @param sourceText - Raw TypeScript source code.
|
|
179
|
-
* @returns
|
|
180
|
-
*
|
|
218
|
+
* @returns A {@link ParsedFile}, or `Err<GildashError>` with `type='closed'` if the instance
|
|
219
|
+
* is closed, or `type='parse'` if the parser fails.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* const parsed = ledger.parseSource('/project/src/app.ts', sourceCode);
|
|
224
|
+
* if (isErr(parsed)) {
|
|
225
|
+
* console.error(parsed.data.message); // e.g. "Failed to parse file: ..."
|
|
226
|
+
* return;
|
|
227
|
+
* }
|
|
228
|
+
* // parsed is now a ParsedFile
|
|
229
|
+
* const symbols = ledger.extractSymbols(parsed);
|
|
230
|
+
* ```
|
|
181
231
|
*/
|
|
182
|
-
parseSource(filePath: string, sourceText: string): ParsedFile
|
|
232
|
+
parseSource(filePath: string, sourceText: string): Result<ParsedFile, GildashError>;
|
|
183
233
|
/**
|
|
184
234
|
* Extract all symbol declarations from a previously parsed file.
|
|
185
235
|
*
|
|
236
|
+
* Returns function, class, variable, type-alias, interface, and enum declarations
|
|
237
|
+
* found in the AST.
|
|
238
|
+
*
|
|
186
239
|
* @param parsed - A {@link ParsedFile} obtained from {@link parseSource}.
|
|
187
|
-
* @returns An array of {@link ExtractedSymbol} entries
|
|
188
|
-
*
|
|
240
|
+
* @returns An array of {@link ExtractedSymbol} entries, or `Err<GildashError>` with
|
|
241
|
+
* `type='closed'` if the instance is closed.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* const symbols = ledger.extractSymbols(parsed);
|
|
246
|
+
* if (isErr(symbols)) return;
|
|
247
|
+
* for (const sym of symbols) {
|
|
248
|
+
* console.log(`${sym.kind}: ${sym.name}`);
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
189
251
|
*/
|
|
190
|
-
extractSymbols(parsed: ParsedFile): ExtractedSymbol[]
|
|
252
|
+
extractSymbols(parsed: ParsedFile): Result<ExtractedSymbol[], GildashError>;
|
|
191
253
|
/**
|
|
192
254
|
* Extract inter-file relationships (imports, calls, extends, implements)
|
|
193
255
|
* from a previously parsed file.
|
|
194
256
|
*
|
|
257
|
+
* If tsconfig path aliases were discovered during {@link Gildash.open},
|
|
258
|
+
* they are automatically applied when resolving import targets.
|
|
259
|
+
*
|
|
195
260
|
* @param parsed - A {@link ParsedFile} obtained from {@link parseSource}.
|
|
196
|
-
* @returns An array of {@link CodeRelation} entries
|
|
197
|
-
*
|
|
261
|
+
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
262
|
+
* `type='closed'` if the instance is closed.
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```ts
|
|
266
|
+
* const relations = ledger.extractRelations(parsed);
|
|
267
|
+
* if (isErr(relations)) return;
|
|
268
|
+
* const imports = relations.filter(r => r.type === 'imports');
|
|
269
|
+
* ```
|
|
198
270
|
*/
|
|
199
|
-
extractRelations(parsed: ParsedFile): CodeRelation[]
|
|
271
|
+
extractRelations(parsed: ParsedFile): Result<CodeRelation[], GildashError>;
|
|
200
272
|
/**
|
|
201
273
|
* Trigger a full re-index of all tracked files.
|
|
202
274
|
*
|
|
203
275
|
* Only available to the instance that holds the *owner* role.
|
|
276
|
+
* Reader instances receive `Err<GildashError>` with `type='closed'`.
|
|
204
277
|
*
|
|
205
|
-
* @returns
|
|
206
|
-
*
|
|
278
|
+
* @returns An {@link IndexResult} summary on success, or `Err<GildashError>` with
|
|
279
|
+
* `type='closed'` if the instance is closed / reader,
|
|
280
|
+
* `type='index'` if the indexing pipeline fails.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* const result = await ledger.reindex();
|
|
285
|
+
* if (isErr(result)) {
|
|
286
|
+
* console.error(result.data.message);
|
|
287
|
+
* return;
|
|
288
|
+
* }
|
|
289
|
+
* console.log(`Indexed ${result.indexedFiles} files in ${result.durationMs}ms`);
|
|
290
|
+
* ```
|
|
207
291
|
*/
|
|
208
|
-
reindex(): Promise<IndexResult
|
|
292
|
+
reindex(): Promise<Result<IndexResult, GildashError>>;
|
|
209
293
|
/**
|
|
210
294
|
* Discovered project boundaries within the project root.
|
|
211
295
|
*
|
|
@@ -216,69 +300,124 @@ export declare class Gildash {
|
|
|
216
300
|
* Return aggregate symbol statistics for the given project.
|
|
217
301
|
*
|
|
218
302
|
* @param project - Project name. Defaults to the auto-discovered primary project.
|
|
219
|
-
* @returns
|
|
220
|
-
*
|
|
303
|
+
* @returns A {@link SymbolStats} object with counts grouped by symbol kind,
|
|
304
|
+
* or `Err<GildashError>` with `type='closed'` if the instance is closed,
|
|
305
|
+
* `type='store'` if the database query fails.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* const stats = ledger.getStats();
|
|
310
|
+
* if (isErr(stats)) return;
|
|
311
|
+
* console.log(`Files: ${stats.fileCount}, Symbols: ${stats.symbolCount}`);
|
|
312
|
+
* ```
|
|
221
313
|
*/
|
|
222
|
-
getStats(project?: string): SymbolStats
|
|
314
|
+
getStats(project?: string): Result<SymbolStats, GildashError>;
|
|
223
315
|
/**
|
|
224
316
|
* Search indexed symbols by name, kind, file path, or export status.
|
|
225
317
|
*
|
|
226
|
-
* @param query - Search filters. All fields are optional;
|
|
227
|
-
*
|
|
228
|
-
* @
|
|
318
|
+
* @param query - Search filters (see {@link SymbolSearchQuery}). All fields are optional;
|
|
319
|
+
* omitted fields match everything.
|
|
320
|
+
* @returns An array of {@link SymbolSearchResult} entries, or `Err<GildashError>` with
|
|
321
|
+
* `type='closed'` if the instance is closed,
|
|
322
|
+
* `type='search'` if the query fails.
|
|
229
323
|
*
|
|
230
324
|
* @example
|
|
231
325
|
* ```ts
|
|
232
326
|
* const fns = ledger.searchSymbols({ kind: 'function', isExported: true });
|
|
327
|
+
* if (isErr(fns)) return;
|
|
328
|
+
* fns.forEach(fn => console.log(fn.name, fn.filePath));
|
|
233
329
|
* ```
|
|
234
330
|
*/
|
|
235
|
-
searchSymbols(query: SymbolSearchQuery): SymbolSearchResult[]
|
|
331
|
+
searchSymbols(query: SymbolSearchQuery): Result<SymbolSearchResult[], GildashError>;
|
|
236
332
|
/**
|
|
237
333
|
* Search indexed code relationships (imports, calls, extends, implements).
|
|
238
334
|
*
|
|
239
|
-
* @param query - Search filters. All fields are optional.
|
|
240
|
-
* @returns
|
|
241
|
-
*
|
|
335
|
+
* @param query - Search filters (see {@link RelationSearchQuery}). All fields are optional.
|
|
336
|
+
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
337
|
+
* `type='closed'` if the instance is closed,
|
|
338
|
+
* `type='search'` if the query fails.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* const rels = ledger.searchRelations({ srcFilePath: 'src/app.ts', type: 'imports' });
|
|
343
|
+
* if (isErr(rels)) return;
|
|
344
|
+
* rels.forEach(r => console.log(`${r.srcFilePath} -> ${r.dstFilePath}`));
|
|
345
|
+
* ```
|
|
242
346
|
*/
|
|
243
|
-
searchRelations(query: RelationSearchQuery): CodeRelation[]
|
|
347
|
+
searchRelations(query: RelationSearchQuery): Result<CodeRelation[], GildashError>;
|
|
244
348
|
/**
|
|
245
349
|
* List the files that a given file directly imports.
|
|
246
350
|
*
|
|
247
351
|
* @param filePath - Absolute path of the source file.
|
|
248
352
|
* @param project - Project name. Defaults to the primary project.
|
|
249
353
|
* @param limit - Maximum results. Defaults to `10_000`.
|
|
250
|
-
* @returns
|
|
251
|
-
*
|
|
354
|
+
* @returns An array of absolute paths that `filePath` imports,
|
|
355
|
+
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* const deps = ledger.getDependencies('/project/src/app.ts');
|
|
360
|
+
* if (isErr(deps)) return;
|
|
361
|
+
* console.log('Imports:', deps.join(', '));
|
|
362
|
+
* ```
|
|
252
363
|
*/
|
|
253
|
-
getDependencies(filePath: string, project?: string, limit?: number): string[]
|
|
364
|
+
getDependencies(filePath: string, project?: string, limit?: number): Result<string[], GildashError>;
|
|
254
365
|
/**
|
|
255
366
|
* List the files that directly import a given file.
|
|
256
367
|
*
|
|
257
368
|
* @param filePath - Absolute path of the target file.
|
|
258
369
|
* @param project - Project name. Defaults to the primary project.
|
|
259
370
|
* @param limit - Maximum results. Defaults to `10_000`.
|
|
260
|
-
* @returns
|
|
261
|
-
*
|
|
371
|
+
* @returns An array of absolute paths of files that import `filePath`,
|
|
372
|
+
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* const dependents = ledger.getDependents('/project/src/utils.ts');
|
|
377
|
+
* if (isErr(dependents)) return;
|
|
378
|
+
* console.log('Imported by:', dependents.join(', '));
|
|
379
|
+
* ```
|
|
262
380
|
*/
|
|
263
|
-
getDependents(filePath: string, project?: string, limit?: number): string[]
|
|
381
|
+
getDependents(filePath: string, project?: string, limit?: number): Result<string[], GildashError>;
|
|
264
382
|
/**
|
|
265
383
|
* Compute the full set of files transitively affected by changes.
|
|
266
384
|
*
|
|
267
|
-
*
|
|
385
|
+
* Internally builds a full {@link DependencyGraph} and walks all reverse
|
|
386
|
+
* edges from each changed file to find every transitive dependent.
|
|
268
387
|
*
|
|
269
388
|
* @param changedFiles - Absolute paths of files that changed.
|
|
270
389
|
* @param project - Project name. Defaults to the primary project.
|
|
271
|
-
* @returns
|
|
272
|
-
*
|
|
390
|
+
* @returns De-duplicated absolute paths of all transitively-dependent files
|
|
391
|
+
* (excluding the changed files themselves), or `Err<GildashError>` with
|
|
392
|
+
* `type='closed'` / `type='search'`.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* const affected = await ledger.getAffected(['/project/src/utils.ts']);
|
|
397
|
+
* if (isErr(affected)) return;
|
|
398
|
+
* console.log('Affected files:', affected.length);
|
|
399
|
+
* ```
|
|
273
400
|
*/
|
|
274
|
-
getAffected(changedFiles: string[], project?: string): Promise<string[]
|
|
401
|
+
getAffected(changedFiles: string[], project?: string): Promise<Result<string[], GildashError>>;
|
|
275
402
|
/**
|
|
276
403
|
* Check whether the import graph contains a circular dependency.
|
|
277
404
|
*
|
|
405
|
+
* Internally builds a full {@link DependencyGraph} and runs iterative DFS
|
|
406
|
+
* cycle detection.
|
|
407
|
+
*
|
|
278
408
|
* @param project - Project name. Defaults to the primary project.
|
|
279
|
-
* @returns `true` if at least one cycle exists
|
|
280
|
-
*
|
|
409
|
+
* @returns `true` if at least one cycle exists, `false` otherwise,
|
|
410
|
+
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* const cycleResult = await ledger.hasCycle();
|
|
415
|
+
* if (isErr(cycleResult)) return;
|
|
416
|
+
* if (cycleResult) {
|
|
417
|
+
* console.warn('Circular dependency detected!');
|
|
418
|
+
* }
|
|
419
|
+
* ```
|
|
281
420
|
*/
|
|
282
|
-
hasCycle(project?: string): Promise<boolean
|
|
421
|
+
hasCycle(project?: string): Promise<Result<boolean, GildashError>>;
|
|
283
422
|
}
|
|
284
423
|
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Gildash } from "./gildash";
|
|
2
2
|
export type { GildashOptions, Logger } from "./gildash";
|
|
3
|
-
export {
|
|
3
|
+
export { gildashError } from "./errors";
|
|
4
|
+
export type { GildashError, GildashErrorType } from "./errors";
|
|
4
5
|
export { symbolSearch } from "./search/symbol-search";
|
|
5
6
|
export type { SymbolSearchQuery, SymbolSearchResult } from "./search/symbol-search";
|
|
6
7
|
export { relationSearch } from "./search/relation-search";
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { type Result } from '@zipbul/result';
|
|
1
2
|
import type { JsDocBlock } from '../extractor/types';
|
|
2
|
-
|
|
3
|
+
import { type GildashError } from '../errors';
|
|
4
|
+
export declare function parseJsDoc(commentText: string): Result<JsDocBlock, GildashError>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type Result } from '@zipbul/result';
|
|
1
2
|
import { parseSync as defaultParseSync } from 'oxc-parser';
|
|
2
3
|
import type { ParsedFile } from './types';
|
|
3
|
-
|
|
4
|
+
import { type GildashError } from '../errors';
|
|
5
|
+
export declare function parseSource(filePath: string, sourceText: string, parseSyncFn?: typeof defaultParseSync): Result<ParsedFile, GildashError>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Result } from '@zipbul/result';
|
|
1
2
|
import { type BunSQLiteDatabase } from 'drizzle-orm/bun-sqlite';
|
|
3
|
+
import { type GildashError } from '../errors';
|
|
2
4
|
import * as schema from './schema';
|
|
3
5
|
export interface DbConnectionOptions {
|
|
4
6
|
projectRoot: string;
|
|
@@ -10,7 +12,7 @@ export declare class DbConnection {
|
|
|
10
12
|
private txDepth;
|
|
11
13
|
constructor(opts: DbConnectionOptions);
|
|
12
14
|
get drizzleDb(): BunSQLiteDatabase<typeof schema>;
|
|
13
|
-
open(): void
|
|
15
|
+
open(): Result<void, GildashError>;
|
|
14
16
|
close(): void;
|
|
15
17
|
transaction<T>(fn: (tx: DbConnection) => T): T;
|
|
16
18
|
immediateTransaction<T>(fn: () => T): T;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { type Result } from '@zipbul/result';
|
|
1
2
|
import type { AsyncSubscription, SubscribeCallback } from "@parcel/watcher";
|
|
2
3
|
import { subscribe as parcelSubscribe } from "@parcel/watcher";
|
|
3
4
|
type SubscribeOptions = NonNullable<Parameters<typeof parcelSubscribe>[2]>;
|
|
5
|
+
import { type GildashError } from "../errors";
|
|
4
6
|
import type { FileChangeEvent, WatcherOptions } from "./types";
|
|
5
7
|
import type { Logger } from "../gildash";
|
|
6
8
|
type SubscribeFn = (directoryPath: string, callback: SubscribeCallback, options?: SubscribeOptions) => Promise<AsyncSubscription>;
|
|
7
9
|
export declare class ProjectWatcher {
|
|
8
10
|
#private;
|
|
9
11
|
constructor(options: WatcherOptions, subscribeFn?: SubscribeFn, logger?: Logger);
|
|
10
|
-
start(onChange: (event: FileChangeEvent) => void): Promise<void
|
|
11
|
-
close(): Promise<void
|
|
12
|
+
start(onChange: (event: FileChangeEvent) => void): Promise<Result<void, GildashError>>;
|
|
13
|
+
close(): Promise<Result<void, GildashError>>;
|
|
12
14
|
}
|
|
13
15
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipbul/gildash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "TypeScript code indexing and dependency graph engine for Bun",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"build": "bun build index.ts --outdir dist --target bun --format esm --packages external --sourcemap=linked --production && tsc -p tsconfig.build.json && cp -r src/store/migrations dist/migrations",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
37
|
"test": "bun test",
|
|
38
|
-
"coverage": "bun test --coverage",
|
|
38
|
+
"test:coverage": "bun test --coverage",
|
|
39
39
|
"changeset": "changeset",
|
|
40
40
|
"version-packages": "changeset version",
|
|
41
41
|
"release": "changeset publish"
|
|
@@ -54,5 +54,8 @@
|
|
|
54
54
|
"@types/bun": "latest",
|
|
55
55
|
"drizzle-kit": "^0.31.9",
|
|
56
56
|
"husky": "^9.1.7"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@zipbul/result": "^0.0.3"
|
|
57
60
|
}
|
|
58
|
-
}
|
|
61
|
+
}
|