11cb0ef41Sopenharmony_ci# Node.js API Documentation Tooling
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciThe Node.js API documentation is generated by an in-house tooling that resides
41cb0ef41Sopenharmony_ciwithin the [tools/doc](https://github.com/nodejs/node/tree/main/tools/doc)
51cb0ef41Sopenharmony_cidirectory.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciThe build process (using `make doc`) uses this tooling to parse the markdown
81cb0ef41Sopenharmony_cifiles in [doc/api](https://github.com/nodejs/node/tree/main/doc/api) and
91cb0ef41Sopenharmony_cigenerate the following:
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci1. Human-readable HTML in `out/doc/api/*.html`
121cb0ef41Sopenharmony_ci2. A JSON representation in `out/doc/api/*.json`
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciThese artifacts are published to nodejs.org for multiple versions of
151cb0ef41Sopenharmony_ciNode.js. As an example the latest version of the human-readable HTML
161cb0ef41Sopenharmony_ciis published to [nodejs.org/en/doc](https://nodejs.org/en/docs/),
171cb0ef41Sopenharmony_ciand the latest version of the json documentation is published to
181cb0ef41Sopenharmony_ci[nodejs.org/api/all.json](https://nodejs.org/api/all.json)
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciThe artifacts are built as part of release builds by running the [doc-upload](https://github.com/nodejs/node/blob/1a83ad6a693f851199608ae957ac5d4f76871485/Makefile#L1218-L1224)
211cb0ef41Sopenharmony_ciMakefile target as part of the release-sources part of the
221cb0ef41Sopenharmony_ciiojs+release job.
231cb0ef41Sopenharmony_ciThis target runs the `doc` target to build the docs and then uses
241cb0ef41Sopenharmony_ci`scp` to copy them onto the staging/www server into a directory of the form
251cb0ef41Sopenharmony_ci`/home/staging/nodejs/<type>/<full_version>/docs` where <type> is e.g.
261cb0ef41Sopenharmony_cirelease, nightly, etc. The promotion step (either automatic for
271cb0ef41Sopenharmony_cinightlies or manual for releases) then moves the docs to
281cb0ef41Sopenharmony_ci`/home/dist/nodejs/docs/\<full\_version>` where they are served by node.org.
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci**The key things to know about the tooling include:**
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci1. The entry-point is `tools/doc/generate.js`.
331cb0ef41Sopenharmony_ci2. The tooling supports the CLI arguments listed in the table below.
341cb0ef41Sopenharmony_ci3. The tooling processes one file at a time.
351cb0ef41Sopenharmony_ci4. The tooling uses a set of dependencies as described in the dependencies
361cb0ef41Sopenharmony_ci   section.
371cb0ef41Sopenharmony_ci5. The tooling parses the input files and does several transformations to the
381cb0ef41Sopenharmony_ci   AST (Abstract Syntax Tree).
391cb0ef41Sopenharmony_ci6. The tooling generates a JSON output that contains the metadata and content of
401cb0ef41Sopenharmony_ci   the Markdown file.
411cb0ef41Sopenharmony_ci7. The tooling generates a HTML output that contains a human-readable and ready
421cb0ef41Sopenharmony_ci   to-view version of the file.
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ciThis documentation serves the purpose of explaining the existing tooling
451cb0ef41Sopenharmony_ciprocesses, to allow easier maintenance and evolution of the tooling. It is not
461cb0ef41Sopenharmony_cimeant to be a guide on how to write documentation for Node.js.
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci#### Vocabulary & Good to Know's
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ci* AST means "Abstract Syntax Tree" and it is a data structure that represents
511cb0ef41Sopenharmony_ci  the structure of a certain data format. In our case, the AST is a "graph"
521cb0ef41Sopenharmony_ci  representation of the contents of the Markdown file.
531cb0ef41Sopenharmony_ci* MDN means [Mozilla Developer Network](https://developer.mozilla.org/en-US/)
541cb0ef41Sopenharmony_ci  and it is a website that contains documentation for web technologies. We use
551cb0ef41Sopenharmony_ci  it as a reference for the structure of the documentation.
561cb0ef41Sopenharmony_ci* The
571cb0ef41Sopenharmony_ci  [Stability Index](https://nodejs.org/dist/latest/docs/api/documentation.html#stability-index)
581cb0ef41Sopenharmony_ci  is used to community the Stability of a given Node.js module. The Stability
591cb0ef41Sopenharmony_ci  levels include:
601cb0ef41Sopenharmony_ci  * Stability 0: Deprecated. (This module is Deprecated)
611cb0ef41Sopenharmony_ci  * Stability 1: Experimental. (This module is Experimental)
621cb0ef41Sopenharmony_ci  * Stability 2: Stable. (This module is Stable)
631cb0ef41Sopenharmony_ci  * Stability 3: Legacy. (This module is Legacy)
641cb0ef41Sopenharmony_ci* Within Remark YAML snippets `<!-- something -->` are considered HTML nodes,
651cb0ef41Sopenharmony_ci  that's because YAML isn't valid Markdown content. (Doesn't abide by the
661cb0ef41Sopenharmony_ci  Markdown spec)
671cb0ef41Sopenharmony_ci* "New Tooling" references to the (written from-scratch) API build tooling
681cb0ef41Sopenharmony_ci  introduced in `nodejs/nodejs.dev` that might replace the current one from
691cb0ef41Sopenharmony_ci  `nodejs/node`
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_ci## CLI Arguments
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ciThe tooling requires a `filename` argument and supports extra arguments (some
741cb0ef41Sopenharmony_cialso required) as shown below:
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ci| Argument              | Description                                                                                                                            | Required | Example                            |
771cb0ef41Sopenharmony_ci| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------- |
781cb0ef41Sopenharmony_ci| `--node-version=`     | The version of Node.js that is being documented. It defaults to `process.version` which is supplied by Node.js itself                  | No       | v19.0.0                            |
791cb0ef41Sopenharmony_ci| `--output-directory=` | The directory where the output files will be generated.                                                                                | Yes      | `./out/api/`                       |
801cb0ef41Sopenharmony_ci| `--apilinks=`         | This file is used as an index to specify the source file for each module                                                               | No       | `./out/doc/api/apilinks.json`      |
811cb0ef41Sopenharmony_ci| `--versions-file=`    | This file is used to specify an index of all previous versions of Node.js. It is used for the Version Navigation on the API docs page. | No       | `./out/previous-doc-versions.json` |
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci**Note:** both of the `apilinks` and `versions-file` parameters are generated by
841cb0ef41Sopenharmony_cithe Node.js build process (Makefile). And they're files containing a JSON
851cb0ef41Sopenharmony_ciobject.
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ci### Basic Usage
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci```bash
901cb0ef41Sopenharmony_ci# cd tools/doc
911cb0ef41Sopenharmony_cinpm run node-doc-generator ${filename}
921cb0ef41Sopenharmony_ci```
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci**OR**
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci```bash
971cb0ef41Sopenharmony_ci# nodejs/node root directory
981cb0ef41Sopenharmony_cimake doc
991cb0ef41Sopenharmony_ci```
1001cb0ef41Sopenharmony_ci
1011cb0ef41Sopenharmony_ci## Dependencies and how the Tooling works internally
1021cb0ef41Sopenharmony_ci
1031cb0ef41Sopenharmony_ciThe API tooling uses an-AST-alike library called
1041cb0ef41Sopenharmony_ci[unified](https://github.com/unifiedjs/unified) for processing the Input file as
1051cb0ef41Sopenharmony_cia Graph that supports easy modification and update of its nodes.
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ciIn addition to `unified` we also use
1081cb0ef41Sopenharmony_ci[Remark](https://github.com/remarkjs/remark) for manipulating the Markdown part,
1091cb0ef41Sopenharmony_ciand [Rehype](https://github.com/rehypejs/rehype)to help convert to and from
1101cb0ef41Sopenharmony_ciMarkdown.
1111cb0ef41Sopenharmony_ci
1121cb0ef41Sopenharmony_ci### What are the steps of the internal tooling?
1131cb0ef41Sopenharmony_ci
1141cb0ef41Sopenharmony_ciThe tooling uses `unified` pipe-alike engine to pipe each part of the process.
1151cb0ef41Sopenharmony_ci(The description below is a simplified version)
1161cb0ef41Sopenharmony_ci
1171cb0ef41Sopenharmony_ci* Starting from reading the Frontmatter section of the Markdown file with
1181cb0ef41Sopenharmony_ci  [remark-frontmatter](https://www.npmjs.com/package/remark-frontmatter).
1191cb0ef41Sopenharmony_ci* Then the tooling goes to parse the Markdown by using `remark-parse` and adds
1201cb0ef41Sopenharmony_ci  support to [GitHub Flavoured Markdown](https://github.github.com/gfm/).
1211cb0ef41Sopenharmony_ci* The tooling proceeds by parsing some of the Markdown nodes and transforming
1221cb0ef41Sopenharmony_ci  them to HTML.
1231cb0ef41Sopenharmony_ci* The tooling proceeds to generate the JSON output of the file.
1241cb0ef41Sopenharmony_ci* Finally it does its final node transformations and generates a stringified
1251cb0ef41Sopenharmony_ci  HTML.
1261cb0ef41Sopenharmony_ci* It then stores the output to a JSON file and adds extra styling to the HTML
1271cb0ef41Sopenharmony_ci  and then stores the HTML file.
1281cb0ef41Sopenharmony_ci
1291cb0ef41Sopenharmony_ci### What each file is responsible for?
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ciThe files listed below are the ones referenced and actually used during the
1321cb0ef41Sopenharmony_cibuild process of the API docs as we see on <https://nodejs.org/api>. The
1331cb0ef41Sopenharmony_ciremaining files from the directory might be used by other steps of the Node.js
1341cb0ef41Sopenharmony_ciMakefile or might even be deprecated/remnant of old processes and might need to
1351cb0ef41Sopenharmony_cibe revisited/removed.
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci* **`html.mjs`**: Responsible for transforming nodes by decorating them with
1381cb0ef41Sopenharmony_ci  visual artifacts for the HTML pages;
1391cb0ef41Sopenharmony_ci  * For example, transforming man or JS doc references to links correctly
1401cb0ef41Sopenharmony_ci    referring to respective External documentation.
1411cb0ef41Sopenharmony_ci* **`json.mjs`**: Responsible for generating the JSON output of the file;
1421cb0ef41Sopenharmony_ci  * It is mostly responsible for going through the whole Markdown file and
1431cb0ef41Sopenharmony_ci    generating a JSON object that represent the Metadata of a specific Module.
1441cb0ef41Sopenharmony_ci  * For example, for the FS module, it will generate an object with all its
1451cb0ef41Sopenharmony_ci    methods, events, classes and use several regular expressions (ReGeX) for
1461cb0ef41Sopenharmony_ci    extracting the information needed.
1471cb0ef41Sopenharmony_ci* **`generate.mjs`**: Main entry-point of doc generation for a specific file. It
1481cb0ef41Sopenharmony_ci  does e2e processing of a documentation file;
1491cb0ef41Sopenharmony_ci* **`allhtml.mjs`**: A script executed after all files are generated to create a
1501cb0ef41Sopenharmony_ci  single "all" page containing all the HTML documentation;
1511cb0ef41Sopenharmony_ci* **`alljson.mjs`**: A script executed after all files are generated to create a
1521cb0ef41Sopenharmony_ci  single "all" page containing all the JSON entries;
1531cb0ef41Sopenharmony_ci* **`markdown.mjs`**: Contains utility to replace Markdown links to work with
1541cb0ef41Sopenharmony_ci  the <https://nodejs.org/api/> website.
1551cb0ef41Sopenharmony_ci* **`common.mjs`**: Contains a few utility functions that are used by the other
1561cb0ef41Sopenharmony_ci  files.
1571cb0ef41Sopenharmony_ci* **`type-parser.mjs`**: Used to replace "type references" (e.g. "String", or
1581cb0ef41Sopenharmony_ci  "Buffer") to the correct Internal/External documentation pages (i.e. MDN or
1591cb0ef41Sopenharmony_ci  other Node.js documentation pages).
1601cb0ef41Sopenharmony_ci
1611cb0ef41Sopenharmony_ci**Note:** It is important to mention that other files not mentioned here might
1621cb0ef41Sopenharmony_cibe used during the process but are not relevant to the generation of the API
1631cb0ef41Sopenharmony_cidocs themselves. You will notice that a lot of the logic within the build
1641cb0ef41Sopenharmony_ciprocess is **specific** to the current <https://nodejs.org/api/> infrastructure.
1651cb0ef41Sopenharmony_ciJust as adding some JavaScript snippets, styles, transforming certain Markdown
1661cb0ef41Sopenharmony_cielements into HTML, and adding certain HTML classes or such things.
1671cb0ef41Sopenharmony_ci
1681cb0ef41Sopenharmony_ci**Note:** Regarding the previous **Note** it is important to mention that we're
1691cb0ef41Sopenharmony_cicurrently working on an API tooling that is generic and independent of the
1701cb0ef41Sopenharmony_cicurrent Nodejs.org Infrastructure.
1711cb0ef41Sopenharmony_ci[The new tooling that is functional is available at the nodejs.dev repository](https://github.com/nodejs/nodejs.dev/blob/main/scripts/syncApiDocs.js)
1721cb0ef41Sopenharmony_ciand uses plain ReGeX (No AST) and [MDX](https://mdxjs.com/).
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci## The Build Process
1751cb0ef41Sopenharmony_ci
1761cb0ef41Sopenharmony_ciThe build process that happens on `generate.mjs` follows the steps below:
1771cb0ef41Sopenharmony_ci
1781cb0ef41Sopenharmony_ci* Links within the Markdown are replaced directly within the source Markdown
1791cb0ef41Sopenharmony_ci  (AST) (`markdown.replaceLinks`)
1801cb0ef41Sopenharmony_ci  * This happens within `markdown.mjs` and basically it adds suffixes or
1811cb0ef41Sopenharmony_ci    modifies link references within the Markdown
1821cb0ef41Sopenharmony_ci  * This is necessary for the `https://nodejs.org` infrastructure as all pages
1831cb0ef41Sopenharmony_ci    are suffixed with `.html`
1841cb0ef41Sopenharmony_ci* Text (and some YAML) Nodes are transformed/modified through
1851cb0ef41Sopenharmony_ci  `html.preprocessText`
1861cb0ef41Sopenharmony_ci* JSON output is generated through `json.jsonAPI`
1871cb0ef41Sopenharmony_ci* The title of the page is inferred through `html.firstHeader`
1881cb0ef41Sopenharmony_ci* Nodes are transformed into HTML Elements through `html.preprocessElements`
1891cb0ef41Sopenharmony_ci* The HTML Table of Contents (ToC) is generated through `html.buildToc`
1901cb0ef41Sopenharmony_ci
1911cb0ef41Sopenharmony_ci### `html.mjs`
1921cb0ef41Sopenharmony_ci
1931cb0ef41Sopenharmony_ciThis file is responsible for doing node AST transformations that either update
1941cb0ef41Sopenharmony_ciMarkdown nodes to decorate them with more data or transform them into HTML Nodes
1951cb0ef41Sopenharmony_cithat attain a certain visual responsibility; For example, to generate the "Added
1961cb0ef41Sopenharmony_ciat" label, or the Source Links or the Stability Index, or the History table.
1971cb0ef41Sopenharmony_ci
1981cb0ef41Sopenharmony_ci**Note:** Methods not listed below are either not relevant or utility methods
1991cb0ef41Sopenharmony_cifor string/array/object manipulation (e.g.: are used by the other methods
2001cb0ef41Sopenharmony_cimentioned below).
2011cb0ef41Sopenharmony_ci
2021cb0ef41Sopenharmony_ci#### `preprocessText`
2031cb0ef41Sopenharmony_ci
2041cb0ef41Sopenharmony_ci**New Tooling:** Most of the features within this method are available within
2051cb0ef41Sopenharmony_cithe new tooling.
2061cb0ef41Sopenharmony_ci
2071cb0ef41Sopenharmony_ciThis method does two things:
2081cb0ef41Sopenharmony_ci
2091cb0ef41Sopenharmony_ci* Replaces the Source Link YAML entry `<-- source_link= -->` into a "Source
2101cb0ef41Sopenharmony_ci  Link" HTML anchor element.
2111cb0ef41Sopenharmony_ci* Replaces type references within the Markdown (text) (i.e.: "String", "Buffer")
2121cb0ef41Sopenharmony_ci  into the correct HTML anchor element that links to the correct documentation
2131cb0ef41Sopenharmony_ci  page.
2141cb0ef41Sopenharmony_ci  * The original node then gets mutated from text to HTML.
2151cb0ef41Sopenharmony_ci  * It also updates references to Linux "MAN" pages to Web versions of them.
2161cb0ef41Sopenharmony_ci
2171cb0ef41Sopenharmony_ci#### `firstHeader`
2181cb0ef41Sopenharmony_ci
2191cb0ef41Sopenharmony_ci**New Tooling:** All features within this method are available within the new
2201cb0ef41Sopenharmony_ciTooling.
2211cb0ef41Sopenharmony_ci
2221cb0ef41Sopenharmony_ciIs used to attempt to extract the first heading of the page (recursively) to
2231cb0ef41Sopenharmony_cidefine the "title" of the page.
2241cb0ef41Sopenharmony_ci
2251cb0ef41Sopenharmony_ci**Note:** As all API Markdown files start with a Heading, this could possibly be
2261cb0ef41Sopenharmony_ciimproved to a reduced complexity.
2271cb0ef41Sopenharmony_ci
2281cb0ef41Sopenharmony_ci#### `preprocessElements`
2291cb0ef41Sopenharmony_ci
2301cb0ef41Sopenharmony_ci**New Tooling:** All features within this method are available within the new
2311cb0ef41Sopenharmony_citooling.
2321cb0ef41Sopenharmony_ci
2331cb0ef41Sopenharmony_ciThis method is responsible for doing multiple transformations within the AST
2341cb0ef41Sopenharmony_ciNodes, in majority, transforming the source node in respective HTML elements
2351cb0ef41Sopenharmony_ciwith diverse responsibilities, such as:
2361cb0ef41Sopenharmony_ci
2371cb0ef41Sopenharmony_ci* Updating Markdown `code` blocks by adding Language highlighting
2381cb0ef41Sopenharmony_ci  * It also adds the "CJS"/"MJS" switch to Nodes that are followed by their
2391cb0ef41Sopenharmony_ci    CJS/ESM equivalents.
2401cb0ef41Sopenharmony_ci* Increasing the Heading level of each Heading
2411cb0ef41Sopenharmony_ci* Parses YAML blocks and transforms them into HTML elements (See more at the
2421cb0ef41Sopenharmony_ci  `parseYAML` method)
2431cb0ef41Sopenharmony_ci* Updates BlockQuotes that are prefixed by the "Stability" word into a Stability
2441cb0ef41Sopenharmony_ci  Index HTML element.
2451cb0ef41Sopenharmony_ci
2461cb0ef41Sopenharmony_ci#### `parseYAML`
2471cb0ef41Sopenharmony_ci
2481cb0ef41Sopenharmony_ci**New Tooling:** Most of the features within this method are available within
2491cb0ef41Sopenharmony_cithe new tooling.
2501cb0ef41Sopenharmony_ci
2511cb0ef41Sopenharmony_ciThis method is responsible for parsing the `<--YAML snippets -->` and
2521cb0ef41Sopenharmony_citransforming them into HTML elements.
2531cb0ef41Sopenharmony_ci
2541cb0ef41Sopenharmony_ciIt follows a certain kind of "schema" that basically constitutes in the
2551cb0ef41Sopenharmony_cifollowing options:
2561cb0ef41Sopenharmony_ci
2571cb0ef41Sopenharmony_ci| YAML Key      | Description                                                                                                                     | Example                                               | Example Result              | Available on new tooling |
2581cb0ef41Sopenharmony_ci| ------------- | ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | --------------------------- | ------------------------ |
2591cb0ef41Sopenharmony_ci| `added`       | It's used to reference when a certain "module", "class" or "method" was added on Node.js                                        | `added: v0.1.90`                                      | `Added in: v0.1.90`         | Yes                      |
2601cb0ef41Sopenharmony_ci| `deprecated`  | It's used to reference when a certain "module", "class" or "method" was deprecated on Node.js                                   | `deprecated: v0.1.90`                                 | `Deprecated since: v0.1.90` | Yes                      |
2611cb0ef41Sopenharmony_ci| `removed`     | It's used to reference when a certain "module", "class" or "method" was removed on Node.js                                      | `removed: v0.1.90`                                    | `Removed in: v0.1.90`       | No                       |
2621cb0ef41Sopenharmony_ci| `changes`     | It's used to describe all the changes (historical ones) that happened within a certain "module", "class" or "method" in Node.js | `[{ version: v0.1.90, pr-url: '', description: '' }]` | --                          | Yes                      |
2631cb0ef41Sopenharmony_ci| `napiVersion` | It's used to describe in which version of the N-API this "module", "class" or "method" is available within Node.js              | `napiVersion: 1`                                      | `N-API version: 1`          | Yes                      |
2641cb0ef41Sopenharmony_ci
2651cb0ef41Sopenharmony_ci**Note:** The `changes` field gets prepended with the `added`, `deprecated` and
2661cb0ef41Sopenharmony_ci`removed` fields if they exist. The table only gets generated if a `changes`
2671cb0ef41Sopenharmony_cifield exists. In the new tooling only "added" is prepended for now.
2681cb0ef41Sopenharmony_ci
2691cb0ef41Sopenharmony_ci#### `buildToc`
2701cb0ef41Sopenharmony_ci
2711cb0ef41Sopenharmony_ci**New Tooling:** This feature is natively available within the new tooling
2721cb0ef41Sopenharmony_cithrough MDX.
2731cb0ef41Sopenharmony_ci
2741cb0ef41Sopenharmony_ciThis method generates the Table of Contents based on all the Headings of the
2751cb0ef41Sopenharmony_ciMarkdown file.
2761cb0ef41Sopenharmony_ci
2771cb0ef41Sopenharmony_ci#### `altDocs`
2781cb0ef41Sopenharmony_ci
2791cb0ef41Sopenharmony_ci**New Tooling:** All features within this method are available within the new
2801cb0ef41Sopenharmony_citooling.
2811cb0ef41Sopenharmony_ci
2821cb0ef41Sopenharmony_ciThis method generates a version picker for the current page to be shown in older
2831cb0ef41Sopenharmony_civersions of the API docs.
2841cb0ef41Sopenharmony_ci
2851cb0ef41Sopenharmony_ci### `json.mjs`
2861cb0ef41Sopenharmony_ci
2871cb0ef41Sopenharmony_ciThis file is responsible for generating a JSON object that (supposedly) is used
2881cb0ef41Sopenharmony_cifor IDE-Intellisense or for indexing of all the "methods", "classes", "modules",
2891cb0ef41Sopenharmony_ci"events", "constants" and "globals" available within a certain Markdown file.
2901cb0ef41Sopenharmony_ci
2911cb0ef41Sopenharmony_ciIt attempts a best effort extraction of the data by using several regular
2921cb0ef41Sopenharmony_ciexpression patterns (ReGeX).
2931cb0ef41Sopenharmony_ci
2941cb0ef41Sopenharmony_ci**Note:** JSON output generation is currently not supported by the new tooling,
2951cb0ef41Sopenharmony_cibut it is in the pipeline for development.
2961cb0ef41Sopenharmony_ci
2971cb0ef41Sopenharmony_ci#### `jsonAPI`
2981cb0ef41Sopenharmony_ci
2991cb0ef41Sopenharmony_ciThis method traverses all the AST Nodes by iterating through each one of them
3001cb0ef41Sopenharmony_ciand infers the kind of information each node contains through ReGeX. Then it
3011cb0ef41Sopenharmony_cimutate the data and appends it to the final JSON object.
3021cb0ef41Sopenharmony_ci
3031cb0ef41Sopenharmony_ciFor a more in-depth information we recommend to refer to the `json.mjs` file as
3041cb0ef41Sopenharmony_ciit contains a lot of comments.
305