svelte_config.ts

view source

Declarations
#

8 declarations

has_vite_config
#

svelte_config.ts view source

(dir?: string): boolean import {has_vite_config} from '@fuzdev/gro/svelte_config.js';

Whether the project in dir has a Vite config, and so anything to read a Svelte config through. Exported because it's what makes a config read worth caching - a project without one never pays for a resolution to begin with.

dir

type string
default process.cwd()

returns

boolean

load_default_svelte_config
#

svelte_config.ts view source

(): Promise<ParsedSvelteConfig> import {load_default_svelte_config} from '@fuzdev/gro/svelte_config.js';

The parsed Svelte config for the project in the cwd, memoized.

Reading it costs a full Vite config resolution, which runs every Vite plugin's config hooks, so callers pull it in on demand instead of paying for it on every Gro invocation.

returns

Promise<ParsedSvelteConfig>

load_svelte_config
#

svelte_config.ts view source

(): Promise<Config | null> import {load_svelte_config} from '@fuzdev/gro/svelte_config.js';

Loads the Svelte config of the project in the cwd by resolving its Vite config.

returns

Promise<Config | null>

null if the project has no Vite config, or one that configures no Svelte plugin

throws

  • if - the project has a Vite config but Vite isn't installed, or if it fails to resolve

parse_svelte_config
#

ParsedSvelteConfig
#

svelte_config.ts view source

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

A subset of SvelteKit's config in a form that Gro uses. 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 Config | null

base_url

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

assets_url

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

assets_path

Same as the SvelteKit files.assets, relative to the project directory.

type string

routes_path

Same as the SvelteKit files.routes, relative to the project directory.

type string

src_path

Same as the SvelteKit files.src, relative to the project directory. The env declarations entry env.ts lives here.

type string

env_dir

type string | undefined

version_name

Same as the SvelteKit version.name, exposed as version by the $app/env shim.

type string | undefined

svelte_compile_options

type CompileOptions

svelte_compile_module_options

type ModuleCompileOptions

svelte_preprocessors

type PreprocessorGroup | PreprocessorGroup[] | undefined

ParseSvelteConfigOptions
#

svelte_config.ts view source

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

svelte_config?

An already-loaded config to parse instead of resolving the project's Vite config.

type Config

SVELTE_COMPILE_OPTIONS_DEFAULT
#

svelte_config.ts view source

CompileOptions import {SVELTE_COMPILE_OPTIONS_DEFAULT} from '@fuzdev/gro/svelte_config.js';

Gro compiles for the server by default, because SvelteKit handles the client in the normal cases. Frozen because it's handed out as a default value.

to_default_compile_module_options
#

svelte_config.ts view source

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

__0

type CompileOptions

returns

ModuleCompileOptions

Depends on
#

Imported by
#