rolldown-license-plugin 2.0.0 → 2.1.0

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.
package/README.md CHANGED
@@ -29,9 +29,9 @@ Returns the plugin.
29
29
 
30
30
  #### `opts.done`
31
31
 
32
- Type: `(licenses: LicenseInfo[]) => void`
32
+ Type: `(licenses: LicenseInfo[], context: PluginContext) => void | Promise<void>`
33
33
 
34
- Callback invoked during `generateBundle` with the collected license data.
34
+ Callback invoked during `generateBundle` with the collected license data. The `context` parameter provides access to rolldown's plugin context, including `emitFile`.
35
35
 
36
36
  #### `opts.match`
37
37
 
package/dist/index.d.ts CHANGED
@@ -5739,7 +5739,7 @@ type LicenseInfo = {
5739
5739
  };
5740
5740
  /** Options for {@link licensePlugin} */
5741
5741
  type RolldownLicensePluginOpts = {
5742
- /** Called during `generateBundle` with the collected license data, sorted by name */done: (licenses: LicenseInfo[]) => void; /** Regex to match license filenames. Default: `/^((UN)?LICEN(S|C)E|COPYING).*$/i` */
5742
+ /** Called during `generateBundle` with the collected license data, sorted by name */done: (licenses: LicenseInfo[], context: PluginContext) => void | Promise<void>; /** Regex to match license filenames. Default: `/^((UN)?LICEN(S|C)E|COPYING).*$/i` */
5743
5743
  match?: RegExp; /** When set, word-wrap `licenseText` to this column width */
5744
5744
  wrapText?: number; /** Validate each dependency's license. Return `false` to throw a build error */
5745
5745
  allow?: (license: LicenseInfo) => boolean;
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ const licensePlugin = ({ done, match = defaultMatch, wrapText, allow }) => ({
110
110
  const violations = licenses.filter((entry) => !allow(entry));
111
111
  if (violations.length) throw new Error(`License violation in: ${violations.map((entry) => `${entry.name}@${entry.version} (${entry.license || "unlicensed"})`).join(", ")}`);
112
112
  }
113
- done(licenses);
113
+ await done(licenses, this);
114
114
  }
115
115
  });
116
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-license-plugin",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Rolldown plugin to extract dependency licenses",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/rolldown-license-plugin",