/**
 * @packageDocumentation
 *
 * The document contains all the configurations of the `@lynx-js/rspeedy` package.
 *
 * @example
 *
 * Use `lynx.config.ts` with {@link defineConfig} to get better TypeScript intellisense.
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   entry: './src/index.tsx',
 * })
 * ```
 */

import type { CompressOptions } from '@rsbuild/core';
import type { CreateRsbuildOptions } from '@rsbuild/core';
import type { DataUriLimit } from '@rsbuild/core';
import type { DistPathConfig } from '@rsbuild/core';
import type { InlineChunkConfig } from '@rsbuild/core';
import type { Linter } from '@rsdoctor/types';
import { logger } from '@rsbuild/core';
import type { PerformanceConfig } from '@rsbuild/core';
import type { Plugin } from '@rsdoctor/types';
import type { ProxyConfig } from '@rsbuild/core';
import type { RsbuildConfig } from '@rsbuild/core';
import type { RsbuildEntry } from '@rsbuild/core';
import type { RsbuildInstance } from '@rsbuild/core';
import { RsbuildPlugin } from '@rsbuild/core';
import { RsbuildPluginAPI } from '@rsbuild/core';
import type { RsbuildPlugins } from '@rsbuild/core';
import { version as rsbuildVersion } from '@rsbuild/core';
import { Rspack } from '@rsbuild/core';
import { rspack } from '@rsbuild/core';
import type { ServerConfig } from '@rsbuild/core';
import type { ToolsConfig } from '@rsbuild/core';
import type { WatchFiles } from '@rsbuild/core';

/**
 * {@inheritdoc Performance.buildCache}
 *
 * @beta
 */
export declare interface BuildCache {
    /**
     * Add additional cache digests, the previous build cache will be invalidated
     * when any value in the array changes.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * Add `process.env.SOME_ENV` to the cache digest.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     buildCache: {
     *       cacheDigest: [process.env.SOME_ENV],
     *     },
     *   },
     * })
     * ```
     */
    cacheDigest?: Array<string | undefined> | undefined;
    /**
     * The output directory of the cache files.
     *
     * @defaultValue 'node_modules/.cache'
     */
    cacheDirectory?: string | undefined;
    /**
     * An array of files containing build dependencies.
     * Rspack will use the hash of each of these files to invalidate the persistent cache.
     *
     * @defaultValue `['package.json', 'tsconfig.json' (or source.tsconfigPath), '.env', '.env.*', 'tailwindcss.config.*']`; when using the Rspeedy CLI with `performance.buildCache` enabled, the loaded `lynx.config.*` file is also added.
     *
     * @example
     *
     * Add `postcss.config.js` to the build dependencies.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     buildCache: {
     *       buildDependencies: ['postcss.config.js'],
     *     },
     *   },
     * })
     * ```
     */
    buildDependencies?: string[] | undefined;
}

/**
 * The name of the bundle files.
 *
 * It can be a string with placeholders (`[name]`, `[contenthash]`,
 * `[platform]`), or a function that returns a string based on the
 * {@link BundleFilenameContext}.
 *
 * @public
 */
export declare type BundleFilename = string | ((context: BundleFilenameContext) => string);

/**
 * The context passed to the {@link Filename.bundle} function.
 *
 * @public
 */
export declare interface BundleFilenameContext {
    /**
     * Whether the filename is being resolved for a lazy bundle (async chunk)
     * instead of the main bundle of an entry.
     *
     * This allows you to control the main bundle and the lazy bundles with a
     * single function, without needing a dedicated `lazyBundle` field.
     */
    lazyBundle: boolean;
    /**
     * The name of the entry.
     *
     * It is `undefined` for lazy bundles, since a lazy bundle name is resolved
     * per async chunk (use the `[name]` placeholder in the returned string
     * instead).
     */
    entryName?: string | undefined;
    /**
     * The environment (platform) name, e.g. `'lynx'` or `'web'`.
     */
    platform: string;
}

/**
 * {@inheritdoc Performance.chunkSplit}
 *
 * @deprecated Use the top-level {@link Config.splitChunks} option instead.
 *
 * @public
 */
export declare interface ChunkSplit {
    /**
     * The ChunkSplitting strategy.
     *
     * @defaultValue In Rsbuild's default chunk splitting behavior, the strategy is `'split-by-experience'`.
     *
     * @remarks
     *
     * - `split-by-experience`(Rsbuild default): an empirical splitting strategy, automatically splits some commonly used npm packages into chunks of moderate size.
     *
     * - `split-by-module`: split by NPM package granularity, each NPM package corresponds to a chunk.
     *
     * - `split-by-size`: automatically split according to module size.
     *
     * - `all-in-one`: bundle all codes into one chunk.
     *
     * - `single-vendor`: bundle all NPM packages into a single chunk.
     *
     * - `custom`: custom chunk splitting strategy.
     *
     * @example
     *
     * - Use `all-in-one` to put all modules in one chunk.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'all-in-one',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use `single-vendor` to put all third-party dependencies in one chunk. And source code in another chunk.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'single-vendor',
     *     },
     *   },
     * })
     * ```
     */
    strategy?: 'all-in-one' | 'split-by-module' | 'split-by-experience' | 'single-vendor' | undefined;
    /**
     * Custom Rspack chunk splitting config can be specified.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * - Split `@lynx-js/react` and `react-router` into chunk `lib-react`.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'split-by-experience',
     *       override: {
     *         cacheGroups: {
     *           react: {
     *             test: /node_modules[\\/](@lynx-js[\\/]react|react-router)[\\/]/,
     *             name: 'lib-react',
     *           },
     *         },
     *       },
     *     },
     *   },
     * })
     * ```
     */
    override?: Rspack.Configuration extends {
        optimization?: {
            splitChunks?: infer P;
        } | undefined;
    } ? P : never;
}

/**
 * {@inheritdoc Performance.chunkSplit}
 *
 * @deprecated Use the top-level {@link Config.splitChunks} option instead.
 *
 * @public
 */
export declare interface ChunkSplitBySize {
    /**
     * {@inheritdoc ChunkSplit.strategy}
     */
    strategy: 'split-by-size';
    /**
     * The minimum size of a chunk, unit in bytes.
     *
     * @defaultValue 10000
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'split-by-size',
     *       minSize: 20000,
     *     },
     *   },
     * })
     * ```
     */
    minSize?: number | undefined;
    /**
     * The maximum size of a chunk, unit in bytes.
     *
     * @defaultValue `Number.POSITIVE_INFINITY`
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'split-by-size',
     *       maxSize: 50000,
     *     },
     *   },
     * })
     * ```
     */
    maxSize?: number | undefined;
    /**
     * {@inheritdoc ChunkSplit.override}
     *
     * @defaultValue undefined
     */
    override?: Rspack.Configuration extends {
        optimization?: {
            splitChunks?: infer P;
        } | undefined;
    } ? P : never;
}

/**
 * {@inheritdoc Performance.chunkSplit}
 *
 * @deprecated Use the top-level {@link Config.splitChunks} option instead.
 *
 * @public
 */
export declare interface ChunkSplitCustom {
    /**
     * {@inheritdoc ChunkSplit.strategy}
     */
    strategy: 'custom';
    /**
     * {@inheritdoc ChunkSplit.override}
     *
     * @defaultValue undefined
     *
     * @example
     *
     * - Split `@lynx-js/react` and `react-router` into chunk `lib-react`.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     chunkSplit: {
     *       strategy: 'custom',
     *       splitChunks: {
     *         cacheGroups: {
     *           react: {
     *             test: /node_modules[\\/](@lynx-js[\\/]react|react-router)[\\/]/,
     *             name: 'lib-react',
     *           },
     *         },
     *       },
     *     },
     *   },
     * })
     * ```
     */
    splitChunks?: Rspack.Configuration extends {
        optimization?: {
            splitChunks?: infer P;
        } | undefined;
    } ? P : never;
}

/**
 * The `Config` is the configuration that `rspeedy` uses.
 *
 * @public
 */
export declare interface Config {
    /**
     * The {@link Dev} option is used to control the behavior related with development. Including: HMR, DevServer, etc.
     *
     * @defaultValue undefined
     */
    dev?: Dev | undefined;
    /**
     * The {@link Config.environments} option is used to set the output environment.
     *
     * @defaultValue When this option is unset, Rspeedy passes `{ lynx: {} }` to Rsbuild.
     *
     * @remarks
     *
     * Normally you don't need this if you are not using Lynx for Web.
     *
     * @example
     *
     * - Using different entries for Lynx and Web.
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   environments: {
     *     lynx: {},
     *     web: {
     *       source: { entry: { web: './src/index.web.jsx' } },
     *     },
     *   },
     *   source: {
     *     entry: './src/index.jsx',
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Building Web-only outputs.
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   environments: {
     *     web: {
     *       source: { entry: { web: './src/index.web.jsx' } },
     *     },
     *   },
     * })
     * ```
     */
    environments?: RsbuildConfig['environments'] | undefined;
    /**
     * Specify the build mode for Rsbuild and Rspack, as each mode has different default behavior and optimizations.
     *
     * @defaultValue Depends on `process.env.NODE_ENV`: `'production'` when `NODE_ENV` is `'production'`, `'development'` when `NODE_ENV` is `'development'`, and `'none'` otherwise. When using Rspeedy's CLI, `rspeedy dev` and `rspeedy preview` default to `'development'`, while `rspeedy build` defaults to `'production'`.
     *
     * @example
     *
     * If the value of `mode` is `'development'`:
     *
     * - Enable HMR and register the {@link https://rspack.rs/plugins/webpack/hot-module-replacement-plugin | HotModuleReplacementPlugin}.
     *
     * - Generate JavaScript and CSS source maps. In Lynx environments, all `.map` assets are removed before emit. See {@link Output.sourceMap} for details.
     *
     * - The `process.env.NODE_ENV` in the source code will be replaced with `'development'`.
     *
     * - The `import.meta.env.MODE` in the source code will be replaced with `'development'`.
     *
     * - The `import.meta.env.DEV` in the source code will be replaced with `true`.
     *
     * - The `import.meta.env.PROD` in the source code will be replaced with `false`.
     *
     * @example
     *
     * If the value of `mode` is `'production'`:
     *
     * - Enable JavaScript code minification and register the {@link https://rspack.rs/plugins/rspack/swc-js-minimizer-rspack-plugin | SwcJsMinimizerRspackPlugin}.
     *
     * - Generated JavaScript and CSS filenames will have hash suffixes, see {@link Output.filenameHash}.
     *
     * - Generated CSS Modules classnames will be shorter, see {@link CssModules.localIdentName}.
     *
     * - Generate JavaScript and CSS source maps. In Lynx environments, all `.map` assets are removed before emit. See {@link Output.sourceMap}.
     *
     * - The `process.env.NODE_ENV` in the source code will be replaced with `'production'`.
     *
     * - The `import.meta.env.MODE` in the source code will be replaced with `'production'`.
     *
     * - The `import.meta.env.DEV` in the source code will be replaced with `false`.
     *
     * - The `import.meta.env.PROD` in the source code will be replaced with `true`.
     */
    mode?: 'development' | 'production' | 'none' | undefined;
    /**
     * The {@link Output} option is used to set how and where should the bundles and assets output.
     *
     * @defaultValue undefined
     */
    output?: Output | undefined;
    /**
     * The {@link Performance} option is used to optimize the build-time and runtime performance.
     *
     * @defaultValue undefined
     */
    performance?: Performance | undefined;
    /**
     * The {@link Resolve} option is used to control the resolution behavior of Rspack.
     *
     * @defaultValue undefined
     */
    resolve?: Resolve | undefined;
    /**
     * The {@link Server} option changes the behavior of dev-server.
     *
     * @defaultValue undefined
     */
    server?: Server | undefined;
    /**
     * The {@link Source} option changes the behavior of source files.
     *
     * @defaultValue undefined
     */
    source?: Source | undefined;
    /**
     * Configure chunk splitting.
     *
     * @defaultValue Rspeedy defaults this to `false`; if configured, Rsbuild handles it with its top-level `splitChunks` option.
     *
     * See {@link https://rsbuild.rs/config/split-chunks | Rsbuild - splitChunks} for details.
     */
    splitChunks?: RsbuildConfig['splitChunks'] | undefined;
    /**
     * The {@link Tools} options changes the behavior of various building tools.
     *
     * @defaultValue undefined
     */
    tools?: Tools | undefined;
    /**
     * The `plugins` option is used to customize the build process in a variety of ways.
     *
     * @defaultValue undefined
     *
     * @remarks
     * Rspeedy uses the plugin APIs from {@link https://rsbuild.rs/plugins/dev/index | Rsbuild}. See the corresponding document for developing a plugin.
     */
    plugins?: RsbuildPlugins | undefined;
}

/**
 *  Parameters for the function exported from `lynx.config.js`.
 *
 * @public
 */
export declare interface ConfigParams {
    /**
     * The value of `process.env['NODE_ENV']`
     *
     * @defaultValue When `loadConfig` evaluates a config function, this value is `process.env.NODE_ENV ?? 'production'`
     *
     * @remarks
     * Common values include (non-exhaustive):
     * - `'production'`
     *
     * - `'development'`
     *
     * - `'test'`
     */
    env: 'production' | 'development' | 'test' | (string & Record<never, never>);
    /**
     * The CLI command of Rspeedy.
     *
     * @defaultValue When `loadConfig` evaluates a config function, this value is `process.argv[2] ?? 'build'`
     *
     * @remarks
     *
     * Possible values:
     *
     * - `'build'`
     *
     * - `'dev'`
     *
     * - `'inspect'`
     *
     * - `'preview'`
     */
    command: 'build' | 'dev' | 'inspect' | 'preview' | (string & Record<never, never>);
}

/**
 * The type of the console method.
 *
 * @public
 */
export declare type ConsoleType = 'log' | 'warn' | 'error' | 'info' | 'debug' | 'profile' | 'profileEnd' | (string & Record<never, never>);

/**
 * The `createRspeedy` method can let you create a Rspeedy instance and you can customize the build or development process in Node.js Runtime.
 *
 * @param options - {@link CreateRspeedyOptions}
 * @returns - Rspeedy instance.
 *
 * @example
 *
 * ```ts
 * import { createRspeedy } from '@lynx-js/rspeedy'
 *
 * void async function () {
 *   const rspeedy = await createRspeedy({})
 *   await rspeedy.build()
 * }()
 * ```
 *
 * @public
 */
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv, environment, callerName, }: CreateRspeedyOptions): Promise<RspeedyInstance>;

/**
 * The options of `createRspeedy` method.
 *
 * @public
 */
export declare interface CreateRspeedyOptions {
    /**
     * The root path of the current build.
     */
    cwd?: string;
    /**
     * The config of Rspeedy.
     */
    rspeedyConfig?: Config;
    /**
     * Rspeedy automatically loads the .env file by default, utilizing the [Rsbuild API](https://rsbuild.rs/api/javascript-api/core#load-env-variables).
     * You can use the environment variables defined in the .env file within your code by accessing them via `import.meta.env.FOO` or `process.env.Foo`.
     * @see https://rsbuild.rs/guide/advanced/env-vars#env-file
     * @defaultValue true
     */
    loadEnv?: CreateRsbuildOptions['loadEnv'];
    /**
     * Only build specified environments.
     * For example, passing `['lynx']` will only build the `lynx` environment.
     * If not specified or passing an empty array, all environments will be built.
     * @see https://rsbuild.rs/guide/advanced/environments#build-specified-environment
     * @defaultValue []
     */
    environment?: CreateRsbuildOptions['environment'];
    /**
     * The name of the framework or tool that is currently invoking Rsbuild.
     * This allows plugins to tailor their behavior based on the calling context.
     *
     * @example
     *
     * Rsbuild plugins can access this value via `api.context.callerName`.
     *
     * ```js
     * export function myPlugin() {
     *   return {
     *     name: 'my-plugin',
     *     setup(api) {
     *       // Log the name of the tool invoking Rsbuild
     *       console.log(`Called by: ${api.context.callerName}`);
     *
     *       // Conditionally apply plugin logic based on caller
     *       if (api.context.callerName === 'rspeedy') {
     *         api.modifyRsbuildConfig((config) => {
     *           // Apply rspeedy-specific config changes
     *           return config;
     *         });
     *       } else if (api.context.callerName === 'rslib') {
     *         api.modifyRsbuildConfig((config) => {
     *           // Apply rslib-specific config changes
     *           return config;
     *         });
     *       }
     *     }
     *   };
     * }
     * ```
     *
     * @defaultValue 'rspeedy'
     */
    callerName?: string;
}

/**
 * {@inheritdoc Tools.cssExtract}
 *
 * @public
 */
export declare interface CssExtract {
    /**
     * {@inheritdoc @lynx-js/css-extract-webpack-plugin#LoaderOptions}
     *
     * @defaultValue undefined
     */
    loaderOptions?: CssExtractRspackLoaderOptions | undefined;
    /**
     * {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions}
     *
     * @defaultValue undefined
     */
    pluginOptions?: CssExtractRspackPluginOptions | undefined;
}

/**
 * {@inheritdoc @lynx-js/css-extract-webpack-plugin#LoaderOptions}
 *
 * @public
 */
export declare interface CssExtractRspackLoaderOptions {
    /**
     * The same as {@link https://github.com/webpack-contrib/mini-css-extract-plugin#esModule}.
     * By default, `@lynx-js/css-extract-webpack-plugin` generates JS modules that use the ES modules syntax.
     * There are some cases in which using ES modules is beneficial,
     * like in the case of module concatenation and tree shaking.
     *
     * @example
     * You can enable a CommonJS syntax using:
     *
     * ```js
     * import {CssExtractRspackPlugin} from "@lynx-js/css-extract-webpack-plugin";
     * export default {
     *   plugins: [new CssExtractRspackPlugin()],
     *   module: {
     *     rules: [
     *       {
     *         test: /\.css$/i,
     *         use: [
     *           {
     *             loader: CssExtractRspackPlugin.loader,
     *             options: {
     *               esModule: false,
     *             },
     *           },
     *           "css-loader",
     *         ],
     *       },
     *     ],
     *   },
     * };
     * ```
     *
     * @public
     *
     * @defaultValue true
     */
    esModule?: boolean | undefined;
}

/**
 * {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions}
 *
 * @public
 */
export declare interface CssExtractRspackPluginOptions {
    /**
     * {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions.ignoreOrder}
     *
     * @defaultValue undefined
     */
    ignoreOrder?: boolean | undefined;
    /**
     * {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions.pathinfo}
     *
     * @defaultValue undefined
     */
    pathinfo?: boolean | undefined;
}

/**
 * {@inheritdoc Tools.cssLoader}
 *
 * @public
 */
export declare interface CssLoader {
    /**
     * The option `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@imported` resources and CSS modules imports.
     *
     * @defaultValue `1` when compiling CSS files and `2` when compiling Sass or Less files
     *
     * @remarks
     *
     * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#importloaders | css-loader#import-loaders} for details.
     */
    importLoaders?: 0 | 1 | 2 | undefined;
    /**
     * The {@link CssLoaderModules | cssLoader.modules} option enables/disables the CSS Modules specification and setup basic behavior.
     *
     * @defaultValue Enables CSS Modules with automatic `*.module.*` detection, camelCase exports, `namedExport: false`, and `localIdentName` inherited from `output.cssModules.localIdentName`.
     *
     * @example
     *
     * Using `false` value to increase performance because we avoid parsing CSS Modules features, it will be useful for developers who use vanilla css or use other technologies.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     cssLoader: {
     *       modules: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * Using `() => true` value to enable CSS Modules for all files.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     cssLoader: {
     *       modules: () => true,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * Using object value to enable CSS Modules based-on {@link CssLoaderModules.auto} option and setup more configurations about CSS Modules.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     cssLoader: {
     *       modules: {
     *         namedExport: true,
     *       },
     *     },
     *   },
     * })
     * ```
     */
    modules?: boolean | CssLoaderModules | undefined;
}

/**
 * {@inheritdoc CssLoader.modules}
 *
 * @public
 */
export declare interface CssLoaderModules {
    /**
     * {@inheritdoc CssModules.auto}
     *
     * @defaultValue true
     */
    auto?: boolean | RegExp | ((filename: string) => boolean) | undefined;
    /**
     * {@inheritdoc CssModules.exportLocalsConvention}
     *
     * @defaultValue `'camelCase'`
     */
    exportLocalsConvention?: CssModuleLocalsConvention | undefined;
    /**
     * {@inheritdoc CssModules.localIdentName}
     *
     * @defaultValue `'[local]-[hash:base64:6]'`
     */
    localIdentName?: string | undefined;
    /**
     * Enables/disables ES modules named export for locals.
     *
     * @defaultValue false
     *
     * @example
     *
     * - `style.css`
     *
     * ```css
     * .foo-baz {
     *   color: red;
     * }
     * .bar {
     *   color: blue;
     * }
     * .default {
     *   color: green;
     * }
     * ```
     *
     * - `index.js`
     *
     * ```js
     * import * as styles from "./styles.css";
     *
     * // If using `exportLocalsConvention: "as-is"` (default value):
     * console.log(styles["foo-baz"], styles.bar);
     *
     * // If using `exportLocalsConvention: "camel-case-only"`:
     * console.log(styles.fooBaz, styles.bar);
     *
     * // For the `default` class name
     * console.log(styles["_default"]);
     * ```
     */
    namedExport?: boolean | undefined;
}

/**
 * {@inheritdoc CssModules.exportLocalsConvention}
 *
 * @public
 */
export declare type CssModuleLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';

/**
 * {@inheritdoc Output.cssModules}
 *
 * @public
 */
export declare interface CssModules {
    /**
     * The `auto` option allows CSS modules to be automatically enabled based on their filenames.
     *
     * @defaultValue true
     *
     * @remarks
     *
     * Given the various `auto` values, the behavior is described as follows:
     *
     * - `true`: enable CSS modules for all files matching `/\.module\.\w+$/i.test(filename)` RegExp.
     *
     * - `false`: disable CSS modules.
     *
     * - `RegExp`: enable CSS modules for all files matching the `auto.test(filename)` RegExp.
     *
     * - `function`: enable CSS modules based on the filter function.
     *
     * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#auto | css-loader#auto} for details.
     *
     * @example
     *
     * Enable CSS module for `*.module.css` and `shared/*.css`:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cssModules: {
     *       auto: (filename) => {
     *         return filename.includes('.module.') || filename.includes('shared/')
     *       },
     *     },
     *   },
     * })
     * ```
     */
    auto?: boolean | RegExp | ((filename: string) => boolean) | undefined;
    /**
     * Allows exporting names from global class names, so you can use them via import.
     *
     * @defaultValue false
     *
     * @remarks
     *
     * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#exportglobals | css-loader#exportGlobals} for details.
     */
    exportGlobals?: boolean | undefined;
    /**
     * The style of exported class names.
     *
     * @defaultValue `'camelCase'`
     *
     * @remarks
     *
     * Given the various `exportLocalsConvention` values, the behavior is described as follows:
     *
     * - `'asIs'`:	Class names will be exported as is.
     *
     * - `'camelCase'`: Class names will be camelized, the original class name will not to be removed from the locals
     *
     * - `'camelCaseOnly'`: Class names will be camelized, the original class name will be removed from the locals
     *
     * - `'dashes'`: Only dashes in class names will be camelized
     *
     * - `'dashesOnly'`: Dashes in class names will be camelized, the original class name will be removed from the locals
     *
     * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#exportlocalsconvention | css-loader#exportLocalsConvention} for details.
     */
    exportLocalsConvention?: CssModuleLocalsConvention | undefined;
    /**
     * Sets the format of the className generated by CSS Modules after compilation.
     *
     * @defaultValue `'[local]-[hash:base64:6]'`
     *
     * @remarks
     *
     * Available placeholders:
     *
     * - `[local]`: Original class name
     *
     * - `[hash]`: Hash of the class name
     *
     * - `[path]`: File path
     *
     * - `[name]`: File name
     *
     * - `[ext]`: File extension
     *
     * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#localIdentName | css-loader#localIdentName} for details.
     *
     * @example
     *
     * Use only hash for shorter class names:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cssModules: {
     *       localIdentName: '[hash:base64:8]',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * Include file name for debugging:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cssModules: {
     *       localIdentName: '[name]__[local]--[hash:base64:5]',
     *     },
     *   },
     * })
     * ```
     */
    localIdentName?: string | undefined;
}

/**
 * {@inheritdoc Source.decorators}
 *
 * @public
 */
export declare interface Decorators {
    /**
     * Specify the decorator syntax version to be used.
     *
     * @defaultValue `'2022-03'`
     *
     * @remarks
     *
     * If you want to know the differences between different decorators versions, you can refer to: {@link https://github.com/tc39/proposal-decorators?tab=readme-ov-file#how-does-this-proposal-compare-to-other-versions-of-decorators | How does this proposal compare to other versions of decorators?}
     *
     * @example
     *
     * `'2022-03'` corresponds to the Stage 3 decorator proposal, equivalent to the decorator syntax supported by TypeScript 5.0 by default.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   source: {
     *     decorators: { version: '2022-03' },
     *   },
     * })
     * ```
     *
     * @example
     *
     * `'legacy'` corresponds to TypeScript's `experimentalDecorators: true`.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   source: {
     *     decorators: { version: 'legacy' },
     *   },
     * })
     * ```
     */
    version?: 'legacy' | '2022-03';
}

/**
 * The `defineConfig` method is a helper function used to get TypeScript intellisense.
 *
 * @param config - The config of Rspeedy.
 * @returns - The identical config as the input config.
 *
 * @example
 *
 * Use `defineConfig` in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   // autocompletion works here!
 * })
 * ```
 *
 * @public
 */
export declare function defineConfig(config: Config): Config;

/**
 * The `defineConfig` method is a helper function used to get TypeScript intellisense.
 *
 * @param config - The function that returns a config of Rspeedy.
 * @returns - The identical function as the input.
 *
 * @example
 *
 * Use `defineConfig` in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig(() => {
 *   return {
 *     // autocompletion works here!
 *   }
 * })
 * ```
 *
 * @example
 *
 * Use `defineConfig` with parameters in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 *
 * export default defineConfig(({ env }) => {
 *   const isTest = env === 'test'
 *   return {
 *     output: {
 *       minify: isTest ? false : true,
 *     },
 *   }
 * })
 * ```
 *
 * @public
 */
export declare function defineConfig(config: (params: ConfigParams) => Config): (params: ConfigParams) => Config;

/**
 * The `defineConfig` method is a helper function used to get TypeScript intellisense.
 *
 * @param config - The promise that resolves to a config of Rspeedy.
 * @returns - The identical promise as the input.
 *
 * @example
 *
 * Use `defineConfig` in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 *
 * export default defineConfig(
 *   import('@lynx-js/react-rsbuild-plugin').then(({ pluginReactLynx }) => ({
 *     plugins: [pluginReactLynx()],
 *   })),
 * );
 * ```
 *
 * @public
 */
export declare function defineConfig(config: Promise<Config>): Promise<Config>;

/**
 * The `defineConfig` method is a helper function used to get TypeScript intellisense.
 *
 * @param config - The function that returns a promise that resolves to a config of Rspeedy.
 * @returns - The identical function as the input.
 *
 * @example
 *
 * Use `defineConfig` in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig(async () => {
 *   const foo = await bar()
 *   return {
 *     // autocompletion works here!
 *   }
 * })
 * ```
 *
 * @example
 *
 * Use `defineConfig` with parameters in `lynx.config.ts`:
 *
 * ```ts
 * import { defineConfig } from '@lynx-js/rspeedy'
 *
 * export default defineConfig(async ({ env }) => {
 *   const foo = await bar()
 *   const isTest = env === 'test'
 *   return {
 *     output: {
 *       minify: isTest ? false : true,
 *     },
 *   }
 * })
 * ```
 *
 * @public
 */
export declare function defineConfig(config: (params: ConfigParams) => Promise<Config>): (params: ConfigParams) => Promise<Config>;

/**
 * {@inheritdoc Config.dev}
 * @public
 */
export declare interface Dev {
    /**
     * The {@link Dev.assetPrefix} is used to set the URL prefix for static assets during development.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * During `rspeedy dev`, if this option is not set to `false`, the dev plugin normalizes it to `http://<detected-host>:<port>/` and appends `server.base` when configured.
     *
     * The functionality of {@link Dev.assetPrefix} is basically the same as the {@link https://rspack.rs/config/output#outputpublicpath | output.publicPath}
     * config in Rspack. With the following differences:
     *
     * - `dev.assetPrefix` only takes effect during development.
     *
     * - `dev.assetPrefix` automatically appends a trailing `/` by default.
     *
     * - The value of `dev.assetPrefix` is written to the `process.env.ASSET_PREFIX` environment variable.
     *
     * @example
     *
     * If `dev.assetPrefix` is set to true, the URL prefix will be `http://<host>:<port>/`:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   dev: {
     *     assetPrefix: true,
     *   },
     * })
     * ```
     *
     * @example
     *
     * If `dev.assetPrefix` is set to a string, the value will be used as a prefix and automatically appended to the static resource URL.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   dev: {
     *     assetPrefix: 'https://example.com/assets/',
     *   },
     * })
     * ```
     *
     * @example
     *
     * The port number that Rspeedy server listens on may change. For example, if the port is in use, Rspeedy will automatically increment the port number until it finds an available port.
     *
     * To avoid `dev.assetPrefix` becoming invalid due to port changes, you can use one of the following methods:
     *
     * - Enable `server.strictPort`.
     *
     * - Use the `<port>` placeholder to refer to the current port number. Rspeedy will replace the placeholder with the actual port number it is listening on.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   dev: {
     *     assetPrefix: 'https://example.com:<port>/assets/',
     *   },
     * })
     * ```
     */
    assetPrefix?: string | boolean | undefined;
    /**
     * Configuration of the development client.
     *
     * @defaultValue undefined
     */
    client?: DevClient | undefined;
    /**
     * Whether to enable Hot Module Replacement (HMR).
     *
     * @defaultValue true
     *
     * @remarks
     *
     * By default, Rspeedy uses HMR as the preferred method to update modules. If HMR is disabled or cannot be used in certain scenarios, it will automatically fallback to {@link Dev.liveReload}.
     *
     * To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.
     *
     * @example
     *
     * Disable HMR:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     hmr: false,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Disable both HMR and live reload:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     hmr: false,
     *     liveReload: false,
     *   },
     * })
     * ```
     */
    hmr?: boolean | undefined;
    /**
     * Whether to enable live reload functionality.
     *
     * @defaultValue true
     *
     * Live reload is used as a fallback when {@link Dev.hmr} is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.
     *
     * To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.
     *
     * @example
     *
     * Disable live reload:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     liveReload: false,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Disable both HMR and live reload:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     hmr: false,
     *     liveReload: false,
     *   },
     * })
     * ```
     */
    liveReload?: boolean | undefined;
    /**
     * Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * - Specify the files and directories watched for changes.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     watchFiles: {
     *       paths: ['src/**', 'public/**'],
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use {@link https://github.com/paulmillr/chokidar#api | chokidar} options for watching.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     watchFiles: {
     *       paths: ['src/**', 'public/**'],
     *       options: { usePolling: false },
     *     },
     *   },
     * })
     * ```
     */
    watchFiles?: WatchFiles | WatchFiles[] | undefined;
    /**
     * Used to control whether the build artifacts of the development environment are written to the disk.
     *
     * @defaultValue true
     *
     * @remarks
     *
     * This is bypassed to {@link https://github.com/webpack/webpack-dev-middleware?tab=readme-ov-file#writetodisk | `webpack-dev-middleware`}.
     *
     * Setting `writeToDisk: true` won't change the behavior of the `webpack-dev-middleware`, and bundle files accessed through the browser will still be served from memory.
     *
     * This option also accepts a `Function` value, which can be used to filter which files are written to disk.
     *
     * The function follows the same premise as `Array#filter` in which a return value of `false` will not write the file, and a return value of `true` will write the file to disk.
     *
     * @example
     * ```js
     * // lynx.config.ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   dev: {
     *     writeToDisk: (filePath) => /superman\.css$/.test(filePath),
     *   },
     * })
     * ```
     */
    writeToDisk?: boolean | ((filename: string) => boolean) | undefined;
    /**
     * Whether to display progress bar during compilation.
     *
     * @defaultValue true
     *
     * @example
     *
     * Disable the progress bar.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     progressBar: false,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Modify the progress bar `id`
     *
     * To modify the text displayed on the left side of the progress bar, set the `id` option:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   dev: {
     *     progressBar: {
     *       id: 'Some Text'
     *     },
     *   },
     * })
     * ```
     */
    progressBar?: boolean | {
        id?: string;
    } | undefined;
}

/**
 * {@inheritdoc Dev.client}
 *
 * @public
 */
export declare interface DevClient {
    /**
     * The path to websocket.
     *
     * @defaultValue `require.resolve('@lynx-js/websocket')`
     */
    websocketTransport?: string | undefined;
}

/**
 * {@inheritdoc Output.distPath}
 *
 * @public
 */
export declare interface DistPath extends DistPathConfig {
    /**
     * The output directory of the intermediate files.
     *
     * @deprecated
     *
     * This option is never read and will be removed in the future version.
     *
     * @defaultValue `'.rspeedy'`
     */
    intermediate?: string | undefined;
}

/**
 * {@inheritdoc Source.entry}
 *
 * @example
 *
 * - Use a single entry:
 *
 * ```js
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   source: {
 *     entry: './src/pages/main/index.js',
 *   }
 * })
 * ```
 *
 * @example
 *
 * - Use a single entry with multiple entry modules:
 *
 * ```js
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   source: {
 *     entry: ['./src/prefetch.js', './src/pages/main/index.js'],
 *   }
 * })
 * ```
 *
 * @example
 *
 * - Use multiple entries(with multiple entry modules):
 *
 * ```js
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   source: {
 *     entry: {
 *       foo: './src/pages/foo/index.js',
 *       bar: ['./src/pages/bar/index.js', './src/post.js'], // multiple entry modules is allowed
 *     }
 *   }
 * })
 * ```
 *
 * @example
 *
 * - Use multiple entries with {@link EntryDescription}:
 *
 * ```js
 * import { defineConfig } from '@lynx-js/rspeedy'
 * export default defineConfig({
 *   source: {
 *     entry: {
 *       foo: './src/pages/foo/index.js',
 *       bar: {
 *         import: ['./src/prefetch.js', './src/pages/bar'],
 *       }
 *     }
 *   }
 * })
 * ```
 * @public
 */
export declare type Entry = string | string[] | Record<string, string | string[] | EntryDescription>;

/**
 * The `EntryDescription` describes a entry. It is useful when the project has multiple entries with different configuration.
 *
 * @remarks
 * It is similar with the {@link https://rspack.rs/config/entry#entry-description-object | Entry Description Object} of Rspack.
 * But only a few properties that Lynx supports is allowed.
 *
 * @public
 */
export declare interface EntryDescription {
    /**
     * The path to the entry module(s).
     *
     * @defaultValue `'./src/index.js'`
     */
    import?: string | string[] | undefined;
    /**
     * This is an important option when using on-demand-loading or loading external resources like images, files, etc. If an incorrect value is specified you'll receive 404 errors while loading these resources.
     *
     * @defaultValue undefined
     *
     * @see https://webpack.js.org/configuration/output/#outputpublicpath
     */
    publicPath?: string | undefined;
}

/**
 * The exposed API of Rspeedy. Can be used in Rsbuild plugin with {@link https://rsbuild.rs/plugins/dev/core#apiuseexposed | api.useExposed}.
 *
 * @public
 *
 * @example
 *
 * ```ts
 * import type { ExposedAPI } from '@lynx-js/rspeedy'
 * const RsbuildPlugin = {
 *   name: 'my-rsbuild-plugin',
 *   pre: ['lynx:rsbuild:plugin-api'],
 *   setup(api) {
 *     const rspeedyAPI = api.useExposed<ExposedAPI>(Symbol.for('rspeedy.api'))
 *   },
 * }
 * ```
 */
export declare interface ExposedAPI {
    /**
     * The user config.
     */
    config: Config;
    /**
     * Print debug logs.
     *
     * @param message - The printed message.
     */
    debug: (message: string | (() => string)) => void;
    /**
     * Exit the process.
     *
     * @param code - The exit code.
     */
    exit: (code?: number) => Promise<void> | void;
    /**
     * Get the Rspeedy logger.
     */
    logger: typeof logger;
    /**
     * The version of Rspeedy.
     */
    version: string;
    /**
     * Used for plugin qrcode get entry points from self-defined environments rather than default lynx environment.
     */
    entries?: RsbuildEntry;
}

/**
 * {@inheritdoc Output.filename}
 *
 * @public
 */
export declare interface Filename {
    /**
     * The name of the bundle files.
     *
     * @defaultValue `'[name].[platform].bundle'`
     *
     * @remarks
     *
     * The following placeholder is supported:
     *
     * - `[name]`: the name of the entry.
     * - `[contenthash]`: the contenthash of the bundle.
     * - `[platform]`: the environment name of the bundle.
     *
     * @example
     *
     * - Using content hash in bundle filename:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       bundle: '[name].[contenthash].bundle',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Using content hash with length in bundle filename:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       bundle: '[name].[contenthash:8].bundle',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Using a function to control the main bundle and the lazy bundles
     *   separately (e.g. emit lazy bundles into another directory with a git
     *   commit hash appended):
     *
     * ```js
     * import { execSync } from 'node:child_process'
     *
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * const gitHash = execSync('git rev-parse --short HEAD').toString().trim()
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       bundle: ({ lazyBundle, platform }) =>
     *         lazyBundle
     *           ? `my-lazy-bundles/[name].[fullhash]-${gitHash}.bundle`
     *           : `[name].${platform}.bundle`,
     *     },
     *   },
     * })
     * ```
     */
    bundle?: BundleFilename | undefined;
    /**
     * The name of the template files.
     *
     * @deprecated
     *
     * Use {@link Filename.bundle} instead.
     *
     * @defaultValue `'[name].[platform].bundle'`
     *
     * @remarks
     *
     * The following placeholder is supported:
     *
     * - `[name]`: the name of the entry.
     * - `[contenthash]`: the contenthash of the template.
     *
     * @example
     *
     * - Using content hash in bundle filename:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       template: '[name].[contenthash].bundle',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Using content hash with length in bundle filename:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       template: '[name].[contenthash:8].bundle',
     *     },
     *   },
     * })
     * ```
     */
    template?: string | undefined;
    /**
     * The name of the JavaScript files.
     *
     * @defaultValue `'[name].js'` in development, `'[name].[contenthash:8].js'` in production web builds, and `'[name].js'` in production node builds
     *
     * @example
     *
     * - Using a function to dynamically set the filename based on the file information:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       js: (pathData, assetInfo) => {
     *         console.log(pathData); // You can check the contents of pathData here
     *
     *         if (pathData.chunk?.name === 'index') {
     *           return isProd ? '[name].[contenthash:8].js' : '[name].js';
     *         }
     *         return '/some-path/[name].js';
     *       },
     *     },
     *   },
     * })
     * ```
     */
    js?: Rspack.Filename | undefined;
    /**
     * The name of the CSS files.
     *
     * @defaultValue `'[name]/[name].css'`
     *
     * @example
     *
     * - Using a function to dynamically set the filename based on the file information:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filename: {
     *       css: (pathData, assetInfo) => {
     *         console.log(pathData); // You can check the contents of pathData here
     *
     *         if (pathData.chunk?.name === 'index') {
     *           return isProd ? '[name].[contenthash:8].css' : '[name].css';
     *         }
     *         return '/some-path/[name].css';
     *       },
     *     },
     *   },
     * })
     * ```
     */
    css?: Rspack.CssFilename | undefined;
    /**
     * The name of the SVG images.
     *
     * @defaultValue `'[name].[contenthash:8].svg'`
     */
    svg?: Rspack.AssetModuleFilename | undefined;
    /**
     * The name of the font files.
     *
     * @defaultValue `'[name].[contenthash:8][ext]'`
     */
    font?: Rspack.AssetModuleFilename | undefined;
    /**
     * The name of non-SVG images.
     *
     * @defaultValue `'[name].[contenthash:8][ext]'`
     */
    image?: Rspack.AssetModuleFilename | undefined;
    /**
     * The name of media assets, such as video.
     *
     * @defaultValue `'[name].[contenthash:8][ext]'`
     */
    media?: Rspack.AssetModuleFilename | undefined;
    /**
     * The name of WebAssembly files.
     *
     * @defaultValue `'[contenthash:8].module.wasm'`
     */
    wasm?: Rspack.WebassemblyModuleFilename;
    /**
     * The name of other assets, except for above (image, svg, font, html, wasm...)
     *
     * @defaultValue `'[name].[contenthash:8][ext]'`
     */
    assets?: Rspack.AssetModuleFilename;
}

/**
 * Load the build config by the config path.
 *
 * @param loadConfigOptions - the options of `loadConfig` method.
 * @returns Build config.
 *
 * @example
 *
 * ```ts
 * import { loadConfig } from '@lynx-js/rspeedy'
 *
 * void async function () {
 *   const config = await loadConfig({ configPath: './lynx.config.js' })
 *   console.log(config);
 * }()
 * ```
 *
 * @public
 */
export declare function loadConfig(loadConfigOptions: LoadConfigOptions): Promise<LoadConfigResult>;

/**
 * The options of loadConfig.
 *
 * @public
 */
export declare interface LoadConfigOptions {
    /**
     * The config file path to load.
     *
     * @defaultValue Automatically resolves `lynx.config.ts`, `lynx.config.js`, `lynx.config.mts`, or `lynx.config.mjs` from `cwd`
     */
    configPath?: string | undefined;
    /**
     * The working directory used to resolve the config path.
     *
     * @defaultValue `process.cwd()`
     */
    cwd?: string | undefined;
}

/**
 * The result of {@link loadConfig}.
 *
 * @public
 */
export declare interface LoadConfigResult {
    /**
     * The configuration object that exported from the configuration file.
     *
     * @remarks
     *
     * The returned object has already been validated.
     */
    content: Config;
    /**
     * The configuration path that has been loaded.
     */
    configPath: string;
}

export { logger }

/**
 * Merge multiple Rspeedy configuration objects.
 *
 * @param configs - The Rspeedy configuration objects to merge.
 *
 * @returns The merged Rspeedy configuration object.
 *
 * @example
 *
 * ```ts
 * import { mergeRspeedyConfig } from '@lynx-js/rspeedy';
 *
 * const config1 = {
 *   dev: {
 *     writeToDisk: false,
 *   },
 * };
 * const config2 = {
 *   dev: {
 *     writeToDisk: true,
 *   },
 * };
 *
 * const mergedConfig = mergeRspeedyConfig(config1, config2);
 *
 * console.log(mergedConfig); // { dev: { writeToDisk: true } }
 * ```
 *
 * @remarks
 *
 * This is actually an alias of {@link https://rsbuild.rs/api/javascript-api/core#mergersbuildconfig | mergeRsbuildConfig}.
 *
 * @public
 */
export declare function mergeRspeedyConfig(...configs: Config[]): Config;

/**
 * {@inheritdoc Output.minify}
 *
 * @public
 */
export declare interface Minify {
    /**
     * Whether enable the CSS minification.
     *
     * @defaultValue When `output.minify` is enabled and `css` is unset, this defaults to `true`.
     *
     * @remarks
     *
     * When building for production, {@link https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer | @rsbuild/plugin-css-minimizer} is used to minify CSS assets for better transmission efficiency.
     *
     * @example
     *
     * - Disable the CSS minification.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     minify: {
     *       css: false,
     *     },
     *   },
     * })
     * ```
     */
    css?: boolean | undefined;
    /**
     * Whether enable the JavaScript minification.
     *
     * @defaultValue When `output.minify` is enabled and `js` is unset, this defaults to `true`.
     *
     * @example
     *
     * - Disable the JavaScript minification.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     minify: {
     *       js: false,
     *     },
     *   },
     * })
     * ```
     */
    js?: boolean | undefined;
    /**
     * {@link Minify.jsOptions} is used to configure SWC minification options.
     *
     * @defaultValue When JavaScript minification is enabled and `jsOptions` is unset, this defaults to `{}`.
     *
     * @remarks
     *
     * For detailed configurations, please refer to {@link https://rspack.rs/plugins/rspack/swc-js-minimizer-rspack-plugin | SwcJsMinimizerRspackPlugin}.
     *
     * @example
     *
     * - Disable the mangle feature.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     minify: {
     *       jsOptions: {
     *         minimizerOptions: {
     *           mangle: false,
     *         },
     *       },
     *     },
     *   },
     * })
     * ```
     */
    jsOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
    /**
     * {@link Minify.mainThreadOptions} is used to override
     * {@link Minify.jsOptions} for main-thread bundles.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * This option is deep-merged into {@link Minify.jsOptions}.
     * It is mainly used together with ReactLynx dual-thread outputs so that
     * main-thread and background-thread bundles can use different compress rules.
     *
     * @example
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     minify: {
     *       jsOptions: {
     *         minimizerOptions: {
     *           compress: {
     *             pure_funcs: ['console.log'],
     *           },
     *         },
     *       },
     *       mainThreadOptions: {
     *         minimizerOptions: {
     *           compress: {
     *             pure_funcs: ['NativeModules.call', 'lynx.getJSModule'],
     *           },
     *         },
     *       },
     *     },
     *   },
     * })
     * ```
     */
    mainThreadOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
    /**
     * {@link Minify.backgroundOptions} is used to override
     * {@link Minify.jsOptions} for background-thread bundles.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * This option is deep-merged into {@link Minify.jsOptions}.
     * It is mainly used together with ReactLynx dual-thread outputs so that
     * main-thread and background-thread bundles can use different compress rules.
     */
    backgroundOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
}

/**
 * {@inheritdoc Config.output}
 * @public
 */
export declare interface Output {
    /**
     * The {@link Output.assetPrefix} is used to set the URL prefix for static assets.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * The functionality of {@link Output.assetPrefix} is basically the same as the {@link https://rspack.rs/config/output#outputpublicpath | output.publicPath}
     * config in Rspack. With the following differences:
     *
     * - `output.assetPrefix` only takes effect in the production build.
     *
     * - `output.assetPrefix` automatically appends a trailing `/` by default.
     *
     * - The value of `output.assetPrefix` is written to the `process.env.ASSET_PREFIX` environment variable.
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     assetPrefix: 'https://cdn.example.com/assets/',
     *   },
     * })
     * ```
     */
    assetPrefix?: string | undefined;
    /**
     * The {@link Output.cleanDistPath} option determines whether all files in the output directory (default: `dist`) are removed before the build starts.
     *
     * @remarks
     *
     * By default, if the output directory is a subdirectory of the project root path, Rspeedy will automatically clean all files in the build directory.
     *
     * When {@link https://rsbuild.rs/config/output/dist-path#root-directory | output.distPath.root} is an external directory or the same as the project root directory, `cleanDistPath` is not enabled by default to prevent accidental deletion of files from other directories.
     *
     * @defaultValue Automatically enabled when `output.distPath.root` is a subdirectory of the project root; otherwise disabled.
     *
     * @example
     *
     * - Disable cleaning files:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cleanDistPath: false,
     *   },
     * })
     * ```
     * @example
     *
     * - Only clean files before the production build:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cleanDistPath: process.env.NODE_ENV === 'production',
     *   },
     * })
     * ```
     */
    cleanDistPath?: boolean | undefined;
    /**
     * The {@link Output.copy} option is used for copying files to the dist directory.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * For more options, see {@link https://rspack.rs/plugins/rspack/copy-rspack-plugin | Rspack.CopyRspackPlugin}.
     *
     * @example
     *
     * - Copy files from `./src/assets` to the `./dist` directory:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     copy: [
     *       // `./src/assets/image.png` -> `./dist/image.png`
     *       { from: './src/assets' },
     *     ],
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Copy files from ./src/assets to the ./dist/assets directory:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     copy: [
     *       // `./src/assets/image.png` -> `./dist/assets/image.png`
     *       { from: './src/assets', to: 'assets' },
     *     ],
     *   },
     * })
     * ```
     */
    copy?: Rspack.CopyRspackPluginOptions | Rspack.CopyRspackPluginOptions['patterns'] | undefined;
    /**
     * The {@link CssModules} option is used for the customization of CSS Modules configurations.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * The CSS module is enabled for `*.module.css`, `*.module.scss` and `*.module.less`.
     * Use {@link CssModules.auto} to customize the filtering behavior.
     *
     * @example
     *
     * Disable CSS modules:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cssModules: {
     *       auto: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * Enable CSS modules for all CSS files:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     cssModules: {
     *       auto: () => true,
     *     },
     *   },
     * })
     * ```
     */
    cssModules?: CssModules | undefined;
    /**
     * The {@link Output.dataUriLimit} option is used to set the size threshold to inline static assets such as images and fonts.
     *
     * @defaultValue 2048
     *
     * @example
     *
     * Inline all static assets less than 4kB:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     dataUriLimit: 4 * 1024,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Disable inlining of static assets:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     dataUriLimit: 0,
     *   },
     * })
     * ```
     * @example
     *
     * Inline all static assets:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     dataUriLimit: Number.MAX_SAFE_INTEGER,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Disable inlining of all media but not images.
     *
     * ```ts title="lynx.config.ts"
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     dataUriLimit: {
     *       image: 5000,
     *       media: 0,
     *     },
     *   },
     * })
     * ```
     */
    dataUriLimit?: number | DataUriLimit | undefined;
    /**
     * Set the directory of the dist files.
     *
     * @defaultValue Uses Rsbuild's default distPath configuration with `root: 'dist'`.
     *
     * @remarks
     *
     * More options can be found at {@link https://rsbuild.rs/config/output/dist-path | Rsbuild - distPath}.
     *
     * @example
     *
     * Use `output` instead of `dist`(the default value):
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     distPath: {
     *       root: './output',
     *     },
     *   },
     * })
     * ```
     */
    distPath?: DistPath | undefined;
    /**
     * The {@link Filename} determines the name of the JavaScript bundle file to be output. These bundles will be written to the directory specified by output.path.
     *
     * @defaultValue `{ bundle: '[name].[platform].bundle', template: '[name].[platform].bundle' }`
     *
     * @remarks
     *
     * If a string is provided, it will be used as {@link Filename.bundle}.
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     filename: '[name]/[name].lynx.bundle',
     *   },
     * })
     * ```
     */
    filename?: string | Filename | undefined;
    /**
     * The {@link Output.filenameHash} option controls whether to add a hash value to the filename after the production build.
     *
     * @defaultValue In production web builds, Rsbuild defaults this option to `true`; development builds and non-web outputs omit hashes by default.
     *
     * @remarks
     *
     * {@link Output.filename} has a higher priority than {@link Output.filenameHash}.
     *
     * @example
     *
     * - Disable hash
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filenameHash: false,
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Change hash format
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     filenameHash: 'fullhash:16',
     *   },
     * })
     * ```
     *
     * The available hash formats are:
     *
     * - `fullhash`: The hash value of the entire compilation. If any file changes, the hash values of all output files in the entire project will change.
     *
     * - `chunkhash`: The hash value of the chunk. The hash value will only change when the content of the chunk (and its included modules) changes.
     *
     * - `contenthash`: The hash value of the file content. The hash value will only change when the content of the file itself changes.
     */
    filenameHash?: boolean | string | undefined;
    /**
     * The {@link Output.inlineScripts} option controls whether to inline scripts into Lynx bundle (`.lynx.bundle`).
     *
     * @defaultValue Rspeedy defaults this to `true` and only switches it to `false` when the user explicitly enables the top-level `splitChunks` option.
     *
     * @remarks
     *
     * This is different with {@link https://rsbuild.rs/config/output/inline-scripts | output.inlineScripts } since we normally want to inline scripts in Lynx bundle (`.lynx.bundle`).
     *
     * There are two points that need to be especially noted:
     *
     * 1. Only background thread scripts can remain non-inlined, whereas the main thread script is always inlined.
     *
     * 2. Currently, when `experimental_isLazyBundle` is enabled, `inlineScripts` will always be `true`.
     *
     * @example
     *
     * Disable inlining background thread scripts.
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     inlineScripts: false,
     *   },
     * })
     * ```
     */
    inlineScripts?: InlineChunkConfig | undefined;
    /**
     * The {@link Output.legalComments} controls how to handle the legal comment.
     *
     * @defaultValue `'none'`
     *
     * @remarks
     *
     * This is different with Rsbuild since we normally do not want a `.LEGAL.txt` file in Lynx outputs.
     *
     * This behavior can be configured by using one of the following options:
     *
     * - `linked`: Extract all legal comments to a `.LEGAL.txt` file and link to them with a comment.
     *
     * - `inline`: Preserve all legal comments in original position.
     *
     * - `none`: Remove all legal comments.
     */
    legalComments?: 'none' | 'inline' | 'linked' | undefined;
    /**
     * The {@link Minify} configures whether to enable code minification in the production build, or to configure minimizer options.
     *
     * @defaultValue `true` in production builds and `false` otherwise
     *
     * @example
     *
     * Disable minification.
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   output: {
     *     minify: false,
     *   },
     * })
     * ```
     */
    minify?: Minify | boolean | undefined;
    /**
     * The {@link SourceMap} configures whether and how to generate source-map for outputs.
     *
     * @defaultValue When this option is unset in Lynx builds, JavaScript source maps use `'cheap-module-source-map'` in development and `'source-map'` in production; CSS source maps are also generated. All `.map` assets are removed before emit.
     */
    sourceMap?: boolean | SourceMap | undefined;
}

/**
 * {@inheritdoc Config.performance}
 *
 * @public
 */
export declare interface Performance {
    /**
     * Enable or configure persistent build cache.
     *
     * @defaultValue false
     *
     * @beta This feature is experimental and may be changed in the future.
     *
     * @example
     *
     * Enable persistent build cache.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     buildCache: true,
     *   },
     * })
     * ```
     *
     * @example
     *
     * Customize build cache.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     buildCache: {
     *       cacheDigest: [process.env.SOME_ENV],
     *       buildDependencies: ['postcss.config.js'],
     *     },
     *   },
     * })
     * ```
     */
    buildCache?: BuildCache | boolean | undefined;
    /**
     * {@link Performance.chunkSplit} is used to configure the chunk splitting strategy.
     *
     * @defaultValue For web builds, Rsbuild currently uses `{ strategy: 'split-by-experience' }` when this option is unset.
     *
     * @deprecated Use the top-level {@link Config.splitChunks} option instead.
     */
    chunkSplit?: ChunkSplit | ChunkSplitBySize | ChunkSplitCustom | undefined;
    /**
     * Whether capture timing information in Lynx runtime integrations such as ReactLynx.
     *
     * @defaultValue Rspeedy sets this to `true` when `DEBUG` contains `rspeedy`; otherwise it leaves the option unset.
     *
     * @example
     *
     * Enable profile.
     *
     * - Frameworks like ReactLynx will include runtime information using `console.profile`.
     * - Rspeedy will emit `dist/stats.json` after build for bundle analysis compatibility.
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: { profile: true },
     * })
     * ```
     */
    profile?: boolean | undefined;
    /**
     * Whether to remove `console.[methodName]` in production build.
     *
     * @defaultValue false
     *
     * @example
     *
     * - Remove all `console` methods
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     removeConsole: true,
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Remove specific `console` methods
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     removeConsole: ['log', 'warn']
     *   },
     * })
     * ```
     */
    removeConsole?: boolean | ConsoleType[] | undefined;
    /**
     * Whether to print the file sizes after production build.
     *
     * @defaultValue true
     *
     * {@link Performance.printFileSize}
     *
     * See {@link https://rsbuild.rs/config/performance/print-file-size | Rsbuild - performance.printFileSize} for details.
     *
     * @example
     *
     * If you don't want to print any information, you can disable it by setting printFileSize to false:
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: false
     *   },
     * })
     * ```
     *
     * @example
     *
     * Set total to false to disable total size output.
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: {
     *       total: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * Set detail to false to disable per-asset size output.
     *
     * If you don't need to view the size of each static asset, you can set detail to false. In this case, only the total size will be output:
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: {
     *       detail: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * If you don't need to view the gzipped size, you can set compressed to false. This can save some gzip computation time for large projects:
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: {
     *       compressed: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * To include only static assets that meet certain criteria, use a filter function with include.
     *
     * If returned false, the static asset will be excluded and not included in the total size or detailed size.
     *
     * only output static assets larger than 10kB:
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: {
     *       include: (asset) => asset.size > 10 * 1000,
     *     }
     *   },
     * })
     * ```
     *
     * @example
     *
     * To exclude static assets that meet certain criteria, use a filter function with exclude. If both include and exclude are set, exclude will take precedence.
     *
     * Rspeedy defaults to excluding source map, license files, and .d.ts type files, as these files do not affect page load performance.
     *
     * exclude .html files in addition to the default:
     *
     * ```ts
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   performance: {
     *     printFileSize: {
     *       exclude: (asset) =>
     *         /\.(?:map|LICENSE\.txt)$/.test(asset.name) ||
     *         /\.html$/.test(asset.name),
     *     }
     *   },
     * })
     * ```
     */
    printFileSize?: PerformanceConfig['printFileSize'] | undefined;
}

/**
 * {@inheritdoc Config.resolve}
 *
 * @public
 */
export declare interface Resolve {
    /**
     * Create aliases to `import` or `require` certain modules more easily.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * A trailing `$` can also be added to the given object's keys to signify an exact match:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   resolve: {
     *     alias: {
     *       xyz$: 'path/to/file.js',
     *     },
     *   },
     * })
     * ```
     *
     * which would yield these results:
     *
     * ```js
     * import Test1 from 'xyz'; // Exact match, so path/to/file.js is resolved and imported
     * import Test2 from 'xyz/file.js'; // Not an exact match, normal resolution takes place
     * ```
     *
     * @example
     *
     * `resolve.alias` is useful to control how a npm package is resolved.
     *
     * - Change `react` to `@lynx-js/react`:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * import { createRequire } from 'module'
     * const require = createRequire(import.meta.url)
     * export default defineConfig({
     *   resolve: {
     *     alias: {
     *       react: require.resolve('@lynx-js/react'),
     *     },
     *   },
     * })
     * ```
     *
     * This allows you to use some third-party libraries that directly uses `react` as dependencies in ReactLynx.
     *
     * - Force using the same version of `dayjs`:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * import { createRequire } from 'module'
     * const require = createRequire(import.meta.url)
     * export default defineConfig({
     *   resolve: {
     *     alias: {
     *       dayjs: require.resolve('dayjs'),
     *     },
     *   },
     * })
     * ```
     *
     * Please note that this is dangerous, since all the `dayjs`(including the dependencies of a dependencies) is resolved to the version in the project.
     * It may cause both compile-time and runtime errors due to version mismatch.
     *
     * @example
     * Setting `resolve.alias` to `false` will ignore a module.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   resolve: {
     *     alias: {
     *       'ignored-module': false,
     *       './ignored-module': false,
     *     },
     *   },
     * })
     * ```
     */
    alias?: Record<string, string | false | string[]> | undefined;
    /**
     * Set the strategy for path alias resolution, to control the priority relationship
     * between the `paths` option in `tsconfig.json` and the `resolve.alias` option of Rsbuild.
     *
     * @defaultValue `'prefer-tsconfig'`
     *
     * - `prefer-tsconfig` (default): The `paths` option in `tsconfig.json` will take precedence over the
     * `resolve.alias` option of Rsbuild.
     * - `prefer-alias`: The `resolve.alias` option of Rsbuild will take precedence over the
     * `paths` option in `tsconfig.json`.
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   resolve: {
     *     alias: {
     *       '@': './src',
     *     },
     *     aliasStrategy: 'prefer-alias',
     *   },
     * })
     * ```
     */
    aliasStrategy?: 'prefer-tsconfig' | 'prefer-alias' | undefined;
    /**
     * Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * {@link Resolve.dedupe} is implemented based on {@link Resolve.alias}, it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias.
     *
     * The alias generated by {@link Resolve.dedupe} will be merged with the configured {@link Resolve.alias} in the project, and the {@link Resolve.alias} config will take precedence when the keys are the same.
     *
     * @example
     *
     * Use `tslib` from the project root directory.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   resolve: {
     *     dedupe: ['tslib'],
     *   },
     * })
     * ```
     */
    dedupe?: string[] | undefined;
    /**
     * Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
     *
     * @defaultValue `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']`
     *
     * For example, if importing './index', Rsbuild will try to resolve using the following order:
     *
     * - `./index.ts`
     *
     * - `./index.tsx`
     *
     * - `./index.mjs`
     *
     * - `./index.js`
     *
     * - `./index.jsx`
     *
     * - `./index.json`
     *
     * - `./index.cjs`
     *
     * @remarks
     * The difference between `resolve.extensions` and `tools.rspack.resolve.extensions`:
     *
     * `resolve.extensions`: Completely overrides Rspeedy's default resolution.
     *
     * `tools.rspack.resolve.extensions`: Merges with the default configuration using [`webpack-merge`](https://github.com/survivejs/webpack-merge).
     *
     * @example
     * ```js
     * export default {
     *   resolve: {
     *     extensions: ['.ts', '.tsx', '.js'],
     *   },
     * }
     * ```
     */
    extensions?: string[] | undefined;
}

export { RsbuildPlugin }

export { RsbuildPluginAPI }

export { rsbuildVersion }

declare interface RsdoctorRspackPluginExperiments {
    /**
     * Whether to enable the native plugin to improve the performance.
     * @default true
     */
    enableNativePlugin?: boolean;
}

/**
 * Simplified options type for `tools.rsdoctor`.
 *
 * Keep this type free of deeply nested/intersection utility types to ensure
 * typia can generate validators from `Config`.
 *
 * @public
 */
export declare interface RsdoctorRspackPluginOptions extends Omit<RsdoctorRspackPluginOptions_2<[]>, 'linter'> {
    linter?: {
        rules?: Record<string, unknown>;
        level?: 'Ignore' | 'Warn' | 'Error';
        extends?: unknown[];
    };
}

declare interface RsdoctorRspackPluginOptions_2<Rules extends Linter.ExtendRuleData[]> extends Plugin.RsdoctorWebpackPluginOptions<Rules> {
    /**
     * The experiments of the Rsdoctor Rspack plugin.
     */
    experiments?: RsdoctorRspackPluginExperiments;
}

export { Rspack }

export { rspack }

export declare const rspackVersion: string;

/**
 * The instance of Rspeedy.
 *
 * @public
 */
export declare type RspeedyInstance = RsbuildInstance & {
    getRspeedyConfig(): Config;
};

/**
 * {@inheritdoc Config.server}
 * @public
 */
export declare interface Server {
    /**
     * Configure the base path of the server.
     *
     * @defaultValue `'/'`
     *
     * @remarks
     * Users can access lynx bundle through `http://<host>:<port>/main.lynx.bundle` by default.
     *
     * If you want to access lynx bundle through `http://<host>:<port>/foo/main.lynx.bundle`, you can change `server.base` to `/foo`
     *
     * you can refer to {@link https://rsbuild.rs/config/server/base | server.base } for more information.
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   server: {
     *     base: '/dist'
     *   },
     * })
     * ```
     */
    base?: string | undefined;
    /**
     * Configure whether to enable {@link https://developer.mozilla.org/en-US/docs/Glossary/gzip_compression | gzip compression } for static assets served by the dev server or preview server.
     *
     * @defaultValue true
     *
     * See {@link https://rsbuild.rs/config/server/compress | Rsbuild - server.compress } for details.
     *
     * @example
     *
     * To disable the gzip compression, set compress to false:
     *
     * ```js
     * export default {
     *   server: {
     *     compress: false,
     *   },
     * }
     * ```
     *
     * @example
     *
     * Compress if it starts with /foo
     *
     * ```js
     * export default {
     *   server: {
     *     compress: {
     *       filter: (req) => {
     *         if (req.url?.includes('/foo')) {
     *           return false;
     *         }
     *         return true;
     *       },
     *     },
     *   },
     * }
     * ```
     *
     * @example
     *
     * set level of zlib compression
     *
     * ```js
     * export default {
     *   server: {
     *     compress: {
     *       level: 6,
     *     },
     *   },
     * }
     * ```
     */
    compress?: boolean | CompressOptions | undefined;
    /**
     * Configure CORS for the dev server or preview server.
     *
     * @defaultValue Uses Rsbuild's default CORS options.
     *
     * - Set to an object to enable CORS with the specified options.
     *
     * - Set to `true` to enable CORS with the default options (allows all origins, not recommended).
     *
     * - Set to `false` to disable CORS.
     *
     * See {@link https://rsbuild.rs/config/server/cors | Rsbuild - server.cors } for details.
     *
     * @example
     *
     * ```js
     * export default {
     *   server: {
     *     cors: {
     *       origin: 'https://example.com',
     *     },
     *   },
     * }
     * ```
     */
    cors?: ServerConfig['cors'] | undefined;
    /**
     * Adds headers to all responses.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   server: {
     *     headers: {
     *       'Access-Control-Allow-Origin': '**',
     *     },
     *   },
     * })
     * ```
     */
    headers?: Record<string, string | string[]> | undefined;
    /**
     * Specify the host that the Rspeedy Server listens to.
     *
     * @defaultValue "0.0.0.0"
     *
     * @remarks
     * During `rspeedy dev`, if `server.host` is unset, the dev plugin resolves dev-server-related URLs and client host settings with a detected local IPv4 address, such as `192.168.1.50`. If you have multiple network interfaces, set `server.host` explicitly to choose the desired address.
     *
     * @example
     *
     * Set the host to a custom value:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   server: {
     *     host: "192.168.1.50",
     *   },
     * })
     * ```
     */
    host?: string | undefined;
    /**
     * Specify the port that the Rspeedy Server listens to.
     *
     * @defaultValue Rsbuild defaults this option to `3000`.
     *
     * @remarks
     * By default, the server automatically increments the port number when the configured port is occupied.
     *
     * @example
     *
     * Set the port to a custom value:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   server: {
     *     port: 3470,
     *   },
     * })
     * ```
     */
    port?: number | undefined;
    /**
     * Configure proxy rules for the dev server or preview server to proxy requests to the specified service.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * ```js
     * export default {
     *   server: {
     *     proxy: {
     *       // http://localhost:3000/api -> http://localhost:3000/api
     *       // http://localhost:3000/api/foo -> http://localhost:3000/api/foo
     *       '/api': 'http://localhost:3000',
     *     },
     *   },
     * }
     * ```
     */
    proxy?: ProxyConfig | undefined;
    /**
     * When a port is occupied, Rspeedy will automatically increment the port number until an available port is found.
     *
     * @defaultValue false
     *
     * By default, strict port mode is disabled. Set strictPort to true and Rspeedy will throw an exception when the port is occupied.
     */
    strictPort?: boolean | undefined;
}

/**
 * {@inheritdoc Config.source}
 *
 * @public
 */
export declare interface Source {
    /**
     * {@inheritdoc Resolve.alias}
     *
     * @deprecated - Use {@link Resolve.alias} instead.
     *
     * @defaultValue undefined
     */
    alias?: Record<string, string | false | string[]> | undefined;
    /**
     * Include additional files that should be treated as static assets.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * By default, Rsbuild treats common image, font, audio, and video files as static assets.
     * Through the source.assetsInclude config, you can specify additional file types that should be treated as static assets.
     * These added static assets are processed using the same rules as the built-in supported static assets。
     *
     * The usage of `source.assetsInclude` is consistent with {@link https://rspack.rs/config/module#condition | Condition}
     * in Rspack, which supports passing in strings, regular expressions, arrays of conditions, or logical conditions
     * to match the module path or assets.
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     assetsInclude: /\.json5$/,
     *   },
     * })
     * ```
     */
    assetsInclude?: Rspack.RuleSetCondition | undefined;
    /**
     * Used to configure the decorators syntax.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * See {@link Decorators.version} for more information.
     */
    decorators?: Decorators | undefined;
    /**
     * The `define` options is used to define some values or expressions at compile time.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * Using `define` for environment variables.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     define: {
     *       BUILD_VERSION: JSON.stringify(process.env.BUILD_VERSION ?? 'unknown_version'),
     *       'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
     *     },
     *   },
     * })
     * ```
     *
     * Expressions will be replaced with the corresponding code fragments:
     *
     * ```js
     * const version = BUILD_VERSION;
     * if (process.env.NODE_ENV === 'development') {}
     *
     * // ⬇️ Turn into being...
     * const version = "unknown_version";
     * if ("development" === 'development') {}
     * ```
     *
     * @example
     *
     * Using `define` for `typeof`.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     define: {
     *       'typeof window': JSON.stringify("undefined"),
     *     },
     *   },
     * })
     * ```
     *
     * The `typeof` expressions will be replaced with the corresponding code fragments:
     *
     * ```js
     * if (typeof window !== 'undefined') {}
     *
     * // ⬇️ Turn into being...
     * if ("undefined" !== 'undefined') {}
     * ```
     *
     * @example
     *
     * Using `define` with objects.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     define: {
     *       'import.meta': {
     *         foo: JSON.stringify('foo'),
     *         bar: { baz: 0 },
     *       },
     *     },
     *   },
     * })
     * ```
     *
     * Expressions will be replaced with the corresponding code fragments:
     *
     * ```js
     * console.log(import.meta)
     *
     * // ⬇️ Turn into being...
     * console.log({ foo: "foo", bar: { baz: 0 } })
     * ```
     *
     * @remarks
     *
     * - If the value provided is a string, it will be utilized as a code fragment.
     *
     * - If the value provided is an object, all its keys will be defined in the same manner.
     *
     * - If the value isn't a string, it will be stringified, with functions included.
     *
     * - Notably, if a `typeof` prefix is attached to the key, it will be exclusively defined for `typeof` calls."
     */
    define?: Rspack.DefinePluginOptions;
    /**
     * The {@link Entry} option is used to set the entry module.
     *
     * @defaultValue `'./src/index.js'`
     *
     * @example
     *
     * - Use a single entry:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     entry: './src/pages/main/index.js',
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use a single entry with multiple entry modules:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     entry: ['./src/prefetch.js', './src/pages/main/index.js'],
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use multiple entries(with multiple entry modules):
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     entry: {
     *       foo: './src/pages/foo/index.js',
     *       bar: ['./src/pages/bar/index.js', './src/post.js'], // multiple entry modules is allowed
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use multiple entries with {@link EntryDescription}:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     entry: {
     *       foo: './src/pages/foo/index.js',
     *       bar: {
     *         import: ['./src/prefetch.js', './src/pages/bar'],
     *       },
     *     },
     *   },
     * })
     * ```
     */
    entry?: Entry | undefined;
    /**
     * The `source.exclude` is used to specify JavaScript files that should be excluded from compilation.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * By default, Rsbuild compiles JavaScript files in the current directory and TypeScript/JSX files
     * in all directories. Through the `source.exclude` config, you can specify files or directories
     * that should be excluded from compilation.
     * The usage of `source.exclude` is consistent with {@link https://rspack.rs/config/module#ruleexclude | Rule.exclude}
     * in Rspack, which supports passing in strings or regular expressions to match module paths.
     *
     * @example
     *
     * - Exclude specific files or directories
     *
     * You can exclude specific files or directories from compilation to improve build performance
     * or avoid processing certain files:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   source: {
     *     exclude: [
     *       // Exclude all files in the test directory
     *       /[\\/]test[\\/]/,
     *       // Exclude specific file
     *       './src/legacy-file.js',
     *       // Exclude files matching a pattern
     *       /\.stories\.(js|ts)x?$/,
     *     ],
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Exclude third-party dependencies
     *
     * You can exclude specific third-party dependencies that don't need compilation:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * import path from 'node:path'
     * import { createRequire } from 'node:module'
     *
     * const require = createRequire(import.meta.url)
     *
     * export default defineConfig({
     *   source: {
     *     exclude: [
     *       // Exclude specific package
     *       path.dirname(require.resolve('lodash')),
     *       // Exclude using regex pattern
     *       /node_modules[\\/]lodash-es[\\/]/,
     *     ],
     *   },
     * })
     * ```
     */
    exclude?: Rspack.RuleSetCondition[] | undefined;
    /**
     * The `source.include` is used to specify additional JavaScript files that need to be compiled.
     *
     * @defaultValue When unset, Rsbuild compiles JavaScript files in the current directory and TypeScript or JSX files in all directories, while excluding JavaScript files under `node_modules`.
     *
     * @remarks
     *
     * To avoid redundant compilation, by default, Rsbuild only compiles JavaScript
     * files in the current directory and TypeScript and JSX files in all directories.
     * It does not compile JavaScript files under `node_modules`.
     *
     * Through the `source.include` config, you can specify directories or modules
     * that need to be compiled by Rsbuild.
     * The usage of `source.include` is consistent with {@link https://rspack.rs/config/module#ruleinclude |  Rule.include}
     * in Rspack, which supports passing in strings or regular expressions to match the module path.
     *
     * @example
     *
     * - Compile Npm Packages
     *
     * A typical usage scenario is to compile npm packages under `node_modules`,
     * because some third-party dependencies have ESNext syntax, which may not be supported in Lynx.
     * You can solve the problem by using this config to specify the dependencies
     * that need to be compiled.
     *
     * ```js
     * import { createRequire } from 'node:module'
     * import path from 'node:path'
     *
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * const require = createRequire(import.meta.url)
     *
     * export default defineConfig({
     *   source: {
     *     include: [
     *       // Method 1:
     *       // First get the path of the module by `require.resolve`
     *       // Then pass path.dirname to point to the corresponding directory
     *       path.dirname(require.resolve('query-string')),
     *       // Method 2:
     *       // Match by regular expression
     *       // All paths containing `node_modules/query-string/` will be matched
     *       /node_modules[\\/]query-string[\\/]/,
     *     ],
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Compile Libraries in Monorepo
     *
     * ```js
     * import path from 'node:path'
     * import { fileURLToPath } from 'node:url'
     *
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * const __dirname = path.dirname(fileURLToPath(import.meta.url))
     *
     * const packagesDir = path.resolve(__dirname, '../../packages')
     *
     * export default defineConfig({
     *   source: {
     *     include: [
     *       // Compile all files in Monorepo's package directory
     *       // It is recommended to exclude the node_modules
     *       {
     *         and: [packagesDir, { not: /[\\/]node_modules[\\/]/ }],
     *       },
     *     ],
     *   },
     * })
     * ```
     */
    include?: Rspack.RuleSetCondition[] | undefined;
    /**
     * Add a script before the entry file of each page. This script will be executed before the page code.
     * It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * See {@link https://rsbuild.rs/config/source/pre-entry | source.preEntry} for more details.
     *
     * @example
     *
     * Relative path will be resolved relative to the project root directory.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     preEntry: './src/polyfill.ts',
     *   },
     * })
     * ```
     */
    preEntry?: string | string[] | undefined;
    /**
     * The {@link TransformImport} option transforms the import paths to enable modular imports from subpaths of third-party packages, similar to the functionality provided by {@link https://npmjs.com/package/babel-plugin-import | babel-plugin-import}.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * When using the TUX component library, you can import components on demand with the following config:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   source: {
     *     transformImport: [
     *       {
     *         libraryName: 'foo',
     *         customName: 'foo/src/components/{{ member }}/{{ member }}',
     *       },
     *     ],
     *   },
     * })
     * ```
     *
     * This will transform the following source code:
     *
     * ```js
     * import { Button } from 'foo'
     * ```
     *
     * to:
     *
     * ```js
     * import { Button } from 'foo/src/components/Button/Button'
     * ```
     */
    transformImport?: TransformImport[] | undefined;
    /**
     * Configure a custom `tsconfig.json` file path to use, can be a relative or absolute path.
     *
     * @defaultValue `'./tsconfig.json'`
     *
     * @remarks
     *
     * The `tsconfigPath` configuration affects the following behaviors:
     *
     * - The `paths` field is used to configure {@link Source.alias | Path Aliases}.
     *
     * - Sets the scope and rules for the {@link https://rsbuild.rs/guide/basic/typescript#type-checking | Type Check Plugin}.
     *
     * @example
     *
     * Relative path will be resolved relative to the project root directory.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     * export default defineConfig({
     *   source: {
     *     tsconfigPath: './tsconfig.build.json',
     *   },
     * })
     * ```
     */
    tsconfigPath?: string | undefined;
}

/**
 * {@inheritdoc Output.sourceMap}
 *
 * @public
 */
export declare interface SourceMap {
    /**
     * How the source map should be generated. Setting it to `false` will disable the source map.
     *
     * @defaultValue When `output.sourceMap` is an object and `js` is unset, it defaults to `'cheap-module-source-map'` in development. In production, it defaults to `'source-map'` for Lynx environments and `false` otherwise.
     *
     * @remarks
     *
     * See {@link https://rspack.rs/config/devtool | Rspack - Devtool} for details.
     *
     * @example
     *
     * - Enable high-quality source-maps for production:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     sourceMap: {
     *       js: process.env['NODE_ENV'] === 'production'
     *         ? 'source-map'
     *         : 'cheap-module-source-map',
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Disable source-map generation:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     sourceMap: {
     *       js: false,
     *     },
     *   },
     * })
     * ```
     *
     * @example
     *
     * - Use high-quality source-maps for all environments:
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     sourceMap: {
     *       js: 'source-map',
     *     },
     *   },
     * })
     * ```
     */
    js?: Rspack.DevTool | undefined | `${Exclude<Rspack.DevTool, false | 'eval'>}-debugids`;
    /**
     * Whether to generate CSS source maps.
     *
     * @remarks
     *
     * Defaults to `true`. In Lynx builds, all `.map` assets are removed before emit.
     *
     * @example
     *
     * Disable CSS sourcemap.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   output: {
     *     sourceMap: {
     *       css: false,
     *     },
     *   },
     * })
     * ```
     */
    css?: boolean | undefined;
}

/**
 * {@inheritdoc Config.tools}
 *
 * @public
 */
export declare interface Tools {
    /**
     * The {@link Tools.bundlerChain} changes the options of {@link https://rspack.rs | Rspack} using {@link https://github.com/rspack-contrib/rspack-chain | rspack-chain}.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     bundlerChain(chain) {
     *       chain.resolve.fullySpecified(true)
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://github.com/rspack-contrib/rspack-chain | rspack-chain} for details.
     */
    bundlerChain?: ToolsConfig['bundlerChain'] | undefined;
    /**
     * The {@link CssLoader} controls the options of {@link https://github.com/webpack-contrib/css-loader | css-loader}.
     *
     * @defaultValue Uses defaults derived from `output.cssModules` and `output.sourceMap`, with `importLoaders` set to `1` for CSS files and `2` for Sass/Less files.
     *
     * @remarks
     *
     * The default option is as follow:
     *
     * ```js
     * const defaultOptions = {
     *   modules: {
     *     auto: true,
     *     namedExport: false,
     *     exportLocalsConvention: 'camelCase',
     *     localIdentName: output.cssModules.localIdentName,
     *   },
     *   sourceMap: output.sourceMap,
     *   // importLoaders is `1` when compiling css files, and is `2` when compiling sass/less files
     *   importLoaders: 1 || 2,
     * };
     * ```
     */
    cssLoader?: CssLoader | undefined;
    /**
     * The {@link CssExtract} controls the options of {@link https://rspack.rs/plugins/rspack/css-extract-rspack-plugin | CssExtractRspackPlugin}
     *
     * @defaultValue undefined
     */
    cssExtract?: CssExtract | undefined;
    /**
     * The {@link Tools.rsdoctor} controls the options of {@link https://rsdoctor.dev/ | Rsdoctor}.
     *
     * @defaultValue undefined
     *
     * @remarks
     * Setting `RSDOCTOR=true` enables Rsdoctor. When it is enabled, Rspeedy merges additional plugin defaults during config normalization.
     *
     * @example
     *
     * - Use the built-in Rsdoctor.
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     rsdoctor: {
     *       disableClientServer: true,
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://rsdoctor.dev/config/options/options | Rsdoctor - Configuration} for details.
     */
    rsdoctor?: RsdoctorRspackPluginOptions | undefined;
    /**
     * The {@link Tools.rspack} controls the options of {@link https://rspack.rs/ | Rspack}.
     *
     * @defaultValue undefined
     *
     * @example
     *
     * - Use object config
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     rspack: {
     *       resolve: {
     *         fullySpecified: true,
     *       },
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://rspack.rs/config/index | Rspack - Configuration} for details.
     *
     * @example
     *
     * - Use function with `env` utils
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     rspack(config, { env }) {
     *       if (env === 'development') {
     *         config.devtool = 'cheap-source-map'
     *       }
     *       return config
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://rsbuild.rs/config/tools/rspack#env | Rsbuild - tools.rspack} for details.
     *
     * @example
     *
     * - Use function with `mergeConfig` utils
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     rspack(config, { mergeConfig }) {
     *       return mergeConfig(config, {
     *         resolve: {
     *           fullySpecified: true,
     *         },
     *       })
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://rsbuild.rs/config/tools/rspack#mergeconfig | Rsbuild - tools.rspack} for details.
     *
     * @example
     *
     * - Use function with `appendPlugins` utils
     *
     * ```js
     * import { defineConfig } from '@lynx-js/rspeedy'
     *
     * export default defineConfig({
     *   tools: {
     *     rspack(config, { appendPlugins, rspack }) {
     *       appendPlugins(new rspack.BannerPlugin({ banner: 'Hello, World!' }))
     *       return config
     *     },
     *   },
     * })
     * ```
     *
     * See {@link https://rsbuild.rs/config/tools/rspack#appendplugins | Rsbuild - tools.rspack} for details.
     */
    rspack?: ToolsConfig['rspack'] | undefined;
    /**
     * The {@link Tools.swc} controls the options of {@link https://rspack.rs/guide/features/builtin-swc-loader | builtin:swc-loader}.
     *
     * @defaultValue undefined
     */
    swc?: ToolsConfig['swc'] | undefined;
}

/**
 * {@inheritdoc Source.transformImport}
 *
 * @public
 */
export declare interface TransformImport {
    /**
     * Whether to convert camelCase imports to kebab-case.
     *
     * @defaultValue Rsbuild defaults this option to `true`.
     *
     * @example
     *
     * - Input:
     *
     * ```js
     * import { ButtonGroup } from 'foo'
     * ```
     *
     * - Output:
     *
     * When set to `true`:
     * ```js
     * import ButtonGroup from 'foo/button-group'
     * ```
     *
     * When set to `false`:
     * ```js
     * import ButtonGroup from 'foo/ButtonGroup'
     * ```
     */
    camelToDashComponentName?: boolean | undefined;
    /**
     * Customize the transformed path.
     *
     * @defaultValue undefined
     *
     * @remarks
     *
     * You you can specify the format of the transformed path.
     * For example, by setting it to `my-lib/{{ camelCase member }}`, you can convert the member into camelCase.
     *
     * The following formats are supported:
     *
     * - `kebabCase`: lowercase letters, words joined by hyphens. For example: `my-variable-name`.
     *
     * - `snakeCase`: lowercase letters, words joined by underscores. For example: `my_variable_name`.
     *
     * - `camelCase`: first letter lowercase, the first letter of each following word uppercase. For example: `myVariableName`.
     *
     * - `upperCase`: uppercase letters, other characters unchanged. For example: `MY-VARIABLE-NAME`.
     *
     * - `lowerCase`: lowercase letters, other characters unchanged. For example: `my-variable-name`.
     */
    customName?: string | undefined;
    /**
     * The original import path that needs to be transformed.
     *
     * @remarks
     *
     * This option is required.
     */
    libraryName: string;
    /**
     * Used to splice the transformed path, the splicing rule is `${libraryName}/${libraryDirectory}/${member}`, where member is the imported member.
     *
     * @defaultValue `'lib'`
     *
     * @example
     *
     * - Input:
     *
     * ```js
     * import { Button } from 'foo'
     * ```
     *
     * - Output:
     *
     * ```js
     * import Button from 'foo/lib/button'
     * ```
     */
    libraryDirectory?: string | undefined;
    /**
     * Whether to convert import statements to default imports.
     *
     * @defaultValue Rsbuild defaults this option to `true`.
     *
     * @example
     *
     * - Input:
     *
     * ```js
     * import { Button } from 'foo'
     * ```
     *
     * - Output:
     *
     * When set to `true`:
     * ```js
     * import Button from 'foo/button'
     * ```
     *
     * When set to `false`:
     * ```js
     * import { Button } from 'foo/button'
     * ```
     */
    transformToDefaultImport?: boolean | undefined;
}

export declare const version: string;

export { }
