Thanks to visit codestin.com
Credit goes to gro.fuz.dev

api #

task runner and toolkit extending SvelteKit

81 modules ยท 328 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...

analyze_gen_result
#

analyze_gen_results
#

gen.ts view source

(gen_results: GenResults): Promise<AnalyzedGenResult[]>

gen_results

returns

Promise<AnalyzedGenResult[]>

AnalyzedGenResult
#

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>

asset
#

sveltekit_shim_app_paths.ts view source

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

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

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>

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>

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
#

ChangesetBump
#

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<...>

__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; }[]>

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; }>

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

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>

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: { ...; }[]; }>

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
#

create_paths
#

CreateGroConfig
#

gro_config.ts view source

CreateGroConfig

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

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>

result

type string

returns

ActionResult<Success, Failure>

dev
#

DevTaskContext
#

disableScrollHandling
#

discover_build_output_dirs
#

build_cache.ts view source

(): Promise<string[]>

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

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"

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): { ...; }

form_element

type HTMLFormElement

submit?

type SubmitFunction<Success, Failure> | undefined
optional

returns

{ destroy(): void; }

esbuild_plugin_external_worker
#

esbuild_plugin_svelte
#

esbuild_plugin_sveltekit_local_imports
#

esbuild_plugin_sveltekit_local_imports.ts view source

(): Plugin

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

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
#

EsbuildPluginSveltekitShimAppOptions
#

EsbuildPluginSveltekitShimEnvOptions
#

esbuild_plugin_sveltekit_shim_env.ts view source

EsbuildPluginSveltekitShimEnvOptions

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

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

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

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<...>

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>

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>

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>

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
#

FindGenfilesResult
#

FindModulesFailure
#

FindTasksResult
#

format_directory
#

format_directory.ts view source

(log: Logger, dir: string, check?: boolean, extensions?: string, root_paths?: string, prettier_cli?: string | Cli, pm_cli?: string, additional_args?: Args | undefined, patterns?: string[] | undefined): Promise<...>

Formats files on the filesystem. When patterns is provided, formats those specific files/patterns. Otherwise formats dir with default extensions, plus root files if dir is paths.source. This is separated from ./format_file to avoid importing all of the prettier code inside modules that import this one. (which has a nontrivial cost)

log

type Logger

dir

type string

check

type boolean
default false

extensions

type string
default EXTENSIONS_DEFAULT

root_paths

type string
default ROOT_PATHS_DEFAULT

prettier_cli

type string | Cli
default PRETTIER_CLI_DEFAULT

pm_cli

type string
default PM_CLI_DEFAULT

additional_args?

type Args | undefined
optional

patterns?

type string[] | undefined
optional

returns

Promise<SpawnResult>

format_file
#

format_file.ts view source

(content: string, options: Options, base_options?: Options | null | undefined): Promise<string>

Formats a file with Prettier.

content

type string

options

type Options

base_options

defaults to the cwd's package.json prettier value

type Options | null | undefined
default cached_base_options

returns

Promise<string>

FoundGenfiles
#

gen.ts view source

FoundGenfiles

resolved_input_files

type Array<ResolvedInputFile>

resolved_input_files_by_root_dir

type Map<PathId, Array<ResolvedInputFile>>

resolved_input_paths

type Array<ResolvedInputPath>

FoundTask
#

FoundTasks
#

task.ts view source

FoundTasks

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
#

GenConfig
#

GenContext
#

gen.ts view source

GenContext

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
#

GenDependenciesConfig
#

gen.ts view source

GenDependenciesConfig

patterns

type Array<RegExp>

files

type Array<PathId>

GenDependenciesResolver
#

gen.ts view source

GenDependenciesResolver

(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

id

type PathId

content

type string

origin_id

type PathId

format

type boolean

GenfileModule
#

GenfileModuleMeta
#

GenfileModuleResult
#

GenfileModuleResultFailure
#

gen.ts view source

GenfileModuleResultFailure

ok

type false

id

type PathId

reason

type string

error

type Error

elapsed

type number

GenfileModuleResultSuccess
#

gen.ts view source

GenfileModuleResultSuccess

ok

type true

id

type PathId

files

type Array<GenFile>

elapsed

type number

GenFunction
#

gen.ts view source

GenFunction

(call)

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

ctx
returns RawGenResult | Promise<RawGenResult>

GenResult
#

GenResults
#

gen.ts view source

GenResults

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[]>

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
#

GITHUB_DIRNAME
#

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<...>

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>

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<...>

GRO_CONFIG_FILENAME
#

GRO_DEV_DIR
#

GRO_DEV_DIRNAME
#

GRO_DIR
#

GRO_DIRNAME
#

GRO_DIST_DIR
#

GRO_DIST_PREFIX
#

GRO_PACKAGE_DIR
#

gro_paths
#

gro_plugin_deno_compile
#

gro_plugin_deno_server
#

gro_plugin_deno_server.ts view source

(options?: GroPluginDenoServerOptions): Plugin<PluginContext<object>>

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_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>>

__0

default {}

returns

Plugin<PluginContext<object>>

gro_plugin_sveltekit_app
#

gro_plugin_sveltekit_library
#

GroConfig
#

gro_config.ts view source

GroConfig

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

inheritance

extends:

see also

plugins

type PluginsCreateConfig

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

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

filer_options

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

type Partial<FilerOptions> | null

GroConfigModule
#

GroPluginDenoCompileOptions
#

gro_plugin_deno_compile.ts view source

GroPluginDenoCompileOptions

entry

Entry point TypeScript file.

type string

output_name

Output binary name (without path).

type string

output_dir

Output directory for the binary.

type string

permissions

Deno permissions to grant.

type Array<string>

flags

Additional deno compile flags.

type Array<string>

generate_hash

Generate a SHA-256 hash file alongside the binary. The hash file is named {output_name}.sha256 and uses sha256sum format.

type boolean

GroPluginDenoServerOptions
#

gro_plugin_deno_server.ts view source

GroPluginDenoServerOptions

entry

Entry point TypeScript file for the Deno server.

type string

port

Port for the Deno server.

type number

host

Host for the Deno server.

type string

permissions

Deno permissions to grant.

type Array<string>

flags

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

type Array<string>

watch

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

type boolean

env_file

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

type string | null

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>

GroPluginGenOptions
#

gro_plugin_gen.ts view source

GroPluginGenOptions

input_paths

type Array<string>

root_dirs

type Array<string>

flush_debounce_delay

type number

GroPluginServerOptions
#

gro_plugin_server.ts view source

GroPluginServerOptions

entry_points

same as esbuild's entryPoints

type Array<string>

dir

type string

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>

ambient_env

type Record<string, string>

svelte_config

type SvelteConfig

target

type string

esbuild_build_options

Optionally map the esbuild options.

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

rebuild_throttle_delay

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

type number

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

run

Whether to run the server or not after building.

type boolean

GroPluginSveltekitAppOptions
#

GroPluginSveltekitLibraryOptions
#

has_server
#

gro_plugin_server.ts view source

(path?: PathId): Promise<Result<object, { message: string; }>>

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; }>>

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<...>

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
#

infer_paths
#

InputPath
#

install_with_cache_healing
#

npm_install_helpers.ts view source

(pm_cli: string, options?: InstallCacheHealingOptions): Promise<NpmCommandResult>

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>

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

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<...>

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

(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>

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

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
#

is_gen_path
#

is_gro_id
#

is_private_env
#

env.ts view source

(key: string, public_prefix: string, private_prefix: string): boolean

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

key

type string

public_prefix

type string

private_prefix

type string

returns

boolean

is_task_path
#

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>

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>

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

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>

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>

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

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

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>

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<...>

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

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>

found_genfiles

timings?

type Timings | undefined
optional

returns

Promise<LoadGenfilesResult>

load_gro_config
#

gro_config.ts view source

(dir?: string): Promise<GroConfig>

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

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

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<...>

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

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>

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>

found_tasks

root_path

type PathId
default process.cwd()

returns

Promise<LoadTasksResult>

LoadedGenfiles
#

LoadedTasks
#

LoadGenfilesFailure
#

LoadGenfilesResult
#

LoadModuleFailure
#

LoadModuleResult
#

LoadModulesFailure
#

modules.ts view source

LoadModulesFailure<TModuleMeta>

generics

TModuleMeta

constraint ModuleMeta

type

type 'load_module_failures'

load_module_failures

type Array<LoadModuleFailure>

reasons

type Array<string>

modules

type Array<TModuleMeta>

LoadModulesResult
#

LoadTasksFailure
#

LoadTasksResult
#

LOCKFILE_FILENAME
#

log_error_reasons
#

log_task_help
#

log_tasks
#

task_logging.ts view source

(log: Logger, loaded_tasks: LoadedTasks, log_intro?: boolean): void

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

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

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>

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>

generics

TModule

constraint Record<string, any>
default Record<string, any>

id

type PathId

mod

type TModule

navigating
#

NODE_MODULES_DIRNAME
#

normalize_gen_config
#

NpmCommandResult
#

npm_install_helpers.ts view source

NpmCommandResult

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

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
#

Outpaths
#

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; }

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[]

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

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<...>

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; }>

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

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

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; }>

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

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<...>

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>

serialized_package_json

type string

returns

Promise<void>

PackageJsonDep
#

PackageJsonMapper
#

package_json.ts view source

PackageJsonMapper

(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>

parse_imports
#

parse_imports.ts view source

(id: PathId, contents: string, ignore_types?: boolean): ImportSpecifier[]

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>

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

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

path_id

type PathId

p

type Paths
default infer_paths(path_id)

returns

string

paths
#

Paths
#

paths.ts view source

Paths

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>

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

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>>[]

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>

generics

TArgs

default object

inheritance

extends:
  • TaskContext<TArgs>

dev

type boolean

watch

type boolean

Plugins
#

plugin.ts view source

See Plugins.create for a usage example.

generics

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>

generics

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
#

PRETTIER_CLI_DEFAULT
#

print_build_result
#

print_command_args
#

print_path
#

RawGenFile
#

gen.ts view source

RawGenFile

content

type string

filename

type string

format

type boolean

RawGenResult
#

RawGroConfig
#

gro_config.ts view source

RawGroConfig

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

RawInputPath
#

README_FILENAME
#

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

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
#

render_sveltekit_shim_app_paths
#

sveltekit_shim_app.ts view source

(base_url?: "" | `/${string}` | undefined, assets_url?: "" | `http://${string}` | `https://${string}` | undefined): string

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

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}` & {}}`

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<...>

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

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>

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>

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>

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

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
#

ResolvedInputPaths
#

input_path.ts view source

ResolvedInputPaths

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

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

<T extends RouteIdWithSearchOrHash | PathnameWithSearchOrHash>(...args: ResolveArgs<T>) => "/" | "/about" | "/docs" | "/docs/api" | "/docs/introduction" | "/docs/library" | ... 9 more ... | `/${string}${`/docs/api/${string}` & {}}`

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: Options, base_options?: Options | ... 1 more ... | undefined) => Promise<...>) | undefined): Promise<...>

gen_modules

type GenfileModuleMeta[]

config

filer

type Filer

log

type Logger

timings

type Timings

invoke_task

format_file?

type ((content: string, options: Options, base_options?: Options | null | undefined) => Promise<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<...>

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<...>

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

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<...>

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

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<...>

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

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>

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>

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>

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
#

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>

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>

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>

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

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>

generics

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
#

TaskContext
#

TaskError
#

task.ts view source

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

inheritance

extends:
  • ModuleMeta<TaskModule>

name

type string

to_cli_name
#

to_default_compile_module_options
#

svelte_config.ts view source

({ dev, generate, filename, rootDir, warningFilter, }: CompileOptions): ModuleCompileOptions

__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>

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

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>

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

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

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

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[]

raw_input_paths

type RawInputPath[]

root_path?

type string | undefined
optional

returns

InputPath[]

to_output_file_name
#

to_raw_rest_args
#

args.ts view source

(argv?: string[]): string[]

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

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; }

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

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<...>

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<...>

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

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

config_module

type any

config_path

type string

returns

void

validate_task_module
#

task.ts view source

(mod: Record<string, any>): mod is TaskModule

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

Watch for changes on the filesystem using chokidar.

__0

returns

WatchNodeFs

WatchDirOptions
#

watch_dir.ts view source

WatchDirOptions

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

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
#

WatcherChangeType
#

WatchNodeFs
#

write_gen_results
#

gen.ts view source

(gen_results: GenResults, analyzed_gen_results: AnalyzedGenResult[], log: Logger): Promise<void>

gen_results

analyzed_gen_results

type AnalyzedGenResult[]

log

type Logger

returns

Promise<void>