Skip to content

Bump typedoc version from 0.15 to 0.19 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sphinx_js/pydantic_typedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ExternalModule(NodeBase):
class OtherNode(NodeBase):
kindString: Literal[
"Module",
"Namespace",
"Type alias",
"Enumeration",
"Enumeration member",
Expand Down
27 changes: 14 additions & 13 deletions sphinx_js/typedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ def get_object(
"""
return self._objects_by_path.get(path_suffix)

def _parent_nodes(self, node: pyd.IndexType) -> Iterator[pyd.ExternalModule]:
def _parent_nodes(
self, node: pyd.IndexType
) -> Iterator[pyd.ExternalModule | pyd.OtherNode]:
"""Return an iterator of parent nodes"""
n: pyd.IndexType | None = node
while n and n.id != 0:
if n.kindString == "External module":
if n.kindString == "External module" or n.kindString == "Module":
# Found one!
yield n
n = n.parent
Expand All @@ -104,19 +106,13 @@ def _containing_module(self, node: pyd.AnyNode) -> Pathname | None:
return Pathname(make_path_segments(node, self._base_dir))
return None

def _containing_deppath(self, node: pyd.AnyNode) -> str | None:
def _containing_deppath(self, node: pyd.Node | pyd.Signature) -> str | None:
"""Return the path pointing to the module containing the given node.
The path is absolute or relative to `root_for_relative_js_paths`.
Raises ValueError if one isn't found.

"""
for node in self._parent_nodes(node):
deppath = node.originalName
if deppath:
return relpath(deppath, self._base_dir)
else:
raise ValueError("Could not find deppath")
raise ValueError("Could not find deppath")
return node.sources[0].fileName

def _top_level_properties(
self,
Expand Down Expand Up @@ -500,7 +496,11 @@ def member_properties(


def short_name(node: pyd.Node | pyd.Signature) -> str:
if node.kindString == "Module" or node.kindString == "External module":
if (
node.kindString == "Module"
or node.kindString == "External module"
or node.kindString == "Namespace"
):
return node.name[1:-1] # strip quotes
return node.name

Expand Down Expand Up @@ -548,7 +548,7 @@ def make_path_segments(
or node.kindString == "Property"
or node.kindString == "Accessor"
or node.kindString == "Interface"
or node.kindString == "Module"
or node.kindString == "Namespace"
):
# We emit a segment for a Method's child Call Signature but skip the
# Method itself. They 2 nodes have the same names, but, by taking the
Expand All @@ -568,10 +568,11 @@ def make_path_segments(
segments = [node.name]
if child_was_static is False:
delimiter = "#"
elif node.kindString == "External module":
elif node.kindString == "External module" or node.kindString == "Module":
# 'name' contains folder names if multiple folders are passed into
# TypeDoc. It's also got excess quotes. So we ignore it and take
# 'originalName', which has a nice, absolute path.
assert node.originalName
rel = relpath(node.originalName, base_dir)
if not is_explicitly_rooted(rel):
rel = f".{sep}{rel}"
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ deps = -rrequirements_dev.txt
allowlist_externals =
env
npm
commands_pre = npm install --no-save [email protected] typedoc@0.15.0
commands_pre = npm install --no-save [email protected] typedoc@0.19.0
# Contrary to the tox docs, setenv's changes to $PATH are not visible inside
# any commands we call. I hack around this with env:
commands =
Expand Down