Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DoxParser
✓ import { DoxParser } from 'doxdox-parser-dox';
✗ import DoxParser from 'doxdox-parser-dox';
The primary parser class is a named export, not a default export. Ensure named import syntax is used.
ParserConfig
✓ import type { ParserConfig } from 'doxdox-parser-dox';
Import types separately using `import type` for TypeScript environments to avoid bundling unused code.
Document
✓ import type { Document } from 'doxdox-core';
The `Document` interface, representing the parsed output structure, is typically exposed by `doxdox-core` as it defines the common output format for all parsers.
Demonstrates how to instantiate the DoxParser and use its `parse` method to extract documentation data from a string of code with Dox-style comments.
import { DoxParser } from 'doxdox-parser-dox';
// In a typical doxdox setup, the core library would manage parser instantiation and execution.
// This quickstart demonstrates how the DoxParser itself works by calling its parse method directly.
// Sample JavaScript/TypeScript code with Dox comments
const sampleCode = `
/**
* @file This is a test file demonstrating Dox comments.
* @module Calculator
*/
/**
* Adds two numbers and returns their sum.
*
* This function takes two numeric arguments and
* performs an addition operation.
*
* @param {number} a - The first operand.
* @param {number} b - The second operand.
* @returns {number} The sum of 'a' and 'b'.
* @example
* const result = add(5, 3); // result is 8
*/
function add(a: number, b: number): number {
return a + b;
}
/**
* Subtracts the second number from the first.
*
* @param {number} x - The number to subtract from.
* @param {number} y - The number to subtract.
* @returns {number} The difference (x - y).
*/
const subtract = (x: number, y: number): number => x - y;
/**
* Multiplies two numbers.
* @private
* @param {number} factor1 - The first factor.
* @param {number} factor2 - The second factor.
* @returns {number} The product.
*/
function multiply(factor1: number, factor2: number): number {
return factor1 * factor2;
}
`;
async function parseDoxCode() {
const parser = new DoxParser();
const filePath = 'src/math-utils.ts'; // Represents the file path for context
const options = {}; // doxdox parser options, if any
console.log(`Parsing Dox-style comments from: ${filePath}\n`);
try {
const parsedDocument = await parser.parse(sampleCode, filePath, options);
console.log('--- Parsed Document Output (Excerpt) ---');
console.log(`File: ${parsedDocument.file}`);
console.log(`Module: ${parsedDocument.module}`);
console.log('Methods:');
parsedDocument.methods.forEach((method, index) => {
console.log(` ${index + 1}. Name: ${method.name}`);
console.log(` Description: ${method.description}`);
if (method.params) {
console.log(' Parameters:');
method.params.forEach(param => {
console.log(` - ${param.name} (${param.type}): ${param.description}`);
});
}
if (method.returns) {
console.log(` Returns: ${method.returns[0].type} - ${method.returns[0].description}`);
}
if (method.tags) {
console.log(` Tags: ${method.tags.map(tag => `@${tag.tag} ${tag.name}`).join(', ')}`);
}
console.log('');
});
} catch (error) {
console.error('Error during parsing:', error);
}
}
parseDoxCode();
Debug
Known issues
breakingThe minimum Node.js version required for doxdox v4 and its associated parsers has been increased to 20.x.fixUpgrade your Node.js environment to version 20.x or higher before installing or running doxdox-parser-dox.
affects: >=4.0.0-preview.21
gotchaThis package is currently in a preview state (v4.0.0-preview.X) and is subject to frequent updates, including potential API changes, before a stable v4 release.fixPin exact package versions in your `package.json` to prevent unexpected breaking changes during preview releases. Monitor the project's changelog for updates if using in production.
affects: >=4.0.0-preview.1
breakingThe internal parser method signature and expected output data structure may have undergone breaking changes to align with a unified parser interface across doxdox v4.fixIf you are directly interacting with the parser's programmatic interface or relying on the exact shape of the `Document` output, refer to the `doxdox-core` and `doxdox-parser-dox` typings or documentation for the latest interface specifications.
affects: >=4.0.0-preview.17
gotchaAs a preview package, the exact structure of the parsed output (Document interface) or the ParserConfig object may evolve before a stable v4 release.fixRefer to the doxdox-core and doxdox-parser-dox typings or documentation regularly for updates to the data structures, especially when upgrading between preview versions.
affects: >=4.0.0-preview.1
Errors
Common errors & fixes
Error: Cannot find module 'doxdox-core'
doxdox-core is a peer dependency and must be installed separately from doxdox-parser-dox.
fixInstall the core library: `npm install doxdox-core@4.0.0-preview.25` or the corresponding compatible version.
SyntaxError: require() not supported in ES module scope
doxdox v4 and its parser plugins are designed for ES Modules (ESM) and do not support CommonJS `require()` statements.
fixEnsure your project is configured for ESM (e.g., by setting `"type": "module"` in `package.json` or using `.mjs` file extensions) and use `import` statements for all modules.
Node.js version x.x.x is not supported. Required Node.js version is >=20.
Your Node.js environment is running a version older than the minimum required 20.x for doxdox v4 components.
fixUpgrade Node.js to version 20.x or newer using a version manager like `nvm` or by installing a recent Node.js LTS release.
Parsing failed due to comment/code pattern matching issues.
The parser encountered Dox comments or surrounding code patterns that it could not correctly interpret, possibly due to non-standard formatting or internal parser logic changes.
fixReview your source code's Dox comments to ensure they adhere to standard formatting. If the issue persists with valid Dox syntax, consider reporting it to the doxdox project as a potential parser bug, referencing the affected preview version.
Upgrade
Version history
4.0.0-preview.25latest on npm
Audit
Dependencies
doxdox-corerequiredRequired peer dependency for the doxdox ecosystem; this parser integrates with the core library.