hexo-swpp 2.5.0 → 2.5.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.
@@ -19,7 +19,8 @@ module.exports = (hexo, config, pluginConfig, swRules) => {
19
19
  if (!fs.existsSync(config.public_dir))
20
20
  return logger.info('未检测到发布目录,跳过 swpp 执行')
21
21
  // 读取拓展 json
22
- const expand = fs.existsSync(name) ? JSON.parse(fs.readFileSync(name, 'utf-8')) : undefined
22
+ const expandName = 'update.json'
23
+ const expand = fs.existsSync(expandName) ? JSON.parse(fs.readFileSync(expandName, 'utf-8')) : undefined
23
24
  const cachePath = 'cacheList.json'
24
25
  const updatePath = 'update.json'
25
26
  const oldCache = await getJsonFromNetwork(cachePath)
@@ -159,8 +160,8 @@ module.exports = (hexo, config, pluginConfig, swRules) => {
159
160
  postcss.parse(text).walkDecls(decl => {
160
161
  if (decl.value.includes('url')) {
161
162
  decl.value.match(/url\(([^)]+)\)/g)
162
- .map(it => it.match(/^(url\(['"])/) ? it.substring(5, it.length - 2) : it.substring(4, it.length - 1))
163
- .forEach(link => handleLink(link))
163
+ ?.map(it => it.match(/^(url\(['"])/) ? it.substring(5, it.length - 2) : it.substring(4, it.length - 1))
164
+ ?.forEach(link => handleLink(link))
164
165
  }
165
166
  })
166
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "hexo-log": "^3.0.0",