Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

367
node_modules/license-webpack-plugin/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,367 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [4.0.2] - 2022-02-10
### Fixed
- Fix regression when using dynamic imports
- Fix regression of `excludedPackageTest` option not being respected
## [4.0.1] - 2022-01-27
### Changed
- Performance improvement: use resolve data already present in most modules
- Performance improvement: use throwIfNoEntry option on filesystem operations to improve performance
## [4.0.0] - 2021-11-11
### Fixed
- Fix `TypeError: item.node is not a function` errors by including `webpack-sources@^3.0.0` as direct dependency.
### Removed
- Remove support for webpack versions less than 5. Only webpack 5 is supported as of this version.
## [3.0.0] - 2021-10-02
### Fixed
- Fix `TypeError: item.node is not a function` errors from webpack 5.47.0 and later
## [2.3.21] - 2021-08-20
### Fixed
- Fix delegated modules giving errors about nonexistent `/package.json` file
## [2.3.20] - 2021-07-12
### Fixed
- Fixed an issue where dependent and cached modules' licenses were not being added
## [2.3.19] - 2021-05-31
### Changed
- Optimized calls to compilation.getStats() by filtering out unnecessary stats information
### Fixed
- Fixed banners not working on webpack v5. Check the [documentation](DOCUMENTATION.md) for important configuration changes required for banners to work on webpack v5.
## [2.3.18] - 2021-05-07
### Changed
- Register webpack as optional peer dependency
## [2.3.17] - 2021-04-10
### Changed
- Performance improvements in large repos
## [2.3.16] - 2021-03-26
### Fixed
- Fix data URI modules giving errors about nonexistent `/package.json` file
## [2.3.15] - 2021-03-03
### Fixed
- Fix remote modules giving errors about nonexistent `/package.json` file
## [2.3.14] - 2021-02-19
### Fixed
- Fix ignored modules giving errors about nonexistent `/package.json` file
## [2.3.13] - 2021-02-12
### Fixed
- Fix container entry modules giving errors about nonexistent `/package.json` file
## [2.3.12] - 2021-02-11
### Fixed
- Fix files processed by loaders not getting processed correctly
- Fix errors about `/package.json` when using webpack module federation
## [2.3.11] - 2021-01-11
### Fixed
- Fix performance regression by caching webpack stats object
## [2.3.10] - 2021-01-07
### Fixed
- Remove external dependencies (which can't be resolved during build time) from processing
## [2.3.9] - 2020-12-25
### Fixed
- Fix webpack license output being missing when using webpack v5
## [2.3.8] - 2020-12-24
### Fixed
- Fix missing ES modules from output when using webpack v5
- Fix explicit setting of `perChunkOutput: true` not being honored by the plugin
## [2.3.7] - 2020-12-24
### Fixed
- Fix error when `perChunkOutput` is set to `false` and webpack 4 is used: `TypeError: Cannot read property 'tap' of undefined`
## [2.3.6] - 2020-12-24
### Fixed
- Fix warning when `perChunkOutput` is set to `false`: `WARNING in Conflict: Multiple assets emit different content to the same filename <filename>`
## [2.3.5] - 2020-12-24
### Fixed
- Fix warning when `perChunkOutput` is set to `false`: `DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated`. This reintroduces the warning `perChunkOutput` is set to `false`: `WARNING in Conflict: Multiple assets emit different content to the same filename <filename>`.
## [2.3.4] - 2020-12-23
### Fixed
- Fix warning when `perChunkOutput` is set to `false`: `WARNING in Conflict: Multiple assets emit different content to the same filename <filename>`
## [2.3.3] - 2020-12-23
### Fixed
- Fix deprecation messages in webpack 5: `[DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API` and `[DEP_WEBPACK_CHUNK_ENTRY_MODULE] DeprecationWarning: Chunk.entryModule: Use new ChunkGraph API`
## [2.3.2] - 2020-12-07
### Fixed
- Fix directory permission of dist folder by publishing from Linux instead of Windows
## [2.3.1] - 2020-10-24
### Fixed
- Fix deprecation message in webpack 5: `[DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated`
## [2.3.0] - 2020-07-12
### Added
- Allow variables like `[hash]` in `outputFilename` when `perChunkOutput` is set to `false`.
## [2.2.0] - 2020-05-03
### Added
- Added option `skipChildCompilers` to skip applying the plugin to child compilers.
## [2.1.4] - 2020-03-13
### Fixed
- Allow for multiple included/excluded chunks
## [2.1.3] - 2019-10-13
### Fixed
- Ignore package.json files that don't have a `name` field when searching for a package's `package.json` file.
## [2.1.2] - 2019-08-11
### Fixed
- Fix `licenseTemplateDir` option not being able to find template files.
## [2.1.1] - 2019-02-23
### Fixed
- Handle missing license template file when `licenseTemplateDir` is used
## [2.1.0] - 2019-01-12
### Changed
- License report is now sorted by module name.
## [2.0.4] - 2018-11-30
### Fixed
- Switch `@types/webpack-sources` to a regular dependency instead of a devDependency.
## [2.0.3] - 2018-11-04
### Fixed
- Handle auto exclusion of `license`, if the guessed name is a folder instead of file.
- Ignore directories found in `SEE LICENSE IN`-style licenses.
## [2.0.2] - 2018-10-09
### Fixed
- Handle object-style `license` field in `package.json`
## [2.0.1] - 2018-09-23
### Fixed
- Handle invalid filename in `SEE LICENSE IN`-style licenses in `package.json` files.
## [2.0.0] - 2018-09-23
### Added
- `licenseInclusionTest` option
- `unacceptableLicenseTest` option
- `handleUnacceptableLicense` option
- `handleMissingLicenseText` option
- `licenseTextOverrides` option
- `renderLicenses` option
- `renderBanner` option
- `chunkIncludeExcludeTest` option
- `additionalChunkModules` option
- `additionalModules` option
- `preferredLicenseTypes` option
- `handleLicenseAmbiguity` option
- `handleMissingLicenseType` option
- `excludedPackageTest` option
- `silent` option
### Changed
- No explicit configuration is necessary anymore. All license types will be included.
- There is no dependency on `ejs` anymore. Instead, render functions are used.
- Packages are identified by traversing dictories upward until a `package.json` file is found.
This should make package identificaton more reliable.
- Use webpack's `inputFileSystem` instead of `fs` module.
- In order to avoid issues with source maps, the plugin hook is done at a different phase of the webpack build.
- The `modulesDirectories` option requires full paths and is now used to restrict which directories a module may be detected from.
- License filename detection is now done by regular expression which means more license files should be picked up now.
- When license text cannot be found, the plugin will no longer write the license type as the license text. Instead it will omit printing the license text. (The license type will still be written though.)
- The `webpack-sources` dependency has moved from a peer dependency to a direct dependency.
### Removed
- `suppressErrors` option
- `pattern` option
- `outputTemplate` option
- `includePackagesWithoutLicense` option
- `unacceptablePattern` option
- `abortOnUnacceptableLicense` option
- `bannerTemplate` option
- `includedChunks` option
- `excludedChunks` option
- `additionalPackages` option
- `buildRoot` option
### Fixed
- No more interference with source maps
## [1.5.0] - 2018-09-20
### Added
- Support for absolute paths in `modulesDirectories` option
### Fixed
- Support symlinked `node_modules` folder
## [1.4.0] - 2018-08-05
### Changed
- Support license filenames with British spelling: "licence"
## [1.3.1] - 2018-03-22
### Fixed
- Add documentation for license info in banner template
## [1.3.0] - 2018-03-10
### Added
- Support adding license info to banner template
## [1.2.3] - 2018-03-04
### Fixed
- Resolved deprecation warning from webpack
## [1.2.2] - 2018-03-04
### Fixed
- Empty license output on webpack versions prior to v4
## [1.2.1] - 2018-03-04
### Fixed
- Use async webpack compiler hook
## [1.2.0] - 2018-03-04
### Added
- Support multiple modules directories
## [1.1.2] - 2018-02-24
### Fixed
- Search file dependencies of webpack build
## [1.1.1] - 2017-10-20
### Fixed
- Fixed `peerDependencies` declaration in `package.json`
## [1.1.0] - 2017-10-04
### Changed
- Normalize line endings in license files
## [1.0.2] - 2017-09-30
### Fixed
- Scan files referenced by `rootModule` in the build.
## [1.0.1] - 2017-09-14
### Fixed
- Exception when stray file is in `node_modules` folder
## [1.0.0] - 2017-08-12
### Added
- Option to output files on a per-chunk basis
- Option to add banner to chunks
- Option to render license information via ejs template
### Changed
- Use explicit export of `LicenseWebpackPlugin` instead of default export
- Rename `includeUndefined` option to `includePackagesWithoutLicense`
### Removed
- Option to add verison number to output
- Option to output license text
- Option to output package url
- Filename option
## [0.6.0] - 2017-08-04
### Added
- Option to show/hide version number of packages
## [0.5.1] - 2017-07-05
### Fixed
- Handle webpack contexts which are inside `node_modules`
## [0.5.0] - 2017-04-08
### Added
- Option to detect and abort build when unacceptable licenses are found
## [0.4.3] - 2017-03-12
### Fixed
- Handle multiple @ signs in file paths
## [0.4.2] - 2017-01-19
### Fixed
- Create output directory if it does not exist
## [0.4.1] - 2016-12-18
### Fixed
- Print error message properly when `pattern` option is not supplied
## [0.4.0] - 2016-11-23
### Added
- Option to override license types
### Fixed
- Support old `package.json` license structure
- Tests work on Windows
## [0.3.0] - 2016-10-22
### Added
- Option to suppress error messages
## [0.2.1] - 2016-10-22
### Fixed
- Ignore files outside of `node_modules`
## [0.2.0] - 2016-09-24
### Added
- Option to output url of a package
- Option to include packages which don't hava license
- Option to output license text of a package
## [0.1.4] - 2016-07-04
Refactoring release, no changes to functionality / API
## [0.1.3] - 2016-07-04
Refactoring release, no changes to functionality / API
## [0.1.2] - 2016-07-03
### Fixed
- Handle scoped packages properly
## [0.1.1] - 2016-07-02
### Added
- Initial release
[0.1.1]: https://github.com/xz64/license-webpack-plugin/tree/v0.1.1
[0.1.2]: https://github.com/xz64/license-webpack-plugin/compare/v0.1.1...v0.1.2
[0.1.3]: https://github.com/xz64/license-webpack-plugin/compare/v0.1.2...v0.1.3
[0.1.4]: https://github.com/xz64/license-webpack-plugin/compare/v0.1.3...v0.1.4
[0.2.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.1.4...v0.2.0
[0.2.1]: https://github.com/xz64/license-webpack-plugin/compare/v0.2.0...v0.2.1
[0.3.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.2.1...v0.3.0
[0.4.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.3.0...v0.4.0
[0.4.1]: https://github.com/xz64/license-webpack-plugin/compare/v0.4.0...v0.4.1
[0.4.2]: https://github.com/xz64/license-webpack-plugin/compare/v0.4.1...v0.4.2
[0.4.3]: https://github.com/xz64/license-webpack-plugin/compare/v0.4.2...v0.4.3
[0.5.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.4.3...v0.5.0
[0.5.1]: https://github.com/xz64/license-webpack-plugin/compare/v0.5.0...v0.5.1
[0.6.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.5.1...v0.6.0
[1.0.0]: https://github.com/xz64/license-webpack-plugin/compare/v0.6.0...v1.0.0
[1.0.1]: https://github.com/xz64/license-webpack-plugin/compare/v1.0.0...v1.0.1
[1.0.2]: https://github.com/xz64/license-webpack-plugin/compare/v1.0.1...v1.0.2
[1.1.0]: https://github.com/xz64/license-webpack-plugin/compare/v1.0.2...v1.1.0
[1.1.1]: https://github.com/xz64/license-webpack-plugin/compare/v1.1.0...v1.1.1
[1.1.2]: https://github.com/xz64/license-webpack-plugin/compare/v1.1.1...v1.1.2
[1.2.0]: https://github.com/xz64/license-webpack-plugin/compare/v1.1.2...v1.2.0
[1.2.1]: https://github.com/xz64/license-webpack-plugin/compare/v1.2.0...v1.2.1
[1.2.2]: https://github.com/xz64/license-webpack-plugin/compare/v1.2.1...v1.2.2
[1.2.3]: https://github.com/xz64/license-webpack-plugin/compare/v1.2.2...v1.2.3
[1.3.0]: https://github.com/xz64/license-webpack-plugin/compare/v1.2.3...v1.3.0
[1.3.1]: https://github.com/xz64/license-webpack-plugin/compare/v1.3.0...v1.3.1
[1.4.0]: https://github.com/xz64/license-webpack-plugin/compare/v1.3.1...v1.4.0

332
node_modules/license-webpack-plugin/DOCUMENTATION.md generated vendored Normal file
View file

@ -0,0 +1,332 @@
# Documentation
## Basic Setup
Below is an example of how to add the plugin to a webpack config:
```javascript
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
module.exports = {
plugins: [
new LicenseWebpackPlugin()
]
};
```
## Configuration
* **`stats`** - toggle warnings and errors on/off (default: report warnings and errors)
Example:
```javascript
new LicenseWebpackPlugin({
stats: {
warnings: true,
errors: true
}
});
```
* **`licenseInclusionTest`** - filter which licenses get included in the report (default: capture all licenses)
Example:
```javascript
new LicenseWebpackPlugin({
licenseInclusionTest: (licenseType) => (licenseType === 'MIT')
});
```
Notes: All license identifiers in npm packages are supposed to follow SPDX format. If your requirements are very specific, it is recommended to set up this option using the [`spdx-satisfies`](https://www.npmjs.com/package/spdx-satisfies) package. The plugin does not provide the `spdx-satisfies` package, so you must install it separately if you want to use it.
Example using `spdx-satisfies`:
```javascript
const satisfies = require('spdx-satisfies');
new LicenseWebpackPlugin({
licenseInclusionTest: (licenseType) => satisfies(licenseType, '(ISC OR MIT)')
});
```
* **`outputFilename`** - customize the license report filename (default: `'[name].licenses.txt'`)
Example:
```javascript
new LicenseWebpackPlugin({
outputFilename: '[name].[hash].licenses.txt'
});
```
* **`unacceptableLicenseTest`** - error out on unacceptable license (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
unacceptableLicenseTest: (licenseType) => (licenseType === 'GPL')
});
```
* **`handleUnacceptableLicense`** - do something when an unacceptable license is found (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
unacceptableLicenseTest: (licenseType) => (licenseType === 'GPL'),
handleUnacceptableLicense: (packageName, licenseType) => {
// do something here
}
});
```
* **`excludedPackageTest`** - exclude packages (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
excludedPackageTest: (packageName) => packageName === 'excluded-package'
});
```
* **`perChunkOutput`** - control whether or not the license files are generated per chunk or are combined into one file (default: `true`)
Example:
```javascript
new LicenseWebpackPlugin({
perChunkOutput: false // combine all license information into one file
});
```
* **`addBanner`** - write a banner to the top of each js file (default: `false`)
⚠️ **Webpack V5 Users**: Please read the notes on the `renderBanner` option as some special configuration is required when using banners on webpack v5.
Example:
```javascript
new LicenseWebpackPlugin({
addBanner: true
});
```
* **`licenseTypeOverrides`** - override the license type for specific packages (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
licenseTypeOverrides: {
foopkg: 'MIT'
}
});
```
* **`licenseTextOverrides`** - override the license text for specific packages (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
licenseTextOverrides: {
foopkg: 'License text for foopkg'
}
});
```
* **`licenseFileOverrides`** - override the license filename for specific packages (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
licenseFileOverrides: {
foopkg: 'The-License.txt'
}
});
```
Notes: The license filename is resolved relative to the package directory.
* **`renderLicenses`** - change the format / contents of the generated license file (default: print package name, license type, and license text)
Example:
```javascript
new LicenseWebpackPlugin({
renderLicenses: (modules) => {
console.log(modules[0].packageJson, modules[0].licenseId, modules[0].licenseText);
return JSON.stringify(modules);
}
});
```
* **`renderBanner`** - change the format / contents of the banner written to the top of each js file (default: print message indicating license filename)
⚠️ **Webpack V5 Users**: The `modules` parameter to `renderBanner` will be empty in webpack v5 due to technical limitations. In addition, TerserPlugin (which is automatically enabled on production builds to minify code and extract licenses) will interfere with the banner. In order to turn off the license handling feature of TerserPlugin, it needs to be reconfigured in webpack configuration like this:
```javascript
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false, // prevents TerserPlugin from extracting a [chunkName].js.LICENSE.txt file
terserOptions: {
format: {
// Tell terser to remove all comments except for the banner added via LicenseWebpackPlugin.
// This can be customized further to allow other types of comments to show up in the final js file as well.
// See the terser documentation for format.comments options for more details.
comments: (astNode, comment) => (comment.value.startsWith('! licenses are at '))
}
}
})
]
}
}
```
Example:
```javascript
new LicenseWebpackPlugin({
addBanner: true,
renderBanner: (filename, modules) => {
console.log(modules);
return '/*! licenses are at ' + filename + '*/';
}
});
```
* **`handleMissingLicenseText`** - do something when license text is missing from a package (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
handleMissingLicenseText: (packageName, licenseType) => {
console.log('Cannot find license for ' + packageName);
return 'UNKNOWN';
}
});
```
Notes: You can return your own license text from this function, but you should prefer using `licenseTextOverrides` first.
* **`licenseTemplateDir`** - use fallback license files for when a package is missing a license file (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
licenseTemplateDir: path.resolve(__dirname, 'licenseTemplates')
});
```
Notes: This option specifies a directory containing `.txt` files containing the license text based on the license type. (e.g. `MIT.txt`). Templates can be found [here](https://github.com/spdx/license-list).
* **`chunkIncludeExcludeTest`** - control which chunks gets processed by the plugin (default: all chunks get processed)
Example:
```javascript
new LicenseWebpackPlugin({
chunkIncludeExcludeTest: {
exclude: ['foo'],
include: ['bar']
}
});
```
Example:
```
new LicenseWebpackPlugin({
chunkIncludeExcludeTest: (chunkName) => chunkName.startsWith('abc')
});
```
Notes: If there is a duplicate entry in both the `exclude` and `include` array, the duplicated entry will be excluded.
* **`modulesDirectories`** - limit which directories get scanned for license files (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
modulesDirectories: [
path.resolve(__dirname, 'node_modules')
]
});
```
* **`additionalChunkModules`** - add additional node modules to a chunk (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
additionalChunkModules: {
main: [
{
name: 'somepkg',
directory: path.join(__dirname, 'node_modules', 'somepkg')
}
]
}
});
```
* **`additionalModules`** - add additional node modules to the scan (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
additionalModules: [
{
name: 'somepkg',
directory: path.join(__dirname, 'node_modules', 'somepkg')
}
]
});
```
* **`preferredLicenseTypes`** - help the plugin decide which license type to pick in case a package specifies multiple licenses (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
preferredLicenseTypes: ['MIT', 'ISC']
});
```
* **`handleLicenseAmbiguity`** - do something when the plugin finds ambiguous license types (default: pick first license type)
Example:
```javascript
new LicenseWebpackPlugin({
handleLicenseAmbiguity: (packageName, licenses) => {
console.log(packageName);
console.log(licenses[0].url);
return licenses[0].type;
}
});
```
Notes: This function is called whenever a license type could not be determined when a package uses the deprecated `licenses` field (which is an array of license types) in its package.json. It should return the license type to use. By default, the plugin prints a warning message to the console and chooses the first license type. You should use the `preferredLicenseTypes` option instead of this one.
* **`handleMissingLicenseType`** - do something when a package is missing a license type (default: disabled)
Example:
```javascript
new LicenseWebpackPlugin({
handleMissingLicenseType: (packageName) => {
console.log(packageName);
return null;
}
});
```
Notes: You can return a license type from this function, but it is a better idea to use the `licenseTypeOverrides` option.
* **`skipChildCompilers`** - do not apply the plugin to child webpack compilers (default: applies to child compilers too)
Example:
```javascript
new LicenseWebpackPlugin({
skipChildCompilers: true
});
```

15
node_modules/license-webpack-plugin/LICENSE generated vendored Normal file
View file

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2016, S K (xz64)
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

36
node_modules/license-webpack-plugin/MIGRATION.md generated vendored Normal file
View file

@ -0,0 +1,36 @@
# Migration Guide
## 3.x to 4.x
* Support for webpack 4 and below are now removed. Please use an older version of the plugin if you need it to work with webpack 4 or below.
## 2.x to 3.x
* Most builds can upgrade directly from 2.x to 3.x without having to change anything.
* The `webpack-sources` package is no longer bundled with the plugin nor listed as a peerDependency of the plugin. This allows the plugin to use the same version of `webpack-sources` that comes with the `webpack` installation.
## 1.x to 2.x
* The plugin no longer requires any explicit configuration. By default it will pick up all license types.
* The plugin no longer writes warnings/errors directly to console and instead reports warnings/errors to webpack.
* The `modulesDirectories` option defaults to null and requires full paths if specified. When `modulesDirectories` is null, third-party modules may be picked up from any directory.
* The following options have been removed:
- `buildRoot` - The plugin can work reliably without this option having to be specified now. You can remove it from your configuration.
- `suppressErrors` - Use the `stats` option on the plugin config instead to turn off warnings/errors.
- `pattern` - Use the new `licenseInclusionTest` option instead.
- `outputTemplate` - Use the new `renderLicenses` option instead.
- `includePackagesWithoutLicense` - Use the new `licenseInclusionTest` option instead.
- `unacceptablePattern` - Use the new `unacceptableLicenseTest` option instead.
- `abortOnUnacceptableLicense` - The plugin will send an error to webpack whenever an unacceptable license is found. Use the new `handleUnacceptableLicense` option if you want to do something in addition to that.
- `bannerTemplate` - Use the new `renderBanner` option instead.
- `includedChunks` - Use the new `chunkIncludeExcludeTest` option instead.
- `excludedChunks` - Use the new `chunkIncludeExcludeTest` option instead.
- `additionalPackages` - Use the new `additionalChunkModules` or `additionalModules` option instead.
* Check the [documentation](DOCUMENTATION.md) for information on how to use the new options.
## 0.6.x to 1.x
* Change `require('license-webpack-plugin')` to `require('license-webpack-plugin').LicenseWebpackPlugin`.
* Change `includeUndefined` in the plugin options to `includePackagesWithoutLicense`.
* The following options have been removed:
- `addVersion` - Use the new `outputTemplate` option to configure an ejs template to be used for writing the output.
- `addLicenseText` - Use the new `outputTemplate` option to configure an ejs template to be used for writing the output.
- `addUrl` - Use the new `outputTemplate` option to configure an ejs template to be used for writing the output.
- `filename` - The plugin outputs an individual file per chunk now and is configured by the `outputFilename` option. Check the `README.md` file to see how it works.

45
node_modules/license-webpack-plugin/README.md generated vendored Normal file
View file

@ -0,0 +1,45 @@
# License Webpack Plugin
[![Build Status](https://api.travis-ci.org/xz64/license-webpack-plugin.svg?branch=master)](https://travis-ci.org/xz64/license-webpack-plugin)
Manage third-party license compliance in your webpack build.
## Installation
`npm install license-webpack-plugin --save-dev`
## Usage
To use the plugin, simply add it to the plugins section in the webpack config.
Example:
```javascript
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
module.exports = {
plugins: [
new LicenseWebpackPlugin()
]
};
```
The default behavior will add a license notice file to each chunk of the webpack build. In addition, it will add a banner indicating the path to the license notice file in any Javascript assets. Third party libraries imported via external tools like SASS `@import` may not appear in the output (since webpack does not process `@import`). If this issue happens, please specify additional modules that the plugin should scan.
To configure the plugin, check the [documentation](DOCUMENTATION.md).
## Build Instructions
```
yarn
yarn build
```
## Migration Guides
Migration guides for breaking changes are documented [here](MIGRATION.md).
## Changelog
The changelog can be found [here](CHANGELOG.md).
## License
[ISC](https://opensource.org/licenses/ISC)

View file

@ -0,0 +1,9 @@
import { WebpackChunk } from './WebpackChunk';
import { WebpackCompilation } from './WebpackCompilation';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
interface AssetManager {
writeChunkLicenses(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation, chunk: WebpackChunk): void;
writeChunkBanners(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation, chunk: WebpackChunk): void;
writeAllLicenses(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation): void;
}
export { AssetManager };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,7 @@
import { IncludeExcludeTest } from './IncludeExcludeTest';
declare class ChunkIncludeExcludeTester {
private includeExcludeTest;
constructor(includeExcludeTest: IncludeExcludeTest);
isIncluded(chunkName: string): boolean;
}
export { ChunkIncludeExcludeTester };

View file

@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChunkIncludeExcludeTester = void 0;
var ChunkIncludeExcludeTester = /** @class */ (function () {
function ChunkIncludeExcludeTester(includeExcludeTest) {
this.includeExcludeTest = includeExcludeTest;
}
ChunkIncludeExcludeTester.prototype.isIncluded = function (chunkName) {
if (typeof this.includeExcludeTest === 'function') {
return this.includeExcludeTest(chunkName);
}
// only include
if (this.includeExcludeTest.include && !this.includeExcludeTest.exclude) {
return this.includeExcludeTest.include.indexOf(chunkName) > -1;
}
// only exclude
if (this.includeExcludeTest.exclude && !this.includeExcludeTest.include) {
// included as long as it's not excluded
return !(this.includeExcludeTest.exclude.indexOf(chunkName) > -1);
}
// include and exclude together
if (this.includeExcludeTest.include && this.includeExcludeTest.exclude) {
return (!(this.includeExcludeTest.exclude.indexOf(chunkName) > -1) &&
this.includeExcludeTest.include.indexOf(chunkName) > -1);
}
return true;
};
return ChunkIncludeExcludeTester;
}());
exports.ChunkIncludeExcludeTester = ChunkIncludeExcludeTester;

View file

@ -0,0 +1,43 @@
import { LicenseTest } from './LicenseTest';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
import { IncludeExcludeTest } from './IncludeExcludeTest';
import { Module } from './Module';
import { ConstructedStats } from './ConstructedStats';
interface ConstructedOptions {
buildRoot: string;
licenseInclusionTest: LicenseTest;
unacceptableLicenseTest: LicenseTest;
handleUnacceptableLicense: (packageName: string, licenseType: string) => void;
handleMissingLicenseText: (packageName: string, licenseType: string | null) => string | null;
perChunkOutput: boolean;
licenseTemplateDir?: string;
licenseFileOverrides: {
[key: string]: string;
};
licenseTextOverrides: {
[key: string]: string;
};
licenseTypeOverrides: {
[key: string]: string;
};
renderLicenses: (modules: LicenseIdentifiedModule[]) => string;
renderBanner: (filename: string, modules: LicenseIdentifiedModule[]) => string;
outputFilename: string;
addBanner: boolean;
chunkIncludeExcludeTest: IncludeExcludeTest;
modulesDirectories: string[] | null;
additionalChunkModules: {
[chunkName: string]: Module[];
};
additionalModules: Module[];
preferredLicenseTypes: string[];
handleLicenseAmbiguity: (packageName: string, licenses: {
type: string;
url: string;
}[]) => string;
handleMissingLicenseType: (packageName: string) => string | null;
excludedPackageTest: (packageName: string) => boolean;
stats: ConstructedStats;
skipChildCompilers: boolean;
}
export { ConstructedOptions };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,5 @@
interface ConstructedStats {
warnings: boolean;
errors: boolean;
}
export { ConstructedStats };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,8 @@
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
interface FileHandler {
getModule(filename: string | null | undefined): LicenseIdentifiedModule | null;
isBuildRoot(filename: string): boolean;
isInModuleDirectory(filename: string): boolean;
excludedPackageTest(filename: string): boolean;
}
export { FileHandler };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,11 @@
interface FileSystem {
pathSeparator: string;
pathExists(filename: string): boolean;
isFileInDirectory(filename: string, directory: string): boolean;
readFileAsUtf8(filename: string): string;
join(...paths: string[]): string;
resolvePath(path: string): string;
listPaths(dir: string): string[];
isDirectory(dir: string): boolean;
}
export { FileSystem };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,5 @@
declare type IncludeExcludeTest = {
include?: string[];
exclude?: string[];
} | ((chunkName: string) => boolean);
export { IncludeExcludeTest };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,4 @@
declare type LicenseFileOverrides = {
[key: string]: string;
};
export { LicenseFileOverrides };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,8 @@
import { Module } from './Module';
import { PackageJson } from './PackageJson';
interface LicenseIdentifiedModule extends Module {
packageJson?: PackageJson;
licenseId?: string | null;
licenseText?: string | null;
}
export { LicenseIdentifiedModule };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,7 @@
interface LicensePolicy {
isLicenseWrittenFor(licenseType: string | null): boolean;
isLicenseUnacceptableFor(licenseType: string | null): boolean;
handleUnacceptableLicense(packageName: string, licenseType: string | null): void;
handleMissingLicenseText(packageName: string, licenseType: string | null): void;
}
export { LicensePolicy };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,2 @@
declare type LicenseTest = (licenseName: string) => boolean;
export { LicenseTest };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,4 @@
interface LicenseTestRunner {
test(licenseId: string): boolean;
}
export { LicenseTestRunner };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,4 @@
declare type LicenseTextOverrides = {
[key: string]: string;
};
export { LicenseTextOverrides };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,19 @@
import { LicenseTextOverrides } from './LicenseTextOverrides';
import { FileSystem } from './FileSystem';
import { Module } from './Module';
import { LicenseFileOverrides } from './LicenseFilesOverrides';
import { WebpackCompilation } from './WebpackCompilation';
import { Logger } from './Logger';
declare class LicenseTextReader {
private logger;
private fileSystem;
private fileOverrides;
private textOverrides;
private templateDir;
private handleMissingLicenseText;
constructor(logger: Logger, fileSystem: FileSystem, fileOverrides: LicenseFileOverrides, textOverrides: LicenseTextOverrides, templateDir: string | undefined, handleMissingLicenseText: (packageName: string, licenseType: string | null) => string | null);
readLicense(compilation: WebpackCompilation, module: Module, licenseType: string | null): string | null;
readText(directory: string, filename: string): string;
private guessLicenseFilename;
}
export { LicenseTextReader };

View file

@ -0,0 +1,81 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LicenseTextReader = void 0;
var LicenseTextReader = /** @class */ (function () {
function LicenseTextReader(logger, fileSystem, fileOverrides, textOverrides, templateDir, handleMissingLicenseText) {
this.logger = logger;
this.fileSystem = fileSystem;
this.fileOverrides = fileOverrides;
this.textOverrides = textOverrides;
this.templateDir = templateDir;
this.handleMissingLicenseText = handleMissingLicenseText;
}
LicenseTextReader.prototype.readLicense = function (compilation, module, licenseType) {
if (this.textOverrides[module.name]) {
return this.textOverrides[module.name];
}
if (this.fileOverrides[module.name]) {
return this.readText(module.directory, this.fileOverrides[module.name]);
}
if (licenseType && licenseType.indexOf('SEE LICENSE IN ') === 0) {
var filename = licenseType.split(' ')[3];
return this.fileSystem.isFileInDirectory(filename, module.directory)
? this.readText(module.directory, filename)
: null;
}
var pathsInModuleDirectory = this.fileSystem.listPaths(module.directory);
var guessedLicenseFilename = this.guessLicenseFilename(pathsInModuleDirectory, module.directory);
if (guessedLicenseFilename !== null) {
return this.readText(module.directory, guessedLicenseFilename);
}
if (this.templateDir) {
var templateFilename = licenseType + ".txt";
var templateFilePath = this.fileSystem.join(this.templateDir, templateFilename);
if (this.fileSystem.isFileInDirectory(templateFilePath, this.templateDir)) {
return this.fileSystem
.readFileAsUtf8(templateFilePath)
.replace(/\r\n/g, '\n');
}
}
this.logger.warn(compilation, "could not find any license file for " + module.name + ". Use the licenseTextOverrides option to add the license text if desired.");
return this.handleMissingLicenseText(module.name, licenseType);
};
LicenseTextReader.prototype.readText = function (directory, filename) {
return this.fileSystem
.readFileAsUtf8(this.fileSystem.join(directory, filename))
.replace(/\r\n/g, '\n');
};
LicenseTextReader.prototype.guessLicenseFilename = function (paths, modulePath) {
var e_1, _a;
try {
for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
var path = paths_1_1.value;
var filePath = this.fileSystem.join(modulePath, path);
if (/^licen[cs]e/i.test(path) && !this.fileSystem.isDirectory(filePath)) {
return path;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
}
finally { if (e_1) throw e_1.error; }
}
return null;
};
return LicenseTextReader;
}());
exports.LicenseTextReader = LicenseTextReader;

View file

@ -0,0 +1,6 @@
import { PackageJson } from './PackageJson';
import { WebpackCompilation } from './WebpackCompilation';
interface LicenseTypeIdentifier {
findLicenseIdentifier(compilation: WebpackCompilation, packageName: string, packageJson: PackageJson): string | null;
}
export { LicenseTypeIdentifier };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,4 @@
declare type LicenseTypeOverrides = {
[key: string]: string;
} | null;
export { LicenseTypeOverrides };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,9 @@
import { WebpackCompiler } from './WebpackCompiler';
import { WebpackPlugin } from './WebpackPlugin';
import { PluginOptions } from './PluginOptions';
declare class LicenseWebpackPlugin implements WebpackPlugin {
private pluginOptions;
constructor(pluginOptions?: PluginOptions);
apply(compiler: WebpackCompiler): void;
}
export { LicenseWebpackPlugin };

View file

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LicenseWebpackPlugin = void 0;
var ChunkIncludeExcludeTester_1 = require("./ChunkIncludeExcludeTester");
var PluginChunkReadHandler_1 = require("./PluginChunkReadHandler");
var PluginFileHandler_1 = require("./PluginFileHandler");
var WebpackFileSystem_1 = require("./WebpackFileSystem");
var PluginLicenseTypeIdentifier_1 = require("./PluginLicenseTypeIdentifier");
var LicenseTextReader_1 = require("./LicenseTextReader");
var WebpackCompilerHandler_1 = require("./WebpackCompilerHandler");
var PluginModuleCache_1 = require("./PluginModuleCache");
var WebpackAssetManager_1 = require("./WebpackAssetManager");
var PluginLicensesRenderer_1 = require("./PluginLicensesRenderer");
var PluginLicensePolicy_1 = require("./PluginLicensePolicy");
var PluginLicenseTestRunner_1 = require("./PluginLicenseTestRunner");
var PluginOptionsReader_1 = require("./PluginOptionsReader");
var Logger_1 = require("./Logger");
var LicenseWebpackPlugin = /** @class */ (function () {
function LicenseWebpackPlugin(pluginOptions) {
if (pluginOptions === void 0) { pluginOptions = {}; }
this.pluginOptions = pluginOptions;
}
LicenseWebpackPlugin.prototype.apply = function (compiler) {
var fileSystem = new WebpackFileSystem_1.WebpackFileSystem(compiler.inputFileSystem);
var optionsReader = new PluginOptionsReader_1.PluginOptionsReader(compiler.context);
var options = optionsReader.readOptions(this.pluginOptions);
var logger = new Logger_1.Logger(options.stats);
var fileHandler = new PluginFileHandler_1.PluginFileHandler(fileSystem, options.buildRoot, options.modulesDirectories, options.excludedPackageTest);
var licenseTypeIdentifier = new PluginLicenseTypeIdentifier_1.PluginLicenseTypeIdentifier(logger, options.licenseTypeOverrides, options.preferredLicenseTypes, options.handleLicenseAmbiguity, options.handleMissingLicenseType);
var licenseTextReader = new LicenseTextReader_1.LicenseTextReader(logger, fileSystem, options.licenseFileOverrides, options.licenseTextOverrides, options.licenseTemplateDir, options.handleMissingLicenseText);
var licenseTestRunner = new PluginLicenseTestRunner_1.PluginLicenseTestRunner(options.licenseInclusionTest);
var unacceptableLicenseTestRunner = new PluginLicenseTestRunner_1.PluginLicenseTestRunner(options.unacceptableLicenseTest);
var policy = new PluginLicensePolicy_1.PluginLicensePolicy(licenseTestRunner, unacceptableLicenseTestRunner, options.handleUnacceptableLicense, options.handleMissingLicenseText);
var readHandler = new PluginChunkReadHandler_1.PluginChunkReadHandler(logger, fileHandler, licenseTypeIdentifier, licenseTextReader, policy, fileSystem);
var licenseRenderer = new PluginLicensesRenderer_1.PluginLicensesRenderer(options.renderLicenses, options.renderBanner);
var moduleCache = new PluginModuleCache_1.PluginModuleCache();
var assetManager = new WebpackAssetManager_1.WebpackAssetManager(options.outputFilename, licenseRenderer);
var chunkIncludeExcludeTester = new ChunkIncludeExcludeTester_1.ChunkIncludeExcludeTester(options.chunkIncludeExcludeTest);
var handler = new WebpackCompilerHandler_1.WebpackCompilerHandler(chunkIncludeExcludeTester, readHandler, assetManager, moduleCache, options.addBanner, options.perChunkOutput, options.additionalChunkModules, options.additionalModules, options.skipChildCompilers);
handler.handleCompiler(compiler);
};
return LicenseWebpackPlugin;
}());
exports.LicenseWebpackPlugin = LicenseWebpackPlugin;

View file

@ -0,0 +1,6 @@
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
interface LicensesRenderer {
renderLicenses(modules: LicenseIdentifiedModule[]): string;
renderBanner(filename: string, modules: LicenseIdentifiedModule[]): string;
}
export { LicensesRenderer };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

10
node_modules/license-webpack-plugin/dist/Logger.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import { ConstructedStats } from './ConstructedStats';
import { WebpackCompilation } from './WebpackCompilation';
declare class Logger {
private stats;
private static LOG_PREFIX;
constructor(stats: ConstructedStats);
warn(compilation: WebpackCompilation, message: string): void;
error(compilation: WebpackCompilation, message: string): void;
}
export { Logger };

21
node_modules/license-webpack-plugin/dist/Logger.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
var Logger = /** @class */ (function () {
function Logger(stats) {
this.stats = stats;
}
Logger.prototype.warn = function (compilation, message) {
if (this.stats.warnings) {
compilation.warnings.push("" + Logger.LOG_PREFIX + message);
}
};
Logger.prototype.error = function (compilation, message) {
if (this.stats.errors) {
compilation.errors.push("" + Logger.LOG_PREFIX + message);
}
};
Logger.LOG_PREFIX = 'license-webpack-plugin: ';
return Logger;
}());
exports.Logger = Logger;

5
node_modules/license-webpack-plugin/dist/Module.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
interface Module {
name: string;
directory: string;
}
export { Module };

2
node_modules/license-webpack-plugin/dist/Module.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,10 @@
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
interface ModuleCache {
registerModule(chunkName: string, module: LicenseIdentifiedModule): void;
markSeenForChunk(chunkName: string, packageName: string): void;
alreadySeenForChunk(chunkName: string, packageName: string): boolean;
getModule(packageName: string): LicenseIdentifiedModule | null;
getAllModulesForChunk(chunkName: string): LicenseIdentifiedModule[];
getAllModules(): LicenseIdentifiedModule[];
}
export { ModuleCache };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,13 @@
interface PackageJson {
name: string;
license?: string | {
type: string;
url: string;
};
licenses?: {
type: string;
url: string;
}[];
version: string;
}
export { PackageJson };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,28 @@
import { WebpackChunkHandler } from './WebpackChunkHandler';
import { WebpackChunk } from './WebpackChunk';
import { FileHandler } from './FileHandler';
import { LicenseTypeIdentifier } from './LicenseTypeIdentifier';
import { FileSystem } from './FileSystem';
import { LicenseTextReader } from './LicenseTextReader';
import { ModuleCache } from './ModuleCache';
import { LicensePolicy } from './LicensePolicy';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
import { WebpackCompilation } from './WebpackCompilation';
import { Logger } from './Logger';
import { WebpackStats } from './WebpackStats';
declare class PluginChunkReadHandler implements WebpackChunkHandler {
private logger;
private fileHandler;
private licenseTypeIdentifier;
private licenseTextReader;
private licensePolicy;
private fileSystem;
private moduleIterator;
private innerModuleIterator;
constructor(logger: Logger, fileHandler: FileHandler, licenseTypeIdentifier: LicenseTypeIdentifier, licenseTextReader: LicenseTextReader, licensePolicy: LicensePolicy, fileSystem: FileSystem);
processChunk(compilation: WebpackCompilation, chunk: WebpackChunk, moduleCache: ModuleCache, stats: WebpackStats | undefined): void;
private extractIdentifiedModule;
private getPackageJson;
processModule(compilation: WebpackCompilation, chunk: WebpackChunk, moduleCache: ModuleCache, module: LicenseIdentifiedModule): void;
}
export { PluginChunkReadHandler };

View file

@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginChunkReadHandler = void 0;
var WebpackChunkModuleIterator_1 = require("./WebpackChunkModuleIterator");
var WebpackInnerModuleIterator_1 = require("./WebpackInnerModuleIterator");
var PluginChunkReadHandler = /** @class */ (function () {
function PluginChunkReadHandler(logger, fileHandler, licenseTypeIdentifier, licenseTextReader, licensePolicy, fileSystem) {
this.logger = logger;
this.fileHandler = fileHandler;
this.licenseTypeIdentifier = licenseTypeIdentifier;
this.licenseTextReader = licenseTextReader;
this.licensePolicy = licensePolicy;
this.fileSystem = fileSystem;
this.moduleIterator = new WebpackChunkModuleIterator_1.WebpackChunkModuleIterator();
this.innerModuleIterator = new WebpackInnerModuleIterator_1.WebpackInnerModuleIterator(require.resolve);
}
PluginChunkReadHandler.prototype.processChunk = function (compilation, chunk, moduleCache, stats) {
var _this = this;
this.moduleIterator.iterateModules(compilation, chunk, stats, function (chunkModule) {
_this.innerModuleIterator.iterateModules(chunkModule, function (module) {
var identifiedModule = _this.extractIdentifiedModule(module) ||
_this.fileHandler.getModule(module.resource);
if (identifiedModule) {
_this.processModule(compilation, chunk, moduleCache, identifiedModule);
}
});
});
};
PluginChunkReadHandler.prototype.extractIdentifiedModule = function (module) {
var resolved = module.resourceResolveData;
if (!resolved)
return undefined;
var directory = resolved.descriptionFileRoot, packageJson = resolved.descriptionFileData;
if (
// if missing data, fall back to fs module hunting
directory &&
packageJson &&
packageJson.name &&
// user checks to decide if we should include the module
this.fileHandler.isInModuleDirectory(directory) &&
!this.fileHandler.isBuildRoot(directory) &&
!this.fileHandler.excludedPackageTest(packageJson.name)) {
return {
directory: directory,
packageJson: packageJson,
name: packageJson.name
};
}
return undefined;
};
PluginChunkReadHandler.prototype.getPackageJson = function (directory) {
var filename = "" + directory + this.fileSystem.pathSeparator + "package.json";
return JSON.parse(this.fileSystem.readFileAsUtf8(filename));
};
PluginChunkReadHandler.prototype.processModule = function (compilation, chunk, moduleCache, module) {
var _a;
if (!moduleCache.alreadySeenForChunk(chunk.name, module.name)) {
var alreadyIncludedModule = moduleCache.getModule(module.name);
if (alreadyIncludedModule !== null) {
moduleCache.registerModule(chunk.name, alreadyIncludedModule);
}
else {
// module not yet in cache
var packageJson = (_a = module.packageJson) !== null && _a !== void 0 ? _a : this.getPackageJson(module.directory);
var licenseType = this.licenseTypeIdentifier.findLicenseIdentifier(compilation, module.name, packageJson);
if (this.licensePolicy.isLicenseUnacceptableFor(licenseType)) {
this.logger.error(compilation, "unacceptable license found for " + module.name + ": " + licenseType);
this.licensePolicy.handleUnacceptableLicense(module.name, licenseType);
}
if (this.licensePolicy.isLicenseWrittenFor(licenseType)) {
var licenseText = this.licenseTextReader.readLicense(compilation, module, licenseType);
moduleCache.registerModule(chunk.name, {
licenseText: licenseText,
packageJson: packageJson,
name: module.name,
directory: module.directory,
licenseId: licenseType
});
}
}
moduleCache.markSeenForChunk(chunk.name, module.name);
}
};
return PluginChunkReadHandler;
}());
exports.PluginChunkReadHandler = PluginChunkReadHandler;

View file

@ -0,0 +1,20 @@
import { FileHandler } from './FileHandler';
import { FileSystem } from './FileSystem';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
declare class PluginFileHandler implements FileHandler {
private fileSystem;
private buildRoot;
private modulesDirectories;
excludedPackageTest: (packageName: string) => boolean;
private cache;
constructor(fileSystem: FileSystem, buildRoot: string, modulesDirectories: string[] | null, excludedPackageTest: (packageName: string) => boolean);
static PACKAGE_JSON: string;
getModule(filename: string): LicenseIdentifiedModule | null;
isInModuleDirectory(filename: string): boolean;
isBuildRoot(filename: string): boolean;
private getModuleInternal;
private findModuleDir;
private parsePackageJson;
private dirContainsValidPackageJson;
}
export { PluginFileHandler };

View file

@ -0,0 +1,105 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginFileHandler = void 0;
var PluginFileHandler = /** @class */ (function () {
function PluginFileHandler(fileSystem, buildRoot, modulesDirectories, excludedPackageTest) {
this.fileSystem = fileSystem;
this.buildRoot = buildRoot;
this.modulesDirectories = modulesDirectories;
this.excludedPackageTest = excludedPackageTest;
this.cache = {};
}
PluginFileHandler.prototype.getModule = function (filename) {
return this.cache[filename] === undefined
? (this.cache[filename] = this.getModuleInternal(filename))
: this.cache[filename];
};
PluginFileHandler.prototype.isInModuleDirectory = function (filename) {
var e_1, _a;
if (this.modulesDirectories === null)
return true;
if (filename === null || filename === undefined)
return false;
var foundInModuleDirectory = false;
var resolvedPath = this.fileSystem.resolvePath(filename);
try {
for (var _b = __values(this.modulesDirectories), _c = _b.next(); !_c.done; _c = _b.next()) {
var modulesDirectory = _c.value;
if (resolvedPath.startsWith(this.fileSystem.resolvePath(modulesDirectory))) {
foundInModuleDirectory = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return foundInModuleDirectory;
};
PluginFileHandler.prototype.isBuildRoot = function (filename) {
return this.buildRoot === filename;
};
PluginFileHandler.prototype.getModuleInternal = function (filename) {
if (filename === null || filename === undefined)
return null;
if (!this.isInModuleDirectory(filename))
return null;
var module = this.findModuleDir(filename);
if (module !== null && this.excludedPackageTest(module.name)) {
return null;
}
return module;
};
PluginFileHandler.prototype.findModuleDir = function (filename) {
var pathSeparator = this.fileSystem.pathSeparator;
var dirOfModule = filename.substring(0, filename.lastIndexOf(pathSeparator));
var oldDirOfModule = null;
while (!this.dirContainsValidPackageJson(dirOfModule)) {
// check parent directory
oldDirOfModule = dirOfModule;
dirOfModule = this.fileSystem.resolvePath("" + dirOfModule + pathSeparator + ".." + pathSeparator);
// reached filesystem root
if (oldDirOfModule === dirOfModule) {
return null;
}
}
if (this.isBuildRoot(dirOfModule)) {
return null;
}
var packageJson = this.parsePackageJson(dirOfModule);
return {
packageJson: packageJson,
name: packageJson.name,
directory: dirOfModule
};
};
PluginFileHandler.prototype.parsePackageJson = function (dirOfModule) {
var packageJsonText = this.fileSystem.readFileAsUtf8(this.fileSystem.join(dirOfModule, PluginFileHandler.PACKAGE_JSON));
var packageJson = JSON.parse(packageJsonText);
return packageJson;
};
PluginFileHandler.prototype.dirContainsValidPackageJson = function (dirOfModule) {
if (!this.fileSystem.pathExists(this.fileSystem.join(dirOfModule, PluginFileHandler.PACKAGE_JSON))) {
return false;
}
var packageJson = this.parsePackageJson(dirOfModule);
return !!packageJson.name;
};
PluginFileHandler.PACKAGE_JSON = 'package.json';
return PluginFileHandler;
}());
exports.PluginFileHandler = PluginFileHandler;

View file

@ -0,0 +1,14 @@
import { LicensePolicy } from './LicensePolicy';
import { LicenseTestRunner } from './LicenseTestRunner';
declare class PluginLicensePolicy implements LicensePolicy {
private licenseTester;
private unacceptableLicenseTester;
private unacceptableLicenseHandler;
private missingLicenseTextHandler;
constructor(licenseTester: LicenseTestRunner, unacceptableLicenseTester: LicenseTestRunner, unacceptableLicenseHandler: (packageName: string, licenseType: string) => void, missingLicenseTextHandler: (packageName: string, licenseType: string) => void);
isLicenseWrittenFor(licenseType: string): boolean;
isLicenseUnacceptableFor(licenseType: string): boolean;
handleUnacceptableLicense(packageName: string, licenseType: string): void;
handleMissingLicenseText(packageName: string, licenseType: string): void;
}
export { PluginLicensePolicy };

View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginLicensePolicy = void 0;
var PluginLicensePolicy = /** @class */ (function () {
function PluginLicensePolicy(licenseTester, unacceptableLicenseTester, unacceptableLicenseHandler, missingLicenseTextHandler) {
this.licenseTester = licenseTester;
this.unacceptableLicenseTester = unacceptableLicenseTester;
this.unacceptableLicenseHandler = unacceptableLicenseHandler;
this.missingLicenseTextHandler = missingLicenseTextHandler;
}
PluginLicensePolicy.prototype.isLicenseWrittenFor = function (licenseType) {
return this.licenseTester.test(licenseType);
};
PluginLicensePolicy.prototype.isLicenseUnacceptableFor = function (licenseType) {
return this.unacceptableLicenseTester.test(licenseType);
};
PluginLicensePolicy.prototype.handleUnacceptableLicense = function (packageName, licenseType) {
this.unacceptableLicenseHandler(packageName, licenseType);
};
PluginLicensePolicy.prototype.handleMissingLicenseText = function (packageName, licenseType) {
this.missingLicenseTextHandler(packageName, licenseType);
};
return PluginLicensePolicy;
}());
exports.PluginLicensePolicy = PluginLicensePolicy;

View file

@ -0,0 +1,8 @@
import { LicenseTest } from './LicenseTest';
import { LicenseTestRunner } from './LicenseTestRunner';
declare class PluginLicenseTestRunner implements LicenseTestRunner {
private licenseTest;
constructor(licenseTest: LicenseTest);
test(licenseId: string): boolean;
}
export { PluginLicenseTestRunner };

View file

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginLicenseTestRunner = void 0;
var PluginLicenseTestRunner = /** @class */ (function () {
function PluginLicenseTestRunner(licenseTest) {
this.licenseTest = licenseTest;
}
PluginLicenseTestRunner.prototype.test = function (licenseId) {
return this.licenseTest(licenseId);
};
return PluginLicenseTestRunner;
}());
exports.PluginLicenseTestRunner = PluginLicenseTestRunner;

View file

@ -0,0 +1,19 @@
import { LicenseTypeIdentifier } from './LicenseTypeIdentifier';
import { PackageJson } from './PackageJson';
import { LicenseTypeOverrides } from './LicenseTypeOverrides';
import { WebpackCompilation } from './WebpackCompilation';
import { Logger } from './Logger';
declare class PluginLicenseTypeIdentifier implements LicenseTypeIdentifier {
private logger;
private licenseTypeOverrides;
private preferredLicenseTypes;
private handleLicenseAmbiguity;
private handleMissingLicenseType;
constructor(logger: Logger, licenseTypeOverrides: LicenseTypeOverrides, preferredLicenseTypes: string[], handleLicenseAmbiguity: (packageName: string, licenses: {
type: string;
url: string;
}[]) => string, handleMissingLicenseType: (packageName: string) => string | null);
findLicenseIdentifier(compilation: WebpackCompilation, packageName: string, packageJson: PackageJson): string | null;
private findPreferredLicense;
}
export { PluginLicenseTypeIdentifier };

View file

@ -0,0 +1,86 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginLicenseTypeIdentifier = void 0;
var PluginLicenseTypeIdentifier = /** @class */ (function () {
function PluginLicenseTypeIdentifier(logger, licenseTypeOverrides, preferredLicenseTypes, handleLicenseAmbiguity, handleMissingLicenseType) {
this.logger = logger;
this.licenseTypeOverrides = licenseTypeOverrides;
this.preferredLicenseTypes = preferredLicenseTypes;
this.handleLicenseAmbiguity = handleLicenseAmbiguity;
this.handleMissingLicenseType = handleMissingLicenseType;
}
PluginLicenseTypeIdentifier.prototype.findLicenseIdentifier = function (compilation, packageName, packageJson) {
if (this.licenseTypeOverrides && this.licenseTypeOverrides[packageName]) {
return this.licenseTypeOverrides[packageName];
}
var licensePropValue = packageJson.license;
if (licensePropValue) {
return typeof licensePropValue === 'string'
? licensePropValue
: licensePropValue.type;
}
// handle deprecated "licenses" field in package.json
if (Array.isArray(packageJson.licenses) &&
packageJson.licenses.length > 0) {
if (packageJson.licenses.length === 1) {
return packageJson.licenses[0].type;
}
// handle multiple licenses when we have a preferred license type
var licenseTypes = packageJson.licenses.map(function (x) { return x.type; });
var licenseType = this.findPreferredLicense(licenseTypes, this.preferredLicenseTypes);
if (licenseType !== null) {
// found preferred license
return licenseType;
}
var resolvedLicenseType = this.handleLicenseAmbiguity(packageName, packageJson.licenses);
this.logger.warn(compilation, packageName + " specifies multiple licenses: " + licenseTypes + ". Automatically selected " + resolvedLicenseType + ". Use the preferredLicenseTypes or the licenseTypeOverrides option to resolve this warning.");
return resolvedLicenseType;
}
this.logger.warn(compilation, "could not find any license type for " + packageName + " in its package.json");
return this.handleMissingLicenseType(packageName);
};
PluginLicenseTypeIdentifier.prototype.findPreferredLicense = function (licenseTypes, preferredLicenseTypes) {
var e_1, _a, e_2, _b;
try {
for (var preferredLicenseTypes_1 = __values(preferredLicenseTypes), preferredLicenseTypes_1_1 = preferredLicenseTypes_1.next(); !preferredLicenseTypes_1_1.done; preferredLicenseTypes_1_1 = preferredLicenseTypes_1.next()) {
var preferredLicenseType = preferredLicenseTypes_1_1.value;
try {
for (var licenseTypes_1 = (e_2 = void 0, __values(licenseTypes)), licenseTypes_1_1 = licenseTypes_1.next(); !licenseTypes_1_1.done; licenseTypes_1_1 = licenseTypes_1.next()) {
var licenseType = licenseTypes_1_1.value;
if (preferredLicenseType === licenseType) {
return preferredLicenseType;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (licenseTypes_1_1 && !licenseTypes_1_1.done && (_b = licenseTypes_1.return)) _b.call(licenseTypes_1);
}
finally { if (e_2) throw e_2.error; }
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (preferredLicenseTypes_1_1 && !preferredLicenseTypes_1_1.done && (_a = preferredLicenseTypes_1.return)) _a.call(preferredLicenseTypes_1);
}
finally { if (e_1) throw e_1.error; }
}
return null;
};
return PluginLicenseTypeIdentifier;
}());
exports.PluginLicenseTypeIdentifier = PluginLicenseTypeIdentifier;

View file

@ -0,0 +1,8 @@
import { LicensesRenderer } from './LicensesRenderer';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
declare class PluginLicensesRenderer implements LicensesRenderer {
renderLicenses: (modules: LicenseIdentifiedModule[]) => string;
renderBanner: (filename: string, modules: LicenseIdentifiedModule[]) => string;
constructor(renderLicenses: (modules: LicenseIdentifiedModule[]) => string, renderBanner: (filename: string, modules: LicenseIdentifiedModule[]) => string);
}
export { PluginLicensesRenderer };

View file

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginLicensesRenderer = void 0;
var PluginLicensesRenderer = /** @class */ (function () {
function PluginLicensesRenderer(renderLicenses, renderBanner) {
this.renderLicenses = renderLicenses;
this.renderBanner = renderBanner;
}
return PluginLicensesRenderer;
}());
exports.PluginLicensesRenderer = PluginLicensesRenderer;

View file

@ -0,0 +1,14 @@
import { ModuleCache } from './ModuleCache';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
declare class PluginModuleCache implements ModuleCache {
private totalCache;
private chunkCache;
private chunkSeenCache;
registerModule(chunkName: string, module: LicenseIdentifiedModule): void;
getModule(packageName: string): LicenseIdentifiedModule | null;
markSeenForChunk(chunkName: string, packageName: string): void;
alreadySeenForChunk(chunkName: string, packageName: string): boolean;
getAllModulesForChunk(chunkName: string): LicenseIdentifiedModule[];
getAllModules(): LicenseIdentifiedModule[];
}
export { PluginModuleCache };

View file

@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginModuleCache = void 0;
var PluginModuleCache = /** @class */ (function () {
function PluginModuleCache() {
this.totalCache = {};
this.chunkCache = {};
this.chunkSeenCache = {};
}
PluginModuleCache.prototype.registerModule = function (chunkName, module) {
this.totalCache[module.name] = module;
if (!this.chunkCache[chunkName]) {
this.chunkCache[chunkName] = {};
}
this.chunkCache[chunkName][module.name] = module;
};
PluginModuleCache.prototype.getModule = function (packageName) {
return this.totalCache[packageName] || null;
};
PluginModuleCache.prototype.markSeenForChunk = function (chunkName, packageName) {
if (!this.chunkSeenCache[chunkName]) {
this.chunkSeenCache[chunkName] = {};
}
this.chunkSeenCache[chunkName][packageName] = true;
};
PluginModuleCache.prototype.alreadySeenForChunk = function (chunkName, packageName) {
return !!(this.chunkSeenCache[chunkName] &&
this.chunkSeenCache[chunkName][packageName]);
};
PluginModuleCache.prototype.getAllModulesForChunk = function (chunkName) {
var modules = [];
var cache = this.chunkCache[chunkName];
if (cache) {
Object.keys(cache).forEach(function (key) {
modules.push(cache[key]);
});
}
return modules;
};
PluginModuleCache.prototype.getAllModules = function () {
var _this = this;
var modules = [];
Object.keys(this.totalCache).forEach(function (key) {
modules.push(_this.totalCache[key]);
});
return modules;
};
return PluginModuleCache;
}());
exports.PluginModuleCache = PluginModuleCache;

View file

@ -0,0 +1,42 @@
import { LicenseTest } from './LicenseTest';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
import { IncludeExcludeTest } from './IncludeExcludeTest';
import { Module } from './Module';
import { PluginStats } from './PluginStats';
interface PluginOptions {
licenseInclusionTest?: LicenseTest;
unacceptableLicenseTest?: LicenseTest;
handleUnacceptableLicense?: (packageName: string, licenseType: string) => void;
handleMissingLicenseText?: (packageName: string, licenseType: string | null) => string | null;
perChunkOutput?: boolean;
licenseTemplateDir?: string;
licenseTextOverrides?: {
[key: string]: string;
};
licenseFileOverrides?: {
[key: string]: string;
};
licenseTypeOverrides?: {
[key: string]: string;
};
renderLicenses?: (modules: LicenseIdentifiedModule[]) => string;
renderBanner?: (filename: string, modules: LicenseIdentifiedModule[]) => string;
outputFilename?: string;
addBanner?: boolean;
chunkIncludeExcludeTest?: IncludeExcludeTest;
modulesDirectories?: string[];
additionalChunkModules?: {
[chunkName: string]: Module[];
};
additionalModules?: Module[];
preferredLicenseTypes?: string[];
handleLicenseAmbiguity?: (packageName: string, licenses: {
type: string;
url: string;
}[]) => string;
handleMissingLicenseType?: (packageName: string) => string | null;
excludedPackageTest?: (packageName: string) => boolean;
stats?: PluginStats;
skipChildCompilers?: boolean;
}
export { PluginOptions };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,8 @@
import { ConstructedOptions } from './ConstructedOptions';
import { PluginOptions } from './PluginOptions';
declare class PluginOptionsReader {
private context;
constructor(context: string);
readOptions(options: PluginOptions): ConstructedOptions;
}
export { PluginOptionsReader };

View file

@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginOptionsReader = void 0;
var PluginOptionsReader = /** @class */ (function () {
function PluginOptionsReader(context) {
this.context = context;
}
PluginOptionsReader.prototype.readOptions = function (options) {
var licenseInclusionTest = options.licenseInclusionTest || (function () { return true; });
var unacceptableLicenseTest = options.unacceptableLicenseTest || (function () { return false; });
var perChunkOutput = options.perChunkOutput === undefined || options.perChunkOutput;
var licenseTemplateDir = options.licenseTemplateDir;
var licenseTextOverrides = options.licenseTextOverrides || {};
var licenseTypeOverrides = options.licenseTypeOverrides || {};
var handleUnacceptableLicense = options.handleUnacceptableLicense || (function () { });
var handleMissingLicenseText = options.handleMissingLicenseText || (function () { return null; });
var renderLicenses = options.renderLicenses ||
(function (modules) {
return modules
.sort(function (left, right) {
return left.name < right.name ? -1 : 1;
})
.reduce(function (file, module) {
return "" + file + module.name + (module.licenseId ? "\n" + module.licenseId : '') + (module.licenseText ? "\n" + module.licenseText : '') + "\n\n";
}, '')
.trim() + "\n";
});
var renderBanner = options.renderBanner ||
(function (filename) {
return "/*! License information is available at " + filename + " */";
});
var outputFilename = options.outputFilename ||
(perChunkOutput ? '[name].licenses.txt' : 'licenses.txt');
var addBanner = options.addBanner === undefined ? false : options.addBanner;
var chunkIncludeExcludeTest = options.chunkIncludeExcludeTest || (function () { return true; });
var modulesDirectories = options.modulesDirectories || null;
var additionalChunkModules = options.additionalChunkModules || {};
var additionalModules = options.additionalModules || [];
var preferredLicenseTypes = options.preferredLicenseTypes || [];
var handleLicenseAmbiguity = options.handleLicenseAmbiguity ||
(function (_packageName, licenses) {
return licenses[0].type;
});
var handleMissingLicenseType = options.handleMissingLicenseType || (function () { return null; });
var licenseFileOverrides = options.licenseFileOverrides || {};
var excludedPackageTest = options.excludedPackageTest || (function () { return false; });
var stats = {
warnings: options.stats && options.stats.warnings !== undefined
? options.stats.warnings
: true,
errors: options.stats && options.stats.errors !== undefined
? options.stats.errors
: true
};
var skipChildCompilers = !!options.skipChildCompilers;
var constructedOptions = {
licenseInclusionTest: licenseInclusionTest,
unacceptableLicenseTest: unacceptableLicenseTest,
perChunkOutput: perChunkOutput,
licenseTemplateDir: licenseTemplateDir,
licenseTextOverrides: licenseTextOverrides,
licenseFileOverrides: licenseFileOverrides,
licenseTypeOverrides: licenseTypeOverrides,
handleUnacceptableLicense: handleUnacceptableLicense,
handleMissingLicenseText: handleMissingLicenseText,
renderLicenses: renderLicenses,
renderBanner: renderBanner,
outputFilename: outputFilename,
addBanner: addBanner,
chunkIncludeExcludeTest: chunkIncludeExcludeTest,
modulesDirectories: modulesDirectories,
additionalChunkModules: additionalChunkModules,
additionalModules: additionalModules,
preferredLicenseTypes: preferredLicenseTypes,
handleLicenseAmbiguity: handleLicenseAmbiguity,
handleMissingLicenseType: handleMissingLicenseType,
excludedPackageTest: excludedPackageTest,
stats: stats,
skipChildCompilers: skipChildCompilers,
buildRoot: this.context
};
return constructedOptions;
};
return PluginOptionsReader;
}());
exports.PluginOptionsReader = PluginOptionsReader;

View file

@ -0,0 +1,5 @@
interface PluginStats {
warnings?: boolean;
errors?: boolean;
}
export { PluginStats };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,14 @@
import { AssetManager } from './AssetManager';
import { WebpackCompilation } from './WebpackCompilation';
import { WebpackChunk } from './WebpackChunk';
import { LicensesRenderer } from './LicensesRenderer';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
declare class WebpackAssetManager implements AssetManager {
private outputFilename;
private licensesRenderer;
constructor(outputFilename: string, licensesRenderer: LicensesRenderer);
writeChunkLicenses(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation, chunk: WebpackChunk): void;
writeChunkBanners(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation, chunk: WebpackChunk): void;
writeAllLicenses(modules: LicenseIdentifiedModule[], compilation: WebpackCompilation): void;
}
export { WebpackAssetManager };

View file

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebpackAssetManager = void 0;
var webpack_sources_1 = require("webpack-sources");
var WebpackAssetManager = /** @class */ (function () {
function WebpackAssetManager(outputFilename, licensesRenderer) {
this.outputFilename = outputFilename;
this.licensesRenderer = licensesRenderer;
}
WebpackAssetManager.prototype.writeChunkLicenses = function (modules, compilation, chunk) {
var text = this.licensesRenderer.renderLicenses(modules);
if (text && text.trim()) {
var filename = compilation.getPath(this.outputFilename, { chunk: chunk });
compilation.assets[filename] = new webpack_sources_1.RawSource(text);
}
};
WebpackAssetManager.prototype.writeChunkBanners = function (modules, compilation, chunk) {
var filename = compilation.getPath(this.outputFilename, { chunk: chunk });
var text = this.licensesRenderer.renderBanner(filename, modules);
if (text && text.trim()) {
var files = chunk.files instanceof Set ? Array.from(chunk.files) : chunk.files;
files
.filter(function (file) { return /\.js$/.test(file); })
.forEach(function (file) {
compilation.assets[file] = new webpack_sources_1.ConcatSource(text, compilation.assets[file]);
});
}
};
WebpackAssetManager.prototype.writeAllLicenses = function (modules, compilation) {
var text = this.licensesRenderer.renderLicenses(modules);
if (text) {
var filename = compilation.getPath(this.outputFilename, compilation);
compilation.assets[filename] = new webpack_sources_1.RawSource(text);
}
};
return WebpackAssetManager;
}());
exports.WebpackAssetManager = WebpackAssetManager;

View file

@ -0,0 +1,9 @@
import { WebpackChunkModule } from './WebpackChunkModule';
export interface WebpackChunk {
name: string;
modulesIterable?: IterableIterator<WebpackChunkModule>;
forEachModule?: (callback: (module: WebpackChunkModule) => void) => void;
modules?: WebpackChunkModule[];
entryModule?: WebpackChunkModule;
files: string[] | Set<string>;
}

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,10 @@
import { WebpackChunk } from './WebpackChunk';
import { ModuleCache } from './ModuleCache';
import { LicenseIdentifiedModule } from './LicenseIdentifiedModule';
import { WebpackCompilation } from './WebpackCompilation';
import { WebpackStats } from './WebpackStats';
interface WebpackChunkHandler {
processChunk(compilation: WebpackCompilation, chunk: WebpackChunk, moduleCache: ModuleCache, stats: WebpackStats | undefined): void;
processModule(compilation: WebpackCompilation, chunk: WebpackChunk, moduleCache: ModuleCache, module: LicenseIdentifiedModule): void;
}
export { WebpackChunkHandler };

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,16 @@
import { PackageJson } from './PackageJson';
export interface WebpackChunkModule {
resource?: string;
rootModule?: {
resource?: string;
};
originModule?: {
resource?: string;
};
fileDependencies?: string[];
dependencies?: WebpackChunkModule[];
resourceResolveData?: {
descriptionFileRoot: string;
descriptionFileData: PackageJson;
};
}

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,9 @@
import { WebpackChunk } from './WebpackChunk';
import { WebpackChunkModule } from './WebpackChunkModule';
import { WebpackCompilation } from './WebpackCompilation';
import { WebpackStats } from './WebpackStats';
declare class WebpackChunkModuleIterator {
private statsIterator;
iterateModules(compilation: WebpackCompilation, chunk: WebpackChunk, stats: WebpackStats | undefined, callback: (module: WebpackChunkModule) => void): void;
}
export { WebpackChunkModuleIterator };

View file

@ -0,0 +1,95 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebpackChunkModuleIterator = void 0;
var WebpackStatsIterator_1 = require("./WebpackStatsIterator");
var WebpackChunkModuleIterator = /** @class */ (function () {
function WebpackChunkModuleIterator() {
this.statsIterator = new WebpackStatsIterator_1.WebpackStatsIterator();
}
WebpackChunkModuleIterator.prototype.iterateModules = function (compilation, chunk, stats, callback) {
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
if (typeof compilation.chunkGraph !== 'undefined' &&
typeof stats !== 'undefined') {
try {
// webpack v5
for (var _e = __values(compilation.chunkGraph.getChunkModulesIterable(chunk)), _f = _e.next(); !_f.done; _f = _e.next()) {
var module_1 = _f.value;
callback(module_1);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
var statsModules = this.statsIterator.collectModules(stats, chunk.name);
try {
for (var statsModules_1 = __values(statsModules), statsModules_1_1 = statsModules_1.next(); !statsModules_1_1.done; statsModules_1_1 = statsModules_1.next()) {
var module_2 = statsModules_1_1.value;
callback(module_2);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (statsModules_1_1 && !statsModules_1_1.done && (_b = statsModules_1.return)) _b.call(statsModules_1);
}
finally { if (e_2) throw e_2.error; }
}
}
else if (typeof chunk.modulesIterable !== 'undefined') {
try {
for (var _g = __values(chunk.modulesIterable), _h = _g.next(); !_h.done; _h = _g.next()) {
var module_3 = _h.value;
callback(module_3);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
}
finally { if (e_3) throw e_3.error; }
}
}
else if (typeof chunk.forEachModule === 'function') {
chunk.forEachModule(callback);
}
else if (Array.isArray(chunk.modules)) {
chunk.modules.forEach(callback);
}
if (typeof compilation.chunkGraph !== 'undefined') {
try {
for (var _j = __values(compilation.chunkGraph.getChunkEntryModulesIterable(chunk)), _k = _j.next(); !_k.done; _k = _j.next()) {
var module_4 = _k.value;
callback(module_4);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
}
finally { if (e_4) throw e_4.error; }
}
}
else if (chunk.entryModule) {
callback(chunk.entryModule);
}
};
return WebpackChunkModuleIterator;
}());
exports.WebpackChunkModuleIterator = WebpackChunkModuleIterator;

View file

@ -0,0 +1,46 @@
import { WebpackChunk } from './WebpackChunk';
import { Source } from 'webpack-sources';
import { ChunkGraph } from './ChunkGraph';
import { WebpackCompiler } from './WebpackCompiler';
import { WebpackStats } from './WebpackStats';
export interface WebpackCompilation {
hash: string;
chunks: IterableIterator<WebpackChunk>;
assets: {
[key: string]: Source;
};
errors: any[];
warnings: any[];
getPath(filename: string, data: {
hash?: any;
chunk?: any;
filename?: string;
basename?: string;
query?: any;
}): string;
hooks: {
optimizeChunkAssets: {
tap: (pluginName: string, handler: (chunks: IterableIterator<WebpackChunk>) => void) => void;
};
processAssets: {
tap: (options: {
name: string;
stage: number;
}, handler: () => void) => void;
};
};
plugin?: (phase: string, callback: Function) => void;
chunkGraph?: ChunkGraph;
compiler: WebpackCompiler;
getStats: () => {
toJson: (options?: WebpackStatsOptions) => WebpackStats;
};
}
export interface WebpackStatsOptions {
all?: boolean;
chunks?: boolean;
chunkModules?: boolean;
nestedModules?: boolean;
dependentModules?: boolean;
cachedModules?: boolean;
}

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,18 @@
import { WebpackCompilation } from './WebpackCompilation';
export interface WebpackCompiler {
hooks: {
thisCompilation: {
tap: (pluginName: string, handler: (compilation: WebpackCompilation) => void) => void;
};
compilation: {
tap: (pluginName: string, handler: (compilation: WebpackCompilation) => void) => void;
};
emit: {
tap: (pluginName: string, handler: (compilation: WebpackCompilation) => void) => void;
};
};
context: string;
inputFileSystem: any;
plugin?: (phase: string, callback: Function) => void;
isChild: () => boolean;
}

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,26 @@
import { WebpackChunkHandler } from './WebpackChunkHandler';
import { WebpackCompiler } from './WebpackCompiler';
import { ChunkIncludeExcludeTester } from './ChunkIncludeExcludeTester';
import { ModuleCache } from './ModuleCache';
import { AssetManager } from './AssetManager';
import { Module } from './Module';
declare class WebpackCompilerHandler {
private chunkIncludeTester;
private chunkHandler;
private assetManager;
private moduleCache;
private addBanner;
private perChunkOutput;
private additionalChunkModules;
private additionalModules;
private skipChildCompilers;
static PROCESS_ASSETS_STAGE_ADDITIONS: number;
static PROCESS_ASSETS_STAGE_REPORT: number;
constructor(chunkIncludeTester: ChunkIncludeExcludeTester, chunkHandler: WebpackChunkHandler, assetManager: AssetManager, moduleCache: ModuleCache, addBanner: boolean, perChunkOutput: boolean, additionalChunkModules: {
[chunkName: string]: Module[];
}, additionalModules: Module[], skipChildCompilers: boolean);
handleCompiler(compiler: WebpackCompiler): void;
private iterateChunksForBanner;
private iterateChunks;
}
export { WebpackCompilerHandler };

View file

@ -0,0 +1,176 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebpackCompilerHandler = void 0;
var WebpackCompilerHandler = /** @class */ (function () {
function WebpackCompilerHandler(chunkIncludeTester, chunkHandler, assetManager, moduleCache, addBanner, perChunkOutput, additionalChunkModules, additionalModules, skipChildCompilers) {
this.chunkIncludeTester = chunkIncludeTester;
this.chunkHandler = chunkHandler;
this.assetManager = assetManager;
this.moduleCache = moduleCache;
this.addBanner = addBanner;
this.perChunkOutput = perChunkOutput;
this.additionalChunkModules = additionalChunkModules;
this.additionalModules = additionalModules;
this.skipChildCompilers = skipChildCompilers;
}
WebpackCompilerHandler.prototype.handleCompiler = function (compiler) {
var _this = this;
if (typeof compiler.hooks !== 'undefined') {
var hookType = this.skipChildCompilers
? 'thisCompilation'
: 'compilation';
compiler.hooks[hookType].tap('LicenseWebpackPlugin', function (compilation) {
if (typeof compilation.hooks.processAssets !== 'undefined') {
// webpack v5
compilation.hooks.processAssets.tap({
name: 'LicenseWebpackPlugin',
stage: WebpackCompilerHandler.PROCESS_ASSETS_STAGE_REPORT
}, function () {
// the chunk graph does not contain ES modules
// use stats instead to find the ES module imports
var stats = compilation.getStats().toJson({
all: false,
chunks: true,
chunkModules: true,
nestedModules: true,
dependentModules: true,
cachedModules: true
});
_this.iterateChunks(compilation, compilation.chunks, stats);
});
}
else {
// webpack v4
compilation.hooks.optimizeChunkAssets.tap('LicenseWebpackPlugin', function (chunks) {
_this.iterateChunks(compilation, chunks);
});
}
if (_this.addBanner) {
_this.iterateChunksForBanner(compilation);
}
});
if (!this.perChunkOutput) {
compiler.hooks[hookType].tap('LicenseWebpackPlugin', function (compilation) {
if (!compilation.compiler.isChild()) {
// Select only root compiler to avoid writing license file multiple times per compilation
if (typeof compilation.hooks.processAssets !== 'undefined') {
// webpack v5
compilation.hooks.processAssets.tap({
name: 'LicenseWebpackPlugin',
stage: WebpackCompilerHandler.PROCESS_ASSETS_STAGE_REPORT + 1
}, function () {
_this.assetManager.writeAllLicenses(_this.moduleCache.getAllModules(), compilation);
});
}
else {
// webpack v4
compilation.hooks.optimizeChunkAssets.tap('LicenseWebpackPlugin', function () {
_this.assetManager.writeAllLicenses(_this.moduleCache.getAllModules(), compilation);
});
}
}
});
}
}
else if (typeof compiler.plugin !== 'undefined') {
compiler.plugin('compilation', function (compilation) {
if (typeof compilation.plugin !== 'undefined') {
compilation.plugin('optimize-chunk-assets', function (chunks, callback) {
_this.iterateChunks(compilation, chunks);
callback();
});
}
});
}
};
WebpackCompilerHandler.prototype.iterateChunksForBanner = function (compilation) {
var _this = this;
// for webpack v4 we write banners in iterateChunks.
// because of plugin hook ordering issues, it is done separately here for webpack v5.
// it is important to note that renderBanner will not receive any modules in the second
// argument due to plugin hook ordering issues in webpack v5.
// For the banner to work in webpack v5 production mode, TerserPlugin must be configured in a specific way.
// Please check the documentation of License Webpack Plugin for more details.
if (typeof compilation.hooks.processAssets !== 'undefined') {
// webpack v5
compilation.hooks.processAssets.tap({
name: 'LicenseWebpackPlugin',
stage: WebpackCompilerHandler.PROCESS_ASSETS_STAGE_ADDITIONS
}, function () {
var e_1, _a;
try {
for (var _b = __values(compilation.chunks), _c = _b.next(); !_c.done; _c = _b.next()) {
var chunk = _c.value;
if (_this.chunkIncludeTester.isIncluded(chunk.name)) {
_this.assetManager.writeChunkBanners(_this.moduleCache.getAllModulesForChunk(chunk.name), compilation, chunk);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
});
}
};
WebpackCompilerHandler.prototype.iterateChunks = function (compilation, chunks, stats) {
var e_2, _a;
var _this = this;
var _loop_1 = function (chunk) {
if (this_1.chunkIncludeTester.isIncluded(chunk.name)) {
this_1.chunkHandler.processChunk(compilation, chunk, this_1.moduleCache, stats);
if (this_1.additionalChunkModules[chunk.name]) {
this_1.additionalChunkModules[chunk.name].forEach(function (module) {
return _this.chunkHandler.processModule(compilation, chunk, _this.moduleCache, module);
});
}
if (this_1.additionalModules.length > 0) {
this_1.additionalModules.forEach(function (module) {
return _this.chunkHandler.processModule(compilation, chunk, _this.moduleCache, module);
});
}
if (this_1.perChunkOutput) {
this_1.assetManager.writeChunkLicenses(this_1.moduleCache.getAllModulesForChunk(chunk.name), compilation, chunk);
}
if (this_1.addBanner &&
typeof compilation.hooks.processAssets === 'undefined') {
// webpack v4
this_1.assetManager.writeChunkBanners(this_1.moduleCache.getAllModulesForChunk(chunk.name), compilation, chunk);
}
}
};
var this_1 = this;
try {
for (var chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next(); !chunks_1_1.done; chunks_1_1 = chunks_1.next()) {
var chunk = chunks_1_1.value;
_loop_1(chunk);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
}
finally { if (e_2) throw e_2.error; }
}
};
// copied from webpack/lib/Compilation.js
WebpackCompilerHandler.PROCESS_ASSETS_STAGE_ADDITIONS = -100;
WebpackCompilerHandler.PROCESS_ASSETS_STAGE_REPORT = 5000;
return WebpackCompilerHandler;
}());
exports.WebpackCompilerHandler = WebpackCompilerHandler;

View file

@ -0,0 +1,14 @@
import { FileSystem } from './FileSystem';
declare class WebpackFileSystem implements FileSystem {
private fs;
pathSeparator: string;
constructor(fs: any);
isFileInDirectory(filename: string, directory: string): boolean;
pathExists(filename: string): boolean;
readFileAsUtf8(filename: string): string;
join(...paths: string[]): string;
resolvePath(pathInput: string): string;
listPaths(dir: string): string[];
isDirectory(dir: string): boolean;
}
export { WebpackFileSystem };

View file

@ -0,0 +1,90 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebpackFileSystem = void 0;
var path = __importStar(require("path"));
var WebpackFileSystem = /** @class */ (function () {
function WebpackFileSystem(fs) {
this.fs = fs;
this.pathSeparator = path.sep;
}
WebpackFileSystem.prototype.isFileInDirectory = function (filename, directory) {
var normalizedFile = this.resolvePath(filename);
var normalizedDirectory = this.resolvePath(directory);
return (!this.isDirectory(normalizedFile) &&
normalizedFile.indexOf(normalizedDirectory) === 0);
};
WebpackFileSystem.prototype.pathExists = function (filename) {
try {
var stat = this.fs.statSync(filename, { throwIfNoEntry: false });
return !!stat;
}
catch (e) {
return false;
}
};
WebpackFileSystem.prototype.readFileAsUtf8 = function (filename) {
return this.fs.readFileSync(filename).toString('utf8');
};
WebpackFileSystem.prototype.join = function () {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
return path.join.apply(path, __spread(paths));
};
WebpackFileSystem.prototype.resolvePath = function (pathInput) {
return path.resolve(pathInput);
};
WebpackFileSystem.prototype.listPaths = function (dir) {
return this.fs.readdirSync(dir);
};
WebpackFileSystem.prototype.isDirectory = function (dir) {
var isDir = false;
try {
isDir = this.fs.statSync(dir, { throwIfNoEntry: false }).isDirectory();
}
catch (e) { }
return isDir;
};
return WebpackFileSystem;
}());
exports.WebpackFileSystem = WebpackFileSystem;

View file

@ -0,0 +1,4 @@
import { WebpackCompiler } from './WebpackCompiler';
export interface WebpackPlugin {
apply(compiler: WebpackCompiler): void;
}

View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

2
node_modules/license-webpack-plugin/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import { LicenseWebpackPlugin } from './LicenseWebpackPlugin';
export { LicenseWebpackPlugin };

5
node_modules/license-webpack-plugin/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LicenseWebpackPlugin = void 0;
var LicenseWebpackPlugin_1 = require("./LicenseWebpackPlugin");
Object.defineProperty(exports, "LicenseWebpackPlugin", { enumerable: true, get: function () { return LicenseWebpackPlugin_1.LicenseWebpackPlugin; } });

63
node_modules/license-webpack-plugin/package.json generated vendored Normal file
View file

@ -0,0 +1,63 @@
{
"name": "license-webpack-plugin",
"version": "4.0.2",
"description": "Outputs licenses from 3rd party libraries to a file",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"/dist/**/*",
"/MIGRATION.md",
"/DOCUMENTATION.md"
],
"scripts": {
"clean": "rimraf dist",
"format": "cross-env prettier --single-quote --write 'src/**/*.ts'",
"format:e2e": "cross-env prettier --ignore-path .gitignore --single-quote --write 'e2e/**/*.js'",
"lint": "cross-env tslint 'src/**/*.ts' --project tsconfig.json",
"build": "yarn run format && yarn run lint && yarn run clean && tsc",
"prepublishOnly": "yarn run build",
"jest": "jest",
"test:unit": "yarn run build && yarn run jest",
"test:e2e": "yarn run format:e2e && yarn --cwd e2e/webpack-v4 && yarn --cwd e2e/webpack-v5 && jest --config jest.config.e2e.js --runInBand",
"test": "yarn run test:unit && yarn run test:e2e"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/xz64/license-webpack-plugin.git"
},
"keywords": [
"license",
"plugin",
"webpack"
],
"author": "S K (xz64)",
"license": "ISC",
"bugs": {
"url": "https://github.com/xz64/license-webpack-plugin/issues"
},
"homepage": "https://github.com/xz64/license-webpack-plugin#readme",
"devDependencies": {
"@types/jest": "^22.2.2",
"@types/webpack-sources": "^0.1.5",
"cross-env": "^5.2.0",
"jest": "^22.4.3",
"prettier": "^1.19.1",
"rimraf": "^2.6.2",
"ts-jest": "^22.4.2",
"tslint": "^5.9.1",
"tslint-config-airbnb": "^5.8.0",
"tslint-config-prettier": "^1.10.0",
"typescript": "^3.8.0"
},
"dependencies": {
"webpack-sources": "^3.0.0"
},
"peerDependenciesMeta": {
"webpack": {
"optional": true
},
"webpack-sources": {
"optional": true
}
}
}