graphlens-typescript 0.2.2__tar.gz → 0.3.0__tar.gz
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.
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/PKG-INFO +1 -1
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/pyproject.toml +1 -1
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_adapter.py +8 -1
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_project_detector.py +25 -19
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/__init__.py +0 -0
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_deps.py +0 -0
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_module_resolver.py +0 -0
- {graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_visitor.py +0 -0
{graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_adapter.py
RENAMED
|
@@ -14,6 +14,7 @@ from graphlens import (
|
|
|
14
14
|
RelationKind,
|
|
15
15
|
)
|
|
16
16
|
from graphlens.utils import make_node_id
|
|
17
|
+
from graphlens.utils.roots import filter_nested_root_files
|
|
17
18
|
|
|
18
19
|
from graphlens_typescript._deps import (
|
|
19
20
|
TYPESCRIPT_DEFAULT_DEP_PARSERS,
|
|
@@ -109,8 +110,14 @@ class TypescriptAdapter(LanguageAdapter):
|
|
|
109
110
|
self._dep_parsers,
|
|
110
111
|
)
|
|
111
112
|
else:
|
|
112
|
-
|
|
113
|
+
lang_roots = find_typescript_roots(project_root)
|
|
114
|
+
for lang_root in lang_roots:
|
|
113
115
|
root_files = self.collect_files(lang_root)
|
|
116
|
+
root_files = filter_nested_root_files(
|
|
117
|
+
root_files,
|
|
118
|
+
lang_root,
|
|
119
|
+
lang_roots,
|
|
120
|
+
)
|
|
114
121
|
_analyze_root(
|
|
115
122
|
graph,
|
|
116
123
|
project_root,
|
|
@@ -6,6 +6,8 @@ import json
|
|
|
6
6
|
import re
|
|
7
7
|
from typing import TYPE_CHECKING
|
|
8
8
|
|
|
9
|
+
from graphlens.utils import collect_marker_roots
|
|
10
|
+
|
|
9
11
|
if TYPE_CHECKING:
|
|
10
12
|
from pathlib import Path
|
|
11
13
|
|
|
@@ -42,26 +44,30 @@ def find_typescript_roots(search_root: Path) -> list[Path]:
|
|
|
42
44
|
"""
|
|
43
45
|
Find TypeScript project roots within search_root (monorepo support).
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
A marker at ``search_root`` does not hide nested package roots.
|
|
48
|
+
``tsconfig`` files inside an existing ``package.json`` root are treated as
|
|
49
|
+
that package's config rather than as independent roots.
|
|
48
50
|
"""
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
package_roots = collect_marker_roots(
|
|
52
|
+
search_root,
|
|
53
|
+
("package.json",),
|
|
54
|
+
excluded_dirs=_EXCLUDED_DIRS,
|
|
55
|
+
fallback_to_search_root=False,
|
|
56
|
+
)
|
|
57
|
+
tsconfig_roots = collect_marker_roots(
|
|
58
|
+
search_root,
|
|
59
|
+
("tsconfig.json",),
|
|
60
|
+
excluded_dirs=_EXCLUDED_DIRS,
|
|
61
|
+
fallback_to_search_root=False,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
roots = list(package_roots)
|
|
65
|
+
for tsconfig_root in tsconfig_roots:
|
|
66
|
+
if tsconfig_root in roots:
|
|
67
|
+
continue
|
|
68
|
+
if any(tsconfig_root.is_relative_to(root) for root in package_roots):
|
|
69
|
+
continue
|
|
70
|
+
roots.append(tsconfig_root)
|
|
65
71
|
|
|
66
72
|
return sorted(roots) if roots else [search_root]
|
|
67
73
|
|
{graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphlens_typescript-0.2.2 → graphlens_typescript-0.3.0}/src/graphlens_typescript/_visitor.py
RENAMED
|
File without changes
|