rolldown-license-plugin 2.1.0 → 2.2.1

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/dist/index.js CHANGED
@@ -40,7 +40,7 @@ function parseLicense(pkgJson) {
40
40
  return "";
41
41
  }
42
42
  /** Rolldown plugin that extracts license information from bundled dependencies */
43
- const licensePlugin = ({ done, match = defaultMatch, wrapText, allow }) => ({
43
+ const licensePlugin = ({ done, match = defaultMatch, wrapText, allow, failOnViolation = false, failOnUnlicensed = false }) => ({
44
44
  name: "rolldown-license-plugin",
45
45
  async generateBundle(_opts, bundle) {
46
46
  const pkgJsonCache = /* @__PURE__ */ new Map();
@@ -107,8 +107,15 @@ const licensePlugin = ({ done, match = defaultMatch, wrapText, allow }) => ({
107
107
  }));
108
108
  licenses.sort((a, b) => a.name.localeCompare(b.name));
109
109
  if (allow) {
110
- const violations = licenses.filter((entry) => !allow(entry));
111
- if (violations.length) throw new Error(`License violation in: ${violations.map((entry) => `${entry.name}@${entry.version} (${entry.license || "unlicensed"})`).join(", ")}`);
110
+ const errors = [];
111
+ for (const entry of licenses) {
112
+ if (allow(entry)) continue;
113
+ const fail = entry.license ? failOnViolation : failOnUnlicensed;
114
+ const msg = entry.license ? `Dependency "${entry.name}" has an incompatible license: ${entry.license}` : `Dependency "${entry.name}" does not specify any license.`;
115
+ if (fail) errors.push(msg);
116
+ else console.warn(msg);
117
+ }
118
+ if (errors.length) throw new Error(errors.join("\n"));
112
119
  }
113
120
  await done(licenses, this);
114
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-license-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "Rolldown plugin to extract dependency licenses",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/rolldown-license-plugin",
@@ -15,13 +15,16 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "peerDependencies": {
19
+ "rolldown": "*"
20
+ },
18
21
  "devDependencies": {
19
22
  "@types/node": "25.5.2",
20
- "@typescript/native-preview": "7.0.0-dev.20260407.1",
21
- "eslint": "10.1.0",
22
- "eslint-config-silverwind": "127.1.4",
23
+ "@typescript/native-preview": "7.0.0-dev.20260409.1",
24
+ "eslint": "10.2.0",
25
+ "eslint-config-silverwind": "131.0.2",
23
26
  "jest-extended": "7.0.0",
24
- "rolldown": "1.0.0-rc.13",
27
+ "rolldown": "1.0.0-rc.15",
25
28
  "tsdown": "0.21.7",
26
29
  "tsdown-config-silverwind": "2.0.5",
27
30
  "typescript": "5.9.3",
@@ -29,7 +32,7 @@
29
32
  "updates": "17.13.5",
30
33
  "updates-config-silverwind": "2.0.1",
31
34
  "versions": "14.2.6",
32
- "vitest": "4.1.3",
35
+ "vitest": "4.1.4",
33
36
  "vitest-config-silverwind": "11.1.4"
34
37
  }
35
38
  }