GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: add [src] links to async_hooks.html · nodejs/node@2ca2199

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Makefile
  • test/fixtures/apilinks
    • class.json
    • class.js
  • tools/doc
    • apilinks.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,12 @@ out/apilinks.json: $(wildcard lib/*.js) tools/doc/apilinks.js
653653
$(call available-node, $(gen-apilink))
654654

655655
out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.js \
656-
tools/doc/html.js tools/doc/json.js | out/apilinks.json
656+
tools/doc/html.js tools/doc/json.js tools/doc/apilinks.js | \
657+
out/apilinks.json
657658
$(call available-node, $(gen-api))
658659

659-
out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js
660+
out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js \
661+
tools/doc/apilinks.js
660662
$(call available-node, tools/doc/allhtml.js)
661663

662664
out/doc/api/all.json: $(apidocs_json) tools/doc/alljson.js
Collapse file

‎test/fixtures/apilinks/class.js‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
// An exported class using ES2015 class syntax.
4+
5+
class Class {
6+
constructor() {};
7+
method() {};
8+
}
9+
10+
module.exports = {
11+
Class
12+
};
Collapse file

‎test/fixtures/apilinks/class.json‎

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Class": "class.js#L5",
3+
"new Class": "class.js#L6",
4+
"class.method": "class.js#L7"
5+
}
Collapse file

‎tools/doc/apilinks.js‎

Copy file name to clipboardExpand all lines: tools/doc/apilinks.js
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ process.argv.slice(2).forEach((file) => {
107107
// ClassName.foo = ...;
108108
// ClassName.prototype.foo = ...;
109109
// function Identifier(...) {...};
110+
// class Foo {...}
110111
//
111112
const indirect = {};
112113

@@ -153,6 +154,24 @@ process.argv.slice(2).forEach((file) => {
153154
if (basename.startsWith('_')) return;
154155
definition[`${basename}.${name}`] =
155156
`${link}#L${statement.loc.start.line}`;
157+
158+
} else if (statement.type === 'ClassDeclaration') {
159+
if (!exported.constructors.includes(statement.id.name)) return;
160+
definition[statement.id.name] = `${link}#L${statement.loc.start.line}`;
161+
162+
const name = statement.id.name.slice(0, 1).toLowerCase() +
163+
statement.id.name.slice(1);
164+
165+
statement.body.body.forEach((defn) => {
166+
if (defn.type !== 'MethodDefinition') return;
167+
if (defn.kind === 'method') {
168+
definition[`${name}.${defn.key.name}`] =
169+
`${link}#L${defn.loc.start.line}`;
170+
} else if (defn.kind === 'constructor') {
171+
definition[`new ${statement.id.name}`] =
172+
`${link}#L${defn.loc.start.line}`;
173+
}
174+
});
156175
}
157176
});
158177

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.