Skip to content

@loontail/minecraft-kit v0.5.0

Classes

ClassDescription
ChildProcessSpawnerDefault spawner backed by node:child_process.spawn.
FabricVersionsApiPublic Fabric versions API surface.
FetchHttpClientDefault HttpClient implementation backed by Node's built-in fetch (undici under the hood). Maps fetch errors to MinecraftKitError.
ForgeVersionsApiPublic Forge versions API surface.
MinecraftKitSingle facade for the entire library.
MinecraftKitErrorThe single error class thrown by every public API in @loontail/minecraft-kit.
MinecraftVersionsApiPublic Minecraft versions API surface.
RuntimeVersionsApiPublic runtime versions API surface.
TargetsApiPublic Targets API surface.

Interfaces

InterfaceDescription
ArtifactDownloadA single hash-verified download.
AspectRepairInputInputs accepted by every aspect-specific planXxxRepair (planMinecraftRepair, planFabricRepair, planForgeRepair, planRuntimeRepair). The per-aspect input types are aliases over this shape.
AssetIndexDocumentAsset index document body.
AssetIndexReferenceReference to the asset-index JSON file.
AssetObjectA single asset object hash + size.
DetectSystemInputInputs allowing the host system to be derived from current Node values or overrides.
DiscoveredLoaderHintInferred loader hint (does not assert correctness).
DiscoveredRuntimeHintDetected runtime files.
DiscoveredTargetDiscovered installation found by scanning a root directory. Contains only what was actually read from disk — no assumptions about correctness, completeness, or repair state.
DownloadActionA single download step.
ExtractNativeActionA native extraction step. Source jar must already exist on disk.
FabricCompatibilityEntryCompatibility entry from /v2/versions/loader/{minecraftVersion}.
FabricListInputInputs to FabricVersionsApi.list.
FabricLoaderSummarySummary entry from /v2/versions/loader.
FabricProfileFabric profile JSON returned by /v2/versions/loader/{mc}/{loader}/profile/json.
FabricResolveInputInputs to FabricVersionsApi.resolve.
FileRefReference to a single file used in download events.
ForgeBuildSummaryA Forge build entry derived from the Maven metadata XML.
ForgeInstallProfileModern Forge install_profile.json (spec 1) shape — only fields we actually consume.
ForgeListInputInputs to ForgeVersionsApi.list.
ForgeProcessorA single processor invocation.
ForgeProfileDataSide-keyed data value pair.
ForgeResolveInputInputs to ForgeVersionsApi.resolve.
ForgeVersionJsonThe version.json stored inside the Forge installer JAR.
HttpClientPluggable HTTP client. The default implementation uses Node's built-in fetch; consumers can inject a fake (e.g. for tests) by passing an httpClient to the MinecraftKit constructor.
HttpRequestOptionsOptions for an HTTP request.
HttpResponseResponse delivered by the HttpClient interface.
InstallPlanPre-computed install plan: a flat ordered list of actions plus computed totals.
InstallReportOutcome summary returned by install.run.
LaunchCompositionFully composed launch command, ready to be passed to kit.launch.run.
LaunchExitOutcome of a finished launch.
LaunchMemoryOptionsOptional memory configuration.
LaunchOptionsInputs for kit.launch.compose (and the lower-level composeLaunch helper).
LaunchResolutionOptionsOptional resolution / window configuration.
LaunchRunOptionsOptions for kit.launch.run (and the lower-level runLaunch helper).
LaunchSessionLive handle for a running game process.
LibraryArtifactAn individual library artifact (jar/zip).
LibraryRuleRule entry used by libraries and modern arguments.
LoggerPluggable logger. Default implementation is a silent logger; pass your own to surface logs.
MemoryCacheOptionsInputs to createMemoryCache.
MetadataCachePluggable in-memory cache for HTTP metadata responses.
MinecraftArgumentsModern (1.13+) arguments structure.
MinecraftDownloadsPer-platform downloads block of the Minecraft per-version manifest.
MinecraftGetInputInputs to MinecraftVersionsApi.get / .resolve.
MinecraftJavaVersionRequired Java runtime descriptor from the version manifest.
MinecraftKitErrorContextStructured context attached to errors.
MinecraftKitOptionsConstructor options for MinecraftKit.
MinecraftLatestInputInputs to MinecraftVersionsApi.latest.
MinecraftLibraryLibrary entry. Combines vanilla, modern-natives, and legacy-classifier shapes.
MinecraftLibraryDownloadsLibrary downloads block.
MinecraftListInputInputs to MinecraftVersionsApi.list.
MinecraftLoggingLogging-config entry from the version manifest.
MinecraftVersionManifestSubset of the per-version manifest used by resolvers and consumers.
MinecraftVersionSummaryOne entry from the top-level Minecraft version_manifest_v2.json listing.
OfflineAuthOffline authentication.
OnlineAuthOnline (token-based) authentication.
OperationOptionsCommon options accepted by long-running operations.
PlanRuntimeInstallInputInputs to planRuntimeInstall.
PlanStandaloneRuntimeInstallInputInputs to planStandaloneRuntimeInstall.
ProcessStreamStream-of-text channel exposed by spawned processes.
ProcessorRefA single processor description used in Forge events.
RepairAspectShared shape of every aspect-specific repair surface (repair.minecraft, .fabric, …).
RepairPlanA repair plan is, structurally, an install plan limited to actions needed to fix the issues reported by a previous VerificationResult. The runner is the same.
RepairPlanOptionsOptions for any repair.<aspect>.plan call. Accepts one or many verification results.
RepairReportRepair report — same shape as install report.
ResolvedFabricLoaderResolved Fabric loader for a specific Minecraft version.
ResolvedForgeLoaderResolved Forge loader.
ResolvedMinecraftFully resolved Minecraft version: summary + parsed manifest, ready to feed into kit.targets.create or kit.install.plan.
ResolvedRuntimeResolved runtime ready to install or launch with.
ResolvedVanillaLoaderTrivial loader used when no mod loader is in play. Carries the resolved Minecraft so the launch composer has a uniform view across vanilla / Fabric / Forge.
ResolverContextShared context passed to every resolver.
RunForgeProcessorActionA Forge processor invocation. Main-Class is intentionally NOT carried here — the runner reads it from classpath[0]'s manifest at execution time, because the JAR is not guaranteed to exist on disk during planning (newer Forge versions ship some processor JARs as regular Maven libraries instead of bundling them in the installer).
RunRepairInputInputs to runRepair. Shared across all aspect-specific repair flows.
RuntimeFileDirectoryA directory placeholder.
RuntimeFileFileA file entry: real bytes to download, may have lzma sidecar.
RuntimeFileLinkA relative symlink.
RuntimeFilesManifestInner per-component file manifest.
RuntimeIndexEntryA single available runtime release.
RuntimeListEntryA summary entry for the list API.
RuntimeListInputInputs to RuntimeVersionsApi.list.
RuntimeResolveInputInputs to RuntimeVersionsApi.resolve.
RuntimeSystemIdentifies the host system for the launcher. All resolvers consume this object to pick the right artifacts (libraries, natives, runtime).
SpawnOptionsOptions accepted by the spawner.
SpawnedProcessLive handle for a child process.
SpawnerPluggable process spawner. The default implementation uses node:child_process; tests inject a fake to avoid spawning real processes.
TargetFully resolved target: a concrete Minecraft + loader + runtime + directory.
TargetCreateInputInputs accepted by kit.targets.create.
TargetListInputInputs to TargetsApi.list.
TargetResolveInputInputs to TargetsApi.resolve.
TargetsApiContextConstructor inputs for TargetsApi.
UpdatePlanUpdate plan — additive list of actions to bring an installation up to date.
UpdateReportUpdate report.
VerificationFileResultA single verified file.
VerificationResultAggregate verification result returned by each verify.<kind>.run API.
VerifyFabricInputInputs to verifyFabric.
VerifyForgeInputInputs to verifyForge.
VerifyMinecraftInputInputs to verifyMinecraft.
VerifyOperationOptionsOptions accepted by every verify.<kind>.run.
VerifyRuntimeInputInputs to verifyRuntime.
WriteLoggingConfigActionWrite a logging config (log4j XML) to disk.
WriteVersionJsonActionWrite a version JSON to disk (Fabric / Forge).

Type Aliases

Type aliasDescription
ApiEndpointsShapeSurface type useful for DI.
ArchitectureArchitecture literal used in launcher metadata.
ArgumentEntryA single argument entry: bare string or rule-gated value.
AuthModeAuth mode literal.
EventTypeLiteral type of the type discriminator of a ProgressEvent.
HttpHeadersSubset of fetch headers the library actually uses.
InstallActionDiscriminated union of install actions.
InstallActionKindDiscriminator for an install action.
InstallPhaseInstall phase literal.
LaunchAuthAuth shape consumed by kit.launch.compose.
LaunchPlaceholderToken literal type.
LoaderA fully resolved loader pinned to a specific Minecraft version. Use the type field to narrow to the concrete shape.
LoaderKindLoader-kind literal (used as discriminator on loader objects).
LogLevelLog-level literal.
MinecraftChannelChannel literal as it appears in version manifest entries.
MinecraftKitErrorCodeStable error code discriminator. Consumers can switch (e.code) exhaustively.
OperatingSystemOS literal as used inside Mojang/Forge/Fabric JSON manifests.
PlanFabricRepairInputInputs to planFabricRepair.
PlanForgeRepairInputInputs to planForgeRepair.
PlanMinecraftRepairInputInputs to planMinecraftRepair.
PlanRuntimeRepairInputInputs to planRuntimeRepair.
ProgressEventDiscriminated union of all runtime progress events. Pass an onEvent callback to install.run, update.run, verify.run, repair.run, or launch.run to receive these.
ProgressListenerListener signature accepted by every long-running operation.
RepairPhaseRepair phase literal.
RuntimeComponentRuntime component literal.
RuntimeFileEntryA single file in the runtime manifest.
RuntimeIndexTop-level runtime index returned by Mojang.
RuntimeIndexPlatformPer-platform component map inside the runtime index.
RuntimePreferenceKindRuntime preference literal.
TargetLoaderInputLoader input variants.
VerificationKindVerification kind literal.
VerifyFileCategoryVerification file category literal.
VerifyFileStatusFile status literal.
VersionPreferenceKindResolution-preference literal.

Variables

VariableDescription
ASSETS_DIR-
ASSETS_INDEXES_DIR-
ASSETS_LEGACY_DIR-
ASSETS_LOG_CONFIGS_DIR-
ASSETS_OBJECTS_DIR-
ASSETS_RESOURCES_DIR-
ASSETS_VIRTUAL_DIR-
ApiEndpointsEndpoint builders.
ArchitecturesCPU architecture identifiers. Matches the values that appear in Mojang library os.arch fields, after normalization from Node's NodeJS.Architecture.
AuthModesAuthentication modes accepted by the launch composer.
BASE_JVM_ARGSJVM args appended for every launch.
CACHE_MAX_ENTRIESMaximum number of entries kept in the metadata cache.
CACHE_TTL_MSTTL for in-memory metadata cache entries, in milliseconds.
DEFAULT_KILL_GRACE_MSTime after a SIGTERM before escalating to SIGKILL when aborting a launch.
DEFAULT_LAUNCHER_NAMEDefault launcher brand sent through ${launcher_name}.
DEFAULT_LAUNCHER_VERSIONDefault launcher version sent through ${launcher_version}.
DEFAULT_LIBRARY_REPOSITORYDefault Maven base URL when a library entry has no url.
DEFAULT_MAX_MBDefault max heap size in megabytes.
DEFAULT_MIN_MBDefault min heap size in megabytes.
DOWNLOAD_CONCURRENCYDefault per-host concurrency for downloads. The runner uses a worker-pool: when one file finishes, the next file in the queue starts immediately. There is no batch barrier.
EXTRACTION_MAX_COMPRESSION_RATIOMaximum compression ratio (decompressed / compressed) before treating as a zip bomb.
EXTRACTION_MAX_ENTRY_COUNTMaximum entry count per archive.
EXTRACTION_MAX_FILE_SIZEPer-file size cap during archive extraction (bytes).
EXTRACTION_MAX_TOTAL_SIZETotal decompressed-bytes cap per archive.
EventTypesStable string constants for the type discriminator of every ProgressEvent. Use these instead of bare string literals when filtering events.
FABRIC_MAVEN_BASEFabric's Maven base.
FALLBACK_COMPONENTFallback Mojang component when the per-version manifest declares none. Pre-1.7 vanilla versions and a handful of legacy snapshots fall in this bucket.
FORGE_INSTALLERS_DIR-
FORGE_INSTALLER_MAX_SIZEReasonable maximum bytes a Forge installer JAR can be.
FORGE_MAVEN_BASEForge's Maven base.
HTTP_RETRY_BACKOFF_BASE_MSBase delay for exponential backoff, in milliseconds.
HTTP_RETRY_BACKOFF_CAP_MSMaximum delay for exponential backoff, in milliseconds.
HTTP_RETRY_MAXMaximum retry attempts for transient HTTP failures.
HTTP_TIMEOUT_MSHTTP request timeout for metadata calls, in milliseconds.
InstallActionKindsAction kinds inside an InstallPlan.
InstallPhasesCoarse-grained install phases. Used in install:phase-changed events so consumers can render a progress bar with named steps.
JAVA_EXECUTABLEJava executable filename per OS (relative to the runtime root).
LAUNCH_PLACEHOLDERSAll ${...} tokens substituted into JVM and game arguments.
LEGACY_JVM_ARGSJVM args added for legacy (≤1.12) versions that lack arguments.jvm.
LIBRARIES_DIR-
LoadersDiscriminator literal identifying which mod loader is active for a target.
LogLevelsLog levels accepted by the pluggable logger.
MACOS_JVM_ARGSmacOS-only JVM args (suppress dock label).
MAC_RUNTIME_PREFIXmacOS runtime layout adds this prefix above JAVA_EXECUTABLE.osx.
MAX_PROCESSOR_STDERR_LINESMaximum number of stderr lines retained from a Forge processor for diagnostics.
MinecraftChannelsMinecraft release channels matching the type field of Mojang version manifest entries.
NATIVES_DIR_NAME-
NODE_ARCH_TO_MOJANG_ARCHMapping from Node's process.arch to Mojang/Mojang-runtime arch tags.
NODE_PLATFORM_TO_MOJANG_OSMapping from Node's process.platform to Mojang OS names.
OperatingSystemsOperating-system identifiers used by Mojang launcher metadata.
PROGRESS_EVENT_INTERVAL_MSThrottle interval for emitting download:progress events (in milliseconds).
RUNTIMES_DIR-
RUNTIME_PLATFORM_KEYSMapping from {OperatingSystem, Architecture} to the runtime-index platform key.
RepairPhasesCoarse-grained repair phases used for repair:phase-changed events.
RuntimeComponentsMojang Java-runtime component identifiers. New components appear over time (e.g. java-runtime-delta for Java 21).
RuntimePreferenceUser-supplied resolution preferences.
SPAWNER_MAX_LINE_BYTESMaximum bytes per line emitted by ChildProcessSpawner. Lines longer than this are split: a Minecraft crash that prints megabytes of unbroken text should not exhaust memory inside the launcher.
USER_AGENTUser-agent value sent on every HTTP request.
VERSIONS_DIRRelative-path segments used to build per-target directory layouts.
VerificationKindsAspect of an installation a verification result describes.
VerifyFileCategoriesCategories assigned to each verified file for easier filtering.
VerifyFileStatusesStatus of an individual file checked during verification.
VersionPreferenceResolution preference used when a user wants the latest, recommended, or a specific version. Preferences are inputs to resolvers; resolved targets always carry concrete versions.
consoleLoggerLogger that mirrors messages to console.<level> with structured fields.
silentLoggerLogger that drops every message. Default when no logger is supplied.

Functions

FunctionDescription
createMemoryCacheIn-memory metadata cache backed by lru-cache.
detectSystemResolve the current host system identifiers.
isErrorCodeTrue when e is an MinecraftKitError carrying the given code.
isMinecraftKitErrorTrue when e is an MinecraftKitError.
offlineUuidForDerive a stable v3-style UUID for an offline player username.
planFabricRepairBuild a repair plan covering the Fabric loader slice: profile JSON + libraries.
planForgeRepairBuild a repair plan covering the Forge loader slice: version JSON, libraries, installer download, and the Forge processors that produce the final installation. When the Forge version JSON was missing during verify (so libraries couldn't be enumerated), every forge-library download is added defensively — downloadFile skips files already on disk.
planMinecraftRepairBuild a repair plan covering only the vanilla Minecraft slice: client jar, version JSON, libraries (incl. native jars), assets, logging config, and native extractions.
planRuntimeInstallBuild an install plan that downloads ONLY the Java runtime declared by target.runtime.
planRuntimeRepairBuild a repair plan covering the Java runtime files. target.runtime.installRoot is honoured automatically because both planInstall and the verify side resolve runtime paths through the same targetPaths.runtimeRoot(..., installRoot) helper.
planStandaloneRuntimeInstallPlan a runtime-only install without a Minecraft target. Useful for "Install Java/runtime" flows where the user just wants a JRE on disk and never had a Minecraft version to choose from. The returned plan is shaped exactly like a normal InstallPlan and runs through the standard install runner — but its target.minecraft and target.loader fields are intentional placeholders. The runner only reads target.runtime for runtime-only plans, so the placeholders are never accessed at runtime.
runRepairExecute any repair plan. Reuses the install runner.
stripUuidDashesStrip the dashes from a UUID. Used by ${auth_uuid}.
verifyFabricVerify the Fabric loader slice: profile JSON + every library it pulls in.
verifyForgeVerify the Forge loader slice: the on-disk Forge version JSON and every library it declares. Libraries can only be enumerated once the JSON is present and parsable; a malformed JSON is surfaced as a CORRUPT issue so repair rewrites it before re-running.
verifyMinecraftVerify the vanilla Minecraft slice of an installation: the client jar, version JSON, libraries (incl. native jars), assets (index + objects), logging config, and the extracted natives directory.
verifyRuntimeVerify the Java runtime files. Honours target.runtime.installRoot when set so a shared/global runtime install is checked at its real location instead of the per-target runtime/ subfolder.

MIT License