deno-doc-wasm
v0.2.0
Published
A re-distribution of the jsr.io/@deno/doc for Node.js
Readme
deno-doc-wasm
Documentation generator for Node.js and Bun.
deno_docis a Rust crate that generates documentation for JavaScript and TypeScript modules.@deno/docis a compiled WebAssembly version of the Rust crate for Deno, published to jsr.io.deno-doc-wasm(this project) is a re-distribution of thejsr:@deno/docpackage so that it can work in Node.js and Bun as well, published to npm.
Installation
npm install deno-doc-wasmUsage
The doc() function takes an array of string URL module specifiers and
potentially some options, and asynchronously resolves with a record of
documentation nodes keyed by the module URL, which represent the surface API of
the module.
A minimal example of using doc() and printing out some information about a
function:
import { doc } from 'deno-doc-wasm'
const records = await doc(['https://deno.land/std/fmt/colors.ts'])
const colorsDoc = records['https://deno.land/std/fmt/colors.ts']
for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`)
}You can also generate documentation from local files using file:// URLs:
import { pathToFileURL } from 'node:url'
import { doc } from 'deno-doc-wasm'
const url = pathToFileURL('./src/index.ts').toString()
const records = await doc([url])
const entries = records[url]
for (const node of entries) {
console.log(`name: ${node.name} kind: ${node.kind}`)
}API reference
Please refer to the documentation for the original @deno/doc package.
Credits
- This project would not be possible without the excellent work by the Deno team. The
deno_doccrate is a well-designed and powerful documentation generator. - Inspired by @devdumpling's work on integrating
@deno/docfor npmx.dev.
License
MIT
