@tenjuu99/blog 0.2.26 → 0.2.27
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
CHANGED
package/lib/dir.js
CHANGED
|
@@ -36,10 +36,16 @@ const cache = () => {
|
|
|
36
36
|
const packages = config.packages.split(',')
|
|
37
37
|
packages.forEach(dir => {
|
|
38
38
|
if (fs.existsSync(`${packageDirCore}/${dir}`)) {
|
|
39
|
+
const helper = config.helper.split(',')
|
|
40
|
+
helper.push(`${dir}.js`)
|
|
41
|
+
config.helper = helper.join(',')
|
|
39
42
|
console.log(styleText('blue', `[cache] enable core package: ${dir}`))
|
|
40
43
|
fs.cpSync(`${packageDirCore}/${dir}`, cacheDir, { recursive: true })
|
|
41
44
|
}
|
|
42
45
|
if (fs.existsSync(`${packageDir}/${dir}`)) {
|
|
46
|
+
const helper = config.helper.split(',')
|
|
47
|
+
helper.push(`${dir}.js`)
|
|
48
|
+
config.helper = helper.join(',')
|
|
43
49
|
console.log(styleText('blue', `[cache] enable package: ${dir}`))
|
|
44
50
|
fs.cpSync(`${packageDir}/${dir}`, cacheDir, { recursive: true })
|
|
45
51
|
}
|
package/lib/helper.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import config from './config.js'
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
2
3
|
import { helperDir } from './dir.js'
|
|
3
4
|
|
|
4
5
|
let helper = {}
|
|
@@ -6,8 +7,10 @@ let helper = {}
|
|
|
6
7
|
if (config.helper) {
|
|
7
8
|
const files = config.helper.split(',')
|
|
8
9
|
files.forEach(async file => {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
if (existsSync(`${helperDir}/${file}`)) {
|
|
11
|
+
const helperAdditional = await import(`${helperDir}/${file}`)
|
|
12
|
+
helper = Object.assign(helper, helperAdditional)
|
|
13
|
+
}
|
|
11
14
|
})
|
|
12
15
|
}
|
|
13
16
|
|
package/package.json
CHANGED
|
@@ -61,6 +61,18 @@ const transition = async (href) => {
|
|
|
61
61
|
document.head.appendChild(meta)
|
|
62
62
|
}
|
|
63
63
|
})
|
|
64
|
+
const scripts = [...document.scripts].forEach(script => {
|
|
65
|
+
if (script.dataset.turbolink === 'reapply') {
|
|
66
|
+
const newScript = document.createElement('script')
|
|
67
|
+
newScript.dataset.turbolink = 'reapply'
|
|
68
|
+
const newScriptHtml = `(() => {
|
|
69
|
+
${script.innerHTML}
|
|
70
|
+
})()`
|
|
71
|
+
newScript.innerHTML = newScriptHtml
|
|
72
|
+
script.parentNode.append(newScript)
|
|
73
|
+
script.remove()
|
|
74
|
+
}
|
|
75
|
+
})
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
const urlFromHref = (href) => {
|
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
<ul class="container">
|
|
9
9
|
<li><a href="{{RELATIVE_PATH}}/about">about</a></li>
|
|
10
10
|
<li><a href="{{RELATIVE_PATH}}/privacy_policy">プライバシーポリシー</a></li>
|
|
11
|
-
<li><a href="{{RELATIVE_PATH}}/rss.xml">RSS</a></li>
|
|
11
|
+
<li><a href="{{RELATIVE_PATH}}/rss.xml" data-turbolink="disable">RSS</a></li>
|
|
12
12
|
</ul>
|
|
13
13
|
</footer>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
<script data-turbolink="reapply">
|
|
16
|
+
const title = document.title
|
|
17
|
+
console.log(title)
|
|
18
18
|
</script>
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
{{ turbolink() }}
|