# `@lazarv/react-server/adapters/*`

Shared types and helpers for building deploy adapters. The same surface is re-exported from every `@lazarv/react-server/adapters/<target>` subpath — each concrete adapter is a thin wrapper around `createAdapter`.

## Functions

### `banner`

```ts
function banner(message: string, options?: {
    forceVerbose?: boolean;
    emoji?: string;
}): void;
```

### `clearDirectory`

```ts
function clearDirectory(dir: string): Promise<void>;
```

### `clearProgress`

```ts
function clearProgress(): void;
```

### `copy`

```ts
function copy(srcDir: string, destDir: string, reactServerOutDir: string): (file: string) => Promise<void>;
```

### `copyFiles`

```ts
function copyFiles(message: string, files: string[], srcDir: string, destDir: string, reactServerOutDir: string, emoji?: string): Promise<void>;
```

### `copyMessage`

```ts
function copyMessage(file: string, srcDir: string, destDir: string, reactServerOutDir: string): void;
```

### `createAdapter`

```ts
function createAdapter<T = any, R = void>(options: {
    name: string;
    outDir: string;
    outStaticDir?: string;
    outServerDir?: string;
    handler: (options: {
        adapterOptions: T;
        files: {
            static: () => Promise<string[]>;
            compressed: () => Promise<string[]>;
            assets: () => Promise<string[]>;
            client: () => Promise<string[]>;
            public: () => Promise<string[]>;
            server: () => Promise<string[]>;
            dependencies: (adapterFiles: string[]) => Promise<{
                src: string;
                dest: string;
            }[]>;
            all: () => Promise<string[]>;
        };
        copy: {
            static: (out?: string) => Promise<void>;
            compressed: (out?: string) => Promise<void>;
            assets: (out?: string) => Promise<void>;
            client: (out?: string) => Promise<void>;
            public: (out?: string) => Promise<void>;
            server: (out?: string) => Promise<void>;
            dependencies: (out: string, adapterFiles?: string[]) => Promise<void>;
        };
        config: Record<string, any>;
        reactServerDir: string;
        reactServerOutDir: string;
        root: string;
        options: Record<string, any>;
    }) => Promise<R>;
    deploy?: DeployCommandDescriptor | ((context: {
        adapterOptions: T;
        options: Record<string, any>;
        handlerResult: R;
    }) => DeployCommandDescriptor | Promise<DeployCommandDescriptor> | void | Promise<void>);
}): Adapter<T>;
```

### `deepMerge`

```ts
function deepMerge<T extends Record<string, any>>(source: T, target: Partial<T>): T;
```

### `defineConfig`

```ts
function defineConfig<T = any>(adapterOptions?: T): (config: any, root: string, options: any) => Promise<void>;
```

### `getConfig`

```ts
function getConfig(): Record<string, any>;
```

### `getDependencies`

```ts
function getDependencies(adapterFiles: string[], reactServerDir: string): Promise<{
    src: string;
    dest: string;
}[]>;
```

### `getFiles`

```ts
function getFiles(pattern: string | string[], srcDir?: string): Promise<string[]>;
```

### `getPublicDir`

```ts
function getPublicDir(): string;
```

### `mergeTomlConfig`

```ts
function mergeTomlConfig<T = Record<string, any>>(existingPath: string, adapterConfig: Partial<T>): T;
```

### `message`

```ts
function message(primary: string, secondary?: string): void;
```

### `readToml`

```ts
function readToml<T = Record<string, any>>(filePath: string): T | null;
```

### `spawnCommand`

```ts
function spawnCommand(command: string, args: string[], options?: {
    cwd?: string;
}): Promise<void>;
```

### `success`

```ts
function success(message: string): void;
```

### `writeJSON`

```ts
function writeJSON(path: string, data: Record<string, any>): Promise<void>;
```

### `writeToml`

```ts
function writeToml(filePath: string, data: Record<string, any>): Promise<void>;
```

## Constants

### `adapter`

```ts
let adapter: Adapter;
```

### `buildOptions`

```ts
let buildOptions: BuildOptions | undefined;
```

## Interfaces

### `Adapter`

```ts
interface Adapter<T = any> {
    (adapterOptions: T, root: string, options: any): Promise<void>;
}
```

## Types

### `BuildOptions`

```ts
type BuildOptions = {
    edge?: {
        entry: string;
    };
};
```

### `DeployCommandDescriptor`

```ts
type DeployCommandDescriptor = {
    command: string;
    args: string[];
    cwd?: string;
    message?: string;
    afterDeploy?: () => void | Promise<void>;
};
```
