/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import type { Compiler, RspackPluginInstance } from '@rspack/core'; /** * The subset of the esbuild `Metafile` structure consumed by `extractLicenses`. * Built here from the rspack chunk graph instead of an esbuild bundling step. */ interface LicenseMetafile { outputs: Record; }>; } /** * Extracts license information for each node module package included in the output * files of the built code. This includes JavaScript and CSS output files. The esbuild * metafile generated during the bundling steps is used as the source of information * regarding what input files where included and where they are located. A path segment * of `node_modules` is used to indicate that a file belongs to a package and its license * should be include in the output licenses file. * * The package name and license field are extracted from the `package.json` file for the * package. If a license file (e.g., `LICENSE`) is present in the root of the package, it * will also be included in the output licenses file. * * Vendored from `@angular/build` 22.1.3 (`src/tools/esbuild/license-extractor.ts`) since * it is not exposed in the package's public or private API. Only the esbuild `Metafile` * type import is replaced with the local `LicenseMetafile` interface. When an earlier * `@angular/build` is installed, its license file lookup is used instead. * * @param metafile An esbuild metafile object. * @param rootDirectory The root directory of the workspace. * @returns A string containing the content of the output licenses file. */ export declare function extractLicenses(metafile: LicenseMetafile, rootDirectory: string): Promise; /** * License extraction inputs collected so far, keyed by the plugin instance * (one per compiler) that produced them. Sharing one map across the browser * and server compilers makes each emit the union of both, since they write * the licenses file to the same output location. */ export type SharedLicenseInputs = Map>; export interface ExtractLicensesPluginOptions { /** * Asset name for the licenses file, relative to the compilation output path. */ outputFilename: string; /** * The root directory of the workspace. */ rootDirectory: string; /** * Inputs shared with the other compilers of the build, when it has several. */ sharedInputs?: SharedLicenseInputs; } /** * Emits a licenses file for the node module packages included in the output, * mirroring the `@angular/build` application builder's `extractLicenses` * behavior and output. Feeds the chunk graph's module paths to the vendored * extractor in place of an esbuild metafile. */ export declare class ExtractLicensesPlugin implements RspackPluginInstance { private options; private readonly sharedInputs; constructor(options: ExtractLicensesPluginOptions); apply(compiler: Compiler): void; } export {}; //# sourceMappingURL=extract-licenses-plugin.d.ts.map