dsh-shelfry 0.4.2 → 0.4.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.
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/regions.js +5 -4
- package/lib/registry.js +1 -1
- package/lib/shelfry-catalog.js +6 -4
- package/lib/types/registry.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ app's **Settings → Plugins** instead.
|
|
|
39
39
|
The plugin list comes from shelfry, fetched live:
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
https://shelfry.app/data/
|
|
42
|
+
https://shelfry.app/data/dsh-shelfry.json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
That file has its own shape (`entries[]` with `i`, `n`, `d`, `s`, `sc`, `t`,
|
package/README.zh.md
CHANGED
package/lib/regions.js
CHANGED
|
@@ -75,13 +75,14 @@ const CHINA_NPM_FALLBACK = 'https://registry.npmmirror.com';
|
|
|
75
75
|
const GITHUB_PROXY_CHINA = 'https://gh-proxy.com';
|
|
76
76
|
const GITHUB_PROXY_CHINA_FALLBACK = 'https://ghfast.top';
|
|
77
77
|
/**
|
|
78
|
-
* 目录的唯一公开地址:shelfry 的
|
|
78
|
+
* 目录的唯一公开地址:shelfry 的 dsh-shelfry.json(插件专用全量数据包)。
|
|
79
79
|
*
|
|
80
|
-
* 这份 JSON 由 shelfry
|
|
81
|
-
* src/shelfry-catalog.ts
|
|
80
|
+
* 这份 JSON 由 shelfry 每次构建时随站点一起生成(与网页端同源数据),条目字段
|
|
81
|
+
* 与内部 Registry 不同,映射放在 src/shelfry-catalog.ts;这里只负责把它放在
|
|
82
|
+
* 哪个地区的哪个地址上。
|
|
82
83
|
* 它带 ETag 与 cache-control,所以 registry.ts 的 304 复用照常生效。
|
|
83
84
|
*/
|
|
84
|
-
const CATALOG_OFFICIAL = 'https://shelfry.app/data/
|
|
85
|
+
const CATALOG_OFFICIAL = 'https://shelfry.app/data/dsh-shelfry.json';
|
|
85
86
|
const ROUTES = {
|
|
86
87
|
global: {
|
|
87
88
|
npmRegistry: DEFAULT_NPM_REGISTRY,
|
package/lib/registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Registry access: shelfry 的目录(
|
|
2
|
+
* Registry access: shelfry 的目录(dsh-shelfry.json)每次请求都重新拉取。
|
|
3
3
|
* 这里只负责抓取、重试、校验与 304 复用;字段映射见 src/shelfry-catalog.ts。
|
|
4
4
|
*/
|
|
5
5
|
import { BODY_STALL_TIMEOUT_MS, HEADERS_TIMEOUT_MS, readBodyWhileProgressing } from './body-progress.js';
|
package/lib/shelfry-catalog.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* shelfry 目录适配层。
|
|
3
3
|
*
|
|
4
|
-
* shelfry 的
|
|
4
|
+
* shelfry 的 dsh-shelfry.json 与市场内部使用的 Registry 是两份不同的契约:
|
|
5
5
|
* 前者用单字母字段(i/n/d/s/t/vr/cmd)描述条目,后者要求 category、owner、
|
|
6
6
|
* description 等结构化字段。本模块只做一次单向映射,并把外部输入的校验收在
|
|
7
7
|
* 这里;抓取、重试与缓存仍留在 registry.ts。
|
|
@@ -20,15 +20,17 @@ import { NPM_NAME_RE } from './sources.js';
|
|
|
20
20
|
const TYPE_TO_CATEGORY = {
|
|
21
21
|
'cordis-plugin': 'plugin',
|
|
22
22
|
skill: 'skill',
|
|
23
|
+
theme: 'theme',
|
|
23
24
|
};
|
|
24
|
-
/**
|
|
25
|
+
/** 分类的本地化标签;主题分类让插件端的主题页有内容可筛。 */
|
|
25
26
|
const CATEGORY_LABELS = {
|
|
26
27
|
plugin: { zh: '插件', en: 'Plugins' },
|
|
27
28
|
skill: { zh: '技能', en: 'Skills' },
|
|
29
|
+
theme: { zh: '主题', en: 'Themes' },
|
|
28
30
|
other: { zh: '其他', en: 'Other' },
|
|
29
31
|
};
|
|
30
|
-
/**
|
|
31
|
-
const CATEGORY_ORDER = ['plugin', 'skill', 'other'];
|
|
32
|
+
/** 分类字典的输出顺序:插件、技能、主题、其他。 */
|
|
33
|
+
const CATEGORY_ORDER = ['plugin', 'skill', 'theme', 'other'];
|
|
32
34
|
/** `i` 字段的唯一合法形态:owner/repo。 */
|
|
33
35
|
const REPO_PATH_RE = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u;
|
|
34
36
|
/** 安装命令的前缀,源站与本地补全都按它拼接。 */
|
package/lib/types/registry.d.ts
CHANGED