hexo-swpp 2.8.8 → 2.8.9

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 (2) hide show
  1. package/lib/swBuilder.js +4 -3
  2. package/package.json +1 -1
package/lib/swBuilder.js CHANGED
@@ -3,11 +3,10 @@ module.exports = (hexo, hexoConfig, rules, ejectValues) => {
3
3
  const nodePath = require('path')
4
4
  const fs = require('fs')
5
5
  const root = hexoConfig.url + (hexoConfig.root ?? '/')
6
- const serviceWorkerConfig = config.serviceWorker
7
6
 
8
7
  // noinspection JSUnresolvedVariable
9
8
  hexo.extend.generator.register('build_service_worker', () => {
10
- if (!serviceWorkerConfig) return
9
+ if (!config.serviceWorker) return
11
10
  return {
12
11
  path: 'sw.js',
13
12
  data: buildServiceWorker(rules, ejectValues)
@@ -54,11 +53,13 @@ function buildServiceWorker(rules, ejectValues) {
54
53
  fetchNoCache,
55
54
  getCdnList,
56
55
  getSpareUrls,
57
- blockRequest
56
+ blockRequest,
57
+ config
58
58
  } = rules
59
59
  const absPath = module.path + '/sw-template.js'
60
60
  const rootPath = nodePath.resolve('./')
61
61
  const relativePath = nodePath.relative(rootPath, absPath)
62
+ const serviceWorkerConfig = config.serviceWorker
62
63
  // 获取拓展文件
63
64
  let cache = getSource(rules, '\n\n', [
64
65
  'cacheList', 'modifyRequest', 'getCdnList', 'getSpareUrls', 'blockRequest',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "2.8.8",
3
+ "version": "2.8.9",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "cheerio": "^1.0.0-rc.12",