/** * JAR Scanner * * Extracts plugin metadata from Minecraft plugin JAR files by reading plugin.yml */ import type { ScanProgressCallback, ScannedPlugin, UnrecognizedPluginFile } from './types/index.js'; /** Clear the plugin JAR lookup cache (call after downloads or rescans) */ export declare function clearPluginJarCache(): void; /** * Scan a single JAR file and extract plugin metadata */ export declare function scanJar(jarPath: string): Promise; /** * Canonical disabled-jar suffix written by Pluginator when "removing" a plugin. * The 7-char length matters — `.jarDIS` replaces `.jar` so removal of the * suffix reverses the rename. */ export declare const DISABLED_JAR_SUFFIX = ".jarDIS"; /** * Recognized disabled-jar suffixes (in priority order — longer matches first * so `.jar.disabled` wins over `.jar.dis`). Pluginator writes `DISABLED_JAR_SUFFIX`; * the others are accepted for back-compat with files renamed by hand. */ export declare const DISABLED_JAR_SUFFIXES: readonly [".jar.disabled", ".jardis", ".jar.dis"]; /** * Convert an enabled JAR filename to the canonical disabled form. * Replaces the trailing `.jar` (case-insensitive) with `DISABLED_JAR_SUFFIX`. */ export declare function toDisabledJar(filename: string): string; /** * Convert a disabled JAR filename back to the enabled `.jar` form. * Returns the input unchanged if it doesn't match a known disabled suffix. */ export declare function fromDisabledJar(filename: string): string; /** * Known unrecognized JAR suffixes — files that look like disabled plugins * but use non-standard naming. We scan these separately and let the user decide. */ export declare const UNRECOGNIZED_JAR_SUFFIXES: string[]; /** * Check if a file is a JAR-like file with an unrecognized suffix. * These are not managed by Pluginator but may be leftover from manual operations. */ export declare function isUnrecognizedJar(filename: string): boolean; /** * Scan all JAR files in a directory */ export declare function scanDirectory(pluginsPath: string, onProgress?: ScanProgressCallback): Promise; /** * Find a plugin by name in a list of scanned plugins */ export declare function findPluginByName(plugins: ScannedPlugin[], name: string): ScannedPlugin | undefined; /** * Get authors as a comma-separated string */ export declare function getAuthorsString(plugin: ScannedPlugin): string; /** * Get dependencies as a comma-separated string */ export declare function getDependenciesString(plugin: ScannedPlugin): string; /** * Check if a JAR filename matches a pattern * Uses escaped pattern to prevent ReDoS attacks (v2.0.0) */ export declare function matchesFilenamePattern(filename: string, pattern: string): boolean; /** * Find a plugin's JAR file in a directory by plugin name * Returns the full path and whether it's currently disabled * * @since v1.51.7 */ export declare function findPluginJar(pluginsPath: string, pluginName: string): Promise<{ path: string; filename: string; disabled: boolean; } | null>; /** * Disable a plugin by renaming its JAR file to .jar.disabled * * @since v1.51.7 */ export declare function disablePluginJar(pluginsPath: string, pluginName: string): Promise; /** * Enable a plugin by renaming its .jar.disabled file back to .jar * * @since v1.51.7 */ export declare function enablePluginJar(pluginsPath: string, pluginName: string): Promise; /** * Server JAR info returned by findAllServerJars * @since v2.5.13 */ export interface ServerJarInfo { path: string; filename: string; version: string | null; fileSize: number; modifiedTime: number; } /** * Find all server JAR files in a server directory, sorted newest first. * Sorts by extracted MC version descending, then by modification time as tiebreaker. * * @param serverPath - Path to the plugins directory or server root * @returns Array of server JAR info objects, newest first * @since v2.5.13 */ export declare function findAllServerJars(serverPath: string): Promise; /** * Find the server JAR file in a server directory (returns the newest one) * * @param serverPath - Path to the plugins directory or server root * @returns Full path to the server JAR or null if not found * @since v1.50.5 */ export declare function findServerJar(serverPath: string): Promise; /** * Scan a directory for unrecognized JAR-like files (.jar.old, .jar.bak, etc.) * * These files are not managed by Pluginator but may be leftover from manual operations. * Returns metadata about each file for UI display. * * @since v2.3.16 */ export declare function scanForUnrecognizedFiles(pluginsPath: string): Promise; /** * A duplicate where both an enabled .jar and disabled .jar.disabled exist * for the same plugin name. The disabled copy is stale and should be cleaned up. * * @since v2.3.17 */ export interface DuplicateDisabledFile { pluginName: string; enabledPath: string; disabledPath: string; } /** * Find plugins where both an enabled .jar and disabled .jar.disabled exist. * These are stale duplicates that should be cleaned up. * * @since v2.3.17 */ export declare function findDuplicateDisabledFiles(plugins: ScannedPlugin[]): DuplicateDisabledFile[]; //# sourceMappingURL=scanner.d.ts.map