javdict 1.3.2 → 1.3.4

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.
@@ -12,7 +12,7 @@ jobs:
12
12
 
13
13
  strategy:
14
14
  matrix:
15
- node-version: [18.x, 20.x, 22.x] # 你的项目要求 >=18,只测这三个就够
15
+ node-version: [20.x, 22.x] # 只保留 20 和 22,放弃 18
16
16
 
17
17
  steps:
18
18
  - name: Checkout code
@@ -22,7 +22,7 @@ jobs:
22
22
  uses: actions/setup-node@v4
23
23
  with:
24
24
  node-version: ${{ matrix.node-version }}
25
- cache: 'npm' # 加速依赖下载
25
+ cache: 'npm'
26
26
 
27
27
  - name: Install dependencies
28
28
  run: npm ci
@@ -30,6 +30,6 @@ jobs:
30
30
  - name: Run tests
31
31
  run: npm test
32
32
 
33
- # 如果你以后加了 ESLint / Prettier,可以在这里加
34
- # - name: Lint
35
- # run: npm run lint
33
+ - name: Show detailed test output
34
+ if: always()
35
+ run: npm test -- --reporter=verbose
package/README.md CHANGED
@@ -11,7 +11,7 @@ English | [中文](README_zh.md) | [日本語](README_jp.md) | [한국어](READM
11
11
 
12
12
  Type a title ID, get back the full details — cast, release date, studio, duration, tags, and more. Multiple data sources are queried automatically with no manual switching required.
13
13
 
14
- ![JavDict-Demo](https://raw.githubusercontent.com/gdjdkid/AvDict/master/Javdict-Demo.gif)
14
+ ![JavDict-Demo-en](https://raw.githubusercontent.com/gdjdkid/AvDict/master/assets/Javdict-Demo-en.gif)
15
15
 
16
16
  ---
17
17
 
package/README_de.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  Gib eine Titel-ID ein und erhalte sofort vollständige Informationen — Besetzung, Erscheinungsdatum, Studio, Laufzeit, Tags und mehr. Mehrere Datenquellen werden automatisch abgefragt, ohne manuelles Umschalten.
13
13
 
14
- ![JavDict-Demo](https://raw.githubusercontent.com/gdjdkid/AvDict/master/Javdict-Demo.gif)
14
+ ![JavDict-Demo-de](https://raw.githubusercontent.com/gdjdkid/AvDict/master/assets/Javdict-Demo-de.gif)
15
15
 
16
16
  ---
17
17
 
package/README_jp.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  番号を入力するだけで、出演者・発売日・メーカー・収録時間・タグなどの詳細情報を取得できます。複数のデータソースを自動的に切り替えて検索します。
13
13
 
14
- ![JavDict-Demo](https://raw.githubusercontent.com/gdjdkid/AvDict/master/Javdict-Demo.gif)
14
+ ![JavDict-Demo-jp](https://raw.githubusercontent.com/gdjdkid/AvDict/master/assets/Javdict-Demo-jp.gif)
15
15
 
16
16
  ---
17
17
 
package/README_kr.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  번호를 입력하면 출연진, 발매일, 제작사, 재생 시간, 태그 등 상세 정보를 바로 확인할 수 있습니다. 여러 데이터 소스를 자동으로 전환하며 검색합니다.
13
13
 
14
- ![JavDict-Demo](https://raw.githubusercontent.com/gdjdkid/AvDict/master/Javdict-Demo.gif)
14
+ ![JavDict-Demo-kr](https://raw.githubusercontent.com/gdjdkid/AvDict/master/assets/Javdict-Demo-kr.gif)
15
15
 
16
16
  ---
17
17
 
package/README_zh.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  输入一个车牌号,即可获取女优、发售日期、制作商、时长、类别等完整信息。支持多数据源自动兜底,无需手动切换。
13
13
 
14
- ![JavDict-Demo](https://raw.githubusercontent.com/gdjdkid/AvDict/master/Javdict-Demo.gif)
14
+ ![JavDict-Demo-zh](https://raw.githubusercontent.com/gdjdkid/AvDict/master/assets/Javdict-Demo-zh.gif)
15
15
 
16
16
  ---
17
17
 
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javdict",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "AV番号命令行查询工具",
5
5
  "main": "./index.js",
6
6
  "type": "module",
@@ -1,12 +1,41 @@
1
+ // 为 Node 18 提供 Web API polyfill
2
+ import { beforeAll } from 'vitest';
3
+
4
+ beforeAll(() => {
5
+ if (typeof global.File === 'undefined') {
6
+ global.File = class File {
7
+ constructor(bits, name, options = {}) {
8
+ this.bits = bits;
9
+ this.name = name;
10
+ this.type = options.type || '';
11
+ this.size = bits?.length || 0;
12
+ }
13
+ };
14
+ }
15
+
16
+ if (typeof global.FormData === 'undefined') {
17
+ global.FormData = class FormData {
18
+ constructor() {
19
+ this.data = new Map();
20
+ }
21
+ append(key, value) {
22
+ this.data.set(key, value);
23
+ }
24
+ };
25
+ }
26
+ });
27
+
28
+ // =====================================================
29
+
1
30
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
31
 
3
- // mock execSync,避免真实的 curl 网络请求
32
+ // Mock child_process
4
33
  vi.mock('child_process', () => ({
5
34
  execSync: vi.fn(),
6
35
  spawnSync: vi.fn(),
7
36
  }));
8
37
 
9
- // mock cache,避免缓存干扰测试结果
38
+ // Mock cache
10
39
  vi.mock('../lib/cache.js', () => ({
11
40
  getCache: vi.fn().mockReturnValue(null),
12
41
  setCache: vi.fn(),
@@ -16,7 +45,7 @@ vi.mock('../lib/cache.js', () => ({
16
45
  import { execSync } from 'child_process';
17
46
  import { search } from '../lib/fetcher.js';
18
47
 
19
- // 模拟 JAVBUS 详情页 HTML
48
+ // 模拟 HTML 数据
20
49
  const MOCK_JAVBUS_HTML = `
21
50
  <html>
22
51
  <head><title>SSIS-001</title></head>
@@ -44,7 +73,6 @@ const MOCK_JAVBUS_HTML = `
44
73
  </html>
45
74
  `;
46
75
 
47
- // 模拟 404 页面
48
76
  const MOCK_404_HTML = `
49
77
  <html>
50
78
  <head><title>404</title></head>
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'node',
6
+ include: ['test/**/*.test.js'],
7
+ pool: 'forks',
8
+ },
9
+ });
package/Javdict-Demo.gif DELETED
Binary file