Skip to content

Commit

Permalink
When a package is re-exported by another package, render the whole do…
Browse files Browse the repository at this point in the history
…cs node for the package being re-exported
  • Loading branch information
crucialfelix committed Jan 3, 2020
1 parent 96110be commit 3f4adb2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tasks/render-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ const redirects = {
},
SCLangError: {
package: "lang",
name: "SCLangError",
},
msg: {
package: "server",
name: "msg",
},
dryads: {
package: "dryads",
Expand Down Expand Up @@ -99,6 +101,8 @@ function find(package, node, name) {
// default a redirect to this package, this name
// so you don't have to specify the whole thing.
// just makes it more complex actually
// But you need this to redirect supercolliderjs exports
// to the packages that have the code.
const goto = {
package,
name,
Expand All @@ -113,6 +117,9 @@ function find(package, node, name) {
if (n.name === name && n.kindString !== "Property") {
return n;
}
if (n.kindString === "External module" && n.name === `"${name}"`) {
return n;
}
};

for (const next of bfs(node)) {
Expand Down Expand Up @@ -395,6 +402,15 @@ function renderDocForName(package, name) {
// throw new Error();
return null;
}

// if node is an external module and package then render that.
// this is when a package re-exports another package
if (name !== "index" && node.name === `"index"` && node.kindString === "External module") {
const a = loadApi(name);
if (a) {
return renderNode(a);
}
}
return renderNode(node);
}

Expand Down

0 comments on commit 3f4adb2

Please sign in to comment.