import type { Plugin } from 'rollup'; export interface LocalStorageDetection { value: string; hint: string; module: string; /** * Name of the env var that guards this literal at runtime, when the * literal is the fallback arm of a `process.env.X || literal` (or `??`) * expression. The CLI preflight uses this to suppress or soften the * error when the guarding var is present in the deploy env. */ guardedBy?: string; } /** * Unified preflight metadata emitted as `preflight-metadata.json`. * Superset of the legacy `preflight-local-paths.json` (which stays emitted * for one release so older CLIs keep working with newer deployers). */ export interface PreflightMetadata { version: 1; localPaths: LocalStorageDetection[]; userEnvRefs: string[]; } /** * Rollup plugin that detects host-local storage URLs (e.g. `file:./mastra.db`, * `postgres://localhost`) in **user source modules** during bundling, and * collects the env vars user code reads via `process.env.X`. * * Only modules outside `node_modules` (and the deployer's own * `.mastra/.build/` pre-bundled files) are inspected, so library code * (like Agent Builder prompt templates or JSDoc examples in `@mastra/core`) * is naturally excluded. When `rootDir` is given, modules outside it are * also excluded — symlinked dependencies (pnpm `link:`/`file:`) resolve to * real paths that never contain `node_modules`. Tree-shaken modules are * excluded via * `generateBundle` — only modules that actually contribute rendered code to * the output are reported. * * When a detected literal is the fallback arm of a `process.env.X || literal` * expression, `guardedBy: "X"` is recorded so the CLI preflight can apply * deploy-time env context instead of hard-erroring on a dead fallback. * * Three assets are emitted into the output directory: * - `preflight-metadata.json` — unified metadata (local paths + user env refs) * - `workers.json` — statically extracted worker topology, or `null` * - `preflight-local-paths.json` — legacy shape, kept for one release so an * older globally-installed CLI paired with a newer project-local deployer * doesn't lose the LOCAL_STORAGE_PATH check. */ export declare function localStorageDetector(rootDir?: string): Plugin; //# sourceMappingURL=local-storage-detector.d.ts.map