/**
 * Packages that Nest and its ecosystem import lazily and that apps are not
 * required to install. In a bundle they are only ignored when they do not
 * resolve from the project, so installed ones are still bundled.
 */
export declare const optionalPackages: string[];
/**
 * Packages whose files are read from disk at runtime instead of imported
 * (`@nestjs/swagger` serves the Swagger UI from `swagger-ui-dist`), so they
 * stay external like native addons.
 */
export declare const runtimeFilePackages: string[];
export interface ExternalPackage {
    name: string;
    version: string;
    /**
     * Limited to some platforms (`os` or `cpu`), so it is pinned in
     * `optionalDependencies` and skipped by `npm install` elsewhere.
     */
    optional?: boolean;
}
/**
 * Returns the package name of a bare request (`@scope/name/sub` becomes
 * `@scope/name`), or undefined for relative, absolute and `node:` requests.
 */
export declare function getPackageName(request: string): string | undefined;
/**
 * Finds the directory of an installed package by walking up the
 * `node_modules` folders, like the Node resolver does.
 */
export declare function findPackageDir(name: string, from: string): string | undefined;
/**
 * True when the request is a known optional package that is not installed
 * where it is imported from. Unlike `require.resolve`, it does not depend on
 * the package `exports` conditions, which matters for ESM-only packages.
 */
export declare function isMissingOptionalPackage(request: string, from?: string): boolean;
/**
 * Walks the installed production dependency graph of the project and returns
 * the packages that cannot be bundled and must stay external: the ones that
 * ship a native addon (`binding.gyp`, `gypfile` or `.node` files) or load one
 * from a platform-specific optional dependency, the `runtimeFilePackages` and
 * the excluded ones. When a package is installed in several versions, the one
 * closest to the project is pinned and the others are reported.
 */
export declare function findExternalPackages(cwd?: string, exclude?: string[]): ExternalPackage[];
/**
 * Externals for a bundle that contains its dependencies: Node builtins and
 * the external packages only. Both are loaded with `require`, because dependencies
 * that are CommonJS call `require('stream')` and expect the module itself,
 * which an ESM `import` external would not give them.
 */
export declare function createBundleExternals(isEsm: boolean, externalPackages: ExternalPackage[]): ({ request }: {
    request?: string;
}, callback: (error?: Error | null, result?: string) => void) => void;
export interface BundleDependenciesPluginOptions {
    isEsm: boolean;
    externalPackages: ExternalPackage[];
    /** Collects the optional packages that were ignored in this compilation. */
    ignored: Set<string>;
}
/**
 * Emits a `package.json` next to the bundle with the external packages pinned to
 * the installed versions and a `type` matching the output, and reports what
 * was stubbed and kept external.
 */
export declare class BundleDependenciesPlugin {
    private readonly options;
    constructor(options: BundleDependenciesPluginOptions);
    apply(compiler: any): void;
}
