public function getLibraries(bool $rescan = false): array
    {
        if (!$rescan && !empty(self::$libraries)) {
            return self::$libraries;
        }

        $compiledFile = $this->pathHelper->realize('{MELIOR_BASE}/Data/Persistent/Compiler/Packages/library.map');
        if (!$rescan && is_file($compiledFile)) {
            $result = \unserialize(\file_get_contents($compiledFile));
        } else {
            $result = [];
            $path = $this->pathHelper->realize('{MELIOR_BASE}/Packages/Library/');

            if (!is_dir($path)) {
                return [];
            }

            foreach (scandir($path) as $entry) {
                if ($entry === '.' || $entry === '..') {
                    continue;
                }

                $subpath = $this->pathHelper->join($path, $entry);
                $result = array_merge($result, $this->readPackageFolder($subpath));
            }
        }

        self::$libraries = $result;

        return $result;
    }