25
25
26
26
__all__ = ["Analyzer" ]
27
27
28
+ MIN_TYPEDOC_VERSION = (0 , 22 , 0 )
29
+
28
30
29
31
@cache
30
32
def typedoc_version_info (typedoc : str ) -> tuple [tuple [int , ...], tuple [int , ...]]:
@@ -41,21 +43,29 @@ def typedoc_version_info(typedoc: str) -> tuple[tuple[int, ...], tuple[int, ...]
41
43
return typedoc_version , typescript_version
42
44
43
45
46
+ def version_to_str (t : Sequence [int ]) -> str :
47
+ return "." .join (str (x ) for x in t )
48
+
49
+
44
50
def typedoc_output (
45
51
abs_source_paths : list [str ], sphinx_conf_dir : str | pathlib .Path , config_path : str
46
52
) -> "Project" :
47
53
"""Return the loaded JSON output of the TypeDoc command run over the given
48
54
paths."""
49
55
typedoc = search_node_modules ("typedoc" , "typedoc/bin/typedoc" , sphinx_conf_dir )
50
56
typedoc_version , _ = typedoc_version_info (typedoc )
57
+ if typedoc_version < MIN_TYPEDOC_VERSION :
58
+ raise RuntimeError (
59
+ f"Typedoc version { version_to_str (typedoc_version )} is too old, minimum required is { version_to_str (MIN_TYPEDOC_VERSION )} "
60
+ )
61
+
51
62
command = Command ("node" )
52
63
os .environ ["TYPEDOC_NODE_MODULES" ] = str (Path (typedoc ).parents [2 ])
53
64
if typedoc_version >= (0 , 24 , 0 ):
54
65
command .add (str (Path (__file__ ).parent / "typedoc_0.24.mjs" ))
55
66
else :
56
67
command .add (typedoc )
57
- if typedoc_version >= (0 , 22 , 0 ):
58
- command .add ("--entryPointStrategy" , "expand" )
68
+ command .add ("--entryPointStrategy" , "expand" )
59
69
60
70
if config_path :
61
71
tsconfig_path = str ((Path (sphinx_conf_dir ) / config_path ).absolute ())
@@ -657,8 +667,7 @@ def to_ir(
657
667
class OtherNode (NodeBase ):
658
668
kindString : Literal [
659
669
"Enumeration" ,
660
- "Enumeration Member" , # M changed to uppercase in version 0.22
661
- "Enumeration member" ,
670
+ "Enumeration Member" ,
662
671
"Namespace" ,
663
672
"Type alias" ,
664
673
"Reference" ,
0 commit comments