hexo-swpp 4.0.2 → 4.0.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.
Files changed (3) hide show
  1. package/README.md +19 -6
  2. package/dist/index.js +3 -2
  3. package/package.json +37 -35
package/README.md CHANGED
@@ -1,11 +1,16 @@
1
1
  这是 `swpp-backends` 的 hexo 端实现,绝大多数功能由 [swpp-backends](https://github.com/EmptyDreams/swpp-backends) 提供。
2
2
 
3
+ 文档:
4
+
5
+ 1. swpp-backends 文档:https://swpp.kmar.top/
6
+ 2. hexo-swpp 文档:https://swpp.kmar.top/quickstart/hexo
7
+
3
8
  ## 安装
4
9
 
5
10
  使用时需要同时安装 `hexo-swpp` 和 `swpp-backends`:
6
11
 
7
12
  ```bash
8
- npm install hexo-swpp swpp-backends@3.0.0-alpha.100
13
+ npm install hexo-swpp swpp-backends
9
14
  ```
10
15
 
11
16
  当 `swpp-backends` 存在版本更新时,可以直接更新 `swpp-backends` 版本,不需要更新 `hexo-swpp` 的版本。(不过 `hexo-swpp` 有更新的话最好也跟进一下。)
@@ -19,6 +24,8 @@ npm install hexo-swpp swpp-backends@3.0.0-alpha.100
19
24
  | ~3.2 | ^2.0.0 |
20
25
  | ~3.3 | ^2.1.2 |
21
26
  | 4.0-alpha | 3.0.0-alpha |
27
+ | 4.0.0 | ^3.0.0 |
28
+ | ^4.0.1 | ^3.1.0 |
22
29
 
23
30
  ## 使用
24
31
 
@@ -69,20 +76,26 @@ swpp:
69
76
  + 如果你的网站发布过程不使用 `hexo deploy` 指令,则不要启用 `auto_exec` 选项。
70
77
  + 将 `npm_url` 调整为非官方 URL 后检查版本时可能会出现 404 错误。
71
78
 
72
- SWPP v3 的文档尚未完成,敬请期待。
73
-
74
79
  ### 指令
75
80
 
76
81
  1. `hexo swpp` - 构建 json 文件
77
82
  2. `hexo swpp -b` / `hexo swpp --build` - 构建 json 文件,同 `hexo swpp`
78
- 3. `hexo swpp -t [URL]` / `hexo swpp --test [URL]` - 尝试拉取指定 URL,使用时将 `[URL]` 替换为有效的 HTTP/HTTPS 链接(需要附带协议头)
79
83
 
80
84
  ## 更新日志
81
85
 
82
86
  + 4.0+
83
- 1. 适配 `swpp-backends@3`
84
- 2. 修复无法与 `hexo8` 一同工作的问题
87
+
88
+ 该版本与 V3 不兼容,请注意修改配置文件!
89
+
90
+ 1. 适配 `swpp-backends@3` \[4.0.0]
91
+ 2. 修复无法与 `hexo8` 一同工作的问题 \[4.0.0]
85
92
  3. 修复不支持 `swpp-backends@3.1.0+` 的问题 \[4.0.1]
93
+ 4. 删除 `track_link` 配置项 \[4.0.2]
94
+ 5. 修复 `gen_dom` 默认值处理错误的问题 \[4.0.3]
95
+ 6. 移除 `-t/-test` 命令 \[4.0.3]
96
+ 7. 重新添加 `-t/-test` 命令 \[4.0.4]
97
+ 8. 修复 `swpp` 命令没有携带任何参数时不触发构建的问题 \[4.0.4]
98
+ 9. 修复 `-t/-test` 执行时不通过配置中的函数判定请求是否成功的问题 \[4.0.4]
86
99
 
87
100
  + 3.3+
88
101
  1. 版本检查改为仅在执行 `hexo server` 时执行 \[3.3.0]
package/dist/index.js CHANGED
@@ -105,8 +105,9 @@ async function start(hexo) {
105
105
  await initRules(hexo, pluginConfig);
106
106
  try {
107
107
  const compilationData = actions.compilationData;
108
+ const isSuccessful = compilationData.crossDep.read('isFetchSuccessful');
108
109
  const response = await fetchUrl(compilationData, test);
109
- if ([200, 301, 302, 307, 308].includes(response.status)) {
110
+ if (isSuccessful.runOnNode(response)) {
110
111
  logger.info('[SWPP][LINK TEST] 资源拉取成功,状态码:' + response.status);
111
112
  }
112
113
  else {
@@ -215,7 +216,7 @@ async function loadConfig(hexo, pluginConfig) {
215
216
  context: 'prod',
216
217
  publicPath: /[/\\]$/.test(publishPath) ? publishPath : publishPath + '/',
217
218
  isServiceWorker: pluginConfig.serviceWorker ?? true,
218
- domJsPath: pluginConfig.gen_dom ? 'sw-dom.js' : undefined,
219
+ domJsPath: pluginConfig.gen_dom ?? true ? 'sw-dom.js' : undefined,
219
220
  diffJsonPath: pluginConfig.gen_diff,
220
221
  });
221
222
  await actions.loadConfig({
package/package.json CHANGED
@@ -1,36 +1,38 @@
1
- {
2
- "name": "hexo-swpp",
3
- "version": "4.0.2",
4
- "main": "dist/index.js",
5
- "types": "types/index.d.ts",
6
- "files": [
7
- "dist",
8
- "types"
9
- ],
10
- "keywords": [
11
- "hexo",
12
- "sw",
13
- "ServiceWorker",
14
- "json",
15
- "auto"
16
- ],
17
- "author": "kmar",
18
- "license": "AGPL-3.0",
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/EmptyDreams/hexo-swpp.git"
22
- },
23
- "homepage": "https://kmar.top/posts/73014407/",
24
- "devDependencies": {
25
- "@types/node": "^22.0.2",
26
- "hexo": "^7.3.0",
27
- "typescript": "^5.5.4"
28
- },
29
- "dependencies": {
30
- "hexo-log": "^4.1.0"
31
- },
32
- "peerDependencies": {
33
- "swpp-backends": "^3.1.0"
34
- },
35
- "scripts": {}
1
+ {
2
+ "name": "hexo-swpp",
3
+ "version": "4.0.4",
4
+ "main": "dist/index.js",
5
+ "types": "types/index.d.ts",
6
+ "scripts": {
7
+ "prepublishOnly": "tsc"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "types"
12
+ ],
13
+ "keywords": [
14
+ "hexo",
15
+ "sw",
16
+ "ServiceWorker",
17
+ "json",
18
+ "auto"
19
+ ],
20
+ "author": "kmar",
21
+ "license": "AGPL-3.0",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/EmptyDreams/hexo-swpp.git"
25
+ },
26
+ "homepage": "https://swpp.kmar.top/",
27
+ "devDependencies": {
28
+ "@types/node": "^22.0.2",
29
+ "hexo": "^7.3.0",
30
+ "typescript": "^5.5.4"
31
+ },
32
+ "dependencies": {
33
+ "hexo-log": "^4.1.0"
34
+ },
35
+ "peerDependencies": {
36
+ "swpp-backends": "^3.1.0"
37
+ }
36
38
  }