Address system information and license review suggestions
This commit is contained in:
@@ -24,18 +24,21 @@ final class Licenses
|
||||
public static function dependencies(): array
|
||||
{
|
||||
$root = dirname(__DIR__, 2);
|
||||
$jquery = @file_get_contents($root . '/public' . Assets::JQUERY, length: 256);
|
||||
$editor = @file_get_contents($root . '/public' . Assets::TOAST_UI_EDITOR);
|
||||
$version = '([0-9][0-9A-Za-z.+-]*)';
|
||||
$entries = [
|
||||
'jquery' => ['name' => 'jQuery', 'version' => '4.0.0', 'license' => 'MIT',
|
||||
'jquery' => ['name' => 'jQuery', 'version' => self::declaredVersion($jquery, '~jQuery v' . $version . '~'), 'license' => 'MIT',
|
||||
'url' => 'https://jquery.com/', 'file' => $root . '/public/assets/jquery-LICENSE.txt'],
|
||||
'toast-ui-editor' => ['name' => 'TOAST UI Editor', 'version' => '3.2.2', 'license' => 'MIT',
|
||||
'toast-ui-editor' => ['name' => 'TOAST UI Editor', 'version' => self::declaredVersion($editor, '~@version\h+' . $version . '~'), 'license' => 'MIT',
|
||||
'url' => 'https://github.com/nhn/tui.editor', 'file' => $root . '/public/assets/vendor/toastui/LICENSE'],
|
||||
'geist' => ['name' => 'Geist', 'version' => '', 'license' => 'OFL-1.1',
|
||||
'geist' => ['name' => 'Geist', 'license' => 'OFL-1.1',
|
||||
'url' => 'https://github.com/vercel/geist-font', 'file' => $root . '/public/assets/geist-OFL.txt'],
|
||||
'dompurify' => ['name' => 'DOMPurify', 'version' => '2.3.3', 'license' => 'Apache-2.0 / MPL-2.0',
|
||||
'url' => 'https://github.com/cure53/DOMPurify/tree/2.3.3', 'file' => null],
|
||||
'prosemirror' => ['name' => 'ProseMirror', 'version' => '', 'license' => 'MIT',
|
||||
'dompurify' => ['name' => 'DOMPurify', 'version' => self::declaredVersion($editor, '~@license DOMPurify\h+' . $version . '~'), 'license' => 'Apache-2.0 / MPL-2.0',
|
||||
'url' => 'https://github.com/cure53/DOMPurify', 'file' => null],
|
||||
'prosemirror' => ['name' => 'ProseMirror', 'license' => 'MIT',
|
||||
'url' => 'https://prosemirror.net/', 'file' => null],
|
||||
'tslib' => ['name' => 'tslib', 'version' => '', 'license' => '0BSD',
|
||||
'tslib' => ['name' => 'tslib', 'license' => '0BSD',
|
||||
'url' => 'https://github.com/microsoft/tslib', 'file' => null],
|
||||
];
|
||||
$lock = @file_get_contents($root . '/composer.lock');
|
||||
@@ -57,6 +60,11 @@ final class Licenses
|
||||
return $entries;
|
||||
}
|
||||
|
||||
private static function declaredVersion(string|false $source, string $pattern): string
|
||||
{
|
||||
return $source !== false && preg_match($pattern, $source, $match) ? $match[1] : '';
|
||||
}
|
||||
|
||||
public static function text(string $key): ?string
|
||||
{
|
||||
$path = self::dependencies()[$key]['file'] ?? null;
|
||||
|
||||
Reference in New Issue
Block a user