open-index/open-npm huggingface dataset:
npm package: @flightdev/adapter-bun
Description: Bun adapter for Flight Framework - ultra-fast Bun runtime
Latest version: 0.0.7

# @flightdev/adapter-bun

Bun runtime deployment adapter for Flight Framework. Ultra-fast builds and runtime performance.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Build Output](#build-output)
- [Running in Production](#running-in-production)
- [Docker](#docker)
- [License](#license)

---

## Installation

```bash
bun add @flightdev/adapter-bun
```

---

## Quick Start

```typescript
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import bun from '@flightdev/adapter-bun';

export default defineConfig({
    adapter: bun(),
});
```

Build and run:

```bash
bun run build
bun .output/server/index.ts
```

---

## Configuration

```typescript
bun({
    // Host to bind
    host: '0.0.0.0',
    
    // Port to listen on
    port: 3000,
    
    // Enable compression
    compression: true,
    
    // Development mode features
    development: process.env.NODE_ENV !== 'production',
});
```

---

## Build Output

```
.output/
├── server/
│   ├── index.ts         # Server entry (Bun-native)
│   └── chunks/          # Code-split chunks
└── client/
    └── assets/          # Static files
```

---

## Running in Production

```bash
# Build
bun run build

# Start
bun .output/server/index.ts

# With environment variables
PORT=8080 bun .output/server/index.ts
```

---

## Docker

```dockerfile
FROM oven/bun:1 AS builder
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build

FROM oven/bun:1-slim
WORKDIR /app
COPY --from=builder /app/.output .output
EXPOSE 3000
CMD ["bun", ".output/server/index.ts"]
```

---

## License

MIT
npm package: @flightdev/adapter-deno
Description: Deno adapter for Flight Framework - deploy to Deno Deploy or self-host with Deno
Latest version: 0.0.7

# @flightdev/adapter-deno

Deno Deploy adapter for Flight Framework. Deploy to Deno's global edge network.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Deno Deploy](#deno-deploy)
- [Build Output](#build-output)
- [License](#license)

---

## Installation

```bash
deno add @flightdev/adapter-deno
# or with npm
npm install @flightdev/adapter-deno
```

---

## Quick Start

```typescript
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import deno from '@flightdev/adapter-deno';

export default defineConfig({
    adapter: deno(),
});
```

---

## Configuration

```typescript
deno({
    // Deno Deploy specific
    port: 8000,
    
    // Enable static file serving
    serveStatic: true,
    
    // Static files directory
    staticDir: 'public',
});
```

---

## Deno Deploy

### Deploy with deployctl

```bash
# Install deployctl
deno install -Arf jsr:@deno/deployctl

# Build
deno task build

# Deploy
deployctl deploy --project=my-app --prod .output/server/main.ts
```

### deno.json

```json
{
    "tasks": {
        "dev": "flight dev",
        "build": "flight build",
        "start": "deno run -A .output/server/main.ts"
    }
}
```

---

## Build Output

```
.output/
├── server/
│   └── main.ts          # Deno server entry
└── static/              # Static assets
```

---

## License

MIT
npm package: @flightdev/adapter-docker
Description: Docker adapter for Flight Framework - optimized, production-ready containers
Latest version: 0.0.7

# @flightdev/adapter-docker

Docker deployment adapter for Flight Framework. Generate optimized Docker images for containerized deployments.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Generated Dockerfile](#generated-dockerfile)
- [Build and Run](#build-and-run)
- [Docker Compose](#docker-compose)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/adapter-docker
```

---

## Quick Start

```typescript
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import docker from '@flightdev/adapter-docker';

export default defineConfig({
    adapter: docker(),
});
```

---

## Configuration

```typescript
docker({
    // Base image
    baseImage: 'node:20-alpine',
    
    // Port to expose
    port: 3000,
    
    // Run as non-root user
    user: 'node',
    
    // Include these files in the image
    include: ['package.json', 'package-lock.json'],
    
    // Build arguments
    buildArgs: {
        NODE_ENV: 'production',
    },
});
```

---

## Generated Dockerfile

After building, find the Dockerfile at `.docker/Dockerfile`:

```dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:20-alpine
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
COPY --from=builder --chown=nodejs:nodejs /app/.output .output
COPY --from=builder /app/package*.json ./
RUN npm ci --omit=dev
USER nodejs
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
```

---

## Build and Run

```bash
# Build
npm run build

# Build Docker image
docker build -f .docker/Dockerfile -t my-flight-app .

# Run
docker run -p 3000:3000 my-flight-app

# With environment variables
docker run -p 3000:3000 -e DATABASE_URL=... my-flight-app
```

---

## Docker Compose

```yaml
# docker-compose.yml
version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: .docker/Dockerfile
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgres://db:5432/myapp
    depends_on:
      - db
  
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: myapp
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:
```

---

## License

MIT
npm package: @flightdev/adapter-netlify
Description: Netlify adapter for Flight Framework - deploy to Netlify Functions and Edge
Latest version: 0.0.7

# @flightdev/adapter-netlify

Netlify deployment adapter for Flight Framework. Deploy with serverless functions and edge middleware.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Edge Functions](#edge-functions)
- [Build Output](#build-output)
- [Deployment](#deployment)
- [Environment Variables](#environment-variables)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/adapter-netlify
```

---

## Quick Start

```typescript
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import netlify from '@flightdev/adapter-netlify';

export default defineConfig({
    adapter: netlify(),
});
```

Deploy:

```bash
npm run build
netlify deploy --prod
```

---

## Configuration

```typescript
netlify({
    // Use edge functions for SSR
    edge: false,
    
    // Netlify Functions directory
    functionsDir: 'netlify/functions',
    
    // Split routes into separate functions
    split: false,
});
```

---

## Edge Functions

For low-latency SSR at the edge:

```typescript
netlify({
    edge: true,
});
```

### Edge Middleware

```typescript
// src/middleware.ts
export default function middleware(request: Request) {
    // Run at the edge before your app
    const country = request.headers.get('x-country');
    
    if (country === 'DE') {
        return Response.redirect('/de');
    }
}

export const config = {
    path: '/*',
};
```

---

## Build Output

```
.netlify/
├── functions/
│   └── server.mjs       # SSR function
├── edge-functions/      # Edge functions (if enabled)
└── publish/
    ├── _redirects
    └── assets/          # Static files
```

---

## Deployment

### Netlify CLI

```bash
# Install CLI
npm install -g netlify-cli

# Login
netlify login

# Deploy preview
netlify deploy

# Deploy production
netlify deploy --prod
```

### netlify.toml

```toml
[build]
  command = "npm run build"
  publish = ".netlify/publish"
  functions = ".netlify/functions"

[functions]
  node_bundler = "esbuild"

[[redirects]]
  from = "/*"
  to = "/.netlify/functions/server"
  status = 200
```

---

## Environment Variables

Set in Netlify dashboard or `netlify.toml`:

```toml
[context.production.environment]
  DATABASE_URL = "..."
```

| Variable | Description |
|----------|-------------|
| `NETLIFY` | Set to `true` on Netlify |
| `CONTEXT` | `production`, `deploy-preview`, or `branch-deploy` |
| `URL` | Production URL |
| `DEPLOY_URL` | Unique deploy URL |

---

## License

MIT
npm package: @flightdev/adapter-static
Description: Static adapter for Flight Framework - generate static HTML files
Latest version: 0.0.7

# @flightdev/adapter-static

Static site generation adapter for Flight Framework. Pre-render all pages at build time.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Dynamic Routes](#dynamic-routes)
- [Build Output](#build-output)
- [Hosting](#hosting)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/adapter-static
```

---

## Quick Start

```typescript
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import static_ from '@flightdev/adapter-static';

export default defineConfig({
    adapter: static_(),
});
```

---

## Configuration

```typescript
static_({
    // Output directory
    outDir: 'dist',
    
    // Generate 404.html
    fallback: '404.html',
    
    // Prerender all routes
    prerender: true,
    
    // Routes to prerender (if not auto-detected)
    pages: ['/', '/about', '/contact'],
    
    // Trailing slashes
    trailingSlash: true,
});
```

---

## Dynamic Routes

For routes like `/blog/[slug]`, export `generateStaticParams`:

```typescript
// src/routes/blog/[slug].page.tsx
export async function generateStaticParams() {
    const posts = await getPosts();
    return posts.map(post => ({
        slug: post.slug,
    }));
}

export default function BlogPost({ params }) {
    // ...
}
```

---

## Build Output

```
dist/
├── index.html
├── about/
│   └── index.html
├── blog/
│   ├── hello-world/
│   │   └── index.html
│   └── another-post/
│       └── index.html
├── 404.html
└── assets/
    ├── style.css
    └── main.js
```

---

## Hosting

### GitHub Pages

```yaml
# .github/workflows/deploy.yml
name: Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npm ci && npm run build
      - uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist
```

### Netlify / Vercel

Just configure the build command and publish directory in the dashboard.

### Nginx

```nginx
server {
    listen 80;
    root /var/www/mysite/dist;
    
    location / {
        try_files $uri $uri/ /index.html;
    }
}
```

---

## License

MIT
npm package: @flightdev/babel-plugin-cache
Description: Babel plugin for 'use cache' directive in Flight Framework
Latest version: 0.0.3

# @flightdev/babel-plugin-cache

Babel plugin for "use cache" directive in Flight Framework.

## Installation

```bash
pnpm add @flightdev/babel-plugin-cache
```

## Usage

### babel.config.js

```javascript
module.exports = {
    plugins: [
        ['@flightdev/babel-plugin-cache', {
            defaultTTL: 3600,
        }],
    ],
};
```

### In Code

```typescript
async function getReviews(productId: string) {
    "use cache";
    return fetch(`/api/reviews/${productId}`).then(r => r.json());
}
```

### Output

```typescript
import { cachedFn } from '@flightdev/cache-components';

const getReviews = cachedFn('getReviews', async (productId: string) => {
    return fetch(`/api/reviews/${productId}`).then(r => r.json());
}, { ttl: 3600 });
```

## Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `defaultTTL` | number | 3600 | Default TTL in seconds |
| `importSource` | string | `@flightdev/cache-components` | Import source |
npm package: @flightdev/bundler
Description: Bundler abstraction layer for Flight Framework
Latest version: 3.0.0

# @flight-framework/bundler

Internal bundler utilities for Flight Framework. Used by the CLI and adapters.

## Installation

This is an internal package. You typically don't need to install it directly.

```bash
npm install @flight-framework/bundler
```

## Overview

The bundler package provides shared utilities for:

- **Vite Configuration**: Common Vite plugins and config
- **Rollup Integration**: Rollup plugins for SSR builds
- **esbuild Helpers**: Fast transpilation utilities
- **Code Splitting**: Optimized chunk generation
- **Tree Shaking**: Dead code elimination

## Usage (Internal)

```typescript
import { createBuildConfig, createDevConfig } from '@flight-framework/bundler';

const config = createBuildConfig({
    entry: './src/entry.ts',
    outDir: '.output',
    target: 'node',
    minify: true,
});
```

## Exports

- `createBuildConfig` - Production build configuration
- `createDevConfig` - Development server configuration
- `createSSRBuild` - Server-side rendering build
- `createClientBuild` - Client bundle build
- `analyzeBundle` - Bundle size analysis

## License

MIT
npm package: @flightdev/bundler-esbuild
Description: esbuild bundler adapter for Flight Framework - fast and minimal
Latest version: 3.0.1

# @flight-framework/bundler-esbuild

esbuild bundler adapter for Flight Framework.

## Installation

```bash
npm install @flight-framework/bundler-esbuild esbuild
```

## Usage

```typescript
// flight.config.ts
import { defineConfig } from '@flight-framework/core';
import { esbuild } from '@flight-framework/bundler-esbuild';

export default defineConfig({
    bundler: esbuild(),
});
```

## Options

```typescript
esbuild({
    // Build target
    target: 'es2022',
    
    // Enable minification (default: true in production)
    minify: true,
    
    // Source maps
    sourcemap: true,
    
    // Output format
    format: 'esm',
    
    // Code splitting
    splitting: true,
    
    // External packages
    external: ['react', 'react-dom'],
    
    // Define global constants
    define: {
        'process.env.API_URL': '"https://api.example.com"',
    },
    
    // JSX configuration
    jsx: 'automatic',
});
```

## Performance

esbuild is extremely fast, typically 10-100x faster than Webpack or Rollup:

| Bundler | Cold Start | Rebuild |
|---------|-----------|---------|
| Vite | ~300ms | ~50ms |
| esbuild | ~50ms | ~10ms |

## Limitations

Unlike Vite, esbuild does not have:
- Built-in HMR (Hot Module Replacement)
- Native CSS Modules support (requires plugin)
- As rich plugin ecosystem

For full-featured development, consider `@flight-framework/bundler-vite`.

## CSS Support

esbuild handles CSS natively but CSS Modules require a plugin:

```bash
npm install esbuild-css-modules-plugin
```

```typescript
import cssModulesPlugin from 'esbuild-css-modules-plugin';

esbuild({
    plugins: [cssModulesPlugin()],
});
```

## License

MIT
npm package: @flightdev/bundler-rolldown
Description: Rolldown bundler adapter for Flight Framework - Rust-based, Vite-compatible
Latest version: 3.0.1

# @flight-framework/bundler-rolldown

Rolldown bundler adapter for Flight Framework. Rust-based bundler with Rollup/Vite-compatible plugin API.

## Installation

```bash
npm install @flight-framework/bundler-rolldown rolldown
```

> **Note**: Rolldown is still in active development. API may change.

## Usage

```typescript
// flight.config.ts
import { defineConfig } from '@flight-framework/core';
import { rolldown } from '@flight-framework/bundler-rolldown';

export default defineConfig({
    bundler: rolldown(),
});
```

## Options

```typescript
rolldown({
    // Build target
    target: 'es2022',
    
    // Enable minification
    minify: true,
    
    // Source maps
    sourcemap: true,
    
    // Output format
    format: 'esm',
    
    // External packages
    external: ['react', 'react-dom'],
    
    // Define global constants
    define: {
        'process.env.API_URL': '"https://api.example.com"',
    },
    
    // Use Vite-compatible plugins (default: true)
    viteMode: true,
});
```

## Why Rolldown?

Rolldown is a Rust-based bundler designed to be:

1. **Fast**: Written in Rust for maximum performance
2. **Compatible**: Rollup-compatible plugin API
3. **Future-proof**: Will power Vite in future versions

## Vite Mode

When `viteMode: true` (default), Rolldown uses experimental Vite-compatible plugins:

- `viteResolvePlugin` - Module resolution
- `viteCSSPlugin` - CSS processing
- `viteCSSPostPlugin` - CSS post-processing

This enables seamless migration from Vite when Rolldown matures.

## Current Limitations

As Rolldown is in beta:

- Some Rollup plugins may not work
- HMR is not yet as mature as Vite
- Documentation is being developed

For production apps, consider `@flight-framework/bundler-vite` until Rolldown reaches 1.0.

## License

MIT
npm package: @flightdev/bundler-vite
Description: Vite bundler adapter for Flight Framework
Latest version: 3.0.1

# @flight-framework/bundler-vite

Vite bundler adapter for Flight Framework.

## Installation

```bash
npm install @flight-framework/bundler-vite vite
```

## Usage

```typescript
// flight.config.ts
import { defineConfig } from '@flight-framework/core';
import { vite } from '@flight-framework/bundler-vite';

export default defineConfig({
    bundler: vite(),
});
```

## Options

```typescript
vite({
    // CSS configuration
    css: {
        modules: true,  // Enable CSS Modules
        devSourcemap: true,
    },
    
    // Vite-specific overrides
    vite: {
        plugins: [...],
        optimizeDeps: { ... },
    },
    
    // Framework plugins (auto-detected by default)
    react: true,
    vue: false,
});
```

## CSS Support

### CSS Modules

Flight + Vite supports CSS Modules natively. Just use `.module.css`:

```css
/* Button.module.css */
.primary {
    background: blue;
}
```

```tsx
import styles from './Button.module.css';

<button className={styles.primary}>Click</button>
```

### Tailwind CSS

Create `tailwind.config.js` and `postcss.config.js` as normal:

```bash
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
```

Vite will automatically use PostCSS.

### Sass/SCSS

```bash
npm install -D sass
```

Then import `.scss` files directly.

## License

MIT
npm package: @flightdev/cache-cloudflare-kv
Description: Cloudflare Workers KV cache adapter for Flight Framework
Author: Flight Framework
Latest version: 0.0.7

# @flightdev/cache-cloudflare-kv

Cloudflare KV cache adapter for Flight Framework. Edge caching with Cloudflare Workers KV.

## Installation

```bash
npm install @flightdev/cache-cloudflare-kv
```

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { cloudflareKV } from '@flightdev/cache-cloudflare-kv';

// In your Cloudflare Worker
export default {
    async fetch(request, env) {
        const cache = createCache(cloudflareKV({
            binding: env.MY_KV_NAMESPACE,
        }));
        
        await cache.set('key', 'value');
        const value = await cache.get('key');
        
        return Response.json({ value });
    }
};
```

## Configuration

```typescript
cloudflareKV({
    // KV namespace binding
    binding: env.MY_KV_NAMESPACE,
    
    // Key prefix
    prefix: 'cache:',
    
    // Default TTL in seconds
    ttl: 3600,
    
    // Cache TTL for reads (edge cache duration)
    cacheTtl: 60,
});
```

## wrangler.toml

```toml
[[kv_namespaces]]
binding = "MY_KV_NAMESPACE"
id = "abc123"
```

## License

MIT
npm package: @flightdev/cache-components
Description: Component-level caching with streaming SSR for Flight Framework
Latest version: 0.0.6

# @flight-framework/cache-components

Component-level caching with streaming SSR for Flight Framework.

Enables **Partial Pre-Rendering (PPR)** patterns - mix static, cached, and dynamic content in a single route.

## Installation

```bash
pnpm add @flight-framework/cache-components
```

## Usage

### Basic Setup

```tsx
import { createCache, memory } from '@flight-framework/core';
import { CacheProvider, CachedContent, Dynamic } from '@flight-framework/cache-components/react';

const cache = createCache({ adapter: memory({ maxSize: 1000 }) });

function App() {
    return (
        <CacheProvider cache={cache} defaultTTL={3600}>
            <Header />  {/* Static */}
            
            <Suspense fallback={<ReviewsSkeleton />}>
                <CachedContent cacheKey="reviews:123" ttl={3600} tags={['reviews']}>
                    <ProductReviews productId="123" />
                </CachedContent>
            </Suspense>
            
            <Dynamic>
                <ShoppingCart />  {/* Always fresh */}
            </Dynamic>
        </CacheProvider>
    );
}
```

### Cached Data Functions

```tsx
import { cachedFn, setGlobalCache } from '@flight-framework/cache-components';

// Set up global cache
setGlobalCache(cache);

// Create cached data fetcher
const getReviews = cachedFn('reviews', async (productId: string) => {
    const res = await fetch(`/api/reviews/${productId}`);
    return res.json();
}, { ttl: 3600, tags: ['reviews'] });

// Usage
const reviews = await getReviews('product-123');
```

### Client-Side Hook

```tsx
import { useCachedData } from '@flight-framework/cache-components/react';

function Price({ productId }) {
    const { data, isLoading, error } = useCachedData(
        `price:${productId}`,
        () => fetch(`/api/price/${productId}`).then(r => r.json()),
        { ttl: 60 }
    );
    
    if (isLoading) return <Skeleton />;
    return <span>${data.price}</span>;
}
```

## API

### Components

| Component | Description |
|-----------|-------------|
| `CacheProvider` | Provides cache context to tree |
| `CachedContent` | Marks content as cached |
| `Dynamic` | Marks content as never cached |

### Functions

| Function | Description |
|----------|-------------|
| `cachedComponent` | Create cached component renderer |
| `cachedFn` | Wrap function with caching |
| `setGlobalCache` | Set global cache instance |

### Hooks

| Hook | Description |
|------|-------------|
| `useCache` | Access cache from context |
| `useCachedData` | Client-side data caching |

## Features

- SSR streaming integration
- Automatic cache key generation
- Tag-based invalidation
- DevTools instrumentation hooks
- Works with any cache adapter
npm package: @flightdev/cache-deno-kv
Description: Deno KV cache adapter for Flight Framework - native Deno key-value store
Author: Flight Framework
Latest version: 0.0.7

# @flightdev/cache-deno-kv

Deno KV cache adapter for Flight Framework. Native Deno KV storage for edge and serverless.

## Installation

```typescript
import { denoKV } from '@flightdev/cache-deno-kv';
```

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { denoKV } from '@flightdev/cache-deno-kv';

const cache = createCache(denoKV());

await cache.set('key', 'value');
const value = await cache.get('key');
```

## Configuration

```typescript
denoKV({
    // Key prefix
    prefix: ['cache'],
    
    // Default TTL in milliseconds
    ttl: 60 * 60 * 1000,
    
    // Custom KV instance (optional, uses Deno.openKv() by default)
    kv: await Deno.openKv('./data.db'),
});
```

## Features

- Zero dependencies
- ACID transactions
- Native Deno Deploy support
- Automatic serialization

## License

MIT
npm package: @flightdev/cache-lru
Description: LRU (Least Recently Used) cache adapter for Flight Framework - bounded memory cache with eviction
Author: Flight Framework
Latest version: 0.0.8

# @flightdev/cache-lru

In-memory LRU cache adapter for Flight Framework. Fast, size-bounded caching.

## Installation

```bash
npm install @flightdev/cache-lru
```

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { lru } from '@flightdev/cache-lru';

const cache = createCache(lru({
    max: 1000,       // Max entries
    ttl: 60 * 1000,  // Default TTL in ms
}));

await cache.set('key', 'value');
const value = await cache.get('key');
```

## Configuration

```typescript
lru({
    // Maximum number of entries
    max: 1000,
    
    // Maximum size in bytes (alternative to max)
    maxSize: 50 * 1024 * 1024,  // 50MB
    
    // Size calculator for maxSize
    sizeCalculation: (value) => JSON.stringify(value).length,
    
    // Default TTL in milliseconds
    ttl: 60 * 1000,
    
    // Update TTL on access
    updateAgeOnGet: true,
    
    // Allow stale values while revalidating
    allowStale: true,
});
```

## Features

- O(1) get/set/delete operations
- Size-bounded with LRU eviction
- TTL support
- Stale-while-revalidate
- No external dependencies

## License

MIT
npm package: @flightdev/cache-redis
Description: Redis cache adapter for Flight Framework using ioredis
Author: Flight Framework
Latest version: 0.0.7

# @flightdev/cache-redis

Redis cache adapter for Flight Framework. Production-ready caching with Redis.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Usage](#usage)
- [Cluster Mode](#cluster-mode)
- [API Reference](#api-reference)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/cache-redis ioredis
```

---

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { redis } from '@flightdev/cache-redis';

const cache = createCache(redis({
    url: process.env.REDIS_URL,
}));

// Set a value
await cache.set('user:123', { name: 'John', email: 'john@example.com' });

// Get a value
const user = await cache.get('user:123');

// Delete a value
await cache.delete('user:123');
```

---

## Configuration

```typescript
redis({
    // Redis URL
    url: 'redis://localhost:6379',
    
    // Or individual options
    host: 'localhost',
    port: 6379,
    password: 'secret',
    db: 0,
    
    // Key prefix
    prefix: 'myapp:cache:',
    
    // Default TTL in seconds
    ttl: 3600,
    
    // Enable TLS
    tls: true,
    
    // Connection options
    maxRetriesPerRequest: 3,
    connectTimeout: 10000,
});
```

---

## Usage

### Basic Operations

```typescript
// Set with TTL
await cache.set('key', 'value', { ttl: 60 });

// Get
const value = await cache.get('key');

// Check existence
const exists = await cache.has('key');

// Delete
await cache.delete('key');

// Clear all
await cache.clear();
```

### With Fetch

Fetch from cache or compute if missing:

```typescript
const user = await cache.fetch('user:123', async () => {
    return await db.users.findById(123);
}, { ttl: 300 });
```

### Tags

Invalidate groups of keys:

```typescript
await cache.set('products:1', data, { tags: ['products'] });
await cache.set('products:2', data, { tags: ['products'] });

// Invalidate all products
await cache.invalidateTag('products');
```

---

## Cluster Mode

```typescript
import { redisCluster } from '@flightdev/cache-redis';

const cache = createCache(redisCluster({
    nodes: [
        { host: 'node1.example.com', port: 6379 },
        { host: 'node2.example.com', port: 6379 },
        { host: 'node3.example.com', port: 6379 },
    ],
    password: 'secret',
}));
```

---

## API Reference

### Adapter Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `url` | `string` | - | Redis URL |
| `host` | `string` | `'localhost'` | Redis host |
| `port` | `number` | `6379` | Redis port |
| `password` | `string` | - | Password |
| `db` | `number` | `0` | Database number |
| `prefix` | `string` | `''` | Key prefix |
| `ttl` | `number` | `3600` | Default TTL |
| `tls` | `boolean` | `false` | Enable TLS |

---

## License

MIT
npm package: @flightdev/cache-sqlite
Description: SQLite cache adapter for Flight Framework - persistent local cache
Author: Flight Framework
Latest version: 0.0.7

# @flightdev/cache-sqlite

SQLite cache adapter for Flight Framework. Persistent local caching with SQLite.

## Installation

```bash
npm install @flightdev/cache-sqlite better-sqlite3
```

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { sqlite } from '@flightdev/cache-sqlite';

const cache = createCache(sqlite({
    path: './cache.db',
}));

await cache.set('key', 'value', { ttl: 3600 });
const value = await cache.get('key');
```

## Configuration

```typescript
sqlite({
    // Database file path
    path: './cache.db',
    
    // Use in-memory database
    memory: false,
    
    // Table name
    table: 'cache',
    
    // Default TTL in seconds
    ttl: 3600,
    
    // Cleanup interval (remove expired entries)
    cleanupInterval: 60 * 1000,
});
```

## Features

- Persistent storage
- Automatic expiration cleanup
- Full-text search on keys
- Zero network latency
- Works offline

## License

MIT
npm package: @flightdev/cache-upstash
Description: Upstash Redis cache adapter for Flight Framework - serverless and edge compatible
Author: Flight Framework
Latest version: 0.0.7

# @flightdev/cache-upstash

Upstash Redis cache adapter for Flight Framework. Serverless-optimized Redis caching.

## Installation

```bash
npm install @flightdev/cache-upstash
```

## Quick Start

```typescript
import { createCache } from '@flightdev/core/cache';
import { upstash } from '@flightdev/cache-upstash';

const cache = createCache(upstash({
    url: process.env.UPSTASH_REDIS_REST_URL,
    token: process.env.UPSTASH_REDIS_REST_TOKEN,
}));

await cache.set('key', 'value', { ttl: 3600 });
const value = await cache.get('key');
```

## Configuration

```typescript
upstash({
    // Upstash REST API URL
    url: process.env.UPSTASH_REDIS_REST_URL,
    
    // Upstash REST API token
    token: process.env.UPSTASH_REDIS_REST_TOKEN,
    
    // Key prefix
    prefix: 'cache:',
    
    // Default TTL in seconds
    ttl: 3600,
    
    // Automatic JSON serialization
    automaticDeserialization: true,
});
```

## Why Upstash?

- Serverless-optimized (HTTP-based, no connection pooling needed)
- Edge-compatible (works in Cloudflare Workers, Vercel Edge, etc.)
- Pay-per-request pricing
- Global replication

## License

MIT
npm package: @flightdev/error-overlay
Description: Unified error overlay for Flight Framework development
Author: Flight Framework Team
Latest version: 0.1.0

# @flight-framework/error-overlay

Unified error overlay for Flight Framework development. Displays runtime errors with source code context and stack traces.

## Installation

```bash
npm install -D @flight-framework/error-overlay
```

## Quick Start

### With Vite

```typescript
// vite.config.ts
import { defineConfig } from 'vite';
import { errorOverlayPlugin } from '@flight-framework/error-overlay/vite';

export default defineConfig({
    plugins: [
        errorOverlayPlugin(),
    ],
});
```

### Manual Setup

```typescript
import { createErrorOverlay } from '@flight-framework/error-overlay';

const overlay = createErrorOverlay({
    position: 'fullscreen',
    theme: 'dark',
    onOpenEditor: (file, line, column) => {
        // Open file in your editor
        fetch(`/__open-editor?file=${file}&line=${line}&column=${column}`);
    },
});

// Catch errors
window.addEventListener('error', (e) => overlay.show(e.error));
window.addEventListener('unhandledrejection', (e) => overlay.show(e.reason));
```

## Features

- Stack trace parsing (V8, Firefox, Safari)
- Source code context with line highlighting
- Dark/light theme support
- Open in editor integration
- Keyboard shortcuts (Esc to dismiss)
- Copy error to clipboard
- User code vs vendor code distinction

## Configuration

```typescript
createErrorOverlay({
    // Position: 'top' | 'bottom' | 'fullscreen'
    position: 'fullscreen',

    // Theme: 'dark' | 'light' | 'auto'
    theme: 'dark',

    // Show frames from node_modules
    showNodeModules: false,

    // Lines of context around error
    contextLines: 5,

    // Enable keyboard shortcuts
    shortcuts: true,

    // Callbacks
    onDismiss: () => {},
    onOpenEditor: (file, line, column) => {},
});
```

## API Reference

### createErrorOverlay(options?)

Create an error overlay instance.

```typescript
const overlay = createErrorOverlay(options);

overlay.show(error);     // Show error
overlay.hide();          // Hide overlay
overlay.destroy();       // Remove completely
overlay.isVisible();     // Check visibility
overlay.configure({});   // Update options
```

### parseStackTrace(stack)

Parse a stack trace string into frames.

```typescript
import { parseStackTrace } from '@flight-framework/error-overlay';

const frames = parseStackTrace(error.stack);
// [{ file, line, column, functionName, isUserCode, ... }]
```

### generateSourceContext(source, line, context)

Generate source code lines around an error line.

```typescript
import { generateSourceContext } from '@flight-framework/error-overlay';

const lines = generateSourceContext(sourceCode, 42, 5);
// [{ number, content, isHighlighted }]
```

## Vite Plugin Options

```typescript
errorOverlayPlugin({
    enabled: true,          // Enable/disable
    position: 'fullscreen', // Overlay position
    theme: 'dark',          // Theme
});
```

## License

MIT
npm package: @flightdev/graphql
Description: GraphQL adapter for Flight Framework - optional, non-imposing
Latest version: 0.1.1

# @flightdev/graphql

GraphQL adapter for Flight Framework. Optional, non-imposing - use it only if you need GraphQL.

## Installation

```bash
npm install @flightdev/graphql graphql graphql-yoga
```

## Quick Start

Create a GraphQL endpoint in your Flight app:

```typescript
// src/routes/api/graphql.ts
import { createGraphQLHandler } from '@flightdev/graphql';
import { yogaAdapter } from '@flightdev/graphql/yoga';
import { schema } from '../../graphql/schema';

const handler = createGraphQLHandler({
  adapter: yogaAdapter(),
  schema,
});

export const GET = handler;
export const POST = handler;
```

## Creating a Schema

### Code-First (Recommended)

```typescript
// src/graphql/schema.ts
import { createSchema } from 'graphql-yoga';

export const schema = createSchema({
  typeDefs: /* GraphQL */ `
    type Query {
      hello(name: String): String!
      users: [User!]!
    }
    
    type User {
      id: ID!
      name: String!
      email: String!
    }
  `,
  resolvers: {
    Query: {
      hello: (_, { name }) => `Hello ${name || 'World'}`,
      users: () => db.users.findMany(),
    },
  },
});
```

### Schema-First

```typescript
import { buildSchema } from 'graphql';
import { createGraphQLHandler } from '@flightdev/graphql';
import { yogaAdapter } from '@flightdev/graphql/yoga';

const schema = buildSchema(/* GraphQL */ `
  type Query {
    hello: String
  }
`);

const rootValue = {
  hello: () => 'Hello World',
};

export const POST = createGraphQLHandler({
  adapter: yogaAdapter({ rootValue }),
  schema,
});
```

## Context

Pass request context to resolvers:

```typescript
const handler = createGraphQLHandler({
  adapter: yogaAdapter(),
  schema,
  context: async (req) => {
    const token = req.headers.get('Authorization');
    const user = token ? await verifyToken(token) : null;
    return { user, db };
  },
});
```

Access in resolvers:

```typescript
const resolvers = {
  Query: {
    me: (_, __, ctx) => ctx.user,
    posts: (_, __, ctx) => ctx.db.posts.findMany(),
  },
};
```

## GraphiQL

GraphiQL is enabled by default in development. Access it at your endpoint URL.

To disable:

```typescript
const handler = createGraphQLHandler({
  adapter: yogaAdapter({ graphiql: false }),
  schema,
});
```

## Adapters

### GraphQL Yoga (Default)

```typescript
import { yogaAdapter } from '@flightdev/graphql/yoga';
```

Yoga is the recommended adapter - modern, lightweight, full fetch API support.

### Apollo (Coming Soon)

```typescript
import { apolloAdapter } from '@flightdev/graphql/apollo';
```

## TypeScript

Full TypeScript support with type inference:

```typescript
import type { GraphQLContext, GraphQLAdapter } from '@flightdev/graphql';
```

## License

MIT
npm package: @flightdev/queue-indexeddb
Description: IndexedDB storage adapter for Flight Framework offline queue
Author: Flight Framework
Latest version: 0.2.5

# @flightdev/queue-indexeddb

IndexedDB storage adapter for Flight Framework's offline action queue.

## Installation

```bash
npm install @flightdev/queue-indexeddb
```

## Usage

```typescript
import { createQueuedAction } from '@flightdev/core/actions';
import { indexedDBAdapter } from '@flightdev/queue-indexeddb';

// Create adapter
const storage = indexedDBAdapter({
    dbName: 'myapp-offline-queue',
    storeName: 'actions', // optional, default: 'queue'
});

// Use with queued actions
const saveOffline = createQueuedAction(saveData, {
    storage,
    retryStrategy: exponentialBackoff({ maxAttempts: 5 }),
});

// Works offline!
await saveOffline({ title: 'My Note', content: '...' });
```

## API

### `indexedDBAdapter(options)`

Creates an IndexedDB storage adapter.

**Options:**
- `dbName` (required): IndexedDB database name
- `storeName` (optional): Object store name, default `'queue'`
- `version` (optional): Database version, default `1`

## Browser Support

Requires IndexedDB support (all modern browsers).

## License

MIT
npm package: @flightdev/storage
Description: Storage adapters for Flight Framework - S3, R2, FS, and more
Latest version: 0.0.7

# @flightdev/storage

File storage package with cloud provider adapters.

## Installation

```bash
npm install @flightdev/storage
```

## Quick Start

```typescript
import { createStorage } from '@flightdev/storage';
import { s3 } from '@flightdev/storage/s3';

const storage = createStorage(s3({
    bucket: 'my-bucket',
    region: 'us-east-1',
}));

// Upload
await storage.put('files/document.pdf', file);

// Download
const data = await storage.get('files/document.pdf');

// Delete
await storage.delete('files/document.pdf');
```

## Adapters

### AWS S3

```typescript
import { s3 } from '@flightdev/storage/s3';

const adapter = s3({
    bucket: 'my-bucket',
    region: 'us-east-1',
    credentials: {
        accessKeyId: process.env.AWS_ACCESS_KEY_ID,
        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    },
});
```

### Cloudflare R2

```typescript
import { r2 } from '@flightdev/storage/r2';

const adapter = r2({
    accountId: process.env.CF_ACCOUNT_ID,
    bucket: 'my-bucket',
    accessKeyId: process.env.R2_ACCESS_KEY_ID,
    secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
});
```

### Local Filesystem

```typescript
import { fs } from '@flightdev/storage/fs';

const adapter = fs({
    basePath: './uploads',
});
```

## API Reference

### storage.put(key, data, options?)

Upload a file.

```typescript
await storage.put('path/file.txt', buffer, {
    contentType: 'text/plain',
    metadata: { uploadedBy: 'user123' },
});
```

### storage.get(key)

Download a file.

```typescript
const data = await storage.get('path/file.txt');
```

### storage.getUrl(key, options?)

Get a signed URL.

```typescript
const url = await storage.getUrl('path/file.txt', {
    expiresIn: 3600, // 1 hour
});
```

### storage.delete(key)

Delete a file.

```typescript
await storage.delete('path/file.txt');
```

### storage.list(prefix?)

List files.

```typescript
const files = await storage.list('uploads/');
```

## License

MIT
npm package: @flightdev/ui-hotwire
Description: Hotwire (Turbo) adapter for Flight Framework
Latest version: 1.1.0

# @flightdev/ui-hotwire

Hotwire adapter for Flight Framework. Turbo + Stimulus for server-rendered applications.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Turbo Frames](#turbo-frames)
- [Turbo Streams](#turbo-streams)
- [API Reference](#api-reference)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/ui @flightdev/ui-hotwire
```

Peer dependencies:

```bash
npm install @hotwired/turbo @hotwired/stimulus
```

---

## Quick Start

```typescript
import { defineUI } from '@flightdev/ui';
import { hotwire } from '@flightdev/ui-hotwire';

const ui = defineUI(hotwire());

const result = await ui.adapter.renderToString({
    component: () => `
        <turbo-frame id="messages">
            <a href="/messages/1">Message 1</a>
        </turbo-frame>
    `,
    props: {},
});

console.log(result.html);
```

---

## Configuration

Configure the Hotwire adapter with options:

```typescript
import { hotwire } from '@flightdev/ui-hotwire';

const adapter = hotwire({
    turbo: true,
    stimulus: true,
});
```

### Available Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `turbo` | `boolean` | `true` | Enable Turbo Drive/Frames/Streams |
| `stimulus` | `boolean` | `true` | Enable Stimulus controllers |

---

## Turbo Frames

Use Turbo Frames for partial page updates:

```html
<turbo-frame id="user-profile">
    <a href="/profile/edit">Edit Profile</a>
    <!-- Content loads inline without full page reload -->
</turbo-frame>
```

---

## Turbo Streams

Use Turbo Streams for real-time updates:

```html
<turbo-stream action="append" target="messages">
    <template>
        <div id="message_5">New message</div>
    </template>
</turbo-stream>
```

### Stream Actions

| Action | Description |
|--------|-------------|
| `append` | Append to target |
| `prepend` | Prepend to target |
| `replace` | Replace target |
| `update` | Update target content |
| `remove` | Remove target |
| `before` | Insert before target |
| `after` | Insert after target |

---

## API Reference

### hotwire(options?)

Create a Hotwire adapter instance.

```typescript
function hotwire(options?: HotwireAdapterOptions): HotwireAdapter;
```

### HotwireAdapter

| Method | Description |
|--------|-------------|
| `renderToString(component, context?)` | Render to HTML string |
| `getHydrationScript(result)` | Generate Hotwire include script |
| `getClientEntry()` | Get client entry code |

### Capabilities

| Capability | Supported |
|------------|-----------|
| Streaming | No |
| Partial Hydration | No |
| Islands | No |
| Resumable | No |
| SSG | Yes |
| CSR | Limited |
| Server Components | No |

---

## License

MIT
npm package: @flightdev/ui-marko
Description: Marko SSR adapter for Flight Framework
Latest version: 1.1.0

# @flightdev/ui-marko

Marko SSR adapter for Flight Framework. Streaming SSR with progressive enhancement.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Streaming SSR](#streaming-ssr)
- [Hydration](#hydration)
- [API Reference](#api-reference)
- [License](#license)

---

## Installation

```bash
npm install @flightdev/ui @flightdev/ui-marko
```

Peer dependencies:

```bash
npm install marko
```

---

## Quick Start

```typescript
import { defineUI } from '@flightdev/ui';
import { marko } from '@flightdev/ui-marko';

const ui = defineUI(marko());

const result = await ui.adapter.renderToString({
    component: template,
    props: { items: [] },
});

console.log(result.html);
```

---

## Streaming SSR

Marko supports streaming SSR out of the box:

```typescript
import { marko } from '@flightdev/ui-marko';

const adapter = marko();

const { stream, done } = adapter.renderToStream(
    { component: template, props: { items } },
    { url: request.url }
);

const reader = stream.getReader();
while (true) {
    const { done: readerDone, value } = await reader.read();
    if (readerDone) break;
    response.write(value);
}
response.end();
```

---

## Hydration

Generate hydration scripts for client-side interactivity:

```typescript
const result = await adapter.renderToString({
    component: template,
    props: { data },
});

const hydrationScript = adapter.getHydrationScript(result);

const html = `
<!DOCTYPE html>
<html>
<body>
    ${result.html}
    ${hydrationScript}
</body>
</html>
`;
```

---

## API Reference

### marko(options?)

Create a Marko adapter instance.

```typescript
function marko(options?: MarkoAdapterOptions): MarkoAdapter;
```

### MarkoAdapter

| Method | Description |
|--------|-------------|
| `renderToString(component, context?)` | Render to HTML string |
| `renderToStream(component, context?, options?)` | Render to readable stream |
| `getHydrationScript(result)` | Generate hydration script |
| `getClientEntry()` | Get client entry code |

### Capabilities

| Capability | Supported |
|------------|-----------|
| Streaming | Yes |
| Partial Hydration | No |
| Islands | No |
| Resumable | No |
| SSG | Yes |
| CSR | Yes |
| Server Components | No |

---

## License

MIT