Buckets:
37 GB
4,042,753 files
Updated about 1 month ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| src | 1 items | ||
| tests | 1 items | ||
| CHANGELOG.md | 2.17 kB xet | a9958857 | |
| README.md | 3.69 kB xet | 442380d7 | |
| deno.json | 366 Bytes xet | ea8ee4ff | |
| mod.ts | 544 Bytes xet | 8baca5ad |
@zuke/vite
Typed Vite CLI task wrappers for
Zuke builds — dev, build, and
preview.
import { ViteTasks } from "@zuke/vite";
await ViteTasks.build((s) => s.outDir("dist").mode("production"));
await ViteTasks.preview((s) => s.port(4173));
API
Full typed API — generated from deno doc
`@zuke/vite` — typed `ViteTasks` wrappers for the Vite (https://vitejs.dev)
CLI, for use in Zuke builds.
```ts
import { ViteTasks } from "@zuke/vite";
await ViteTasks.build((s) => s.outDir("dist").mode("production"));
await ViteTasks.preview((s) => s.port(4173));
```
@module
const ViteTasks: ViteTasksApi
Typed task functions for the `vite` CLI.
class ViteBuildSettings extends ViteSettings
Settings for `vite build`.
outDir(path: PathLike): this
Output directory (`--outDir`).
base(path: string): this
Public base path (`--base`).
emptyOutDir(): this
Empty the output directory before building (`--emptyOutDir`).
sourcemap(): this
Emit source maps (`--sourcemap`).
root(path: PathLike): this
The project root (positional).
override protected buildArgs(): string[]
Assemble the `vite build` argv.
class ViteDevSettings extends ViteSettings
Settings for `vite dev` (the development server).
host(value: string): this
Bind to a host/IP (`--host`).
port(value: number): this
Serve on a specific port (`--port`).
strictPort(): this
Fail instead of trying the next free port when {@link port} is taken
(`--strictPort`).
A build that hands the port to something else — an e2e runner, a health
check — needs the server to be on the port it asked for or not at all;
without this Vite silently moves on and the other side connects to nothing.
open(): this
Open the app in the browser on start (`--open`).
override protected buildArgs(): string[]
Assemble the `vite dev` argv.
class VitePreviewSettings extends ViteSettings
Settings for `vite preview` (serve a production build locally).
host(value: string): this
Bind to a host/IP (`--host`).
port(value: number): this
Serve on a specific port (`--port`).
strictPort(): this
Fail instead of trying the next free port when {@link port} is taken
(`--strictPort`). See {@link ViteDevSettings.strictPort}.
open(): this
Open the app in the browser on start (`--open`).
override protected buildArgs(): string[]
Assemble the `vite preview` argv.
abstract class ViteSettings extends ToolSettings
Base for all `vite` subcommand settings: the binary is `vite`, with the
`--config` and `--mode` options shared by every subcommand.
override protected defaultTool(): string
The default binary this wrapper invokes: `vite`.
override protected defaultResolution(): ToolResolution
Resolve the binary from `node_modules/.bin` by default — vite is an npm-distributed tool.
config(path: PathLike): this
Use an explicit config file (`--config`).
mode(name: string): this
Set the mode, e.g. `production` or `development` (`--mode`).
protected baseArgs(): string[]
The shared option arguments.
interface ViteTasksApi
The shape of {@link ViteTasks}.
dev(configure?: Configure<ViteDevSettings>): Promise<CommandOutput>
Start the dev server: `vite dev`.
build(configure?: Configure<ViteBuildSettings>): Promise<CommandOutput>
Build for production: `vite build`.
preview(configure?: Configure<VitePreviewSettings>): Promise<CommandOutput>
Preview a production build: `vite preview`.
- Total size
- 37 GB
- Files
- 4,042,753
- Last updated
- Oct 24
- Pre-warmed CDN
- US EU US EU