@rushstack/webpack-embedded-dependencies-plugin
0.2.104 • Public • Publishednpm install @rushstack/webpack-embedded-dependencies-plugin --save
A webpack plugin for generating a list of embedded dependencies. Embedded dependencies are third-party packages which are beingbundled into your released code and are oftentimes subject to license, security, and other legal requirements. This pluginaims to make it easier to generate a list of embedded dependencies and their associated metadata, so they can be analyzed by additional tools.
The plugin also includes the ability to generate a secondary asset which contains the license text for each embedded dependency into a single file calledTHIRD-PARTY-NOTICES.html. This is a common legal requirement when deploying services or products containing open-source code.
// webpack.config.jsimportEmbeddedDependenciesWebpackPluginfrom'@rushstack/webpack-embedded-dependencies-plugin';exportdefault()=>{/*...*/plugins:[newEmbeddedDependenciesWebpackPlugin(/* options */)]}
Name of the file to be generated. Defaults to embedded-dependencies.json
newEmbeddedDependenciesWebpackPlugin({outputFileName:'my-custom-file-name.json'})
Whether to generate a license file. Defaults to false and will only generate the embedded-dependencies.json file
newEmbeddedDependenciesWebpackPlugin({generateLicenseFile:true})
Function that generates the license file. Defaults to the plugin's internal default generator function but allows you to override it.
newEmbeddedDependenciesWebpackPlugin({generateLicenseFile:true,generateLicenseFileFunction:(packages:IPackageData[]):string=>{returnpackages.map((pkg)=>{return`<h2>${pkg.name}</h2><p>${pkg.license}</p>`;}).join('');}})
newEmbeddedDependenciesWebpackPlugin({generateLicenseFile:true,generatedLicenseFilename:'custom-license-file-name.html'})
Name of the generated license file. Defaults to THIRD-PARTY-NOTICES.html but can be customized to any name you want.
Function that allows you to filter out packages that you don't want to include in any generated files.
newEmbeddedDependenciesWebpackPlugin({packageFilterPredicate:(packageJson:IPackageData,filePath:string):boolean=>{returnpackageJson.name!=='my-package-to-exclude';}})
export declare type LicenseFileGeneratorFunction = (packages: IPackageData[]) => string;
Function type that generates the license file.
constlicenseFileGenerator:LicenseFileGeneratorFunction=(packages:IPackageData[]):string=>{returnpackages.map((pkg)=>{return`<h2>${pkg.name}</h2><p>${pkg.license}</p>`;}).join('');}
export declare type LicenseFileName = `${string}.${'html' | 'md' | 'txt'}`;
Loose string type that represents the name of the generated license file. The string must have at least one character and must end with one of the following file extensions: html, md, or txt or else you'll receive a TypeScript error.
constlicenseFileName:LicenseFileName='custom-license-file-name.html';constlicenseMarkdownFileName:LicenseFileName='custom-license-file-name.md';constlicenseTextFileName:LicenseFileName='custom-license-file-name.txt';
- CHANGELOG.md - Findout what's new in the latest version
@rushstack/webpack-embedded-dependencies-plugin
is part of theRush Stack family of projects.
Readme
Keywords
nonePackage Sidebar
Install
npm i @rushstack/webpack-embedded-dependencies-plugin
Repository
Weekly Downloads
126
Version
0.2.104
License
MIT
Unpacked Size
144 kB
Total Files
18