@zipbul/gildash 0.25.0 → 0.26.1

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.
@@ -5,4 +5,4 @@ export { extractImports } from './imports-extractor';
5
5
  export { extractCalls } from './calls-extractor';
6
6
  export { extractHeritage } from './heritage-extractor';
7
7
  export { resolveImport, buildImportMap } from './extractor-utils';
8
- export type { ExtractedSymbol, SymbolKind, CodeRelation, Parameter, Modifier, Heritage, Decorator, ExpressionValue, ExpressionLiteral, ExpressionIdentifier, ExpressionMember, ExpressionCall, ExpressionNew, ExpressionObject, ExpressionObjectProperty, ExpressionArray, ExpressionSpread, ExpressionFunction, ExpressionTemplate, ExpressionUnresolvable, JsDocBlock, JsDocTag, ImportReference, QualifiedName, AnnotationSource, ExtractedAnnotation, } from './types';
8
+ export type { ExtractedSymbol, SymbolKind, CodeRelation, Parameter, Modifier, Heritage, Decorator, ExpressionValue, ExpressionLiteral, ExpressionIdentifier, ExpressionMember, ExpressionCall, ExpressionNew, ExpressionObject, ExpressionObjectProperty, ExpressionArray, ExpressionSpread, ExpressionFunction, ExpressionTemplate, ExpressionUnresolvable, ExpressionObjectEntry, KeyExpression, SymbolKey, JsDocBlock, JsDocTag, ImportReference, QualifiedName, AnnotationSource, ExtractedAnnotation, } from './types';
@@ -9,10 +9,32 @@ import type { SourcePosition, SourceSpan } from '../parser/types';
9
9
  * The extractor does **not** resolve imports; use relation queries for that.
10
10
  */
11
11
  export type ExpressionValue = ExpressionLiteral | ExpressionIdentifier | ExpressionMember | ExpressionCall | ExpressionNew | ExpressionObject | ExpressionArray | ExpressionSpread | ExpressionFunction | ExpressionTemplate | ExpressionUnresolvable;
12
- export interface ExpressionLiteral {
13
- kind: 'string' | 'number' | 'boolean' | 'null' | 'undefined';
14
- value: string | number | boolean | null;
12
+ export type ExpressionLiteral = {
13
+ kind: 'string';
14
+ value: string;
15
+ } | {
16
+ kind: 'number';
17
+ value: number;
18
+ } | {
19
+ kind: 'boolean';
20
+ value: boolean;
21
+ } | {
22
+ kind: 'null';
23
+ value: null;
24
+ } | {
25
+ kind: 'undefined';
26
+ value: null;
27
+ }
28
+ /** BigInt literal — value is the numeric portion as a string (e.g. `'42'` for `42n`). */
29
+ | {
30
+ kind: 'bigint';
31
+ value: string;
15
32
  }
33
+ /** Regular-expression literal — value is the full source form (e.g. `'/foo/g'`). */
34
+ | {
35
+ kind: 'regex';
36
+ value: string;
37
+ };
16
38
  export interface ExpressionIdentifier {
17
39
  kind: 'identifier';
18
40
  name: string;
@@ -45,14 +67,50 @@ export interface ExpressionNew {
45
67
  }
46
68
  export interface ExpressionObject {
47
69
  kind: 'object';
48
- properties: ExpressionObjectProperty[];
70
+ /** Properties of the object literal, in source order. Each entry is either
71
+ * a key/value property or a spread element (`...x`). */
72
+ properties: ExpressionObjectEntry[];
49
73
  }
74
+ /** An entry inside an object literal — either a normal key/value property
75
+ * or a spread (`...x`). The spread variant reuses {@link ExpressionSpread}
76
+ * since the runtime shape is identical to spreads elsewhere. */
77
+ export type ExpressionObjectEntry = ExpressionObjectProperty | ExpressionSpread;
50
78
  export interface ExpressionObjectProperty {
51
- key: string;
79
+ kind: 'property';
80
+ /**
81
+ * Property key. Static identifier keys (`{ foo: 1 }`) and string-literal keys
82
+ * (`{ 'foo': 1 }`) are both encoded as `{ kind: 'string', value: 'foo' }`
83
+ * (their runtime semantics are identical). Numeric keys use `kind: 'number'`.
84
+ * Computed keys (`{ [expr]: 1 }`) carry the structured expression
85
+ * (with `importSource` resolution where applicable). Private (`#name`)
86
+ * is *not* valid in object literals and never appears here.
87
+ */
88
+ key: KeyExpression;
52
89
  value: ExpressionValue;
53
- computed?: boolean;
90
+ /** True when written in shorthand form `{ x }` (equivalent to `{ x: x }`). */
54
91
  shorthand?: boolean;
55
92
  }
93
+ /**
94
+ * Any `ExpressionValue` that can appear as a key — every variant except
95
+ * `spread` (which is not a valid key form anywhere). Used for object literal
96
+ * keys, computed class/interface member keys, and enum literal-id keys.
97
+ */
98
+ export type KeyExpression = Exclude<ExpressionValue, ExpressionSpread>;
99
+ /**
100
+ * Form of a key for class/interface members and enum members.
101
+ *
102
+ * - `{ kind: 'private' }` — `#name` private identifier key (class members only).
103
+ * The owning symbol's `name` field carries the full `#name` source form.
104
+ * - Otherwise — a `KeyExpression` carrying the structured key form. For
105
+ * computed keys (`[expr]`), the inner expression's `importSource` is
106
+ * resolved when it is an imported identifier.
107
+ *
108
+ * Object literal property keys use {@link KeyExpression} directly (private
109
+ * keys are not valid in object literals).
110
+ */
111
+ export type SymbolKey = {
112
+ kind: 'private';
113
+ } | KeyExpression;
56
114
  export interface ExpressionArray {
57
115
  kind: 'array';
58
116
  elements: ExpressionValue[];
@@ -92,7 +150,10 @@ export type SymbolKind = 'function' | 'method' | 'class' | 'variable' | 'type' |
92
150
  /**
93
151
  * TypeScript declaration modifiers attached to a symbol.
94
152
  */
95
- export type Modifier = 'async' | 'static' | 'abstract' | 'readonly' | 'private' | 'protected' | 'public' | 'override' | 'declare' | 'const';
153
+ export type Modifier = 'async' | 'static' | 'abstract' | 'readonly' | 'private' | 'protected' | 'public' | 'override' | 'declare' | 'const'
154
+ /** TC39 auto-accessor: `accessor x = 1`. Marks `AccessorProperty` /
155
+ * `TSAbstractAccessorProperty` class members. */
156
+ | 'accessor';
96
157
  /**
97
158
  * A function/method parameter.
98
159
  */
@@ -180,14 +241,20 @@ export interface ExtractedSymbol {
180
241
  /** For methods: distinguishes `'method'`, `'getter'`, `'setter'`, or `'constructor'`. */
181
242
  methodKind?: 'method' | 'getter' | 'setter' | 'constructor';
182
243
  /**
183
- * Syntactic form of a class/interface member key. Omitted for plain identifier
184
- * keys (the default). Distinguishes:
185
- * - `'private'` — `#name` (PrivateIdentifier). `name` field is the bare name without `#`.
186
- * - `'literal'` — string-literal key, e.g. `'my-method'() {}`. `name` is the literal value.
187
- * - `'computed'` `[expr]` key. `name` is the source text of the bracket expression
188
- * (e.g. `'[Symbol.iterator]'`).
244
+ * Form of the member key when it is not a plain identifier. Omitted for
245
+ * identifier-keyed members (`name` carries the identifier in that case).
246
+ *
247
+ * - `{ kind: 'private' }` — `#name` private member. `name` carries the
248
+ * full source form including `#` (e.g. `'#secret'`).
249
+ * - `{ kind: 'string' | 'number' | 'bigint', value }` — non-computed
250
+ * literal key (e.g. `'my-method'() {}`, `42 = 'x'`).
251
+ * - any other `ExpressionValue` shape — computed key `[expr]`, with
252
+ * the inner expression's structure (and `importSource` resolution
253
+ * for imported identifiers) preserved.
254
+ *
255
+ * For object literal property keys, see {@link ExpressionObjectProperty.key}.
189
256
  */
190
- keyKind?: 'private' | 'literal' | 'computed';
257
+ key?: SymbolKey;
191
258
  /** Function/method parameters. Present for functions, methods, and constructors. */
192
259
  parameters?: Parameter[];
193
260
  /** Return type annotation as source text. */
@@ -252,7 +319,26 @@ export interface CodeRelation {
252
319
  metaJson?: string;
253
320
  /** Parsed metadata object derived from `metaJson`. */
254
321
  meta?: Record<string, unknown>;
255
- /** Raw import specifier (e.g. `'lodash'`, `'./missing'`). Present for unresolved/external imports. */
322
+ /**
323
+ * Verbatim module specifier text as written in the source — `'./foo'`,
324
+ * `'@zipbul/core'`, `'lodash'`, etc. Always present on any
325
+ * module-source-bearing relation: `'imports'`, `'re-exports'`,
326
+ * `'type-references'` (any typed import or typed re-export — including
327
+ * bare re-exports cross-referenced through an existing typed import),
328
+ * dynamic `import(...)`, and `require(...)`. Preserved regardless of
329
+ * whether `dstFilePath` was successfully resolved, so consumers can
330
+ * reconstruct the original import form without reverse-engineering
331
+ * tsconfig paths, package `exports` maps, or relative-path normalization.
332
+ *
333
+ * For bare re-exports (`export { x };`) where `x` was previously imported,
334
+ * the relation cross-references the originating import statement and
335
+ * `specifier` carries that import's source text. Bare re-exports that
336
+ * cannot be cross-referenced are *not emitted* as relations at all
337
+ * (rather than emitted with `specifier` absent).
338
+ *
339
+ * Absent only on relations with no associated module source — `'calls'`,
340
+ * `'extends'`, `'implements'`.
341
+ */
256
342
  specifier?: string;
257
343
  }
258
344
  export type AnnotationSource = 'jsdoc' | 'line' | 'block';
@@ -11,7 +11,7 @@ export { patternSearch } from "./search/pattern-search";
11
11
  export type { PatternMatch, PatternCapture } 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, ExtractedSymbol, SymbolKind, Decorator, Parameter, Heritage, Modifier, JsDocBlock, JsDocTag, ExpressionValue, ExpressionLiteral, ExpressionIdentifier, ExpressionMember, ExpressionCall, ExpressionNew, ExpressionObject, ExpressionObjectProperty, ExpressionArray, ExpressionSpread, ExpressionFunction, ExpressionTemplate, ExpressionUnresolvable } from "./extractor/types";
14
+ export type { CodeRelation, ExtractedSymbol, SymbolKey, KeyExpression, SymbolKind, Decorator, Parameter, Heritage, Modifier, JsDocBlock, JsDocTag, ExpressionValue, ExpressionLiteral, ExpressionIdentifier, ExpressionMember, ExpressionCall, ExpressionNew, ExpressionObject, ExpressionObjectEntry, ExpressionObjectProperty, ExpressionArray, ExpressionSpread, ExpressionFunction, ExpressionTemplate, ExpressionUnresolvable } from "./extractor/types";
15
15
  export type { SymbolStats } from "./store/repositories/symbol.repository";
16
16
  export type { WatcherRole, FileChangeEvent } from "./watcher/types";
17
17
  export type { ParsedFile } from "./parser/types";
@@ -8,7 +8,14 @@ export interface StoredCodeRelation extends Omit<CodeRelation, 'specifier'> {
8
8
  dstProject: string | null;
9
9
  /** Whether this relation targets an external (bare specifier) package. */
10
10
  isExternal: boolean;
11
- /** The raw import specifier string (e.g. `'lodash'`, `'./missing'`). `null` when the import was resolved to a file. */
11
+ /**
12
+ * Verbatim module specifier text as written in the source — `'./foo'`,
13
+ * `'@zipbul/core'`, `'lodash'`, etc. Preserved regardless of whether
14
+ * the import was successfully resolved to a file. `null` only on
15
+ * relations with no associated module source (`'calls'`, `'extends'`,
16
+ * `'implements'`). See {@link CodeRelation.specifier} for the full
17
+ * contract.
18
+ */
12
19
  specifier: string | null;
13
20
  }
14
21
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipbul/gildash",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "description": "TypeScript code indexing and dependency graph engine for Bun",
5
5
  "license": "MIT",
6
6
  "repository": {