svelte_config_cache.ts view source
"svelte_config.json" import {SVELTE_CONFIG_CACHE_FILENAME} from '@fuzdev/gro/svelte_config_cache.js'; 7 declarations
svelte_config_cache.ts view source
"svelte_config.json" import {SVELTE_CONFIG_CACHE_FILENAME} from '@fuzdev/gro/svelte_config_cache.js'; svelte_config_cache.ts view source
(stamps: SvelteConfigCacheStamps, dir?: string): SvelteConfigCache | null import {svelte_config_cache_read} from '@fuzdev/gro/svelte_config_cache.js'; Reads the cache and returns it only if every input still matches stamps.
Every kind of miss - absent, corrupt, wrong version, stale - reads the same to the caller,
which resolves the config and rewrites.
stampsdirstringprocess.cwd()SvelteConfigCache | null svelte_config_cache.ts view source
(dir?: string): SvelteConfigCacheStamps import {svelte_config_cache_stamps} from '@fuzdev/gro/svelte_config_cache.js'; Snapshots the state of the cache inputs in dir.
Taken by the caller *before* resolving the config, not inside svelte_config_cache_write afterwards: a config edited mid-resolution should leave a stamp that no longer matches, so the next invocation resolves again. Stamping afterwards would pair the old alias with the new state and serve it as fresh.
dirstringprocess.cwd()SvelteConfigCacheStamps svelte_config_cache.ts view source
1 import {SVELTE_CONFIG_CACHE_VERSION} from '@fuzdev/gro/svelte_config_cache.js'; Bump when SvelteConfigCache's shape changes, or when the meaning of a field does, so caches written by an older Gro self-invalidate instead of being read as the new shape.
svelte_config_cache.ts view source
(stamps: SvelteConfigCacheStamps, read: Pick<SvelteConfigCache, "alias" | "svelte_config_found">, dir?: string): void import {svelte_config_cache_write} from '@fuzdev/gro/svelte_config_cache.js'; Writes the cache for the config that stamps was taken before resolving.
Best effort - a cache that can't be written just means the next invocation resolves again, so a read-only or otherwise unwritable project directory costs speed and nothing else.
stampsreadwhat resolving the config produced
Pick<SvelteConfigCache, "alias" | "svelte_config_found">dirstringprocess.cwd()void svelte_config_cache.ts view source
SvelteConfigCache import type {SvelteConfigCache} from '@fuzdev/gro/svelte_config_cache.js'; versiontype number
stampsaliasThe alias of a ParsedSvelteConfig.
type Record<string, string>
svelte_config_foundfalse when the Vite config resolved but configured no Svelte plugin, so a cached read
can repeat the warning a fresh load would have emitted instead of going quiet about it.
type boolean
svelte_config_cache.ts view source
SvelteConfigCacheStamps import type {SvelteConfigCacheStamps} from '@fuzdev/gro/svelte_config_cache.js'; The mtime and size of each cache input, or null for one that doesn't exist.
Absence is recorded rather than omitted so that *adding* a config file invalidates too.
[key: string]type string | null