gro_config.ts

Declarations
#

11 declarations

view source

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

CreateGroConfig
#

EMPTY_BUILD_CACHE_CONFIG_HASH
#

gro_config.ts view source

"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

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

EXPORTS_EXCLUDER_DEFAULT
#

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

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

GroConfigModule
#

load_gro_config
#

gro_config.ts view source

(dir?: string): Promise<GroConfig>

dir

type string
default paths.root

returns

Promise<GroConfig>

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

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

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.

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

Depends on
#

Imported by
#