Skip to content

Config API reference

Source information
  • Package: @pikacss/config
  • Generated from the exported surface and JSDoc in packages/config/src/index.ts.
  • Public entries: @pikacss/config, @pikacss/config/host
  • Source files: packages/config/src/host-load.ts, packages/config/src/host-scan.ts, packages/config/src/host-types.ts, packages/config/src/host.ts, packages/config/src/index.ts, packages/config/src/types.ts

Package summary

Canonical project configuration and defineConfig authoring surface Re-exports the public surface of @pikacss/core.

Use Engine configuration when you need conceptual usage guidance instead of exact symbol lookup.

Functions

defineConfig

Defines one canonical PikaCSS project configuration.

Overload 1: defineConfig(config)

ParameterTypeDescription
configSingleProjectConfigSingle-entry project settings, including the Engine configuration and project-owned runtime, scan, report, and generated-state options.

Returns: DefinedPikaConfig

Remarks:

The returned value is an opaque transport intended only as a config file default export. Do not inspect, spread, or mutate its runtime shape.

Overload 2: defineConfig(entries, options?)

Defines an explicit non-empty multi-entry PikaCSS project configuration.

ParameterTypeDescription
entriesreadonly [ MultiProjectEntryConfig, ...MultiProjectEntryConfig[] ]Ordered project entries. Every explicit entry owns its callable root and logical CSS module.
options?MultiProjectConfigOptionsProject-wide generated-state options shared by all entries.

Returns: DefinedPikaConfig

Remarks:

Explicit multi-entry authoring remains distinct even when the array currently contains one entry; hosts must not infer single-entry CSS auto-import behavior from its length.



Types

DefinedPikaConfig

Opaque transport produced only by defineConfig.



MultiProjectConfigOptions

Project-wide options for the explicit multi-entry authoring form.

PropertyTypeDescriptionDefault
stateDir?stringDirectory shared by all entries for generated authoring state.Host-provided default, otherwise .pikacss.


MultiProjectEntryConfig

One entry in the explicit multi-entry authoring form.

PropertyTypeDescriptionDefault
engine?EngineConfigEngine-specific configuration for this project entry.{}
fnNamestringRequired compile-time callable root used by this entry's source files.
cssModulestringRequired logical CSS module exposed by this entry's runtime stylesheet.
transformedFormat?'string' | 'array'Replacement shape emitted for the configured base callable.'string'
scan?ScanConfigSource scan patterns owned by this entry.Standard include and exclude patterns from DEFAULT_SCAN_INCLUDE and DEFAULT_SCAN_EXCLUDE.
report?ReportConfigFinal production report behavior for this entry.false


ReportConfig

Optional final production-build report configuration.

Type: boolean | Readonly<{ output: string; }>



ResolvedProjectConfig

Canonical project semantic state consumed by host/runtime layers.

PropertyTypeDescriptionDefault
authoringForm'single' | 'multi'Authoring form used to create this project configuration.
stateDirstringResolved project-wide directory for generated authoring state.
entriesreadonly ResolvedProjectEntry[]Normalized entries in their authored order.


ResolvedProjectEntry

One normalized semantic project entry.

PropertyTypeDescriptionDefault
engineEngineConfigEngine-specific configuration retained for this entry.
fnNamestringValidated compile-time callable root for this entry.
cssModulestringValidated logical CSS module for this entry's runtime stylesheet.
transformedFormat'string' | 'array'Normalized replacement shape emitted for the base callable.
scanResolvedScanConfigResolved source scan patterns for this entry.
reportResolvedReportConfigNormalized final production report behavior for this entry.


ResolvedReportConfig

Normalized report behavior; false disables reporting.

Type: false | Readonly<{ output?: string; }>



ResolvedScanConfig

Fully normalized ordered scan pattern lists.

PropertyTypeDescriptionDefault
includereadonly string[]Resolved include patterns used to select source files for scanning.
excludereadonly string[]Resolved exclude patterns applied after include matching.


ScanConfig

Ordered scan patterns owned by one project entry.

PropertyTypeDescriptionDefault
include?string | readonly string[]Source-file glob or globs to include in this entry's scan.DEFAULT_SCAN_INCLUDE (all supported JavaScript, TypeScript, and Vue source files)
exclude?string | readonly string[]Source-file glob or globs to exclude after include matching.node_modules/**, dist/**, .git/**, .nuxt/**, .output/**, and coverage/**


SingleProjectConfig

Single-entry authoring form accepted by defineConfig.

PropertyTypeDescriptionDefault
engine?EngineConfigEngine-specific configuration for this project entry.{}
fnName?stringCompile-time callable root used by this entry's source files.'pika'
cssModule?stringLogical CSS module exposed by this entry's runtime stylesheet.'pika.css'
transformedFormat?'string' | 'array'Replacement shape emitted for the configured base callable.'string'
scan?ScanConfigSource scan patterns owned by this entry.Standard include and exclude patterns from DEFAULT_SCAN_INCLUDE and DEFAULT_SCAN_EXCLUDE.
report?ReportConfigFinal production report behavior for this entry.false
stateDir?stringProject-wide directory for generated authoring state.Host-provided default, otherwise .pikacss.


Public subpath: @pikacss/config/host

Import this entry as @pikacss/config/host.

ConfigHostDependencyTrace

Deterministic dependency trace for one config-load candidate.

PropertyTypeDescriptionDefault
selectionreadonly ConfigHostFileDependency[]Config-selection paths: all auto candidates or the exact explicit path.
modulesreadonly ConfigHostFileDependency[]Actually evaluated project-local config modules.
allreadonly ConfigHostFileDependency[]De-duplicated selection + module dependencies.


ConfigHostFileDependency

File dependency emitted by the low-level Config host.

PropertyTypeDescriptionDefault
type'file'Dependency discriminator for filesystem-backed config inputs.
pathstringAbsolute dependency path watched by the consuming host.


createPikaScanMatcher(options)

Creates the canonical source-membership matcher for one normalized entry.

ParameterTypeDescription
optionsCreatePikaScanMatcherOptionsNormalized scan configuration and resolved state directory.
options.scanResolvedScanConfigNormalized absolute include/exclude scan patterns.
options.stateDirstringResolved project state directory that is always excluded.

Returns: PikaScanMatcher

Remarks:

Inputs are the absolute scan patterns emitted by the Config host. The resolved state directory is excluded structurally before glob matching, even when an include pattern would otherwise match it.



CreatePikaScanMatcherOptions

Inputs for createPikaScanMatcher.

PropertyTypeDescriptionDefault
scanResolvedScanConfigNormalized absolute include/exclude patterns for one scan entry.
stateDirstringResolved project state directory, always excluded regardless of globs.


LoadedPikaConfig

Canonically loaded and normalized PikaCSS project configuration.

PropertyTypeDescriptionDefault
projectRootstringCanonical absolute project root used for config selection and normalization.
selectedConfigPathstring | nullSelected config spelling, or null for the synthetic no-config default.
configDirstringFilesystem base for authored relative config values.
configResolvedProjectConfigFully normalized project configuration returned to the host.
dependenciesConfigHostDependencyTraceDeterministic config-selection and evaluated-module dependency trace.


loadPikaConfig(options)

Selects, freshly evaluates, and canonically normalizes one PikaCSS project config.

ParameterTypeDescription
optionsLoadPikaConfigOptionsAbsolute project root plus optional explicit config selection and host state-directory default.

Returns: Promise<LoadedPikaConfig>

Remarks:

This is a low-level Node host API. It never creates Engines or owns generation/watch lifecycle. Selection and actually evaluated project-local module dependencies are returned for the caller to aggregate/watch.



LoadPikaConfigOptions

Low-level config selection input.

PropertyTypeDescriptionDefault
projectRootstringImmutable absolute project root chosen by the host.
config?stringClosed explicit config-file selection. Omit for canonical auto-discovery.
defaultStateDir?stringResolved absolute host state-directory default used only when config omits stateDir.


PIKA_CONFIG_AUTO_CANDIDATES

Canonical config filenames checked, in order, during automatic project-config discovery.



PikaConfigHostError

Error from Config-host selection, evaluation, or normalization.

Constructors:

constructor(options)

Creates an error carrying the failed config-host operation and its dependency trace.

ParameterTypeDescriptionDefault
options{ message: string; projectRoot: string; selectedConfigPath?: string | null; dependencies: ConfigHostDependencyTrace; cause?: unknown; }Failed operation details and the dependencies observed before it failed.
options.messagestringHuman-readable description of the config-host failure.
options.projectRootstringAbsolute project root used for config selection.
options.selectedConfigPath?string | nullSelected config path, or null when no config was selected.null
options.dependenciesConfigHostDependencyTraceConfig-selection and evaluated-module dependencies observed before the failure.
options.cause?unknownUnderlying error, when one caused the failure.
PropertyTypeDescriptionDefault
projectRootstringProject root associated with the failed host operation.
selectedConfigPathstring | nullSelected config path when known, otherwise null.
dependenciesConfigHostDependencyTraceDependency trace accumulated before the host operation failed.


PikaScanMatcher

Efficient matcher for one normalized entry scan.

PropertyTypeDescriptionDefault
matches(filePath: string) => booleanReturns whether one absolute physical source path belongs to the entry.


Next