hexo-swpp 2.0.0-beta.0 → 2.0.0-beta.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.
- package/index.js +2 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -40,8 +40,7 @@ if (pluginConfig?.enable) {
|
|
|
40
40
|
const relativePath = nodePath.relative(rootPath, absPath)
|
|
41
41
|
// 获取拓展文件
|
|
42
42
|
let cache = fs.readFileSync('sw-cache.js', 'utf8')
|
|
43
|
-
.replaceAll('module.exports.
|
|
44
|
-
.replaceAll('module.exports.modifyRequest', 'const modifyRequest')
|
|
43
|
+
.replaceAll('module.exports.', 'const ')
|
|
45
44
|
if (!fetchNoCache) {
|
|
46
45
|
if (pluginConfig.sw.cdnRacing && getUrlList) {
|
|
47
46
|
cache +=`
|
|
@@ -73,7 +72,7 @@ if (pluginConfig?.enable) {
|
|
|
73
72
|
} else cache += '\nconst fetchNoCache = request => fetch(request, {cache: "no-store"})'
|
|
74
73
|
}
|
|
75
74
|
const swContent = fs.readFileSync(relativePath, 'utf8')
|
|
76
|
-
.replaceAll("const { cacheList, modifyRequest } = require('../sw-cache')", cache)
|
|
75
|
+
.replaceAll("const { cacheList, modifyRequest, fetchNoCache } = require('../sw-cache')", cache)
|
|
77
76
|
.replaceAll("'@$$[escape]'", (pluginConfig.sw.escape ?? 0).toString())
|
|
78
77
|
.replaceAll("'@$$[cacheName]'", `'${pluginConfig.sw.cacheName ?? 'kmarBlogCache'}'`)
|
|
79
78
|
return {
|