universal-ast-mapper 1.4.0 → 1.5.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.md +1 -0
- package/dist/extractors/typescript.js +44 -0
- package/dist/html.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -605,6 +605,7 @@ Not part of the public API: the internal `src/` module layout and the generated
|
|
|
605
605
|
|
|
606
606
|
| Version | What changed |
|
|
607
607
|
|---------|--------------|
|
|
608
|
+
| **1.5.0** | **`.d.ts` / ambient declarations** — `declare function/const/class`, `declare module "x"`, and `declare namespace` (and plain `namespace`) are now extracted (previously a `.d.ts` yielded 0 symbols). Adds a `namespace` symbol kind; declared APIs surface as exported, nested under their module/namespace. |
|
|
608
609
|
| **1.4.0** | **Dynamic import tracking** — dynamic `import("...")` and CommonJS `require("...")` calls (anywhere in a file) are now captured as imports with an `isDynamic` flag. Relative dynamic imports resolve and draw graph edges like static ones, so lazy-loaded routes/modules show up in the dependency graph. |
|
|
609
610
|
| **1.3.0** | **TS/JS decorators** — class and method symbols now carry a `decorators` field (`@Component({...})`, `@Injectable()`, `@Get("/x")`), in skeletons and `get_call_graph`. Extends the Python decorator support (v0.8.7) to TypeScript/JavaScript — traces Angular/NestJS-style framework wiring to its class/handler. |
|
|
610
611
|
| **1.2.0** | **File-level cross-package resolution** — in a monorepo, bare imports of a workspace package (`@org/utils`, `@org/utils/sub`) now resolve to the actual source file (preferring `src/` over built `dist/`), so `resolve_imports` marks them in-project and `build_symbol_graph` draws cross-package edges. Builds on the v1.1.0 workspace discovery. |
|
|
@@ -147,6 +147,38 @@ function handle(node, exported, typeIndex) {
|
|
|
147
147
|
}
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
+
case "ambient_declaration":
|
|
151
|
+
// `.d.ts` / `declare ...` — surface the declared API as exported.
|
|
152
|
+
return collect(namedChildren(node), true, typeIndex);
|
|
153
|
+
case "function_signature": {
|
|
154
|
+
const name = nameOf(node) ?? "(function)";
|
|
155
|
+
return makeSymbol({
|
|
156
|
+
name,
|
|
157
|
+
kind: "function",
|
|
158
|
+
node,
|
|
159
|
+
rawKind: node.type,
|
|
160
|
+
signature: node.text.replace(/\s+/g, " ").replace(/;\s*$/, "").trim(),
|
|
161
|
+
exported,
|
|
162
|
+
doc: leadingComment(node),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
case "module": // declare module "name" { ... }
|
|
166
|
+
case "internal_module": { // namespace Name { ... }
|
|
167
|
+
const nameNode = node.childForFieldName("name");
|
|
168
|
+
const rawName = nameNode ? nameNode.text : "(namespace)";
|
|
169
|
+
const name = rawName.replace(/^['"`]|['"`]$/g, "");
|
|
170
|
+
const body = node.childForFieldName("body");
|
|
171
|
+
const children = body ? collect(namedChildren(body), false, typeIndex) : [];
|
|
172
|
+
return makeSymbol({
|
|
173
|
+
name,
|
|
174
|
+
kind: "namespace",
|
|
175
|
+
node,
|
|
176
|
+
rawKind: node.type,
|
|
177
|
+
exported,
|
|
178
|
+
doc: leadingComment(node),
|
|
179
|
+
children,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
150
182
|
default:
|
|
151
183
|
return null;
|
|
152
184
|
}
|
|
@@ -200,6 +232,18 @@ function fromVariableDeclaration(node, exported, typeIndex) {
|
|
|
200
232
|
doc: leadingComment(node),
|
|
201
233
|
}));
|
|
202
234
|
}
|
|
235
|
+
else if (exported && !value && decl.childForFieldName("type")) {
|
|
236
|
+
// Ambient `declare const X: T` — no initializer, but part of the typed API.
|
|
237
|
+
out.push(makeSymbol({
|
|
238
|
+
name,
|
|
239
|
+
kind: "const",
|
|
240
|
+
node: decl,
|
|
241
|
+
rawKind: `${node.type}>declare`,
|
|
242
|
+
signature: decl.text.replace(/\s+/g, " ").trim().slice(0, 120),
|
|
243
|
+
exported: true,
|
|
244
|
+
doc: leadingComment(node),
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
203
247
|
}
|
|
204
248
|
return out;
|
|
205
249
|
}
|
package/dist/html.js
CHANGED
package/package.json
CHANGED