bgmt 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cdn.cjs +9 -6
- package/dist/cdn.d.cts +5 -5
- package/dist/cdn.d.mts +5 -5
- package/dist/cdn.mjs +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bgmt
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/bgmt)
|
|
4
4
|
[](https://github.com/yjl9903/bgmc/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
|
+
Shared bangumi helper functions used by [bgmx](https://github.com/yjl9903/bgmx).
|
|
7
|
+
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
```bash
|
package/dist/cdn.cjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/cdn/index.ts
|
|
3
|
-
async function fetchBasicSubjects() {
|
|
4
|
-
const
|
|
3
|
+
async function fetchBasicSubjects(options = {}) {
|
|
4
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
5
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/index.json`);
|
|
5
6
|
if (!resp.ok) throw new Error(`Fetch bgmd index.json failed`, { cause: resp });
|
|
6
7
|
return (await resp.json()).bangumis;
|
|
7
8
|
}
|
|
8
|
-
async function fetchFullSubjects() {
|
|
9
|
-
const
|
|
9
|
+
async function fetchFullSubjects(options = {}) {
|
|
10
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
11
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/full.json`);
|
|
10
12
|
if (!resp.ok) throw new Error(`Fetch bgmd full.json failed`, { cause: resp });
|
|
11
13
|
return (await resp.json()).bangumis;
|
|
12
14
|
}
|
|
13
|
-
async function fetchCalendarSubjects() {
|
|
14
|
-
const
|
|
15
|
+
async function fetchCalendarSubjects(options) {
|
|
16
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
17
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/calendar.json`);
|
|
15
18
|
if (!resp.ok) throw new Error(`Fetch bgmd calendar.json failed`, { cause: resp });
|
|
16
19
|
return (await resp.json()).calendar;
|
|
17
20
|
}
|
package/dist/cdn.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as FullSubject, t as BasicSubject } from "./types-qUxe1mrZ.cjs";
|
|
1
|
+
import { a as SubjectSearch, i as SubjectRating, n as FullSubject, r as SubjectImage, t as BasicSubject } from "./types-qUxe1mrZ.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cdn/index.d.ts
|
|
4
4
|
interface CdnOptions {
|
|
@@ -15,11 +15,11 @@ interface CdnOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
baseURL?: string;
|
|
17
17
|
}
|
|
18
|
-
declare function fetchBasicSubjects(): Promise<BasicSubject[]>;
|
|
19
|
-
declare function fetchFullSubjects(): Promise<FullSubject[]>;
|
|
20
|
-
declare function fetchCalendarSubjects(): Promise<{
|
|
18
|
+
declare function fetchBasicSubjects(options?: CdnOptions): Promise<BasicSubject[]>;
|
|
19
|
+
declare function fetchFullSubjects(options?: CdnOptions): Promise<FullSubject[]>;
|
|
20
|
+
declare function fetchCalendarSubjects(options: CdnOptions): Promise<{
|
|
21
21
|
calendar: [BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[]];
|
|
22
22
|
web: BasicSubject[];
|
|
23
23
|
}>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { CdnOptions, fetchBasicSubjects, fetchCalendarSubjects, fetchFullSubjects };
|
|
25
|
+
export { BasicSubject, CdnOptions, FullSubject, SubjectImage, SubjectRating, SubjectSearch, fetchBasicSubjects, fetchCalendarSubjects, fetchFullSubjects };
|
package/dist/cdn.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as FullSubject, t as BasicSubject } from "./types-CDKF8vJi.mjs";
|
|
1
|
+
import { a as SubjectSearch, i as SubjectRating, n as FullSubject, r as SubjectImage, t as BasicSubject } from "./types-CDKF8vJi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cdn/index.d.ts
|
|
4
4
|
interface CdnOptions {
|
|
@@ -15,11 +15,11 @@ interface CdnOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
baseURL?: string;
|
|
17
17
|
}
|
|
18
|
-
declare function fetchBasicSubjects(): Promise<BasicSubject[]>;
|
|
19
|
-
declare function fetchFullSubjects(): Promise<FullSubject[]>;
|
|
20
|
-
declare function fetchCalendarSubjects(): Promise<{
|
|
18
|
+
declare function fetchBasicSubjects(options?: CdnOptions): Promise<BasicSubject[]>;
|
|
19
|
+
declare function fetchFullSubjects(options?: CdnOptions): Promise<FullSubject[]>;
|
|
20
|
+
declare function fetchCalendarSubjects(options: CdnOptions): Promise<{
|
|
21
21
|
calendar: [BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[], BasicSubject[]];
|
|
22
22
|
web: BasicSubject[];
|
|
23
23
|
}>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { CdnOptions, fetchBasicSubjects, fetchCalendarSubjects, fetchFullSubjects };
|
|
25
|
+
export { BasicSubject, CdnOptions, FullSubject, SubjectImage, SubjectRating, SubjectSearch, fetchBasicSubjects, fetchCalendarSubjects, fetchFullSubjects };
|
package/dist/cdn.mjs
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
//#region src/cdn/index.ts
|
|
2
|
-
async function fetchBasicSubjects() {
|
|
3
|
-
const
|
|
2
|
+
async function fetchBasicSubjects(options = {}) {
|
|
3
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
4
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/index.json`);
|
|
4
5
|
if (!resp.ok) throw new Error(`Fetch bgmd index.json failed`, { cause: resp });
|
|
5
6
|
return (await resp.json()).bangumis;
|
|
6
7
|
}
|
|
7
|
-
async function fetchFullSubjects() {
|
|
8
|
-
const
|
|
8
|
+
async function fetchFullSubjects(options = {}) {
|
|
9
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
10
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/full.json`);
|
|
9
11
|
if (!resp.ok) throw new Error(`Fetch bgmd full.json failed`, { cause: resp });
|
|
10
12
|
return (await resp.json()).bangumis;
|
|
11
13
|
}
|
|
12
|
-
async function fetchCalendarSubjects() {
|
|
13
|
-
const
|
|
14
|
+
async function fetchCalendarSubjects(options) {
|
|
15
|
+
const { version = "0", baseURL = "https://unpkg.com" } = options;
|
|
16
|
+
const resp = await fetch(`${baseURL}/bgmd@${version}/dist/calendar.json`);
|
|
14
17
|
if (!resp.ok) throw new Error(`Fetch bgmd calendar.json failed`, { cause: resp });
|
|
15
18
|
return (await resp.json()).calendar;
|
|
16
19
|
}
|