/**
 * The kind of function.
 */
type FunctionKind = "Sync" | "Async" | "Callback";
interface FunctionQueryBase {
    kind: FunctionKind;
    index?: number | null;
    callbackIndex?: number;
}
/**
 * Describes which function to instrument.
 */
type FunctionQuery = (FunctionQueryBase & {
    className: string;
    methodName: string;
    isExportAlias?: boolean;
}) | (FunctionQueryBase & {
    className: string;
    privateMethodName: string;
    isExportAlias?: boolean;
}) | (FunctionQueryBase & {
    methodName: string;
}) | (FunctionQueryBase & {
    functionName: string;
    isExportAlias?: boolean;
}) | (FunctionQueryBase & {
    objectName: string;
    propertyName: string;
}) | FunctionQueryBase;
/**
 * Configuration for injecting instrumentation code.
 */
interface InstrumentationConfig {
    /**
     * The name of the diagnostics channel to publish to.
     */
    channelName: string;
    /**
     * The module matcher to identify the module and file to instrument.
     */
    module: ModuleMatcher;
    /**
     * The function query to identify the function to instrument.
     */
    functionQuery: FunctionQuery;
    /**
     * Optional raw esquery selector. When provided, this selector is used instead
     * of deriving one from functionQuery.
     */
    astQuery?: string;
}
/**
 * Describes the module and file path you would like to match.
 */
interface ModuleMatcher {
    /**
     * The name of the module you want to match.
     */
    name: string;
    /**
     * The semver range that you want to match.
     */
    versionRange: string;
    /**
     * The path of the file you want to match from the module root.
     */
    filePath: string;
}

interface LegacyBundlerPluginOptions {
    /**
     * Enable debug logging
     */
    debug?: boolean;
    /**
     * Additional instrumentation configs to apply
     */
    instrumentations?: InstrumentationConfig[];
    /**
     * Whether to bundle for browser environments.
     *
     * When true, uses 'dc-browser' for browser-compatible diagnostics_channel polyfill.
     * When false, uses Node.js built-in 'diagnostics_channel' and 'async_hooks'.
     * Defaults to true (assumes browser build).
     */
    browser?: boolean;
}

/**
 * Webpack loader for auto-instrumentation.
 *
 * This is a webpack loader (not a plugin) for compatibility with tools that only support loaders,
 * such as Next.js Turbopack.
 *
 * Usage in next.config.js / next.config.ts:
 * ```javascript
 * const nextConfig: NextConfig = {
 *   turbopack: {
 *     rules: {
 *       // Apply the loader to all JS/MJS/CJS files from node_modules.
 *       // condition: "foreign" restricts the rule to third-party packages only.
 *       "*.{js,mjs,cjs}": {
 *         condition: "foreign",
 *         loaders: [{ loader: require.resolve("braintrust/webpack-loader") }],
 *       },
 *     },
 *   },
 * };
 * ```
 */

/**
 * Webpack loader that instruments JavaScript code using code-transformer.
 *
 * Accepts the same options as the legacy webpack plugin.
 */
declare function codeTransformerLoader(this: any, code: string, inputSourceMap?: any): void;
declare namespace codeTransformerLoader {
    type Options = LegacyBundlerPluginOptions;
}

export { codeTransformerLoader as default };
