rolldown-license-plugin 3.0.7 → 3.0.8
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 +13 -8
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { sep } from "node:path";
|
|
3
3
|
|
|
4
4
|
//#region index.ts
|
|
5
5
|
const defaultMatch = /^((UN)?LICEN(S|C)E|COPYING).*$/i;
|
|
@@ -69,7 +69,7 @@ const licensePlugin = ({ done, match = defaultMatch, wrapLicenseText, allow, fai
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
const dirs = Array.from(roots);
|
|
72
|
-
const pkgRaws = await Promise.all(dirs.map((dir) => readFile(
|
|
72
|
+
const pkgRaws = await Promise.all(dirs.map((dir) => readFile(`${dir}/package.json`, "utf8").catch(() => null)));
|
|
73
73
|
const seen = /* @__PURE__ */ new Set();
|
|
74
74
|
const pkgs = [];
|
|
75
75
|
for (let idx = 0; idx < dirs.length; idx++) {
|
|
@@ -96,11 +96,10 @@ const licensePlugin = ({ done, match = defaultMatch, wrapLicenseText, allow, fai
|
|
|
96
96
|
}
|
|
97
97
|
const probeDirect = match.test("LICENSE");
|
|
98
98
|
const licenses = await Promise.all(pkgs.map(async ({ dir, name, version, license }) => {
|
|
99
|
-
|
|
100
|
-
let raw = probeDirect ? await read("LICENSE") : "";
|
|
99
|
+
let raw = probeDirect ? await readFile(`${dir}/LICENSE`, "utf8").catch(() => "") : "";
|
|
101
100
|
if (!raw) {
|
|
102
101
|
const file = (await readdir(dir).catch(() => null))?.find((entry) => match.test(entry));
|
|
103
|
-
if (file) raw = await
|
|
102
|
+
if (file) raw = await readFile(`${dir}/${file}`, "utf8").catch(() => "");
|
|
104
103
|
}
|
|
105
104
|
return {
|
|
106
105
|
name,
|
|
@@ -109,13 +108,19 @@ const licensePlugin = ({ done, match = defaultMatch, wrapLicenseText, allow, fai
|
|
|
109
108
|
licenseText: wrapLicenseText && raw ? wrap(raw, wrapLicenseText).trim() : raw
|
|
110
109
|
};
|
|
111
110
|
}));
|
|
112
|
-
licenses.sort((a, b) => a.name.
|
|
111
|
+
licenses.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
113
112
|
if (allow) {
|
|
114
113
|
const errors = [];
|
|
115
114
|
for (const entry of licenses) {
|
|
116
115
|
if (allow(entry)) continue;
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
if (!entry.license) {
|
|
117
|
+
const msg = `Dependency "${entry.name}" does not specify any license.`;
|
|
118
|
+
if (failOnUnlicensed) errors.push(msg);
|
|
119
|
+
else this.warn(msg);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const msg = `Dependency "${entry.name}" has an incompatible license: ${entry.license}`;
|
|
123
|
+
if (failOnViolation) errors.push(msg);
|
|
119
124
|
else this.warn(msg);
|
|
120
125
|
}
|
|
121
126
|
if (errors.length) this.error(errors.join("\n"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-license-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Rolldown plugin to extract dependency licenses",
|
|
5
5
|
"author": "silverwind <me@silverwind.io>",
|
|
6
6
|
"repository": "silverwind/rolldown-license-plugin",
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
"rolldown": "*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "25.
|
|
34
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
33
|
+
"@types/node": "25.9.1",
|
|
34
|
+
"@typescript/native-preview": "7.0.0-dev.20260524.1",
|
|
35
35
|
"eslint": "10.4.0",
|
|
36
36
|
"eslint-config-silverwind": "133.0.3",
|
|
37
37
|
"jest-extended": "7.0.0",
|
|
38
|
-
"rolldown": "1.0.
|
|
38
|
+
"rolldown": "1.0.2",
|
|
39
39
|
"tsdown": "0.22.0",
|
|
40
40
|
"tsdown-config-silverwind": "3.0.1",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
42
|
"typescript-config-silverwind": "18.0.0",
|
|
43
|
-
"updates": "17.
|
|
43
|
+
"updates": "17.17.2",
|
|
44
44
|
"updates-config-silverwind": "3.0.2",
|
|
45
45
|
"versions": "15.0.4",
|
|
46
|
-
"vite": "8.0.
|
|
47
|
-
"vitest": "4.1.
|
|
46
|
+
"vite": "8.0.14",
|
|
47
|
+
"vitest": "4.1.7",
|
|
48
48
|
"vitest-config-silverwind": "11.3.5"
|
|
49
49
|
}
|
|
50
50
|
}
|