l0.MoonCats¶
MoonCats ¶
Extracts LuaCATS annotations from MoonScript sources into LuaLS .d.lua type-definition files and rendered API documentation.
Constructor ¶
Creates an extractor.
Instance methods¶
extractPackage ¶
Extracts type-definition files for a set of modules, resolving cross-module references against every module in the set.
| param | type | description |
|---|---|---|
| sources | MoonCatsSource[] | The modules to extract, each with its require identifier. |
Returns:
resultMoonCatsExtractionResult — Definitions for the modules that parsed, plus all findings.
renderDocs ¶
Renders API documentation pages for a set of modules, resolving cross-module references and type links against every module in the set.
| param | type | description |
|---|---|---|
| sources | MoonCatsSource[] | The modules to document, each with its require identifier. |
| opts? | MoonCatsDocOptions |
Returns:
resultMoonCatsDocResult — Pages, index, and site scaffolding.diagnosticsMoonCatsDiagnostics — All findings from the parse pass.
extractModule ¶
Extracts the type-definition file for a single module without cross-module context.
| param | type | description |
|---|---|---|
| source | string |
The module's MoonScript source text. |
| requireId | string |
Require identifier the module resolves under. |
Returns:
definitionstring? — The definition text, or nil when the module fails to parse.diagnosticsMoonCatsDiagnostics — All findings from the run.
Fields¶
| field | type | description |
|---|---|---|
| Parser | MoonCatsParser | |
| Emitter | MoonCatsEmitter | |
| DocRenderer | MoonCatsDocRenderer | |
| Diagnostics | MoonCatsDiagnostics |
Types¶
MoonCatsSource ¶
One MoonScript module handed to an extraction run.
| field | type | description |
|---|---|---|
| requireId | string |
Require identifier the module resolves under. |
| source | string |
The module's MoonScript source text. |
MoonCatsExtractionResult ¶
The outcome of an extraction run.
| field | type | description |
|---|---|---|
| definitions | {requireId: string, text: string}[] |
One definition file per successfully parsed module, in input order. |
| diagnostics | MoonCatsDiagnostics | All findings from parsing and emission. |