hexo-swpp 4.0.2 → 4.0.3

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 +15 -6
  2. package/dist/index.js +1 -26
  3. package/package.json +2 -2
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,22 @@ 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. 修复 `gen_dom` 默认值处理错误的问题 \[4.0.2]
94
+ 5. 移除 `-t/-test` 命令 \[4.0.2]
86
95
 
87
96
  + 3.3+
88
97
  1. 版本检查改为仅在执行 `hexo server` 时执行 \[3.3.0]
package/dist/index.js CHANGED
@@ -31,7 +31,6 @@ const path_1 = __importDefault(require("path"));
31
31
  const swpp_backends_1 = require("swpp-backends");
32
32
  const logger = require('hexo-log').default();
33
33
  const CONSOLE_OPTIONS = [
34
- { name: '-t, --test', desc: '尝试拉取指定链接' },
35
34
  { name: '-b, --build', desc: '构建 swpp,留空参数与使用该参数效果一致' }
36
35
  ];
37
36
  let actions;
@@ -94,36 +93,12 @@ async function start(hexo) {
94
93
  hexo.extend.console.register('swpp', 'Hexo Swpp 的相关指令', {
95
94
  options: CONSOLE_OPTIONS
96
95
  }, async (args) => {
97
- const test = args.t ?? args.test;
98
96
  // noinspection JSUnresolvedReference
99
97
  const build = args.b ?? args.build;
100
- if (test) {
101
- if (typeof test == 'boolean' || Array.isArray(test) || !/^(https?):\/\/(\S*?)\.(\S*?)(\S*)$/i.test(test)) {
102
- logger.error('[SWPP][CONSOLE] --test/-t 后应跟随一个有效 URL');
103
- }
104
- else {
105
- await initRules(hexo, pluginConfig);
106
- try {
107
- const compilationData = actions.compilationData;
108
- const response = await fetchUrl(compilationData, test);
109
- if ([200, 301, 302, 307, 308].includes(response.status)) {
110
- logger.info('[SWPP][LINK TEST] 资源拉取成功,状态码:' + response.status);
111
- }
112
- else {
113
- logger.warn('[SWPP][LINK TEST] 资源拉取失败,状态码:' + response.status);
114
- }
115
- }
116
- catch (e) {
117
- logger.warn('[SWPP][LINK TEST] 资源拉取失败', e);
118
- }
119
- }
120
- }
121
98
  if (build) {
122
99
  if (typeof build !== 'boolean') {
123
100
  logger.warn('[SWPP][CONSOLE] -build/-b 后方不应跟随参数');
124
101
  }
125
- }
126
- if (build || !test) {
127
102
  try {
128
103
  await runSwpp(hexo, pluginConfig);
129
104
  }
@@ -215,7 +190,7 @@ async function loadConfig(hexo, pluginConfig) {
215
190
  context: 'prod',
216
191
  publicPath: /[/\\]$/.test(publishPath) ? publishPath : publishPath + '/',
217
192
  isServiceWorker: pluginConfig.serviceWorker ?? true,
218
- domJsPath: pluginConfig.gen_dom ? 'sw-dom.js' : undefined,
193
+ domJsPath: pluginConfig.gen_dom ?? true ? 'sw-dom.js' : undefined,
219
194
  diffJsonPath: pluginConfig.gen_diff,
220
195
  });
221
196
  await actions.loadConfig({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "type": "git",
21
21
  "url": "https://github.com/EmptyDreams/hexo-swpp.git"
22
22
  },
23
- "homepage": "https://kmar.top/posts/73014407/",
23
+ "homepage": "https://swpp.kmar.top/",
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.0.2",
26
26
  "hexo": "^7.3.0",