Sitelet https://gro.fuz.dev/docs/api/gro_plugin_server.ts#GroPluginServerOptions

gro_plugin_server.ts

view source

Declarations
#

8 declarations

CreateOutpaths
#

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>> import {gro_plugin_server} from '@fuzdev/gro/gro_plugin_server.js';

__0

default {}

returns

Plugin<PluginContext<object>>

GroPluginServerOptions
#

gro_plugin_server.ts view source

GroPluginServerOptions import type {GroPluginServerOptions} from '@fuzdev/gro/gro_plugin_server.js';

entry_points?

same as esbuild's entryPoints

type string[]

default ```[`to_server_source_id` of the Svelte config's `lib_path`]````

dir?

type string

default cwd

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 (dev: boolean): Outpaths

default `to_default_outpaths`

dev

type boolean
returns Outpaths

env_files?

type string[]

default ```SvelteKit's `.env`, `.env.development`, and `.env.production````

ambient_env?

type Record<string, string>

default process.env

svelte_config?

An already-loaded Svelte config, to skip resolving the project's Vite config.

type Config

default ```resolved from the project's Vite config````

target?

type string

default 'esnext'

esbuild_build_options?

Optionally map the esbuild options.

type (base_options: BuildOptions): BuildOptions

default `identity`

base_options

type BuildOptions
returns BuildOptions

rebuild_throttle_delay?

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

type number

default 1000

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

default 'node'

run?

Whether to run the server or not after building.

type boolean

default `dev`

has_server
#

gro_plugin_server.ts view source

(path?: string | undefined): Promise<Result<object, { message: string; }>> import {has_server} from '@fuzdev/gro/gro_plugin_server.js';

path?

the server entry point to look for; defaults to to_server_source_id of the Svelte config's lib_path

type string
optional

returns

Promise<Result>

Outpaths
#

gro_plugin_server.ts view source

Outpaths import type {Outpaths} from '@fuzdev/gro/gro_plugin_server.js';

outdir

type string

default '.gro/dev' or 'dist_server'

outbase

type string

default ```the Svelte config's `lib_path`, so `src/lib` unless it's customized````

outname

type string

default 'server.js'

SERVER_SOURCE_PATH
#

gro_plugin_server.ts view source

"server/server.ts" import {SERVER_SOURCE_PATH} from '@fuzdev/gro/gro_plugin_server.js';

The server entry point, relative to the project's lib directory.

to_default_outpaths
#

gro_plugin_server.ts view source

(dir: string, lib_dir: string): CreateOutpaths import {to_default_outpaths} from '@fuzdev/gro/gro_plugin_server.js';

The Outpaths used when the plugin is given none. Takes lib_dir as a param rather than reading paths.lib so a customized kit.files.lib is honored - resolving it is async, so it can't be a plugin-creation default.

dir

type string

lib_dir

type string

returns

CreateOutpaths

to_server_source_id
#

gro_plugin_server.ts view source

(lib_path: string): PathId import {to_server_source_id} from '@fuzdev/gro/gro_plugin_server.js';

The server entry point of a project whose lib directory is lib_path. Taken from the Svelte config's files.lib rather than the conventional src/lib, so a project that moves its lib directory still has its server found and built.

lib_path

type string

returns

PathId

Depends on
#

Imported by
#