api #

task runner and toolkit extending SvelteKit

81 modules · 330 declarations

Modules
#

afterNavigate
#

sveltekit_shim_app_navigation.ts view source

(callback: (navigation: (NavigationGoto & { type: "goto" | "enter" | "form" | "link" | "popstate"; willUnload: false; }) | (NavigationFormSubmit & { type: "goto" | ... 3 more ... | "popstate"; willUnload: false; }) | (NavigationPopState & { ...; }) | (NavigationLink & { ...; }) | (NavigationEnter & { ...; })) => voi... import {afterNavigate} from '@fuzdev/gro/sveltekit_shim_app_navigation.js';

analyze_gen_result
#

gen.ts view source

(file: GenFile): Promise<AnalyzedGenResult> import {analyze_gen_result} from '@fuzdev/gro/gen.js';

file

type GenFile

returns

Promise<AnalyzedGenResult>

analyze_gen_results
#

gen.ts view source

(gen_results: GenResults): Promise<AnalyzedGenResult[]> import {analyze_gen_results} from '@fuzdev/gro/gen.js';

gen_results

returns

Promise<AnalyzedGenResult[]>

AnalyzedGenResult
#

gen.ts view source

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

applyAction
#

sveltekit_shim_app_forms.ts view source

<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: ActionResult<Success, Failure>) => Promise<void> import {applyAction} from '@fuzdev/gro/sveltekit_shim_app_forms.js';

asset
#

sveltekit_shim_app_paths.ts view source

(file: "/.nojekyll" | "/CNAME" | "/favicon.png" | "/logo.svg" | "/robots.txt" | (string & {})): string import {asset} from '@fuzdev/gro/sveltekit_shim_app_paths.js';

file

type "/.nojekyll" | "/CNAME" | "/favicon.png" | "/logo.svg" | "/robots.txt" | (string & {})

returns

string

assets
#

base
#

base_path_to_path_id
#

paths.ts view source

(base_path: string, p?: Paths): PathId import {base_path_to_path_id} from '@fuzdev/gro/paths.js';

base_path

type string

p

type Paths
default infer_paths(base_path)

returns

PathId

beforeNavigate
#

browser
#

BUILD_CACHE_METADATA_FILENAME
#

BUILD_CACHE_VERSION
#

BuildCacheMetadata
#

build_cache.ts view source

ZodObject<{ version: ZodString; git_commit: ZodNullable<ZodString>; build_cache_config_hash: ZodString; timestamp: ZodString; outputs: ZodArray<...>; }, $strict> import type {BuildCacheMetadata} from '@fuzdev/gro/build_cache.js';

Metadata stored in .gro/ directory to track build cache validity. Schema validates structure at load time to catch corrupted cache files.

building
#

BuildOutputEntry
#

build_cache.ts view source

ZodObject<{ path: ZodString; hash: ZodString; size: ZodNumber; mtime: ZodNumber; ctime: ZodNumber; mode: ZodNumber; }, $strict> import type {BuildOutputEntry} from '@fuzdev/gro/build_cache.js';

Metadata about a single build output file. Includes cryptographic hash for validation plus filesystem stats for debugging and optimization.

CHANGESET_CLI
#

CHANGESET_DIR
#

CHANGESET_PUBLIC_ACCESS
#

CHANGESET_RESTRICTED_ACCESS
#

ChangesetAccess
#

changeset_helpers.ts view source

ZodEnum<{ restricted: "restricted"; public: "public"; }> import type {ChangesetAccess} from '@fuzdev/gro/changeset_helpers.js';

ChangesetBump
#

changeset_helpers.ts view source

ZodEnum<{ minor: "minor"; major: "major"; patch: "patch"; }> import type {ChangesetBump} from '@fuzdev/gro/changeset_helpers.js';

clean_fs
#

clean_fs.ts view source

({ build, build_dev, build_dist, sveltekit, nodemodules, }: { build?: boolean | undefined; build_dev?: boolean | undefined; build_dist?: boolean | undefined; sveltekit?: boolean | undefined; nodemodules?: boolean | undefined; }, rm_options?: RmOptions): Promise<...> import {clean_fs} from '@fuzdev/gro/clean_fs.js';

__0

type { build?: boolean | undefined; build_dev?: boolean | undefined; build_dist?: boolean | undefined; sveltekit?: boolean | undefined; nodemodules?: boolean | undefined; }

rm_options

type RmOptions
default {force: true, recursive: true}

returns

Promise<void>

Cli
#

collect_build_outputs
#

build_cache.ts view source

(build_dirs: string[]): Promise<{ path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]> import {collect_build_outputs} from '@fuzdev/gro/build_cache.js';

Collects information about all files in build output directories. Returns an array of entries with path, hash, size, mtime, ctime, and mode.

Files are hashed in parallel for performance. For very large builds (10k+ files), this may take several seconds but ensures complete cache validation.

build_dirs

array of output directories to scan (e.g., ['build', 'dist', 'dist_server'])

type string[]

returns

Promise<{ path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]>

compute_build_cache_key
#

build_cache.ts view source

(config: GroConfig, log: Logger, git_commit?: string | null | undefined): Promise<{ git_commit: string | null; build_cache_config_hash: string; }> import {compute_build_cache_key} from '@fuzdev/gro/build_cache.js';

Computes the cache key components for a build. This determines whether a cached build can be reused.

config

Gro config (build_cache_config_hash is already computed during config load)

log

Logger

type Logger

git_commit?

optional pre-computed git commit hash (optimization to avoid re-reading)

type string | null | undefined
optional

returns

Promise<{ git_commit: string | null; build_cache_config_hash: string; }>

configure_colored_output_with_path_replacement
#

child_process_logging.ts view source

(child_process: ChildProcess, replacement?: string, cwd?: string): void import {configure_colored_output_with_path_replacement} from '@fuzdev/gro/child_process_logging.js';

Configures process output handling with path replacements while preserving ANSI colors.

child_process

type ChildProcess

replacement

type string
default '.'

cwd

type string
default process.cwd()

returns

void

cook_gro_config
#

gro_config.ts view source

(raw_config: RawGroConfig): Promise<GroConfig> import {cook_gro_config} from '@fuzdev/gro/gro_config.js';

Transforms a RawGroConfig to the more strict GroConfig. This allows users to provide a more relaxed config. Hashes the build_cache_config and deletes the raw value for security.

raw_config

returns

Promise<GroConfig>

create_build_cache_metadata
#

build_cache.ts view source

(config: GroConfig, log: Logger, git_commit?: string | null | undefined, build_dirs?: string[] | undefined): Promise<{ version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { ...; }[]; }> import {create_build_cache_metadata} from '@fuzdev/gro/build_cache.js';

Creates build cache metadata after a successful build. Automatically discovers all build output directories (build/, dist/, dist_*).

config

Gro config

log

Logger

type Logger

git_commit?

optional pre-computed git commit hash (optimization)

type string | null | undefined
optional

build_dirs?

optional pre-discovered build directories (optimization to avoid redundant filesystem scans)

type string[] | undefined
optional

returns

Promise<{ version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; }>

create_empty_gro_config
#

gro_config.ts view source

(): GroConfig import {create_empty_gro_config} from '@fuzdev/gro/gro_config.js';

returns

GroConfig

create_paths
#

paths.ts view source

(root_dir: string): Paths import {create_paths} from '@fuzdev/gro/paths.js';

root_dir

type string

returns

Paths

CreateGroConfig
#

gro_config.ts view source

CreateGroConfig import type {CreateGroConfig} from '@fuzdev/gro/gro_config.js';

(call)

type (base_config: GroConfig, svelte_config?: ParsedSvelteConfig | undefined): RawGroConfig | Promise<RawGroConfig>

base_config

svelte_config?

type ParsedSvelteConfig | undefined
optional
returns RawGroConfig | Promise<RawGroConfig>

CreateOutpaths
#

CSS_MATCHER
#

default_svelte_config
#

svelte_config.ts view source

ParsedSvelteConfig import {default_svelte_config} from '@fuzdev/gro/svelte_config.js';

The parsed SvelteKit config for the cwd, cached globally at the module level.

default_ts_transform_options
#

deserialize
#

sveltekit_shim_app_forms.ts view source

<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: string): ActionResult<Success, Failure> import {deserialize} from '@fuzdev/gro/sveltekit_shim_app_forms.js';

result

type string

returns

ActionResult<Success, Failure>

dev
#

DevTaskContext
#

disableScrollHandling
#

discover_build_output_dirs
#

build_cache.ts view source

(): Promise<string[]> import {discover_build_output_dirs} from '@fuzdev/gro/build_cache.js';

Discovers all build output directories in the current working directory. Returns an array of directory names that exist: build/, dist/, dist_*

returns

Promise<string[]>

Disknode
#

disknode.ts view source

Disknode import type {Disknode} from '@fuzdev/gro/disknode.js';

id

type PathId

contents

null contents means it doesn't exist. We create the file in memory to track its dependents regardless of its existence on disk.

type string | null

external

Is the source file outside of the root_dir or excluded by watch_dir_options.filter?

type boolean

ctime

type number | null

mtime

type number | null

content_hash

SHA-256 hash of contents. null iff contents is null. Used for content-based change detection and caching.

type string | null

dependents

type Map<PathId, Disknode>

dependencies

type Map<PathId, Disknode>

EMPTY_BUILD_CACHE_CONFIG_HASH
#

gro_config.ts view source

"af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262" import {EMPTY_BUILD_CACHE_CONFIG_HASH} from '@fuzdev/gro/gro_config.js';

BLAKE3 hash of empty string, used for configs without build_cache_config. This ensures consistent cache behavior when no custom config is provided.

enhance
#

sveltekit_shim_app_forms.ts view source

<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(form_element: HTMLFormElement, submit?: SubmitFunction<Success, Failure> | undefined): { ...; } import {enhance} from '@fuzdev/gro/sveltekit_shim_app_forms.js';

form_element

type HTMLFormElement

submit?

type SubmitFunction<Success, Failure> | undefined
optional

returns

{ destroy(): void; }

esbuild_plugin_external_worker
#

esbuild_plugin_external_worker.ts view source

({ dev, build_options, dir, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, alias, base_url, assets_url, public_prefix, private_prefix, env_dir, env_files, ambient_env, log, }: EsbuildPluginExternalWorkerOptions): Plugin import {esbuild_plugin_external_worker} from '@fuzdev/gro/esbuild_plugin_external_worker.js';

__0

returns

Plugin

esbuild_plugin_svelte
#

esbuild_plugin_sveltekit_local_imports
#

esbuild_plugin_sveltekit_local_imports.ts view source

(): Plugin import {esbuild_plugin_sveltekit_local_imports} from '@fuzdev/gro/esbuild_plugin_sveltekit_local_imports.js';

Adds support for imports to both .ts and .js, as well as imports without extensions that resolve to .js or .ts. Prefers .ts over any .js, and falls back to .ts if no file is found.

returns

Plugin

esbuild_plugin_sveltekit_shim_alias
#

esbuild_plugin_sveltekit_shim_app
#

esbuild_plugin_sveltekit_shim_env
#

EsbuildPluginExternalWorkerOptions
#

esbuild_plugin_external_worker.ts view source

EsbuildPluginExternalWorkerOptions import type {EsbuildPluginExternalWorkerOptions} from '@fuzdev/gro/esbuild_plugin_external_worker.js';

dev

type boolean

build_options

type esbuild.BuildOptions

dir?

type string

svelte_compile_options?

type CompileOptions

svelte_compile_module_options?

type ModuleCompileOptions

svelte_preprocessors?

type PreprocessorGroup | Array<PreprocessorGroup>

alias?

type Record<string, string>

base_url?

type ParsedSvelteConfig['base_url']

assets_url?

type ParsedSvelteConfig['assets_url']

public_prefix?

type string

private_prefix?

type string

env_dir?

type string

env_files?

type Array<string>

ambient_env?

type Record<string, string>

log?

type Logger

EsbuildPluginSveltekitShimAliasOptions
#

esbuild_plugin_sveltekit_shim_alias.ts view source

EsbuildPluginSveltekitShimAliasOptions import type {EsbuildPluginSveltekitShimAliasOptions} from '@fuzdev/gro/esbuild_plugin_sveltekit_shim_alias.js';

dir?

type string

alias?

type Record<string, string>

EsbuildPluginSveltekitShimAppOptions
#

esbuild_plugin_sveltekit_shim_app.ts view source

EsbuildPluginSveltekitShimAppOptions import type {EsbuildPluginSveltekitShimAppOptions} from '@fuzdev/gro/esbuild_plugin_sveltekit_shim_app.js';

dev

type boolean

base_url

type ParsedSvelteConfig['base_url']

assets_url

type ParsedSvelteConfig['assets_url']

EsbuildPluginSveltekitShimEnvOptions
#

esbuild_plugin_sveltekit_shim_env.ts view source

EsbuildPluginSveltekitShimEnvOptions import type {EsbuildPluginSveltekitShimEnvOptions} from '@fuzdev/gro/esbuild_plugin_sveltekit_shim_env.js';

dev

type boolean

public_prefix?

type string

private_prefix?

type string

env_dir?

type string

env_files?

type Array<string>

ambient_env?

type Record<string, string>

EsbuildPluginSvelteOptions
#

esbuild_plugin_svelte.ts view source

EsbuildPluginSvelteOptions import type {EsbuildPluginSvelteOptions} from '@fuzdev/gro/esbuild_plugin_svelte.js';

dev

type boolean

base_url

type ParsedSvelteConfig['base_url']

dir?

type string

svelte_compile_options?

type CompileOptions

svelte_compile_module_options?

type ModuleCompileOptions

svelte_preprocessors?

type PreprocessorGroup | Array<PreprocessorGroup>

ts_transform_options?

type esbuild.TransformOptions

is_ts?

type (filename: string) => boolean

EVERYTHING_MATCHER
#

Filer
#

filer.ts view source

import {Filer} from '@fuzdev/gro/filer.js';

root_dir

type PathId

readonly

files

type Map<PathId, Disknode>

readonly

constructor

type new (options?: FilerOptions): Filer

options

default EMPTY_OBJECT

get_by_id

type (id: PathId) => Disknode | undefined

get_or_create

type (id: PathId) => Disknode

filter

type (predicate: (disknode: Disknode) => boolean): Disknode[] | null

predicate

type (disknode: Disknode) => boolean
returns Disknode[] | null

init

Initialize the filer to populate files without watching. Safe to call multiple times - subsequent calls are no-ops. Used by gen files to access the file graph.

type (): Promise<void>

returns Promise<void>

watch

type (listener: OnFilerChange): Promise<() => void>

listener

returns Promise<() => void>

close

type (): Promise<void>

returns Promise<void>

inited

type boolean

getter

FilerOptions
#

filer.ts view source

FilerOptions import type {FilerOptions} from '@fuzdev/gro/filer.js';

watch_dir?

type typeof watch_dir

watch_dir_options?

type Partial<OmitStrict<WatchDirOptions, 'on_change'>>

package_json_cache?

type Record<string, PackageJson>

log?

type Logger

filter_dependents
#

filer.ts view source

(disknode: Disknode, get_by_id: (id: PathId) => Disknode | undefined, filter?: FileFilter | undefined, results?: Set<PathId>, searched?: Set<...>, log?: Logger | undefined): Set<...> import {filter_dependents} from '@fuzdev/gro/filer.js';

disknode

get_by_id

type (id: PathId) => Disknode | undefined

filter?

type FileFilter | undefined
optional

results

type Set<PathId>
default new Set()

searched

type Set<PathId>
default new Set()

log?

type Logger | undefined
optional

returns

Set<PathId>

find_cli
#

cli.ts view source

(name: string, cwd?: string | URL, options?: SpawnOptions | undefined): Promise<Cli | null> import {find_cli} from '@fuzdev/gro/cli.js';

Searches the filesystem for the CLI name, first local to the cwd and then globally.

name

type string

cwd

type string | URL
default process.cwd()

options?

type SpawnOptions | undefined
optional

returns

Promise<Cli | null>

null if not found locally or globally

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 | undefined
optional

returns

Promise<FindGenfilesResult>

find_tasks
#

task.ts view source

(input_paths: InputPath[], task_root_dirs: PathId[], config: GroConfig, timings?: Timings | undefined): Promise<FindTasksResult> import {find_tasks} from '@fuzdev/gro/task.js';

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

input_paths

type InputPath[]

task_root_dirs

type PathId[]

config

timings?

type Timings | undefined
optional

returns

Promise<FindTasksResult>

FindGenfilesFailure
#

gen.ts view source

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

FindGenfilesResult
#

gen.ts view source

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

FindModulesFailure
#

task.ts view source

FindModulesFailure import type {FindModulesFailure} from '@fuzdev/gro/task.js';

FindTasksResult
#

task.ts view source

FindTasksResult import type {FindTasksResult} from '@fuzdev/gro/task.js';

format_directory
#

format_directory.ts view source

(log: Logger, dir: string, check?: boolean, filter?: PathFilter | PathFilter[] | undefined, patterns?: string[] | undefined): Promise<FormatDirectoryResult> import {format_directory} from '@fuzdev/gro/format_directory.js';

Formats files on the filesystem in-process via format_file. When patterns is provided, formats those specific files/globs. Otherwise formats dir (recursively, respecting filter) plus the root files when dir is paths.source.

Files the formatter rejects (e.g. a syntax error) are reported and fail the run in both modes rather than being silently skipped.

This is separated from ./format_file so modules that only need directory traversal don't pull in the formatter (which loads the tsv WASM module).

log

type Logger

dir

type string

check

when true, reports unformatted files instead of writing them

type boolean
default false

filter?

directory filters (e.g. config.search_filters) to skip; also prunes patterns results so an explicit glob can't reach node_modules

type PathFilter | PathFilter[] | undefined
optional

patterns?

type string[] | undefined
optional

returns

Promise<FormatDirectoryResult>

format_file
#

format_file.ts view source

(content: string, options?: FormatFileOptions): string import {format_file} from '@fuzdev/gro/format_file.js';

Formats a string of source code in-process. Passes the input through unchanged when the language is unsupported (an expected no-op), but throws when the formatter rejects the source — e.g. a syntax error — so callers can decide whether to log, skip, or fail rather than silently treating broken input as already-formatted.

content

the source to format

type string

options

a filepath to infer the language, or an explicit lang

default {}

returns

string

FormatDirectoryResult
#

format_directory.ts view source

FormatDirectoryResult import type {FormatDirectoryResult} from '@fuzdev/gro/format_directory.js';

ok

type boolean

formatted

The files that were formatted (or, in check mode, that need formatting).

type Array<string>

errored

Files the formatter rejected (e.g. a syntax error), left untouched.

type Array<{id: string; error: unknown}>

FormatFileOptions
#

format_file.ts view source

FormatFileOptions import type {FormatFileOptions} from '@fuzdev/gro/format_file.js';

filepath?

The file path, used to infer the language from its extension.

type string

lang?

The language to format as, overriding any inference from filepath.

type FormatLang

FormatLang
#

format_file.ts view source

FormatLang import type {FormatLang} from '@fuzdev/gro/format_file.js';

The source languages Gro can format in-process, backed by @fuzdev/tsv_wasm (typescript/svelte/css) plus a builtin json formatter. Anything else passes through unchanged.

FoundGenfiles
#

gen.ts view source

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

resolved_input_files

type Array<ResolvedInputFile>

resolved_input_files_by_root_dir

type Map<PathId, Array<ResolvedInputFile>>

resolved_input_paths

type Array<ResolvedInputPath>

FoundTask
#

task.ts view source

FoundTask import type {FoundTask} from '@fuzdev/gro/task.js';

input_path

type InputPath

id

type PathId

task_root_dir

type PathId

FoundTasks
#

task.ts view source

FoundTasks import type {FoundTasks} from '@fuzdev/gro/task.js';

resolved_input_files

type Array<ResolvedInputFile>

resolved_input_files_by_root_dir

type Map<PathId, Array<ResolvedInputFile>>

resolved_input_paths

type Array<ResolvedInputPath>

input_paths

type Array<InputPath>

task_root_dirs

type Array<PathId>

Gen
#

GEN_FILE_PATTERN
#

GEN_FILE_PATTERN_TEXT
#

GEN_NO_PROD_MESSAGE
#

run_gen.ts view source

"gen runs only during development" import {GEN_NO_PROD_MESSAGE} from '@fuzdev/gro/run_gen.js';

GenConfig
#

GenContext
#

gen.ts view source

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

config

type GroConfig

svelte_config

type ParsedSvelteConfig

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

type InvokeTask

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

GenDependencies
#

gen.ts view source

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

GenDependenciesConfig
#

gen.ts view source

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

patterns?

type Array<RegExp>

files?

type Array<PathId>

GenDependenciesResolver
#

gen.ts view source

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

(call)

type (ctx: GenContext): "all" | GenDependenciesConfig | Promise<"all" | GenDependenciesConfig | null> | null

ctx

returns "all" | GenDependenciesConfig | Promise<"all" | GenDependenciesConfig | null> | null

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
#

gen.ts view source

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

GenfileModuleResult
#

gen.ts view source

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

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 Array<GenFile>

elapsed

type number

GenFunction
#

gen.ts view source

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

(call)

type (ctx: GenContext): RawGenResult | Promise<RawGenResult>

ctx

returns RawGenResult | Promise<RawGenResult>

GenResult
#

gen.ts view source

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

origin_id

type PathId

files

type Array<GenFile>

GenResults
#

gen.ts view source

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

results

type Array<GenfileModuleResult>

successes

type Array<GenfileModuleResultSuccess>

failures

type Array<GenfileModuleResultFailure>

input_count

type number

output_count

type number

elapsed

type number

get_possible_paths
#

input_path.ts view source

(input_path: InputPath, root_dirs: PathId[], extensions: string[]): Promise<PossiblePath[]> import {get_possible_paths} from '@fuzdev/gro/input_path.js';

Gets a list of possible source ids for each input path with extensions, duplicating each under root_dirs, without checking the filesystem.

input_path

root_dirs

type PathId[]

extensions

type string[]

returns

Promise<PossiblePath[]>

GIT_DIRNAME
#

GIT_SHORT_HASH_LENGTH
#

build.task.ts view source

7 import {GIT_SHORT_HASH_LENGTH} from '@fuzdev/gro/build.task.js';

Length of git commit hash when displayed in logs (standard git convention).

github_fetch_commit_prs
#

github.ts view source

(owner: string, repo: string, commit_sha: string, token?: string | undefined, log?: Logger | undefined, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined, api_version?: string | undefined): Promise<...> import {github_fetch_commit_prs} from '@fuzdev/gro/github.js';

owner

type string

repo

type string

commit_sha

type string

token?

type string | undefined
optional

log?

type Logger | undefined
optional

cache?

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined
optional

api_version?

type string | undefined
optional

returns

Promise<{ [x: string]: unknown; url: string; id: number; html_url: string; number: number; user: { [x: string]: unknown; login: string; }; }[] | null>

see also

GITHUB_REPO_MATCHER
#

GithubPullRequest
#

github.ts view source

ZodObject<{ url: ZodString; id: ZodNumber; html_url: ZodString; number: ZodNumber; user: ZodObject<{ login: ZodString; }, $loose>; }, $loose> import type {GithubPullRequest} from '@fuzdev/gro/github.js';

goto
#

sveltekit_shim_app_navigation.ts view source

(url: string | URL, opts?: { replaceState?: boolean | undefined; noScroll?: boolean | undefined; keepFocus?: boolean | undefined; invalidateAll?: boolean | undefined; invalidate?: (string | ... 1 more ... | ((url: URL) => boolean))[] | undefined; state?: PageState | undefined; } | undefined) => Promise<...> import {goto} from '@fuzdev/gro/sveltekit_shim_app_navigation.js';

GRO_CONFIG_FILENAME
#

GRO_DEV_DIR
#

GRO_DEV_DIRNAME
#

GRO_DIR
#

GRO_DIRNAME
#

GRO_DIST_DIR
#

GRO_DIST_PREFIX
#

GRO_PACKAGE_DIR
#

gro_paths
#

paths.ts view source

Paths import {gro_paths} from '@fuzdev/gro/paths.js';

Paths for the Gro package being used by the user repo.

gro_plugin_deno_server
#

gro_plugin_deno_server.ts view source

(options?: GroPluginDenoServerOptions): Plugin<PluginContext<object>> import {gro_plugin_deno_server} from '@fuzdev/gro/gro_plugin_deno_server.js';

Creates a gro plugin that runs a Deno server during development. The server is started during setup and stopped on teardown.

In dev mode, Vite should proxy API requests to this server.

options

default {}

returns

Plugin<PluginContext<object>>

gro_plugin_gen
#

gro_plugin_gen.ts view source

({ input_paths, root_dirs, flush_debounce_delay, }?: GroPluginGenOptions): Plugin<PluginContext<object>> import {gro_plugin_gen} from '@fuzdev/gro/gro_plugin_gen.js';

__0

default EMPTY_OBJECT

returns

Plugin<PluginContext<object>>

gro_plugin_server
#

gro_plugin_server.ts view source

({ entry_points, dir, outpaths, env_files, ambient_env, svelte_config, target, esbuild_build_options, rebuild_throttle_delay, cli_command, run, }?: GroPluginServerOptions): Plugin<PluginContext<object>> import {gro_plugin_server} from '@fuzdev/gro/gro_plugin_server.js';

__0

default {}

returns

Plugin<PluginContext<object>>

gro_plugin_sveltekit_app
#

gro_plugin_sveltekit_library
#

GroConfig
#

gro_config.ts view source

GroConfig import type {GroConfig} from '@fuzdev/gro/gro_config.js';

The config that users can extend via gro.config.ts. This is exposed to users in places like tasks and genfiles.

inheritance

extends: RawGroConfig

see also

plugins

type PluginsCreateConfig

see also

map_package_json

Maps the project's package.json before writing it to the filesystem. The package_json argument may be mutated, but the return value is what's used by the caller. Returning null is a no-op for the caller.

type PackageJsonMapper | null

task_root_dirs

The root directories to search for tasks given implicit relative input paths. Defaults to ./src/lib, then the cwd, then the Gro package dist.

type Array<PathId>

search_filters

When searching the filesystem for tasks and genfiles, directories and files are included if they pass all of these filters.

type Array<PathFilter>

js_cli

The CLI to use that's compatible with node.

type string

pm_cli

The CLI to use that's compatible with npm install and npm link. Defaults to 'npm'.

type string

svelte_config_filename?

type string

default `SVELTE_CONFIG_FILENAME`

build_cache_config_hash

SHA-256 hash of the user's build_cache_config from gro.config.ts. This is computed during config normalization and the raw value is immediately deleted. If no build_cache_config was provided, this is the hash of an empty string.

type string

see also

  • ``RawGroConfig.build_cache_config``

filer_options

Options passed to the Filer for file watching and import resolution.

type Partial<FilerOptions> | null

see also

  • ``FilerOptions``

GroConfigModule
#

gro_config.ts view source

GroConfigModule import type {GroConfigModule} from '@fuzdev/gro/gro_config.js';

default

type RawGroConfig | CreateGroConfig

readonly

GroPluginDenoServerOptions
#

gro_plugin_deno_server.ts view source

GroPluginDenoServerOptions import type {GroPluginDenoServerOptions} from '@fuzdev/gro/gro_plugin_deno_server.js';

entry?

Entry point TypeScript file for the Deno server.

type string

default 'src/lib/backend/server.ts'

port?

Port for the Deno server.

type number

default 4041

host?

Host for the Deno server.

type string

default 'localhost'

permissions?

Deno permissions to grant.

type Array<string>

default ['--allow-net', '--allow-read', '--allow-env']

flags?

Additional deno run flags (e.g. --sloppy-imports, --no-check).

type Array<string>

default []

watch?

Whether to watch for file changes and restart. Uses Deno's built-in --watch flag.

type boolean

default true in `dev`

env_file?

Env file to load via Deno's --env flag. Set to null to disable env file loading.

type string | null

default '.env.development'

env?

Additional environment variables to pass to the child process. Always merged with the parent process.env (for PATH, HOME, etc.). PORT, HOST, and NODE_ENV are set automatically from the plugin options.

type Record<string, string>

default {}

GroPluginGenOptions
#

gro_plugin_gen.ts view source

GroPluginGenOptions import type {GroPluginGenOptions} from '@fuzdev/gro/gro_plugin_gen.js';

input_paths?

type Array<string>

root_dirs?

type Array<string>

flush_debounce_delay?

type number

GroPluginServerOptions
#

gro_plugin_server.ts view source

GroPluginServerOptions import type {GroPluginServerOptions} from '@fuzdev/gro/gro_plugin_server.js';

entry_points?

same as esbuild's entryPoints

type Array<string>

dir?

type string

default cwd

outpaths?

Returns the Outpaths given a dev param. Decoupling this from plugin creation allows it to be created generically, so the build and dev tasks can be the source of truth for dev.

type CreateOutpaths

env_files?

type Array<string>

default ```SvelteKit's `.env`, `.env.development`, and `.env.production````

ambient_env?

type Record<string, string>

default process.env

svelte_config?

type SvelteConfig

default ```loaded from `${cwd}/${SVELTE_CONFIG_FILENAME}````

target?

type string

default 'esnext'

esbuild_build_options?

Optionally map the esbuild options.

type (base_options: esbuild.BuildOptions) => esbuild.BuildOptions

default `identity`

rebuild_throttle_delay?

Milliseconds to throttle rebuilds. Should be longer than it takes to build to avoid backpressure.

type number

default 1000

cli_command?

The CLI command to run the server, like 'node' or 'bun' or 'deno'. Receives the path to the server js file as its argument.

type string

default 'node'

run?

Whether to run the server or not after building.

type boolean

default `dev`

GroPluginSveltekitAppOptions
#

gro_plugin_sveltekit_app.ts view source

GroPluginSveltekitAppOptions import type {GroPluginSveltekitAppOptions} from '@fuzdev/gro/gro_plugin_sveltekit_app.js';

vite_cli?

The Vite CLI to use.

type string

GroPluginSveltekitLibraryOptions
#

has_server
#

gro_plugin_server.ts view source

(path?: PathId): Promise<Result<object, { message: string; }>> import {has_server} from '@fuzdev/gro/gro_plugin_server.js';

path

type PathId
default SERVER_SOURCE_ID

returns

Promise<Result<object, { message: string; }>>

has_sveltekit_app
#

sveltekit_helpers.ts view source

(svelte_config_path?: string): Promise<Result<object, { message: string; }>> import {has_sveltekit_app} from '@fuzdev/gro/sveltekit_helpers.js';

svelte_config_path

type string
default SVELTE_CONFIG_FILENAME

returns

Promise<Result<object, { message: string; }>>

has_sveltekit_library
#

sveltekit_helpers.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }, svelte_config?: ParsedSvelteConfig, dep_name?: string): Promise<...> import {has_sveltekit_library} from '@fuzdev/gro/sveltekit_helpers.js';

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

svelte_config

default default_svelte_config

dep_name

type string
default SVELTE_PACKAGE_DEP_NAME

returns

Promise<Result<object, { message: string; }>>

ImportSpecifier
#

parse_imports.ts view source

ImportSpecifier import type {ImportSpecifier} from '@fuzdev/gro/parse_imports.js';

intersects

Flavored<string, 'ImportSpecifier'>

[key: number]

type string

infer_paths
#

paths.ts view source

(id: PathId): Paths import {infer_paths} from '@fuzdev/gro/paths.js';

id

type PathId

returns

Paths

InputPath
#

install_with_cache_healing
#

npm_install_helpers.ts view source

(pm_cli: string, options?: InstallCacheHealingOptions): Promise<NpmCommandResult> import {install_with_cache_healing} from '@fuzdev/gro/npm_install_helpers.js';

Installs dependencies, self-healing the stale-cache (ETARGET) failure mode.

Strategy:

  1. First attempt: ${pm_cli} install [...install_args].
  2. On an npm ETARGET-class failure (stale cache): npm cache clean --force then retry the same install once.
  3. On any other failure — or any failure under a non-npm pm_cli — return immediately without healing.

Why ETARGET happens: right after a dependency is published and the registry has propagated, npm's local cache may still hold stale "404"/no-version metadata for it; clearing the cache forces a fresh metadata fetch. This makes installs safe to run immediately after publishing an upstream package — e.g. picking up a just-released dep in a dependency-ordered publish chain, or gro upgrade-ing to a fresh @latest.

npm only: the heal uses npm-specific syntax (cache clean --force), so it's gated on pm_cli === 'npm'. A non-npm pm_cli surfaces the failure unchanged rather than running a command it can't understand.

The env is always passed through sanitize_install_env so the build's devDependencies survive.

pm_cli

the npm-compatible CLI to run (e.g. config.pm_cli)

type string

options

cwd, env, logger, extra install args, and an injectable runner

default {}

returns

Promise<NpmCommandResult>

the result of the (possibly retried) install

install_with_cache_healing_or_throw
#

npm_install_helpers.ts view source

(pm_cli: string, options?: InstallCacheHealingOptions & { context?: string | undefined; }): Promise<void> import {install_with_cache_healing_or_throw} from '@fuzdev/gro/npm_install_helpers.js';

install_with_cache_healing that throws a TaskError on failure instead of returning the result — the shape every task callsite wants. The thrown message names the exact command (including install_args), an optional context clause, and the failure detail.

pm_cli

the npm-compatible CLI to run (e.g. config.pm_cli)

type string

options

same as install_with_cache_healing, plus an optional context clause appended after the command (e.g. 'after version bump')

type InstallCacheHealingOptions & { context?: string | undefined; }
default {}

returns

Promise<void>

throws

  • TaskError - when the install fails, even after a cache-heal retry

InstallCacheHealingOptions
#

npm_install_helpers.ts view source

InstallCacheHealingOptions import type {InstallCacheHealingOptions} from '@fuzdev/gro/npm_install_helpers.js';

cwd?

working directory for the install; defaults to the current directory

type string

env?

base env; devDependency-pruning vars are stripped via sanitize_install_env

type NodeJS.ProcessEnv

log?

logger for cache-heal progress

type Logger

run?

injectable command runner for tests; defaults to a live-teeing spawn

type NpmCommandRunner

install_args?

Extra args appended after install, e.g. package specs and flags for gro upgrade (['foo@latest', '--force']) or a single dep for gro changeset (['-D', '@changesets/changelog-git']). The same args are reused on the post-cache-clean retry.

type ReadonlyArray<string>

invalidate
#

invalidateAll
#

invoke_task
#

invoke_task.ts view source

(task_name: RawInputPath, args: Args | undefined, config: GroConfig, initial_filer?: Filer | undefined, initial_timings?: Timings | null | undefined, parent_log?: Logger | undefined): Promise<...> import {invoke_task} from '@fuzdev/gro/invoke_task.js';

Invokes Gro tasks by name using the filesystem as the source.

When a task is invoked, Gro first searches for tasks in the current working directory. and falls back to searching Gro's directory, if the two are different. See input_path.ts for info about what "task_name" can refer to. If it matches a directory, all of the tasks within it are logged, both in the current working directory and Gro.

This code is particularly hairy because we're accepting a wide range of user input and trying to do the right thing. Precise error messages are especially difficult and there are some subtle differences in the complex logical branches. The comments describe each condition.

task_name

the name of the task to invoke

args

the CLI args to pass to the task

type Args | undefined

config

the Gro configuration

initial_filer?

type Filer | undefined
optional

initial_timings?

the timings to use for the top-level task, null for composed tasks

type Timings | null | undefined
optional

parent_log?

type Logger | undefined
optional

returns

Promise<void>

InvokeTask
#

task.ts view source

InvokeTask import type {InvokeTask} from '@fuzdev/gro/task.js';

(call)

type (task_name: string, args?: Args | undefined, config?: GroConfig | undefined): Promise<void>

task_name

type string

args?

type Args | undefined
optional

config?

type GroConfig | undefined
optional
returns Promise<void>

is_build_cache_valid
#

build_cache.ts view source

(config: GroConfig, log: Logger, git_commit?: string | null | undefined): Promise<boolean> import {is_build_cache_valid} from '@fuzdev/gro/build_cache.js';

Main function to check if the build cache is valid. Returns true if the cached build can be used, false if a fresh build is needed.

config

Gro config

log

Logger

type Logger

git_commit?

optional pre-computed git commit hash (optimization)

type string | null | undefined
optional

returns

Promise<boolean>

is_etarget_error
#

npm_install_helpers.ts view source

(message: string, stderr: string): boolean import {is_etarget_error} from '@fuzdev/gro/npm_install_helpers.js';

Checks if an npm install failure is caused by stale cache (ETARGET).

Detects the several shapes npm uses for "the requested version isn't there": code ETARGET, ETARGET, notarget, and No matching version found.

message

the short outcome string (e.g. code 1)

type string

stderr

the captured stderr of the failed command

type string

returns

boolean

true when the failure looks like an ETARGET-class staleness error

is_external_module
#

module.ts view source

(module_name: string): boolean import {is_external_module} from '@fuzdev/gro/module.js';

module_name

type string

returns

boolean

is_gen_path
#

gen.ts view source

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

path

type string

returns

boolean

is_gro_id
#

paths.ts view source

(id: PathId): boolean import {is_gro_id} from '@fuzdev/gro/paths.js';

id

type PathId

returns

boolean

is_private_env
#

env.ts view source

(key: string, public_prefix: string, private_prefix: string): boolean import {is_private_env} from '@fuzdev/gro/env.js';

key

type string

public_prefix

type string

private_prefix

type string

returns

boolean

is_public_env
#

env.ts view source

(key: string, public_prefix: string, private_prefix: string): boolean import {is_public_env} from '@fuzdev/gro/env.js';

key

type string

public_prefix

type string

private_prefix

type string

returns

boolean

is_task_path
#

task.ts view source

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

path

type string

returns

boolean

IS_THIS_GRO
#

JS_CLI_DEFAULT
#

JS_MATCHER
#

JSON_MATCHER
#

LIB_DIR
#

LIB_DIRNAME
#

LIB_PATH
#

LIBRARY_CACHE_FILENAME
#

library_cache_key
#

library_load.ts view source

(repo_dir: string): Promise<string | null> import {library_cache_key} from '@fuzdev/gro/library_load.js';

Computes the cache key for a repo at repo_dir: the git HEAD commit hash.

Returns null (uncacheable — analysis still runs, caching is skipped) when the dir is not a git repo OR when the working tree is dirty. A dirty tree is deliberately uncacheable: the commit hash doesn't capture uncommitted edits, so a single -dirty key would serve a stale analysis across successive edits. Skipping the cache while dirty guarantees fresh metadata; clean commits cache.

repo_dir

type string

returns

Promise<string | null>

library_cache_read
#

library_load.ts view source

(cache_path: string, key: string, log?: Logger | undefined): Promise<LibraryLoadResult | null> import {library_cache_read} from '@fuzdev/gro/library_load.js';

Reads and validates the .gro/library.json cache at cache_path.

Returns the cached {library_json, package_json} only when the file exists and its stored hash matches key. Returns null on every miss - absent, stale (different hash), or unreadable/corrupt - signalling the caller to re-analyze.

cache_path

absolute path to the cache file

type string

key

the expected cache key (a clean git commit hash)

type string

log?

type Logger | undefined
optional

returns

Promise<LibraryLoadResult | null>

the cached result, or null on any miss

LIBRARY_CACHE_VERSION
#

library_load.ts view source

1 import {LIBRARY_CACHE_VERSION} from '@fuzdev/gro/library_load.js';

Format version for the .gro/library.json cache. The cache key is the git commit hash, which does NOT change when the cached *shape* changes — so bump this whenever LibraryCache's shape changes (e.g. the LibraryJson / PkgJson split, then slimming LibraryJson to the raw pkg_json/source_json pair) to self-invalidate stale caches across the ecosystem rather than serve old-shaped data at an unchanged commit.

library_cache_write
#

library_load.ts view source

(cache_path: string, key: string, result: LibraryLoadResult, log?: Logger | undefined): Promise<void> import {library_cache_write} from '@fuzdev/gro/library_load.js';

Writes result to the .gro/library.json cache at cache_path, keyed by key and stamped with the current LIBRARY_CACHE_VERSION, creating the parent directory as needed.

Best effort: caching is optional, so write failures are logged as a warning and swallowed rather than thrown.

cache_path

absolute path to the cache file

type string

key

the cache key to store (a clean git commit hash)

type string

result

the {library_json, package_json} to cache

log?

type Logger | undefined
optional

returns

Promise<void>

library_load_from_repo
#

library_load.ts view source

(repo_dir: string, options?: LibraryLoadOptions | undefined): Promise<LibraryLoadResult> import {library_load_from_repo} from '@fuzdev/gro/library_load.js';

Loads a repo's library metadata via svelte-docinfo, with a .gro cache keyed by git hash.

Analyzes repo_dir with analyzeFromFiles and combines the result with the repo's package.json into a LibraryJson, returned alongside the full package.json. Results are cached at <repo_dir>/.gro/library.json keyed by the current git HEAD, so repeated loads at the same commit skip the (potentially slow) analysis. A dirty working tree (or a non-git dir) is uncacheable, so analysis re-runs on every load until the changes are committed - see library_cache_key.

repo_dir

absolute path to the repo to analyze

type string

options?

type LibraryLoadOptions | undefined
optional

returns

Promise<LibraryLoadResult>

the repo's LibraryLoadResult (library_json + full package_json)

LibraryCache
#

LibraryLoadOptions
#

library_load.ts view source

LibraryLoadOptions import type {LibraryLoadOptions} from '@fuzdev/gro/library_load.js';

log?

type Logger

cache?

Set to false to bypass the .gro cache (always re-analyze, but still write the result).

type boolean

LibraryLoadResult
#

library_load.ts view source

LibraryLoadResult import type {LibraryLoadResult} from '@fuzdev/gro/library_load.js';

Result of loading a repo's library metadata: the curated LibraryJson (carrying the publish-safe pkg_json) plus the repo's full package.json.

The full package_json is kept alongside — not folded into LibraryJson — because tooling like fuz_gitops needs dependencies/devDependencies, which the curated LibraryJson.pkg_json deliberately omits.

library_json

type LibraryJson

package_json

type PackageJson

load_build_cache_metadata
#

build_cache.ts view source

(): Promise<{ version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; } | null> import {load_build_cache_metadata} from '@fuzdev/gro/build_cache.js';

Loads build cache metadata from .gro/ directory. Invalid or corrupted cache files are automatically deleted.

returns

Promise<{ version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; } | null>

load_env
#

env.ts view source

(dev: boolean, visibility: "public" | "private", public_prefix: string, private_prefix: string, env_dir?: string | undefined, env_files?: string[], ambient_env?: ProcessEnv): Record<...> import {load_env} from '@fuzdev/gro/env.js';

dev

type boolean

visibility

type "public" | "private"

public_prefix

type string

private_prefix

type string

env_dir?

type string | undefined
optional

env_files

type string[]
default ['.env', '.env.' + (dev ? 'development' : 'production')]

ambient_env

type ProcessEnv
default process.env

returns

Record<string, string>

load_from_env
#

env.ts view source

(key: string, paths?: string[]): string | undefined import {load_from_env} from '@fuzdev/gro/env.js';

Loads a single env value without merging it into process.env. By default searches process.env, then a local .env if one exists, then ../.env if it exists. Empty strings are semantically the same as undefined for more ergonomic fallbacks.

key

type string

paths

type string[]
default ['.env', '../.env']

returns

string | undefined

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 | undefined
optional

returns

Promise<LoadGenfilesResult>

load_gro_config
#

gro_config.ts view source

(dir?: string): Promise<GroConfig> import {load_gro_config} from '@fuzdev/gro/gro_config.js';

dir

type string
default paths.root

returns

Promise<GroConfig>

load_module
#

modules.ts view source

<TModule extends Record<string, any>>(id: PathId, validate?: ((mod: Record<string, any>) => mod is TModule) | undefined, bust_cache?: boolean | undefined): Promise<LoadModuleResult<TModule>> import {load_module} from '@fuzdev/gro/modules.js';

id

type PathId

validate?

type ((mod: Record<string, any>) => mod is TModule) | undefined
optional

bust_cache?

type boolean | undefined
optional

returns

Promise<LoadModuleResult<TModule>>

generics

load_module<TModule extends Record<string, any>>
TModule
constraint Record<string, any>

load_modules
#

modules.ts view source

<TModule extends Record<string, any>, TModuleMeta extends ModuleMeta<TModule>>(resolved_input_files: ResolvedInputFile[], validate: (mod: any) => mod is TModule, map_module_meta: (resolved_input_file: ResolvedInputFile, mod: TModule) => TModuleMeta, timings?: Timings | undefined): Promise<...> import {load_modules} from '@fuzdev/gro/modules.js';

resolved_input_files

type ResolvedInputFile[]

validate

type (mod: any) => mod is TModule

map_module_meta

type (resolved_input_file: ResolvedInputFile, mod: TModule) => TModuleMeta

timings?

type Timings | undefined
optional

returns

Promise<LoadModulesResult<TModuleMeta>>

generics

load_modules<TModule extends Record<string, any>, TModuleMeta extends ModuleMeta<TModule>>
TModule
constraint Record<string, any>
TModuleMeta
constraint ModuleMeta<TModule>

load_svelte_config
#

svelte_config.ts view source

({ dir, config_filename, }?: { dir?: string | undefined; config_filename?: string | undefined; }): Promise<Config | null> import {load_svelte_config} from '@fuzdev/gro/svelte_config.js';

Loads a SvelteKit config at dir.

__0

type { dir?: string | undefined; config_filename?: string | undefined; }
default EMPTY_OBJECT

returns

Promise<Config | null>

null if no config is found

load_tasks
#

task.ts view source

(found_tasks: FoundTasks, root_path?: PathId): Promise<LoadTasksResult> import {load_tasks} from '@fuzdev/gro/task.js';

found_tasks

root_path

type PathId
default process.cwd()

returns

Promise<LoadTasksResult>

LoadedGenfiles
#

gen.ts view source

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

modules

type Array<GenfileModuleMeta>

found_genfiles

type FoundGenfiles

LoadedTasks
#

task.ts view source

LoadedTasks import type {LoadedTasks} from '@fuzdev/gro/task.js';

modules

type Array<TaskModuleMeta>

found_tasks

type FoundTasks

LoadGenfilesFailure
#

gen.ts view source

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

LoadGenfilesResult
#

gen.ts view source

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

LoadModuleFailure
#

LoadModuleResult
#

modules.ts view source

LoadModuleResult<TModule> import type {LoadModuleResult} from '@fuzdev/gro/modules.js';

generics

LoadModuleResult<TModule>
TModule

LoadModulesFailure
#

modules.ts view source

LoadModulesFailure<TModuleMeta> import type {LoadModulesFailure} from '@fuzdev/gro/modules.js';

generics

LoadModulesFailure<TModuleMeta extends ModuleMeta>
TModuleMeta
constraint ModuleMeta

type

type 'load_module_failures'

load_module_failures

type Array<LoadModuleFailure>

reasons

type Array<string>

modules

type Array<TModuleMeta>

LoadModulesResult
#

modules.ts view source

LoadModulesResult<TModuleMeta> import type {LoadModulesResult} from '@fuzdev/gro/modules.js';

generics

LoadModulesResult<TModuleMeta extends ModuleMeta>
TModuleMeta
constraint ModuleMeta

LoadTasksFailure
#

task.ts view source

LoadTasksFailure import type {LoadTasksFailure} from '@fuzdev/gro/task.js';

LoadTasksResult
#

task.ts view source

LoadTasksResult import type {LoadTasksResult} from '@fuzdev/gro/task.js';

LOCKFILE_FILENAME
#

log_error_reasons
#

task_logging.ts view source

(log: Logger, reasons: string[]): void import {log_error_reasons} from '@fuzdev/gro/task_logging.js';

log

type Logger

reasons

type string[]

returns

void

log_task_help
#

log_tasks
#

task_logging.ts view source

(log: Logger, loaded_tasks: LoadedTasks, log_intro?: boolean): void import {log_tasks} from '@fuzdev/gro/task_logging.js';

log

type Logger

loaded_tasks

log_intro

type boolean
default true

returns

void

map_child_process_output
#

child_process_logging.ts view source

(child_process: ChildProcess, transform: (data: string) => string): void import {map_child_process_output} from '@fuzdev/gro/child_process_logging.js';

Maps child process output through a transform function.

child_process

type ChildProcess

transform

type (data: string) => string

returns

void

map_sveltekit_aliases
#

sveltekit_helpers.ts view source

(specifier: string, aliases: [string, string][]): string import {map_sveltekit_aliases} from '@fuzdev/gro/sveltekit_helpers.js';

Map an import specifier with the SvelteKit aliases.

specifier

type string

aliases

type [string, string][]

returns

string

merge_envs
#

env.ts view source

(envs: Record<string, string | undefined>[], visibility: "public" | "private", public_prefix: string, private_prefix: string): Record<string, string> import {merge_envs} from '@fuzdev/gro/env.js';

envs

type Record<string, string | undefined>[]

visibility

type "public" | "private"

public_prefix

type string

private_prefix

type string

returns

Record<string, string>

MODULE_PATH_LIB_PREFIX
#

MODULE_PATH_SRC_PREFIX
#

ModuleMeta
#

modules.ts view source

ModuleMeta<TModule> import type {ModuleMeta} from '@fuzdev/gro/modules.js';

generics

ModuleMeta<TModule extends Record<string, any> = Record<string, any>>
TModule
constraint Record<string, any>
default Record<string, any>

id

type PathId

mod

type TModule

navigating
#

NODE_MODULES_DIRNAME
#

normalize_gen_config
#

gen.ts view source

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

gen

type Gen

returns

GenConfig

NpmCommandResult
#

npm_install_helpers.ts view source

NpmCommandResult import type {NpmCommandResult} from '@fuzdev/gro/npm_install_helpers.js';

Result of one install or cache-clean attempt.

ok

type boolean

stderr

captured stderr; the default runner also tees this live to the terminal

type string

detail

short human-readable outcome, e.g. code 1 or error: spawn ENOENT

type string

NpmCommandRunner
#

npm_install_helpers.ts view source

NpmCommandRunner import type {NpmCommandRunner} from '@fuzdev/gro/npm_install_helpers.js';

Runs an npm-compatible command and reports ok plus captured stderr. Injected by install_with_cache_healing for testing; the default implementation spawns a real subprocess.

(call)

type (command: string, args: readonly string[], options?: { cwd?: string | undefined; env?: ProcessEnv | undefined; } | undefined): Promise<NpmCommandResult>

command

type string

args

type readonly string[]

options?

type { cwd?: string | undefined; env?: ProcessEnv | undefined; } | undefined
optional
returns Promise<NpmCommandResult>

OnFilerChange
#

filer.ts view source

OnFilerChange import type {OnFilerChange} from '@fuzdev/gro/filer.js';

(call)

type (change: WatcherChange, disknode: Disknode): void

change

disknode

returns void

Outpaths
#

gro_plugin_server.ts view source

Outpaths import type {Outpaths} from '@fuzdev/gro/gro_plugin_server.js';

outdir

type string

default '.gro/dev' or 'dist_server'

outbase

type string

default 'src/lib'

outname

type string

default 'server.js'

PACKAGE_JSON_EMPTY
#

package_json.ts view source

{ [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; } import {PACKAGE_JSON_EMPTY} from '@fuzdev/gro/package_json.js';

package_json_extract_dependencies
#

package_json.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }): PackageJsonDep[] import {package_json_extract_dependencies} from '@fuzdev/gro/package_json.js';

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

returns

PackageJsonDep[]

PACKAGE_JSON_FILENAME
#

package_json_has_dependency
#

package_json.ts view source

(dep_name: string, package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }): boolean import {package_json_has_dependency} from '@fuzdev/gro/package_json.js';

dep_name

type string

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

returns

boolean

package_json_load
#

package_json.ts view source

(dir?: string, cache?: Record<string, { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; ... 25 more ...; exports?: string | ... 2 more ... | undefined; }> | undefined, parse?: boolean, log?: Logger | undefined): Promise<...> import {package_json_load} from '@fuzdev/gro/package_json.js';

dir

type string
default IS_THIS_GRO ? gro_paths.root : paths.root

cache?

type Record<string, { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }> | undefined
optional

parse

type boolean
default true

log?

type Logger | undefined
optional

returns

Promise<{ [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }>

package_json_load_for_gro
#

package_json.ts view source

(): Promise<{ [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }> import {package_json_load_for_gro} from '@fuzdev/gro/package_json.js';

returns

Promise<{ [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }>

package_json_parse_repo_url
#

package_json.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }): { ...; } | undefined import {package_json_parse_repo_url} from '@fuzdev/gro/package_json.js';

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

returns

{ owner: string; repo: string; } | undefined

package_json_serialize
#

package_json.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }): string import {package_json_serialize} from '@fuzdev/gro/package_json.js';

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

returns

string

package_json_sync
#

package_json.ts view source

(map_package_json: PackageJsonMapper, log: Logger, write?: boolean, dir?: string, exports_dir?: string): Promise<{ package_json: { [x: string]: unknown; name: string; version?: string | undefined; ... 28 more ...; exports?: string | ... 2 more ... | undefined; } | null; changed: boolean; }> import {package_json_sync} from '@fuzdev/gro/package_json.js';

map_package_json

log

type Logger

write

type boolean
default true

dir

type string
default paths.root

exports_dir

type string
default paths.lib

returns

Promise<{ package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; } | null; changed: boolean; }>

package_json_to_exports
#

package_json.ts view source

(paths: string[]): string | Record<string, unknown> | null import {package_json_to_exports} from '@fuzdev/gro/package_json.js';

paths

type string[]

returns

string | Record<string, unknown> | null

package_json_update
#

package_json.ts view source

(update: (package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }) => { ...; } | ... 1 more ... | null, dir?: string, write?: boolean): Promise<...> import {package_json_update} from '@fuzdev/gro/package_json.js';

Updates package.json. Writes to the filesystem only when contents change.

update

type (package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }) => { ...; } | ... 1 more ... | null

dir

type string
default paths.root

write

type boolean
default true

returns

Promise<{ package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; } | null; changed: boolean; }>

package_json_write
#

package_json.ts view source

(serialized_package_json: string): Promise<void> import {package_json_write} from '@fuzdev/gro/package_json.js';

serialized_package_json

type string

returns

Promise<void>

PackageJsonDep
#

package_json.ts view source

PackageJsonDep import type {PackageJsonDep} from '@fuzdev/gro/package_json.js';

name

type string

version

type string

PackageJsonMapper
#

package_json.ts view source

PackageJsonMapper import type {PackageJsonMapper} from '@fuzdev/gro/package_json.js';

(call)

type (package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }): { ...; } | ... 1 more ... | null

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }
returns { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; } | Promise<...> | null

page
#

sveltekit_shim_app_state.ts view source

Page<{ module_path?: string | undefined; }, "/" | "/about" | "/docs" | "/docs/api" | "/docs/api/[...module_path]" | "/docs/introduction" | "/docs/library" | "/history" | null> import {page} from '@fuzdev/gro/sveltekit_shim_app_state.js';

parse_imports
#

parse_imports.ts view source

(id: PathId, contents: string, ignore_types?: boolean): ImportSpecifier[] import {parse_imports} from '@fuzdev/gro/parse_imports.js';

id

type PathId

contents

type string

ignore_types

type boolean
default true

returns

ImportSpecifier[]

parse_svelte_config
#

svelte_config.ts view source

({ dir_or_config, config_filename, }?: { dir_or_config?: string | Config | undefined; config_filename?: string | undefined; }): Promise<ParsedSvelteConfig> import {parse_svelte_config} from '@fuzdev/gro/svelte_config.js';

Returns Gro-relevant properties of a SvelteKit config as a convenience wrapper around load_svelte_config. Needed because SvelteKit doesn't expose its config resolver.

__0

type { dir_or_config?: string | Config | undefined; config_filename?: string | undefined; }
default EMPTY_OBJECT

returns

Promise<ParsedSvelteConfig>

ParsedSvelteConfig
#

svelte_config.ts view source

ParsedSvelteConfig import type {ParsedSvelteConfig} from '@fuzdev/gro/svelte_config.js';

A subset of SvelteKit's config in a form that Gro uses because SvelteKit doesn't expose its config resolver. Flattens things out to keep them simple and easy to pass around, and doesn't deal with most properties, but includes the full svelte_config. The base and assets in particular are renamed for clarity with Gro's internal systems, so these properties become first-class vocabulary inside Gro.

svelte_config

type SvelteConfig | null

alias

type Record<string, string>

base_url

type '' | `/${string}` | undefined

assets_url

type '' | `http://${string}` | `https://${string}` | undefined

assets_path

Same as the SvelteKit files.assets.

type string

lib_path

Same as the SvelteKit files.lib.

type string

routes_path

Same as the SvelteKit files.routes.

type string

env_dir

type string | undefined

private_prefix

type string | undefined

public_prefix

type string | undefined

svelte_compile_options

type CompileOptions

svelte_compile_module_options

type ModuleCompileOptions

svelte_preprocessors

type PreprocessorGroup | Array<PreprocessorGroup> | undefined

path_id_to_base_path
#

paths.ts view source

(path_id: PathId, p?: Paths): string import {path_id_to_base_path} from '@fuzdev/gro/paths.js';

path_id

type PathId

p

type Paths
default infer_paths(path_id)

returns

string

paths
#

Paths
#

paths.ts view source

Paths import type {Paths} from '@fuzdev/gro/paths.js';

root

type string

source

type string

lib

type string

build

type string

build_dev

type string

config

type string

Plugin
#

plugin.ts view source

Plugin<TPluginContext> import type {Plugin} from '@fuzdev/gro/plugin.js';

Gro Plugins enable custom behavior during gro dev and gro build. In contrast, Adapters use the results of gro build to produce final artifacts.

generics

Plugin<TPluginContext extends PluginContext = PluginContext>
TPluginContext
constraint PluginContext

name

type string

setup?

type (ctx: TPluginContext) => void | Promise<void>

adapt?

type (ctx: TPluginContext) => void | Promise<void>

teardown?

type (ctx: TPluginContext) => void | Promise<void>

plugin_replace
#

plugin.ts view source

(plugins: Plugin<PluginContext<object>>[], new_plugin: Plugin<PluginContext<object>>, name?: string): Plugin<PluginContext<object>>[] import {plugin_replace} from '@fuzdev/gro/plugin.js';

Replaces a plugin by name in plugins without mutating the param. Throws if the plugin name cannot be found.

plugins

accepts the same types as the return value of PluginsCreateConfig

type Plugin<PluginContext<object>>[]

new_plugin

type Plugin<PluginContext<object>>

name

-

type string
default new_plugin.name

returns

Plugin<PluginContext<object>>[]

plugins with new_plugin at the index of the plugin with name

PluginContext
#

plugin.ts view source

PluginContext<TArgs> import type {PluginContext} from '@fuzdev/gro/plugin.js';

generics

PluginContext<TArgs = object>
TArgs
default object

inheritance

extends: TaskContext<TArgs>

dev

type boolean

watch

type boolean

Plugins
#

plugin.ts view source

import {Plugins} from '@fuzdev/gro/plugin.js';

See Plugins.create for a usage example.

generics

Plugins<TPluginContext extends PluginContext>
TPluginContext
constraint PluginContext

ctx

type TPluginContext

readonly

instances

type Array<Plugin<TPluginContext>>

readonly

constructor

type new <TPluginContext extends PluginContext>(ctx: TPluginContext, instances: Plugin<PluginContext<object>>[]): Plugins<TPluginContext>

ctx

type TPluginContext

instances

type Plugin<PluginContext<object>>[]

create

type <TPluginContext extends PluginContext>(ctx: TPluginContext): Promise<Plugins<TPluginContext>>

static

ctx

type TPluginContext
returns Promise<Plugins<TPluginContext>>

setup

type (): Promise<void>

returns Promise<void>

adapt

type (): Promise<void>

returns Promise<void>

teardown

type (): Promise<void>

returns Promise<void>

PluginsCreateConfig
#

plugin.ts view source

PluginsCreateConfig<TPluginContext> import type {PluginsCreateConfig} from '@fuzdev/gro/plugin.js';

generics

PluginsCreateConfig<TPluginContext extends PluginContext = PluginContext>
TPluginContext
constraint PluginContext

(call)

type (ctx: TPluginContext): Plugin<TPluginContext>[] | Promise<Plugin<TPluginContext>[]>

ctx

type TPluginContext
returns Plugin<TPluginContext>[] | Promise<Plugin<TPluginContext>[]>

PM_CLI_DEFAULT
#

PossiblePath
#

preloadCode
#

preloadData
#

sveltekit_shim_app_navigation.ts view source

(href: string) => Promise<{ type: "loaded"; status: number; data: Record<string, any>; } | { type: "redirect"; location: string; }> import {preloadData} from '@fuzdev/gro/sveltekit_shim_app_navigation.js';

print_build_result
#

print_command_args
#

print_path
#

RawGenFile
#

gen.ts view source

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

content

type string

filename?

type string

format?

type boolean

RawGenResult
#

gen.ts view source

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

RawGroConfig
#

gro_config.ts view source

RawGroConfig import type {RawGroConfig} from '@fuzdev/gro/gro_config.js';

The relaxed variant of GroConfig that users can provide via gro.config.ts. Superset of GroConfig.

see also

plugins?

type PluginsCreateConfig

map_package_json?

type PackageJsonMapper | null

task_root_dirs?

type Array<string>

search_filters?

type PathFilter | Array<PathFilter> | null

js_cli?

type string

pm_cli?

type string

build_cache_config?

Optional object defining custom build inputs for cache invalidation. This value is hashed during config normalization and used to detect when builds need to be regenerated due to non-source changes.

Use cases:

  • Environment variables baked into build: {api_url: process.env.PUBLIC_API_URL}
  • External data files: {data: fs.readFileSync('data.json', 'utf-8')}
  • Build feature flags: {enable_analytics: true}

Can be a static object or an async function that returns an object.

IMPORTANT: It's safe to include secrets here because they are hashed and deleted during config normalization. The raw value is never logged or persisted.

type | Record<string, unknown> | (() => Record<string, unknown> | Promise<Record<string, unknown>>)

filer_options?

Options passed to the Filer for file watching and import resolution.

type Partial<FilerOptions> | null

see also

  • ``FilerOptions``

RawInputPath
#

render_env_shim_module
#

sveltekit_shim_env.ts view source

(dev: boolean, mode: "static" | "dynamic", visibility: "public" | "private", public_prefix?: string, private_prefix?: string, env_dir?: string | undefined, env_files?: string[] | undefined, ambient_env?: Record<...> | undefined): string import {render_env_shim_module} from '@fuzdev/gro/sveltekit_shim_env.js';

Generates a module shim for SvelteKit's $env imports.

dev

type boolean

mode

type "static" | "dynamic"

visibility

type "public" | "private"

public_prefix

type string
default 'PUBLIC_'

private_prefix

type string
default ''

env_dir?

type string | undefined
optional

env_files?

type string[] | undefined
optional

ambient_env?

type Record<string, string | undefined> | undefined
optional

returns

string

render_sveltekit_shim_app_environment
#

sveltekit_shim_app.ts view source

(dev: boolean): string import {render_sveltekit_shim_app_environment} from '@fuzdev/gro/sveltekit_shim_app.js';

dev

type boolean

returns

string

render_sveltekit_shim_app_paths
#

sveltekit_shim_app.ts view source

(base_url?: "" | `/${string}` | undefined, assets_url?: "" | `http://${string}` | `https://${string}` | undefined): string import {render_sveltekit_shim_app_paths} from '@fuzdev/gro/sveltekit_shim_app.js';

base_url

type "" | `/${string}` | undefined
default ''

assets_url

type "" | `http://${string}` | `https://${string}` | undefined
default ''

returns

string

replace_extension
#

paths.ts view source

(path: string, new_extension: string): string import {replace_extension} from '@fuzdev/gro/paths.js';

path

type string

new_extension

type string

returns

string

resolve
#

sveltekit_shim_app_paths.ts view source

<T extends RouteIdWithSearchOrHash | PathnameWithSearchOrHash>(...args: ResolveArgs<T>): "/" | "/about" | "/docs" | "/docs/api" | "/docs/introduction" | "/docs/library" | ... 9 more ... | `/${string}${`/docs/api/${string}` & {}}` import {resolve} from '@fuzdev/gro/sveltekit_shim_app_paths.js';

args

type ResolveArgs<T>

returns

"/" | "/about" | "/docs" | "/docs/api" | "/docs/introduction" | "/docs/library" | "/history" | `${`/docs/api/${string}` & {}}` | `/${string}/` | `/${string}/about` | `/${string}/docs` | `/${string}/docs/api` | `/${string}/docs/introduction` | `/${string}/docs/library` | `/${string}/history` | `/${string}${`/docs/api...

resolve_cli
#

cli.ts view source

(name_or_cli: string | Cli, args: string[] | undefined, cwd: string | URL | undefined, log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<...> import {resolve_cli} from '@fuzdev/gro/cli.js';

name_or_cli

type string | Cli

args

type string[]
default []

cwd

type string | URL | undefined

log?

type Logger | undefined
optional

options?

type SpawnOptions | undefined
optional

returns

Promise<Cli | undefined>

resolve_gro_module_path
#

gro_helpers.ts view source

(path?: string): string import {resolve_gro_module_path} from '@fuzdev/gro/gro_helpers.js';

Resolves a path to an internal Gro file. Prefers any local installation of Gro and falls back to the current CLI context.

Uses heuristics to find path, so may fail in some rare corner cases. Currently looks for gro.ts as a sibling to the path arg for detection. If this fails for your usecases, rename gro.ts or open an issue/PR!

Used by the CLI and gro run.

case 1:

We're in a directory that has a local installation of Gro at node_modules/.bin/gro. Use this local version instead of the global.

case 2:

We're running Gro inside the Gro repo itself.

In this case, we use the build directory instead of dist. There's a paradox here for using Gro inside itself - ideally we use the dist directory because that's what's shipped, but the build directory has all of the tests, and loading two instances of its modules causes problems like instanceof checks failing. For now we'll just run from build and see if it causes any problems. There's probably a better design in here somewhere.

case 3:

Fall back to invoking Gro from wherever the CLI is being executed. When using the global CLI, this uses the global Gro installation.

path

type string
default ''

returns

string

resolve_input_files
#

input_path.ts view source

(resolved_input_paths: ResolvedInputPath[], search?: (dir: string) => Promise<ResolvedPath[]>): Promise<ResolvedInputFiles> import {resolve_input_files} from '@fuzdev/gro/input_path.js';

Finds all of the matching files for the given input paths. De-dupes source ids.

resolved_input_paths

type ResolvedInputPath[]

search

type (dir: string) => Promise<ResolvedPath[]>
default fs_search

returns

Promise<ResolvedInputFiles>

resolve_input_paths
#

input_path.ts view source

(input_paths: InputPath[], root_dirs: PathId[], extensions: string[]): Promise<ResolvedInputPaths> import {resolve_input_paths} from '@fuzdev/gro/input_path.js';

Gets the path data for each input path, checking the filesystem for the possibilities and stopping at the first existing file or falling back to the first existing directory. If none is found for an input path, it's added to unmapped_input_paths.

input_paths

type InputPath[]

root_dirs

type PathId[]

extensions

type string[]

returns

Promise<ResolvedInputPaths>

resolve_specifier
#

resolve_specifier.ts view source

(specifier: string, dir: string): Promise<ResolvedSpecifier> import {resolve_specifier} from '@fuzdev/gro/resolve_specifier.js';

Maps an import specifier relative to dir, and infer the correct extension following Vite conventions. If no .js file is found for the specifier on the filesystem, it assumes .ts.

specifier

type string

dir

type string

returns

Promise<ResolvedSpecifier>

ResolvedInputFile
#

ResolvedInputFiles
#

input_path.ts view source

ResolvedInputFiles import type {ResolvedInputFiles} from '@fuzdev/gro/input_path.js';

resolved_input_files

type Array<ResolvedInputFile>

resolved_input_files_by_root_dir

type Map<PathId, Array<ResolvedInputFile>>

input_directories_with_no_files

type Array<InputPath>

ResolvedInputPath
#

input_path.ts view source

ResolvedInputPath import type {ResolvedInputPath} from '@fuzdev/gro/input_path.js';

input_path

type InputPath

id

type PathId

is_directory

type boolean

root_dir

type PathId

ResolvedInputPaths
#

input_path.ts view source

ResolvedInputPaths import type {ResolvedInputPaths} from '@fuzdev/gro/input_path.js';

resolved_input_paths

type Array<ResolvedInputPath>

possible_paths_by_input_path

type Map<InputPath, Array<PossiblePath>>

unmapped_input_paths

type Array<InputPath>

ResolvedSpecifier
#

resolve_specifier.ts view source

ResolvedSpecifier import type {ResolvedSpecifier} from '@fuzdev/gro/resolve_specifier.js';

path_id

The resolved filesystem path for the specifier.

type PathId

path_id_with_querystring

Same as path_id but includes ?raw and other querystrings. (currently none)

type string

specifier

type string

mapped_specifier

type string

namespace

type undefined | 'sveltekit_local_imports_ts' | 'sveltekit_local_imports_js'

raw

type boolean

resolveRoute
#

sveltekit_shim_app_paths.ts view source

⚠️ deprecated

<T extends RouteIdWithSearchOrHash | PathnameWithSearchOrHash>(...args: ResolveArgs<T>) => "/" | "/about" | "/docs" | "/docs/api" | "/docs/introduction" | "/docs/library" | ... 9 more ... | `/${string}${`/docs/api/${string}` & {}}` import {resolveRoute} from '@fuzdev/gro/sveltekit_shim_app_paths.js';

rewrite_dist_imports
#

dist_rewrite_imports.ts view source

(dist_dir?: string, log?: Logger | undefined): Promise<RewriteDistImportsResult> import {rewrite_dist_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Walks dist_dir and rewrites relative .ts import specifiers to .js in every .js runtime file and .d.ts declaration file (whole-file) and .svelte file (<script> blocks only). Source maps (*.map) are skipped.

dist_dir

the packaged output directory; defaults to dist

type string
default SVELTEKIT_DIST_DIRNAME

log?

type Logger | undefined
optional

returns

Promise<RewriteDistImportsResult>

counts of files scanned and rewritten

rewrite_relative_ts_imports
#

dist_rewrite_imports.ts view source

(content: string): string import {rewrite_relative_ts_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Rewrites relative .ts (and .svelte.ts) import specifiers to .js (and .svelte.js) across a chunk of TypeScript source — a whole .d.ts file or a .svelte <script> block.

content

type string

returns

string

rewrite_svelte_ts_imports
#

dist_rewrite_imports.ts view source

(content: string): string import {rewrite_svelte_ts_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Rewrites relative .ts import specifiers to .js inside each <script> block of a .svelte file, leaving template markup untouched.

content

type string

returns

string

RewriteDistImportsResult
#

dist_rewrite_imports.ts view source

RewriteDistImportsResult import type {RewriteDistImportsResult} from '@fuzdev/gro/dist_rewrite_imports.js';

scanned

Number of files scanned (.js, .d.ts, and .svelte).

type number

rewritten

Number of scanned files whose contents changed.

type number

ROUTES_DIRNAME
#

run_gen
#

run_gen.ts view source

(gen_modules: GenfileModuleMeta[], config: GroConfig, filer: Filer, log: Logger, timings: Timings, invoke_task: InvokeTask, format_file?: ((content: string, options?: FormatFileOptions) => string) | undefined): Promise<...> import {run_gen} from '@fuzdev/gro/run_gen.js';

gen_modules

type GenfileModuleMeta[]

config

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

format_file?

type ((content: string, options?: FormatFileOptions) => string) | undefined
optional

returns

Promise<GenResults>

run_svelte_package
#

sveltekit_helpers.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }, options: SveltePackageOptions | undefined, cli: string | Cli, log: Logger, pm_cli: string): Promise<...> import {run_svelte_package} from '@fuzdev/gro/sveltekit_helpers.js';

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

options

type SveltePackageOptions | undefined

cli

type string | Cli

log

type Logger

pm_cli

type string

returns

Promise<void>

run_task
#

run_task.ts view source

(task_meta: TaskModuleMeta, unparsed_args: Args, invoke_task: (task_name: RawInputPath, args: Args | undefined, config: GroConfig, initial_filer?: Filer | undefined, initial_timings?: Timings | ... 1 more ... | undefined, parent_log?: Logger | undefined) => Promise<...>, config: GroConfig, filer: Filer, log: Logger, timings: Timings): Promise<...> import {run_task} from '@fuzdev/gro/run_task.js';

task_meta

unparsed_args

type Args

invoke_task

type (task_name: RawInputPath, args: Args | undefined, config: GroConfig, initial_filer?: Filer | undefined, initial_timings?: Timings | null | undefined, parent_log?: Logger | undefined) => Promise<...>

config

filer

type Filer

log

type Logger

timings

type Timings

returns

Promise<RunTaskResult>

RunTaskResult
#

sanitize_install_env
#

npm_install_helpers.ts view source

(env: ProcessEnv): ProcessEnv import {sanitize_install_env} from '@fuzdev/gro/npm_install_helpers.js';

Returns a copy of env with the devDependency-pruning vars removed.

env

the source environment to sanitize

type ProcessEnv

returns

ProcessEnv

a fresh env object; the input is not mutated

save_build_cache_metadata
#

build_cache.ts view source

(metadata: { version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; }, log?: Logger | undefined): Promise<...> import {save_build_cache_metadata} from '@fuzdev/gro/build_cache.js';

Saves build cache metadata to .gro/ directory. Errors are logged but don't fail the build (cache is optional).

metadata

type { version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; }

log?

type Logger | undefined
optional

returns

Promise<void>

SEARCH_EXCLUDER_DEFAULT
#

gro_config.ts view source

RegExp import {SEARCH_EXCLUDER_DEFAULT} from '@fuzdev/gro/gro_config.js';

The regexp used by default to exclude directories and files when searching the filesystem for tasks and genfiles. Customize via search_filters in the GroConfig. See the test cases for the exact behavior.

SERVER_DIST_PATH
#

SERVER_SOURCE_ID
#

should_trigger_gen
#

gen_helpers.ts view source

(gen_file_id: PathId, changed_file_id: PathId, config: GroConfig, filer: Filer, log: Logger, timings: Timings, invoke_task: InvokeTask): Promise<...> import {should_trigger_gen} from '@fuzdev/gro/gen_helpers.js';

Check if a file change should trigger a gen file.

gen_file_id

type PathId

changed_file_id

type PathId

config

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

returns

Promise<boolean>

SilentError
#

task.ts view source

import {SilentError} from '@fuzdev/gro/task.js';

This is used to tell Gro to exit silently, usually still with with a non-zero exit code. Using it means error logging is handled by the code that threw it.

inheritance

extends: Error

SOURCE_DIR
#

SOURCE_DIRNAME
#

spawn_cli
#

cli.ts view source

(name_or_cli: string | Cli, args?: string[], log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<SpawnResult | undefined> import {spawn_cli} from '@fuzdev/gro/cli.js';

Spawns a CLI if available using fuz_util's spawn. If a string is provided for name_or_cli, it checks first local to the cwd and then globally.

name_or_cli

type string | Cli

args

type string[]
default []

log?

type Logger | undefined
optional

options?

type SpawnOptions | undefined
optional

returns

Promise<SpawnResult | undefined>

undefined if no CLI is found, or the spawn result

spawn_cli_process
#

cli.ts view source

(name_or_cli: string | Cli, args?: string[], log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<SpawnedProcess | undefined> import {spawn_cli_process} from '@fuzdev/gro/cli.js';

Spawns a CLI if available using fuz_util's spawn_process. If a string is provided for name_or_cli, it checks first local to the cwd and then globally.

name_or_cli

type string | Cli

args

type string[]
default []

log?

type Logger | undefined
optional

options?

type SpawnOptions | undefined
optional

returns

Promise<SpawnedProcess | undefined>

undefined if no CLI is found, or the spawn result

spawn_with_loader
#

gro_helpers.ts view source

(loader_path: string, invoke_path: string, argv: string[], js_cli?: string): Promise<SpawnResult> import {spawn_with_loader} from '@fuzdev/gro/gro_helpers.js';

Runs a file using the Gro loader.

Uses conditional exports to correctly set up esm-env as development by default, so if you want production set NODE_ENV=production.

loader_path

path to loader

type string

invoke_path

path to file to spawn with node

type string

argv

type string[]

js_cli

type string
default JS_CLI_DEFAULT

returns

Promise<SpawnResult>

see also

SVELTE_CHECK_CLI
#

SVELTE_CONFIG_FILENAME
#

SVELTE_MATCHER
#

SVELTE_PACKAGE_CLI
#

SVELTE_PACKAGE_DEP_NAME
#

SVELTE_RUNES_MATCHER
#

SVELTE_SCRIPT_MATCHER
#

constants.ts view source

RegExp import {SVELTE_SCRIPT_MATCHER} from '@fuzdev/gro/constants.js';

Extracts the script content from Svelte files.

SVELTEKIT_BUILD_DIRNAME
#

SVELTEKIT_CLI
#

SVELTEKIT_DEV_DIRNAME
#

SVELTEKIT_DIST_DIRNAME
#

SVELTEKIT_ENV_MATCHER
#

SVELTEKIT_GLOBAL_SPECIFIER
#

SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER
#

SVELTEKIT_SHIM_APP_PATHS_MATCHER
#

sveltekit_shim_app_specifiers
#

sveltekit_sync
#

sveltekit_helpers.ts view source

(sveltekit_cli?: string | Cli, pm_cli?: string): Promise<void> import {sveltekit_sync} from '@fuzdev/gro/sveltekit_helpers.js';

sveltekit_cli

type string | Cli
default SVELTEKIT_CLI

pm_cli

type string
default PM_CLI_DEFAULT

returns

Promise<void>

sveltekit_sync_if_available
#

sveltekit_helpers.ts view source

(sveltekit_cli?: string | Cli): Promise<void> import {sveltekit_sync_if_available} from '@fuzdev/gro/sveltekit_helpers.js';

If the SvelteKit CLI is found and its .svelte-kit directory is not, run svelte-kit sync.

sveltekit_cli

type string | Cli
default SVELTEKIT_CLI

returns

Promise<void>

sveltekit_sync_if_obviously_needed
#

sveltekit_helpers.ts view source

(sveltekit_cli?: string | Cli): Promise<void> import {sveltekit_sync_if_obviously_needed} from '@fuzdev/gro/sveltekit_helpers.js';

If the SvelteKit CLI is found and its .svelte-kit directory is not, run svelte-kit sync.

sveltekit_cli

type string | Cli
default SVELTEKIT_CLI

returns

Promise<void>

SVELTEKIT_VITE_CACHE_PATH
#

SveltePackageOptions
#

sveltekit_helpers.ts view source

SveltePackageOptions import type {SveltePackageOptions} from '@fuzdev/gro/sveltekit_helpers.js';

Options to the SvelteKit packaging CLI.

see also

watch?

Watch files in src/lib for changes and rebuild the package

type boolean

w?

Alias for watch.

type boolean

input?

The input directory which contains all the files of the package. Defaults to src/lib

type string

i?

Alias for input.

type string

output?

The output directory where the processed files are written to. Your package.json's exports should point to files inside there, and the files array should include that folder. Defaults to dist

type string

o?

Alias for output.

type string

types?

Whether or not to create type definitions (d.ts files). We strongly recommend doing this as it fosters ecosystem library quality. Defaults to true

type boolean

t?

Alias for types.

type boolean

tsconfig?

The path to a tsconfig or jsconfig. When not provided, searches for the next upper tsconfig/jsconfig in the workspace path.

type string

Task
#

task.ts view source

Task<TArgs, TArgsSchema, TReturn> import type {Task} from '@fuzdev/gro/task.js';

generics

Task<TArgs = Args, TArgsSchema extends z.ZodType<Args, Args> = z.ZodType< Args, Args >, TReturn = unknown>
TArgs
default Args
TArgsSchema
constraint z.ZodType<Args, Args>
default z.ZodType< Args, Args >
TReturn
default unknown

run

type (ctx: TaskContext<TArgs>) => TReturn | Promise<TReturn>

summary?

type string

Args?

type TArgsSchema

TASK_FILE_SUFFIX_JS
#

TASK_FILE_SUFFIX_TS
#

TASK_FILE_SUFFIXES
#

TaskArgs
#

gro_plugin_gen.ts view source

TaskArgs import type {TaskArgs} from '@fuzdev/gro/gro_plugin_gen.js';

inheritance

extends: Args

watch?

type boolean

TaskContext
#

task.ts view source

TaskContext<TArgs> import type {TaskContext} from '@fuzdev/gro/task.js';

generics

TaskContext<TArgs = object>
TArgs
default object

args

type TArgs

config

type GroConfig

svelte_config

type ParsedSvelteConfig

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

type InvokeTask

TaskError
#

task.ts view source

import {TaskError} from '@fuzdev/gro/task.js';

This is used by tasks to signal a known failure. It's useful for cleaning up logging because we usually don't need their stack trace.

inheritance

extends: Error

TaskModule
#

TaskModuleMeta
#

task.ts view source

TaskModuleMeta import type {TaskModuleMeta} from '@fuzdev/gro/task.js';

inheritance

extends: ModuleMeta<TaskModule>

name

type string

to_cli_name
#

cli.ts view source

(cli: string | Cli): string import {to_cli_name} from '@fuzdev/gro/cli.js';

cli

type string | Cli

returns

string

to_default_compile_module_options
#

svelte_config.ts view source

({ dev, generate, filename, rootDir, warningFilter, }: CompileOptions): ModuleCompileOptions import {to_default_compile_module_options} from '@fuzdev/gro/svelte_config.js';

__0

type CompileOptions

returns

ModuleCompileOptions

to_define_import_meta_env
#

esbuild_helpers.ts view source

(dev: boolean, base_url: "" | `/${string}` | undefined, ssr?: boolean, mode?: string): Record<string, string> import {to_define_import_meta_env} from '@fuzdev/gro/esbuild_helpers.js';

Creates an esbuild define shim for Vite's import.meta\.env.

dev

type boolean

base_url

best-effort shim from SvelteKit's base to Vite's import.meta\.env.BASE_URL

type "" | `/${string}` | undefined

ssr

type boolean
default true

mode

type string
default dev ? 'development' : 'production'

returns

Record<string, string>

see also

to_forwarded_args
#

args.ts view source

(command: string, raw_rest_args?: string[] | undefined, cache?: Record<string, Args | undefined>): Args import {to_forwarded_args} from '@fuzdev/gro/args.js';

Parses process.argv for the specified command, so given gro taskname arg1 --arg2 -- eslint eslintarg1 --eslintarg2 -- tsc --tscarg1 --tscarg2 the command 'eslint' returns eslintarg1 --eslintarg2 and 'tsc' returns --tscarg1 and --tscarg2.

command

type string

raw_rest_args?

type string[] | undefined
optional

cache

type Record<string, Args | undefined>
default to_forwarded_args_by_command(raw_rest_args)

returns

Args

to_forwarded_args_by_command
#

args.ts view source

(raw_rest_args?: string[]): Record<string, Args | undefined> import {to_forwarded_args_by_command} from '@fuzdev/gro/args.js';

raw_rest_args

type string[]
default to_raw_rest_args()

returns

Record<string, Args | undefined>

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_implicit_forwarded_args
#

args.ts view source

(command_to_strip?: string | undefined, raw_rest_args?: string[]): Args import {to_implicit_forwarded_args} from '@fuzdev/gro/args.js';

Gets all args after the first -- without assuming a command name. This is useful for tasks that want to forward args directly to a tool without requiring users to specify the tool name explicitly. Optionally strips a specific command name if present for backward compatibility.

command_to_strip?

type string | undefined
optional

raw_rest_args

type string[]
default to_raw_rest_args()

returns

Args

examples

// `gro test -- --watch` → {watch: true} // `gro test -- foo.test.ts` → {_: ['foo.test.ts']} // `gro test -- vitest --watch` with command_to_strip='vitest' → {watch: true} to_implicit_forwarded_args('vitest')

to_input_path
#

input_path.ts view source

(raw_input_path: RawInputPath, root_path?: string): InputPath import {to_input_path} from '@fuzdev/gro/input_path.js';

Raw input paths are paths that users provide to Gro to reference files for tasks and gen.

A raw input path can be to a file or directory in the following forms:

  • an absolute path, preserved
  • an explicit relative path, e.g. ./src/foo, resolved to root_path which defaults to the cwd
  • an implicit relative path, e.g. src/foo, preserved
  • an implicit relative path prefixed with gro/, transformed to absolute in the Gro directory

Thus, input paths are either absolute or implicitly relative.

raw_input_path

root_path

type string
default process.cwd()

returns

InputPath

to_input_paths
#

input_path.ts view source

(raw_input_paths: RawInputPath[], root_path?: string | undefined): InputPath[] import {to_input_paths} from '@fuzdev/gro/input_path.js';

raw_input_paths

type RawInputPath[]

root_path?

type string | undefined
optional

returns

InputPath[]

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

to_raw_rest_args
#

args.ts view source

(argv?: string[]): string[] import {to_raw_rest_args} from '@fuzdev/gro/args.js';

Gets the array of raw string args starting with the first --, if any.

argv

type string[]
default process.argv

returns

string[]

to_root_path
#

paths.ts view source

(id: PathId, p?: Paths): string import {to_root_path} from '@fuzdev/gro/paths.js';

id

type PathId

p

type Paths
default infer_paths(id)

returns

string

to_task_args
#

args.ts view source

(argv?: string[]): { task_name: string; args: Args; } import {to_task_args} from '@fuzdev/gro/args.js';

Parses task_name and args from process.argv, ignoring anything after any --.

argv

type string[]
default process.argv

returns

{ task_name: string; args: Args; }

to_task_name
#

task.ts view source

(id: PathId, task_root_dir: PathId, input_path: InputPath, root_path: PathId): string import {to_task_name} from '@fuzdev/gro/task.js';

id

type PathId

task_root_dir

type PathId

input_path

root_path

type PathId

returns

string

TS_MATCHER
#

TSCONFIG_FILENAME
#

update_changelog
#

changelog.ts view source

(owner: string, repo: string, path?: string, token?: string | undefined, log?: Logger | undefined, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }>): Promise<...> import {update_changelog} from '@fuzdev/gro/changelog.js';

Updates a changelog produced by @changesets/changelog-git with better links and formatting. It's similar to @changesets/changelog-github but doesn't require a token for light usage. This may be better implemented as a standalone dependency as an alternative to @changesets/changelog-git.

owner

type string

repo

type string

path

type string
default 'CHANGELOG.md'

token?

type string | undefined
optional

log?

type Logger | undefined
optional

cache

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }>
default new Map()

returns

Promise<boolean>

boolean indicating if the changelog changed

updated
#

validate_build_cache
#

build_cache.ts view source

(metadata: { version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; }): Promise<...> import {validate_build_cache} from '@fuzdev/gro/build_cache.js';

Validates that a cached build is still valid by checking stats and hashing outputs. Uses size as a fast negative check before expensive hashing. This is comprehensive validation to catch manual tampering or corruption.

metadata

type { version: string; git_commit: string | null; build_cache_config_hash: string; timestamp: string; outputs: { path: string; hash: string; size: number; mtime: number; ctime: number; mode: number; }[]; }

returns

Promise<boolean>

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

validate_gro_config_module
#

gro_config.ts view source

(config_module: any, config_path: string): asserts config_module is GroConfigModule import {validate_gro_config_module} from '@fuzdev/gro/gro_config.js';

config_module

type any

config_path

type string

returns

void

validate_task_module
#

task.ts view source

(mod: Record<string, any>): mod is TaskModule import {validate_task_module} from '@fuzdev/gro/task.js';

mod

type Record<string, any>

returns

boolean

version
#

VITE_CLI
#

VITE_CONFIG_FILENAME
#

VITEST_CLI
#

watch_dir
#

watch_dir.ts view source

({ dir, on_change, filter, absolute, chokidar, ignored, }: WatchDirOptions): WatchNodeFs import {watch_dir} from '@fuzdev/gro/watch_dir.js';

Watch for changes on the filesystem using chokidar.

__0

returns

WatchNodeFs

WatchDirOptions
#

watch_dir.ts view source

WatchDirOptions import type {WatchDirOptions} from '@fuzdev/gro/watch_dir.js';

dir

type string

on_change

type WatcherChangeCallback

filter?

type PathFilter | null | undefined

chokidar?

type ChokidarOptions

absolute?

When false, returns the path relative to dir.

type boolean

default true

ignored?

Pattern to ignore files, merged into chokidar.ignored if also provided.

  • undefined (default) ignores files matching .tmp. pattern
  • null sets no default ignore pattern
  • or some custom pattern

type Matcher | null

WatcherChange
#

WatcherChangeCallback
#

watch_dir.ts view source

WatcherChangeCallback import type {WatcherChangeCallback} from '@fuzdev/gro/watch_dir.js';

(call)

type (change: WatcherChange): void

change

returns void

WatcherChangeType
#

WatchNodeFs
#

watch_dir.ts view source

WatchNodeFs import type {WatchNodeFs} from '@fuzdev/gro/watch_dir.js';

init

type () => Promise<void>

close

type () => Promise<void>

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

type AnalyzedGenResult[]

log

type Logger

returns

Promise<void>