library_gen.ts

Gro-specific library metadata generation.

This module provides Gro integration for library generation. It wraps the generic library_generate function with Gro's Gen interface and provides adapters for converting Gro's Disknode to the build-tool agnostic SourceFileInfo.

For build-tool agnostic usage, see library_generate.ts.

@see library_generate.ts for the generic generation entry point @see library_pipeline.ts for pipeline helpers @see library_output.ts for output file generation

Declarations
#

4 declarations

view source

library_collect_source_files_from_disknodes
#

library_gen.ts view source

(disknodes: Iterable<Disknode>, options: ModuleSourceOptions, log?: { info: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; } | undefined): SourceFileInfo[]

Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.

This avoids errors from files outside source directories (like test fixtures that may have malformed paths or missing content). The filtering uses module_is_source which checks source_paths to only include files in configured source directories.

disknodes

Iterator of Gro disknodes from filer

type Iterable<Disknode>

options

Module source options for filtering

log?

Optional logger for status messages

type { info: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; } | undefined
optional

returns

SourceFileInfo[]

library_gen
#

library_gen.ts view source

(options?: LibraryGenOptions | undefined): Gen

Creates a Gen object for generating library metadata with full TypeScript analysis.

This is the Gro-specific entry point. It handles: - Reading files from Gro's filer - Loading package.json via Gro utilities - Returning output in Gro's Gen format

For build-tool agnostic usage, use library_generate directly.

Usage in a .gen.ts file:

import {library_gen} from '@fuzdev/fuz_ui/library_gen.js'; export const gen = library_gen();

options?

Optional generation options

type LibraryGenOptions | undefined
optional

returns

Gen

LibraryGenOptions
#

library_gen.ts view source

LibraryGenOptions

Options for Gro library generation.

source

Module source options for filtering and path extraction.

Can provide full ModuleSourceOptions or partial options that will be merged with defaults. The project_root is automatically set to process.cwd() if not provided.

type ModuleSourceOptions | Partial<ModuleSourcePartial>

on_duplicates

Callback invoked when duplicate declaration names are found.

Consumers decide how to handle duplicates: throw, warn, or ignore. Use library_throw_on_duplicates for strict flat namespace enforcement.

source_file_from_disknode
#

library_gen.ts view source

(disknode: Disknode): SourceFileInfo

Convert Gro's Disknode to the build-tool agnostic SourceFileInfo interface.

Use this when you want to analyze files using Gro's filer directly.

disknode

type Disknode

returns

SourceFileInfo

throws

  • Error - if disknode has no content (should be loaded by Gro filer)

Depends on
#