library_generate.ts

Generic library metadata generation.

This module provides build-tool agnostic library generation. It takes source files and package metadata, analyzes them, and produces structured metadata with: - JSDoc/TSDoc comments with full tag support - Full type signatures - Source code locations - Parameter information with descriptions and defaults - Return value documentation - Usage examples - Dependency graphs - Svelte component props

For Gro integration, see library_gen.ts which wraps this with Gro's Gen interface.

@see @fuzdev/fuz_util/source_json.js for type definitions @see library_analysis.ts for the unified analysis entry point @see library_pipeline.ts for pipeline helpers @see library_output.ts for JSON/TS file generation

Declarations
#

5 declarations

view source

library_generate
#

library_generate.ts view source

(input: LibraryGenerateInput): LibraryGenerateResult

Generate library metadata from source files.

This is the main entry point for library generation. It analyzes source files, extracts metadata, and produces both structured data and file contents.

input

returns

LibraryGenerateResult

examples

Example 1

library_throw_on_duplicates
#

library_generate.ts view source

(duplicates: Map<string, DuplicateInfo[]>, log: { error: (...args: unknown[]) => void; }): void

Strict duplicate handler that throws on any duplicate declaration names.

Use this callback with library_generate({ on_duplicates: library_throw_on_duplicates }) to enforce a flat namespace where all declaration names must be unique.

duplicates

type Map<string, DuplicateInfo[]>

log

type { error: (...args: unknown[]) => void; }

returns

void

throws

  • Error - if any duplicate declaration names are found

LibraryGenerateInput
#

library_generate.ts view source

LibraryGenerateInput

Input for library metadata generation.

source_files

Source files to analyze (must have content loaded).

type Array<SourceFileInfo>

package_json

Package metadata (name, version).

type PackageJson

source_options

Module source options for path extraction.

program

Optional TypeScript program. If not provided, one will be created. Pass an existing program to reuse across multiple calls.

type ts.Program

on_duplicates

Optional callback for handling duplicate declaration names.

log

Optional logger for status and diagnostic messages.

type Logger

LibraryGenerateResult
#

library_generate.ts view source

LibraryGenerateResult

Result of library metadata generation.

source_json

The generated source metadata.

type SourceJson

json_content

JSON file content string.

type string

ts_content

TypeScript wrapper file content string.

type string

OnDuplicatesCallback
#

Depends on
#

Imported by
#