@zipbul/gildash 0.26.0 → 0.27.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 +63 -9
- package/README.md +221 -28
- package/dist/index.js +9 -9
- package/dist/src/extractor/types.d.ts +20 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/parser/ast-utils.d.ts +71 -1
- package/dist/src/parser/index.d.ts +1 -1
- package/dist/src/search/relation-search.d.ts +8 -1
- package/package.json +1 -1
|
@@ -319,7 +319,26 @@ export interface CodeRelation {
|
|
|
319
319
|
metaJson?: string;
|
|
320
320
|
/** Parsed metadata object derived from `metaJson`. */
|
|
321
321
|
meta?: Record<string, unknown>;
|
|
322
|
-
/**
|
|
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
|
+
*/
|
|
323
342
|
specifier?: string;
|
|
324
343
|
}
|
|
325
344
|
export type AnnotationSource = 'jsdoc' | 'line' | 'block';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -30,3 +30,6 @@ export type { SourcePosition, SourceSpan } from './parser/types';
|
|
|
30
30
|
export type { Program, Node } from 'oxc-parser';
|
|
31
31
|
export { Visitor, visitorKeys } from 'oxc-parser';
|
|
32
32
|
export type { VisitorObject } from 'oxc-parser';
|
|
33
|
+
export { walk, parseAndWalk, ScopeTracker } from 'oxc-walker';
|
|
34
|
+
export type { WalkerEnter, WalkerLeave, WalkerCallbackContext, WalkerThisContextEnter, WalkerThisContextLeave, WalkOptions, ScopeTrackerNode, ScopeTrackerOptions, } from 'oxc-walker';
|
|
35
|
+
export { isArrowFunctionExpression, isAssignmentExpression, isCallExpression, isFunctionDeclaration, isFunctionExpression, isFunctionNode, isIdentifier, isMemberExpression, isTSQualifiedName, isVariableDeclaration, } from './parser/ast-utils';
|
|
@@ -1,6 +1,76 @@
|
|
|
1
|
+
import type { Node } from 'oxc-parser';
|
|
1
2
|
import type { QualifiedName } from '../extractor/types';
|
|
2
3
|
export declare function getNodeHeader(node: Record<string, unknown>, parent?: Record<string, unknown> | null): string;
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Type predicate for the union of FunctionDeclaration / FunctionExpression /
|
|
6
|
+
* ArrowFunctionExpression discriminators.
|
|
7
|
+
*
|
|
8
|
+
* Note: `FunctionDeclaration` and `FunctionExpression` both narrow to the
|
|
9
|
+
* `Function` interface in @oxc-project/types — that interface's `type` field
|
|
10
|
+
* is also satisfied by `TSDeclareFunction` and `TSEmptyBodyFunctionExpression`,
|
|
11
|
+
* but those discriminators return `false` here at runtime. Callers reading
|
|
12
|
+
* `.params` / `.body` should be aware that `body` may be `null` only on the
|
|
13
|
+
* declare/empty-body variants (excluded by this predicate).
|
|
14
|
+
*/
|
|
15
|
+
export declare function isFunctionNode(node: Node): node is Extract<Node, {
|
|
16
|
+
type: 'FunctionDeclaration' | 'FunctionExpression' | 'ArrowFunctionExpression';
|
|
17
|
+
}>;
|
|
18
|
+
export declare function isArrowFunctionExpression(node: Node): node is Extract<Node, {
|
|
19
|
+
type: 'ArrowFunctionExpression';
|
|
20
|
+
}>;
|
|
21
|
+
export declare function isAssignmentExpression(node: Node): node is Extract<Node, {
|
|
22
|
+
type: 'AssignmentExpression';
|
|
23
|
+
}>;
|
|
24
|
+
export declare function isCallExpression(node: Node): node is Extract<Node, {
|
|
25
|
+
type: 'CallExpression';
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Note: discriminator `"FunctionDeclaration"` narrows to the `Function`
|
|
29
|
+
* interface, which structurally also accepts `type: 'TSDeclareFunction'` and
|
|
30
|
+
* `type: 'TSEmptyBodyFunctionExpression'` — but those literals fail this
|
|
31
|
+
* runtime check. Narrowed result has `.params` (always) and `.body` (typed
|
|
32
|
+
* `FunctionBody | null`; non-null for FunctionDeclaration / FunctionExpression).
|
|
33
|
+
*/
|
|
34
|
+
export declare function isFunctionDeclaration(node: Node): node is Extract<Node, {
|
|
35
|
+
type: 'FunctionDeclaration';
|
|
36
|
+
}>;
|
|
37
|
+
/** See `isFunctionDeclaration` for shared `Function` interface notes. */
|
|
38
|
+
export declare function isFunctionExpression(node: Node): node is Extract<Node, {
|
|
39
|
+
type: 'FunctionExpression';
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Note: discriminator `"Identifier"` is shared by 6 interfaces in
|
|
43
|
+
* @oxc-project/types — IdentifierName, IdentifierReference, BindingIdentifier,
|
|
44
|
+
* LabelIdentifier, TSThisParameter, TSIndexSignatureName. All 6 expose `.name`
|
|
45
|
+
* (string; literal `"this"` for TSThisParameter). The narrowed result is the
|
|
46
|
+
* union of all 6; callers needing finer distinction must check additional
|
|
47
|
+
* fields (e.g. TSThisParameter has `decorators: []` and `optional: false`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function isIdentifier(node: Node): node is Extract<Node, {
|
|
50
|
+
type: 'Identifier';
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Note: discriminator `"MemberExpression"` is shared by 3 interfaces —
|
|
54
|
+
* ComputedMemberExpression, StaticMemberExpression, PrivateFieldExpression.
|
|
55
|
+
* All 3 expose `.object` and a property-side field (`.property` /
|
|
56
|
+
* `.field`). Callers needing finer distinction should check `.computed`
|
|
57
|
+
* (Computed only) or the property-side field shape.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isMemberExpression(node: Node): node is Extract<Node, {
|
|
60
|
+
type: 'MemberExpression';
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Note: discriminator `"TSQualifiedName"` is shared by 2 interfaces —
|
|
64
|
+
* TSQualifiedName and TSImportTypeQualifiedName. Both expose `.left` and
|
|
65
|
+
* `.right`, but `.left` shape differs (TSQualifiedName: TSQualifiedName |
|
|
66
|
+
* IdentifierName; TSImportTypeQualifiedName: TSImportTypeQualifier).
|
|
67
|
+
*/
|
|
68
|
+
export declare function isTSQualifiedName(node: Node): node is Extract<Node, {
|
|
69
|
+
type: 'TSQualifiedName';
|
|
70
|
+
}>;
|
|
71
|
+
export declare function isVariableDeclaration(node: Node): node is Extract<Node, {
|
|
72
|
+
type: 'VariableDeclaration';
|
|
73
|
+
}>;
|
|
4
74
|
export declare function getNodeName(node: unknown): string | null;
|
|
5
75
|
export declare function getStringLiteralValue(node: unknown): string | null;
|
|
6
76
|
export declare function getQualifiedName(expr: unknown): QualifiedName | 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 { getNodeHeader, isFunctionNode, getNodeName, getStringLiteralValue, getQualifiedName, } from './ast-utils';
|
|
4
|
+
export { getNodeHeader, isArrowFunctionExpression, isAssignmentExpression, isCallExpression, isFunctionDeclaration, isFunctionExpression, isFunctionNode, isIdentifier, isMemberExpression, isTSQualifiedName, isVariableDeclaration, getNodeName, getStringLiteralValue, getQualifiedName, } from './ast-utils';
|
|
5
5
|
export { parseJsDoc } from './jsdoc-parser';
|
|
6
6
|
export type { ParsedFile, SourcePosition, SourceSpan } from './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
|
-
/**
|
|
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
|
/**
|