rolldown-license-plugin 2.2.4 → 2.2.5

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -13
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readFile, readdir } from "node:fs/promises";
1
+ import { readFileSync, readdirSync } from "node:fs";
2
2
  import { join, sep } from "node:path";
3
3
 
4
4
  //#region index.ts
@@ -70,32 +70,34 @@ const licensePlugin = ({ done, match = defaultMatch, wrapText, allow, failOnViol
70
70
  }
71
71
  const seen = /* @__PURE__ */ new Set();
72
72
  const licenses = [];
73
- await Promise.all(Array.from(roots, async (dir) => {
73
+ for (const dir of roots) {
74
74
  let pkgJson;
75
75
  try {
76
- pkgJson = JSON.parse(await readFile(join(dir, "package.json"), "utf8"));
76
+ pkgJson = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
77
77
  } catch {
78
- return;
78
+ continue;
79
79
  }
80
- if (!pkgJson.name) return;
80
+ if (!pkgJson.name) continue;
81
81
  const key = `${pkgJson.name}@${pkgJson.version ?? ""}`;
82
- if (seen.has(key)) return;
82
+ if (seen.has(key)) continue;
83
83
  seen.add(key);
84
84
  let licenseText = "";
85
85
  try {
86
- const licenseFile = (await readdir(dir)).find((entry) => match.test(entry));
87
- if (licenseFile) {
88
- licenseText = await readFile(join(dir, licenseFile), "utf8");
89
- if (wrapText) licenseText = wrap(licenseText, wrapText).trim();
90
- }
91
- } catch {}
86
+ licenseText = readFileSync(join(dir, "LICENSE"), "utf8");
87
+ } catch {
88
+ try {
89
+ const licenseFile = readdirSync(dir).find((entry) => match.test(entry));
90
+ if (licenseFile) licenseText = readFileSync(join(dir, licenseFile), "utf8");
91
+ } catch {}
92
+ }
93
+ if (wrapText && licenseText) licenseText = wrap(licenseText, wrapText).trim();
92
94
  licenses.push({
93
95
  name: pkgJson.name,
94
96
  version: pkgJson.version ?? "",
95
97
  license: parseLicense(pkgJson),
96
98
  licenseText
97
99
  });
98
- }));
100
+ }
99
101
  licenses.sort((a, b) => a.name.localeCompare(b.name));
100
102
  if (allow) {
101
103
  const errors = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-license-plugin",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "Rolldown plugin to extract dependency licenses",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/rolldown-license-plugin",
@@ -19,18 +19,18 @@
19
19
  "rolldown": "*"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/node": "25.5.2",
23
- "@typescript/native-preview": "7.0.0-dev.20260409.1",
22
+ "@types/node": "25.6.0",
23
+ "@typescript/native-preview": "7.0.0-dev.20260410.1",
24
24
  "eslint": "10.2.0",
25
- "eslint-config-silverwind": "131.0.2",
25
+ "eslint-config-silverwind": "131.0.4",
26
26
  "jest-extended": "7.0.0",
27
27
  "rolldown": "1.0.0-rc.15",
28
28
  "tsdown": "0.21.7",
29
29
  "tsdown-config-silverwind": "2.0.5",
30
- "typescript": "5.9.3",
30
+ "typescript": "6.0.2",
31
31
  "typescript-config-silverwind": "17.0.0",
32
32
  "updates": "17.14.0",
33
- "updates-config-silverwind": "2.0.1",
33
+ "updates-config-silverwind": "2.1.0",
34
34
  "versions": "14.2.7",
35
35
  "vite": "8.0.8",
36
36
  "vitest": "4.1.4",