import { MastraBundler } from '@mastra/core/bundler'; import type { Config } from '@mastra/core/mastra'; import type { InputOptions, OutputOptions } from 'rollup'; import { analyzeBundle } from '../build/analyze/index.js'; import type { BundlerOptions, ExternalDependencyInfo } from '../build/types.js'; import type { BundlerPlatform } from '../build/utils.js'; export type { BundlerOptions, ExternalDependencyInfo } from '../build/types.js'; export type { BundlerPlatform } from '../build/utils.js'; export declare const IS_DEFAULT: unique symbol; /** * Constraints declared by the source app, plus the packages some resolution field pins. * * Only `dependencies` values are read. Override fields contribute names, never values: which of * `overrides`, `resolutions`, `pnpm.overrides` or `pnpm-workspace.yaml` a given install honoured * depends on the package manager and its version, so reproducing that precedence would mean * emulating three package managers. A name appearing in any of them is enough to know the resolved * version was chosen deliberately, which is all this needs. */ export type SourceDependencyConstraints = { dependencies: Record; pinnedByResolutionField: Set; }; /** * True when a specifier is something the isolated install in `.mastra/output` can resolve from the * registry: a semver range, a dist tag, a wildcard, or an npm alias whose target is a registry * package and range. * * This is an allowlist rather than a denylist of known protocols, so an unfamiliar protocol is * rejected without this code having to know it exists. The output directory is not a workspace, has * no catalog definitions and has a different relative-path base, so `catalog:`, `workspace:`, * `file:`, `link:` and git specifiers are all either uninstallable there or point somewhere else. */ export declare const isRegistryVersionSpec: (spec: string) => boolean; /** * Read the constraints the source app declared. * * `dependencies` come from the manifest at `projectRoot`, the package the build was invoked for and * whose directory receives the output, falling back to the manifest above the entry file. Anchoring * on `projectRoot` rather than the entry file keeps the answer deterministic when the entry handed * to the bundler is a generated wrapper rather than the app's own source file. * * Resolution-field names are collected from both that manifest and the workspace root, including the * root `pnpm-workspace.yaml`, because a name pinned anywhere means the resolved version may have been * chosen deliberately rather than hoisted by accident. */ export declare const getSourceDependencyConstraints: ({ projectRoot, mastraEntryFile, workspaceRoot, }: { projectRoot: string; mastraEntryFile: string; workspaceRoot?: string; }) => Promise; /** * Prefer the constraint the app declared over the version resolved from `node_modules`. * * The resolved version is whatever the install happened to hoist, so an app declaring `zod: ^4.3.6` * next to a hoisted `zod@3.25.76` gets the hoisted version written into the output manifest and the * isolated install then locks it in. */ export declare const applySourceDependencyRange: (dependencyName: string, dependencyInfo: ExternalDependencyInfo, constraints: SourceDependencyConstraints) => ExternalDependencyInfo; export declare abstract class Bundler extends MastraBundler { protected analyzeOutputDir: string; protected outputDir: string; protected platform: BundlerPlatform; constructor(name: string, component?: 'BUNDLER' | 'DEPLOYER'); prepare(outputDirectory: string): Promise; writePackageJson(outputDirectory: string, dependencies: Map, resolutions?: Record): Promise; protected createBundler(inputOptions: InputOptions, outputOptions: Partial & { dir: string; }): Promise<{ write: () => Promise; close: () => Promise; }>; protected getUserBundlerOptions(mastraEntryFile: string, outputDirectory: string): Promise>; protected analyze(entry: string | string[], mastraFile: string, outputDirectory: string): Promise<{ projectType?: string | undefined; externalDependencies: Map; depsToOptimize: Map; workspaceRoot: string | undefined; outputDir: string; dependencies: Map; workspaceMap: Map; }>; protected pnpmNodeLinker?: 'hoisted'; protected getAdditionalEntries(): Record; protected installDependencies(outputDirectory: string, rootDir?: string, pnpmOverrides?: Record): Promise; /** * Generate a package-lock.json for the output directory so that deploy targets * can use `npm ci` instead of `npm install`, skipping version resolution entirely. * This is a lockfile-only operation — no packages are downloaded. * * Temporarily moves node_modules out of the way because pnpm's symlink-based * layout confuses npm's arborist, then restores it afterwards so that * `mastra start` (or wrangler) can still resolve dependencies at runtime. */ private generateNpmLockfile; protected copyPublic(mastraDir: string, outputDirectory: string): Promise; protected copyDOTNPMRC({ rootDir, outputDirectory, }: { rootDir?: string; outputDirectory: string; }): Promise; /** * Writes the `mastra-project.json` deployment marker for Software Factory * projects after public assets have been copied. Verifies that the Factory * SPA (`factory/index.html`) exists in the output before emitting the marker. */ protected writeFactoryMarker(outputDirectory: string): Promise; protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited>, toolsPaths: (string | string[])[], { enableSourcemap, enableMinify, enableEsmShim, externals }: BundlerOptions, additionalEntries: Record, toolProjectRoot: string): Promise; getAllToolPaths(mastraDir: string, toolsPaths?: (string | string[])[]): (string | string[])[]; listToolsInputOptions(toolsPaths: (string | string[])[], projectRoot?: string): Promise<{ [k: string]: string; }>; protected _bundle(serverFile: string, mastraEntryFile: string, { projectRoot, outputDirectory, enableEsmShim, }: { projectRoot: string; outputDirectory: string; enableEsmShim?: boolean; }, toolsPaths?: (string | string[])[], bundleLocation?: string): Promise; lint(_entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise; } //# sourceMappingURL=index.d.ts.map