alepha
Version:
Alepha is a convention-driven TypeScript framework for building robust, end-to-end type-safe applications, from serverless APIs to full-stack React apps.
192 lines (190 loc) • 5.14 kB
TypeScript
import { Options } from "@vitejs/plugin-react";
import { BrotliOptions, ZlibOptions } from "node:zlib";
import { Alepha } from "alepha";
import { Plugin, UserConfig } from "vite";
//#region src/viteCompress.d.ts
interface ViteCompressOptions {
/**
* If true, the plugin will not compress the files.
*
* @default false
*/
disabled?: boolean;
/**
* If true, the plugin will compress the files using brotli.
* Can also be an object with brotli options.
*
* @default true
*/
brotli?: boolean | BrotliOptions;
/**
* If true, the plugin will compress the files using gzip.
* Can also be an object with gzip options.
*
* @default true
*/
gzip?: boolean | ZlibOptions;
/**
* A filter to determine which files to compress.
* Can be a RegExp or a function that returns true for files to compress.
*
* @default /\.(js|mjs|cjs|css|wasm|svg|html)$/
*/
filter?: RegExp | ((fileName: string) => boolean);
}
declare function viteCompress(options?: ViteCompressOptions): Plugin;
declare function compressFile(options: ViteCompressOptions | undefined, filePath: string): Promise<void>;
//#endregion
//#region src/helpers/buildClient.d.ts
interface BuildClientOptions {
dist: string;
html: string;
/**
* @default false
*/
precompress?: ViteCompressOptions | boolean;
/**
* @default false
*/
prerender?: boolean;
/**
* Build a sitemap.xml file based on the $pages routes.
*/
sitemap?: {
hostname: string;
};
config?: UserConfig;
}
//#endregion
//#region src/viteAlephaBuildDocker.d.ts
interface ViteAlephaBuildDockerOptions {
/**
* The directory where the build output will be placed.
*
* @default "dist"
*/
distDir?: string;
/**
* Image name to use in the Dockerfile.
* If not provided, it will default to `node:24-alpine`.
*/
image?: string;
/**
* Command to run in the Docker container.
* If not provided, it will default to `node`.
*/
command?: string;
}
//#endregion
//#region src/viteAlephaBuildVercel.d.ts
interface ViteAlephaBuildVercelOptions {
/**
* The directory where the build output will be placed.
*
* @default "dist"
*/
distDir?: string;
/**
* The name of the client directory.
*
* @default "public"
*/
clientDir?: string;
config?: VercelConfig;
}
interface VercelConfig {
projectName?: string;
orgId?: string;
projectId?: string;
config?: Record<string, any> & {
crons?: Array<{
path: string;
schedule: string;
}>;
};
}
declare function viteAlephaBuildVercel(opts?: ViteAlephaBuildVercelOptions): Promise<{
name: string;
apply: string;
writeBundle(): void;
}>;
//#endregion
//#region src/viteAlephaBuild.d.ts
interface ViteAlephaBuildOptions {
/**
* Path to the entry file for the server build.
* If empty, SSR build will be skipped.
*/
serverEntry?: string;
/**
* Set false to skip the client build.
* This is useful if you only want to build the server-side application.
*/
client?: false | Partial<BuildClientOptions>;
/**
* If true, the build will be optimized for Vercel deployment.
*
* If `VERCEL_PROJECT_ID` and `VERCEL_ORG_ID` environment variables are set, .vercel will be generated with the correct configuration.
*
* @default false
*/
vercel?: boolean | VercelConfig;
/**
* If true, the build will be optimized for Docker deployment.
* Additionally, it will generate a Dockerfile in the dist directory.
*/
docker?: boolean | ViteAlephaBuildDockerOptions;
}
declare function viteAlephaBuild(options?: ViteAlephaBuildOptions): Promise<Plugin>;
//#endregion
//#region src/viteAlephaDev.d.ts
interface ViteAlephaDevOptions {
/**
* Path to the entry file for the server build.
* If empty, plugin will be disabled.
*/
serverEntry?: string;
/**
* If true, enables debug logging.
*
* @default false
*/
debug?: boolean;
}
/**
* Plug Alepha into Vite development server.
*/
declare function viteAlephaDev(options?: ViteAlephaDevOptions): Promise<Plugin>;
//#endregion
//#region src/viteAlepha.d.ts
type ViteAlephaOptions = ViteAlephaDevOptions & ViteAlephaBuildOptions & {
react?: false | Options;
};
declare function viteAlepha(options?: ViteAlephaOptions): (Plugin | Promise<Plugin>)[];
//#endregion
//#region src/index.d.ts
declare global {
var __alepha: Alepha;
}
/**
* Plugin vite for Alepha framework.
*
* This module provides Vite plugins and configurations to integrate Alepha applications with Vite's build and development processes.
*
* @example
* ```ts
* import { defineConfig } from "vite";
* import { viteAlepha } from "alepha/vite";
*
* export default defineConfig({
* plugins: [viteAlepha()],
* // other Vite configurations...
* });
* ```
*
* @module alepha.vite
*/
//# sourceMappingURL=index.d.ts.map
//#endregion
export { VercelConfig, ViteAlephaBuildOptions, ViteAlephaBuildVercelOptions, ViteAlephaDevOptions, ViteAlephaOptions, ViteCompressOptions, compressFile, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteCompress };
//# sourceMappingURL=index.d.ts.map