license-checker-plugin 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,8 +15,12 @@ export interface LicensePluginOptions {
15
15
  includeHomepage?: boolean;
16
16
  /** Include the author/publisher in each entry. */
17
17
  includeAuthor?: boolean;
18
- /** Exclude specific packages from the output by name. */
19
- excludePackages?: string[];
18
+ /**
19
+ * Exclude specific packages from the output.
20
+ * Can be a list of package names, or a predicate function
21
+ * `(packageName: string) => boolean`.
22
+ */
23
+ excludePackages?: (string | ((name: string) => boolean))[];
20
24
  /**
21
25
  * Allow only these licenses. When set, the build fails if any bundled
22
26
  * package has a license not in this list.
@@ -71,7 +71,7 @@ class LicensePluginCore {
71
71
  resolveLicenseEntries(packages) {
72
72
  const entries = [];
73
73
  for (const pkgInfo of packages.values()) {
74
- if (this.options.excludePackages.includes(pkgInfo.name))
74
+ if (this.options.excludePackages.some((e) => (typeof e === 'function' ? e(pkgInfo.name) : e === pkgInfo.name)))
75
75
  continue;
76
76
  let licenseInfo = this.db.getLicense(pkgInfo.name, pkgInfo.version);
77
77
  if (licenseInfo.license === 'UNKNOWN') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "license-checker-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A bundler-agnostic plugin to generate third-party license notices for bundled packages. Supports webpack 5, Rspack, and Vite.",
5
5
  "author": "Axetroy <axetroy.dev@gmail.com>",
6
6
  "repository": {