const allowedLicenseIdentifierPattern = /^(MIT|MIT-0|ISC|BSD-2-Clause|BSD-3-Clause|BSD-4-Clause|0BSD|Unlicense|Apache-2\.0|Zlib|WTFPL|Artistic-2\.0|BlueOak-1\.0\.0|CC0-1\.0|CC-BY-4\.0|CC-BY-3\.0|OFL-1\.1|BSD|Python-2\.0)$/i; export function isAllowedLicenseIdentifier(value) { return allowedLicenseIdentifierPattern.test(value); } // 旧 npm 包的许可字段缺失或使用非 SPDX 拼写,不能因此给所有版本或未知包放行。 // 原作者补充的同版 metadata 和发布包证据见 third-party/README.md。 const reviewed = new Set(["buffers@0.1.1", "chainsaw@0.1.0"]); export function legacyLicenseIdentifier(pkg) { return pkg.name === "buffers" && pkg.version === "0.1.1" ? "MIT/X11" : undefined; } export function isReviewedLegacyLicense(pkg) { return reviewed.has(`${pkg.name}@${pkg.version}`) && pkg.license === "MIT/X11"; }