UNPKG

3.44 kBTypeScriptView Raw
1import { UpdatedObject } from "@xmcl/net";
2import { ForgeInstaller } from "./index";
3export declare namespace ForgeWebPage {
4 interface Download {
5 md5: string;
6 sha1: string;
7 path: string;
8 }
9 /**
10 * Parse the html string of forge webpage
11 */
12 function parse(content: string): ForgeWebPage;
13 /**
14 * Query the webpage content from files.minecraftforge.net.
15 *
16 * You can put the last query result to the fallback option. It will check if your old result is up-to-date.
17 * It will request a new page only when the fallback option is outdated.
18 *
19 * @param option The option can control querying minecraft version, and page caching.
20 */
21 function getWebPage(): Promise<ForgeWebPage | undefined>;
22 /**
23 * Query the webpage content from files.minecraftforge.net.
24 *
25 * You can put the last query result to the fallback option. It will check if your old result is up-to-date.
26 * It will request a new page only when the fallback option is outdated.
27 *
28 * @param option The option can control querying minecraft version, and page caching.
29 */
30 function getWebPage(option?: {
31 mcversion?: string;
32 }): Promise<ForgeWebPage | undefined>;
33 /**
34 * Query the webpage content from files.minecraftforge.net.
35 *
36 * You can put the last query result to the fallback option. It will check if your old result is up-to-date.
37 * It will request a new page only when the fallback option is outdated.
38 *
39 * @param option The option can control querying minecraft version, and page caching.
40 */
41 function getWebPage(option?: {
42 mcversion?: string;
43 fallback?: ForgeWebPage;
44 }): Promise<ForgeWebPage | undefined>;
45 /**
46 * Query the webpage content from files.minecraftforge.net.
47 *
48 * You can put the last query result to the fallback option. It will check if your old result is up-to-date.
49 * It will request a new page only when the fallback option is outdated.
50 *
51 * @param option The option can control querying minecraft version, and page caching.
52 */
53 function getWebPage(option?: {
54 mcversion?: string;
55 fallback: ForgeWebPage;
56 }): Promise<ForgeWebPage>;
57 /**
58 * A richer version info than forge installer required
59 */
60 interface Version extends ForgeInstaller.VersionMeta {
61 /**
62 * The minecraft version
63 */
64 mcversion: string;
65 /**
66 * The version of forge
67 */
68 version: string;
69 date: string;
70 /**
71 * The changelog info
72 */
73 changelog?: ForgeWebPage.Download;
74 installer: ForgeWebPage.Download;
75 mdk?: ForgeWebPage.Download;
76 universal: ForgeWebPage.Download;
77 source?: ForgeWebPage.Download;
78 launcher?: ForgeWebPage.Download;
79 /**
80 * The type of the forge release. The `common` means the normal release.
81 */
82 type: "buggy" | "recommended" | "common" | "latest";
83 }
84 namespace Version {
85 function to(webPageVersion: ForgeWebPage.Version): ForgeInstaller.VersionMeta;
86 }
87}
88declare module "./index" {
89 namespace VersionMeta {
90 function from(webPageVersion: ForgeWebPage.Version): ForgeInstaller.VersionMeta;
91 }
92}
93export interface ForgeWebPage extends UpdatedObject {
94 versions: ForgeWebPage.Version[];
95 mcversion: string;
96}