gen.ts

view source

Declarations
#

38 declarations

analyze_gen_result
#

analyze_gen_results
#

AnalyzedGenResult
#

gen.ts view source

AnalyzedGenResult

type { file: GenFile; existing_content: string; is_new: false; has_changed: boolean; } | { file: GenFile; existing_content: null; is_new: true; has_changed: true; }

import type {AnalyzedGenResult} from '@fuzdev/gro/gen.js';

create_gen_context
#

gen.ts view source

(base: GenContextBase, origin_id: PathId, changed_file_id?: PathId | undefined): GenContext import {create_gen_context} from '@fuzdev/gro/gen.js';

Builds a GenContext for one genfile, so generating and resolving dependencies see the same context - notably the lazy svelte_config, which is a getter rather than a value so a genfile that ignores it never resolves it.

base

origin_id

type PathId

changed_file_id?

type PathId
optional

returns

GenContext

find_genfiles
#

gen.ts view source

(input_paths: InputPath[], root_dirs: PathId[], config: GroConfig, timings?: Timings | undefined): Promise<FindGenfilesResult> import {find_genfiles} from '@fuzdev/gro/gen.js';

Finds modules from input paths. (see input_path.ts for more)

input_paths

type InputPath[]

root_dirs

type PathId[]

config

timings?

type Timings
optional

returns

Promise<FindGenfilesResult>

FindGenfilesFailure
#

gen.ts view source

FindGenfilesFailure

type { type: "unmapped_input_paths"; unmapped_input_paths: InputPath[]; resolved_input_paths: ResolvedInputPath[]; reasons: string[]; } | { type: "input_directories_with_no_files"; input_directories_with_no_files: InputPath[]; resolved_input_files: ResolvedInputFile[]; resolved_input_files_by_root_dir: Map<PathId, ResolvedInputFile[]>; resolved_input_paths: ResolvedInputPath[]; reasons: string[]; }

import type {FindGenfilesFailure} from '@fuzdev/gro/gen.js';

FindGenfilesResult
#

gen.ts view source

FindGenfilesResult

type ({ ok: true; } & { value: FoundGenfiles; }) | (({ ok: false; } & { type: "unmapped_input_paths"; unmapped_input_paths: InputPath[]; resolved_input_paths: ResolvedInputPath[]; reasons: string[]; }) | ({ ok: false; } & { type: "input_directories_with_no_files"; input_directories_with_no_files: InputPath[]; resolved_input_files: ResolvedInputFile[]; resolved_input_files_by_root_dir: Map<PathId, ResolvedInputFile[]>; resolved_input_paths: ResolvedInputPath[]; reasons: string[]; }))

import type {FindGenfilesResult} from '@fuzdev/gro/gen.js';

FoundGenfiles
#

Gen
#

GEN_FILE_PATTERN
#

GEN_FILE_PATTERN_TEXT
#

GenConfig
#

GenContext
#

gen.ts view source

GenContext import type {GenContext} from '@fuzdev/gro/gen.js';

config

type GroConfig

svelte_config

Resolved on first access, so genfiles that don't touch it never pay to read the SvelteKit config.

type Promise<ParsedSvelteConfig>

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

type <TName extends string>(task_name: InvokeTaskName<TName>, ...rest: InvokeTaskRest<TName>): Promise<void>

task_name

type InvokeTaskName<TName>

rest

type InvokeTaskRest<TName>
returns Promise<void>

origin_id

Same as import.meta.url but in path form.

type PathId

origin_path

The origin_id relative to the root dir.

type string

changed_file_id

The file that triggered dependency checking. Only available when resolving dependencies dynamically. undefined during actual generation.

type PathId | undefined

GenContextBase
#

gen.ts view source

GenContextBase import type {GenContextBase} from '@fuzdev/gro/gen.js';

The GenContext values that are the same for every genfile in a run, as opposed to the per-genfile ones create_gen_context derives.

config

type GroConfig

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

type <TName extends string>(task_name: InvokeTaskName<TName>, ...rest: InvokeTaskRest<TName>): Promise<void>

task_name

type InvokeTaskName<TName>

rest

type InvokeTaskRest<TName>
returns Promise<void>

GenDependencies
#

GenDependenciesConfig
#

gen.ts view source

GenDependenciesConfig import type {GenDependenciesConfig} from '@fuzdev/gro/gen.js';

patterns?

type RegExp[]

files?

type PathId[]

GenDependenciesResolver
#

GenFile
#

gen.ts view source

GenFile import type {GenFile} from '@fuzdev/gro/gen.js';

id

type PathId

content

type string

origin_id

type PathId

format

type boolean

GenfileModule
#

gen.ts view source

GenfileModule import type {GenfileModule} from '@fuzdev/gro/gen.js';

gen

type Gen

GenfileModuleMeta
#

GenfileModuleResult
#

GenfileModuleResultFailure
#

gen.ts view source

GenfileModuleResultFailure import type {GenfileModuleResultFailure} from '@fuzdev/gro/gen.js';

ok

type false

id

type PathId

reason

type string

error

type Error

elapsed

type number

GenfileModuleResultSuccess
#

gen.ts view source

GenfileModuleResultSuccess import type {GenfileModuleResultSuccess} from '@fuzdev/gro/gen.js';

ok

type true

id

type PathId

files

type GenFile[]

elapsed

type number

GenFunction
#

GenResult
#

gen.ts view source

GenResult import type {GenResult} from '@fuzdev/gro/gen.js';

origin_id

type PathId

files

type GenFile[]

GenResults
#

is_gen_path
#

gen.ts view source

(path: string): boolean import {is_gen_path} from '@fuzdev/gro/gen.js';

path

type string

returns

boolean

load_genfiles
#

gen.ts view source

(found_genfiles: FoundGenfiles, timings?: Timings | undefined): Promise<LoadGenfilesResult> import {load_genfiles} from '@fuzdev/gro/gen.js';

found_genfiles

timings?

type Timings
optional

returns

Promise<LoadGenfilesResult>

LoadedGenfiles
#

LoadGenfilesFailure
#

LoadGenfilesResult
#

gen.ts view source

LoadGenfilesResult

type ({ ok: true; } & { value: LoadedGenfiles; }) | ({ ok: false; } & LoadGenfilesFailure)

import type {LoadGenfilesResult} from '@fuzdev/gro/gen.js';

normalize_gen_config
#

gen.ts view source

(gen: Gen): GenConfig import {normalize_gen_config} from '@fuzdev/gro/gen.js';

gen

type Gen

returns

GenConfig

RawGenFile
#

gen.ts view source

RawGenFile import type {RawGenFile} from '@fuzdev/gro/gen.js';

content

type string

filename?

type string

format?

type boolean

RawGenResult
#

to_gen_result
#

gen.ts view source

(origin_id: PathId, raw_result: RawGenResult): GenResult import {to_gen_result} from '@fuzdev/gro/gen.js';

origin_id

type PathId

raw_result

returns

GenResult

to_output_file_name
#

gen.ts view source

(filename: string): string import {to_output_file_name} from '@fuzdev/gro/gen.js';

filename

type string

returns

string

validate_gen_module
#

gen.ts view source

(mod: Record<string, any>): mod is GenfileModule import {validate_gen_module} from '@fuzdev/gro/gen.js';

mod

type Record<string, any>

returns

boolean

write_gen_results
#

gen.ts view source

(gen_results: GenResults, analyzed_gen_results: AnalyzedGenResult[], log: Logger): Promise<void> import {write_gen_results} from '@fuzdev/gro/gen.js';

gen_results

analyzed_gen_results

log

type Logger

returns

Promise<void>

Depends on
#

Imported by
#