feat: update caching strategy

This commit is contained in:
Ayo Ayco 2024-08-18 19:53:44 +02:00
parent bcc1574e8f
commit 5bea1c96ba
4 changed files with 132 additions and 135 deletions

View file

@ -17,7 +17,7 @@
"@astro-reactive/form": "^0.10.0", "@astro-reactive/form": "^0.10.0",
"@astro-reactive/validator": "^0.5.0", "@astro-reactive/validator": "^0.5.0",
"@astrojs/sitemap": "^3.1.6", "@astrojs/sitemap": "^3.1.6",
"@ayco/astro-sw": "^0.7.10", "@ayco/astro-sw": "^0.8.4",
"astro": "^4.14.2", "astro": "^4.14.2",
"astro-github-stats": "^0.7.0", "astro-github-stats": "^0.7.0",
"astro-iconify": "^1.2.0" "astro-iconify": "^1.2.0"

View file

@ -10,22 +10,22 @@ importers:
devDependencies: devDependencies:
'@astro-reactive/form': '@astro-reactive/form':
specifier: ^0.10.0 specifier: ^0.10.0
version: 0.10.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4))(rollup@4.20.0)(typescript@5.5.4) version: 0.10.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))(rollup@4.21.0)(typescript@5.5.4)
'@astro-reactive/validator': '@astro-reactive/validator':
specifier: ^0.5.0 specifier: ^0.5.0
version: 0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4))(rollup@4.20.0)(typescript@5.5.4) version: 0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))(rollup@4.21.0)(typescript@5.5.4)
'@astrojs/sitemap': '@astrojs/sitemap':
specifier: ^3.1.6 specifier: ^3.1.6
version: 3.1.6 version: 3.1.6
'@ayco/astro-sw': '@ayco/astro-sw':
specifier: ^0.7.10 specifier: ^0.8.4
version: 0.7.10 version: 0.8.4
astro: astro:
specifier: ^4.14.2 specifier: ^4.14.2
version: 4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) version: 4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
astro-github-stats: astro-github-stats:
specifier: ^0.7.0 specifier: ^0.7.0
version: 0.7.0(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4)) version: 0.7.0(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))
astro-iconify: astro-iconify:
specifier: ^1.2.0 specifier: ^1.2.0
version: 1.2.0 version: 1.2.0
@ -75,8 +75,8 @@ packages:
resolution: {integrity: sha512-/ca/+D8MIKEC8/A9cSaPUqQNZm+Es/ZinRv0ZAzvu2ios7POQSsVD+VOj7/hypWNsNM3T7RpfgNq7H2TU1KEHA==} resolution: {integrity: sha512-/ca/+D8MIKEC8/A9cSaPUqQNZm+Es/ZinRv0ZAzvu2ios7POQSsVD+VOj7/hypWNsNM3T7RpfgNq7H2TU1KEHA==}
engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0} engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0}
'@ayco/astro-sw@0.7.10': '@ayco/astro-sw@0.8.4':
resolution: {integrity: sha512-pGXC0mWalsBgb0ZzpRMdqPt4LoUQ6/Tcsm1SrpAqPmMDNraRPxtkvyx9cBm5YQme3AT7SoPk2Q8p+sUKQ4s+WA==} resolution: {integrity: sha512-Gv+VoVsCQguFmb0/VHc3J9HxVD2S6KS/HXy+lOwYSOyfx7obKYyRL8pn/qC2HShPVI2V9PSuXHC7vMk0EheT2Q==}
engines: {node: '>=18.0.0'} engines: {node: '>=18.0.0'}
'@babel/code-frame@7.24.7': '@babel/code-frame@7.24.7':
@ -611,88 +611,88 @@ packages:
rollup: rollup:
optional: true optional: true
'@rollup/rollup-android-arm-eabi@4.20.0': '@rollup/rollup-android-arm-eabi@4.21.0':
resolution: {integrity: sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==} resolution: {integrity: sha512-WTWD8PfoSAJ+qL87lE7votj3syLavxunWhzCnx3XFxFiI/BA/r3X7MUM8dVrH8rb2r4AiO8jJsr3ZjdaftmnfA==}
cpu: [arm] cpu: [arm]
os: [android] os: [android]
'@rollup/rollup-android-arm64@4.20.0': '@rollup/rollup-android-arm64@4.21.0':
resolution: {integrity: sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==} resolution: {integrity: sha512-a1sR2zSK1B4eYkiZu17ZUZhmUQcKjk2/j9Me2IDjk1GHW7LB5Z35LEzj9iJch6gtUfsnvZs1ZNyDW2oZSThrkA==}
cpu: [arm64] cpu: [arm64]
os: [android] os: [android]
'@rollup/rollup-darwin-arm64@4.20.0': '@rollup/rollup-darwin-arm64@4.21.0':
resolution: {integrity: sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==} resolution: {integrity: sha512-zOnKWLgDld/svhKO5PD9ozmL6roy5OQ5T4ThvdYZLpiOhEGY+dp2NwUmxK0Ld91LrbjrvtNAE0ERBwjqhZTRAA==}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
'@rollup/rollup-darwin-x64@4.20.0': '@rollup/rollup-darwin-x64@4.21.0':
resolution: {integrity: sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==} resolution: {integrity: sha512-7doS8br0xAkg48SKE2QNtMSFPFUlRdw9+votl27MvT46vo44ATBmdZdGysOevNELmZlfd+NEa0UYOA8f01WSrg==}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
'@rollup/rollup-linux-arm-gnueabihf@4.20.0': '@rollup/rollup-linux-arm-gnueabihf@4.21.0':
resolution: {integrity: sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==} resolution: {integrity: sha512-pWJsfQjNWNGsoCq53KjMtwdJDmh/6NubwQcz52aEwLEuvx08bzcy6tOUuawAOncPnxz/3siRtd8hiQ32G1y8VA==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.20.0': '@rollup/rollup-linux-arm-musleabihf@4.21.0':
resolution: {integrity: sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==} resolution: {integrity: sha512-efRIANsz3UHZrnZXuEvxS9LoCOWMGD1rweciD6uJQIx2myN3a8Im1FafZBzh7zk1RJ6oKcR16dU3UPldaKd83w==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.20.0': '@rollup/rollup-linux-arm64-gnu@4.21.0':
resolution: {integrity: sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==} resolution: {integrity: sha512-ZrPhydkTVhyeGTW94WJ8pnl1uroqVHM3j3hjdquwAcWnmivjAwOYjTEAuEDeJvGX7xv3Z9GAvrBkEzCgHq9U1w==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm64-musl@4.20.0': '@rollup/rollup-linux-arm64-musl@4.21.0':
resolution: {integrity: sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==} resolution: {integrity: sha512-cfaupqd+UEFeURmqNP2eEvXqgbSox/LHOyN9/d2pSdV8xTrjdg3NgOFJCtc1vQ/jEke1qD0IejbBfxleBPHnPw==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@rollup/rollup-linux-powerpc64le-gnu@4.20.0': '@rollup/rollup-linux-powerpc64le-gnu@4.21.0':
resolution: {integrity: sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==} resolution: {integrity: sha512-ZKPan1/RvAhrUylwBXC9t7B2hXdpb/ufeu22pG2psV7RN8roOfGurEghw1ySmX/CmDDHNTDDjY3lo9hRlgtaHg==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.20.0': '@rollup/rollup-linux-riscv64-gnu@4.21.0':
resolution: {integrity: sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==} resolution: {integrity: sha512-H1eRaCwd5E8eS8leiS+o/NqMdljkcb1d6r2h4fKSsCXQilLKArq6WS7XBLDu80Yz+nMqHVFDquwcVrQmGr28rg==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.20.0': '@rollup/rollup-linux-s390x-gnu@4.21.0':
resolution: {integrity: sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==} resolution: {integrity: sha512-zJ4hA+3b5tu8u7L58CCSI0A9N1vkfwPhWd/puGXwtZlsB5bTkwDNW/+JCU84+3QYmKpLi+XvHdmrlwUwDA6kqw==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
'@rollup/rollup-linux-x64-gnu@4.20.0': '@rollup/rollup-linux-x64-gnu@4.21.0':
resolution: {integrity: sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==} resolution: {integrity: sha512-e2hrvElFIh6kW/UNBQK/kzqMNY5mO+67YtEh9OA65RM5IJXYTWiXjX6fjIiPaqOkBthYF1EqgiZ6OXKcQsM0hg==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@rollup/rollup-linux-x64-musl@4.20.0': '@rollup/rollup-linux-x64-musl@4.21.0':
resolution: {integrity: sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==} resolution: {integrity: sha512-1vvmgDdUSebVGXWX2lIcgRebqfQSff0hMEkLJyakQ9JQUbLDkEaMsPTLOmyccyC6IJ/l3FZuJbmrBw/u0A0uCQ==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@rollup/rollup-win32-arm64-msvc@4.20.0': '@rollup/rollup-win32-arm64-msvc@4.21.0':
resolution: {integrity: sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==} resolution: {integrity: sha512-s5oFkZ/hFcrlAyBTONFY1TWndfyre1wOMwU+6KCpm/iatybvrRgmZVM+vCFwxmC5ZhdlgfE0N4XorsDpi7/4XQ==}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.20.0': '@rollup/rollup-win32-ia32-msvc@4.21.0':
resolution: {integrity: sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==} resolution: {integrity: sha512-G9+TEqRnAA6nbpqyUqgTiopmnfgnMkR3kMukFBDsiyy23LZvUCpiUwjTRx6ezYCjJODXrh52rBR9oXvm+Fp5wg==}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
'@rollup/rollup-win32-x64-msvc@4.20.0': '@rollup/rollup-win32-x64-msvc@4.21.0':
resolution: {integrity: sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==} resolution: {integrity: sha512-2jsCDZwtQvRhejHLfZ1JY6w6kEuEtfF9nzYsZxzSlNVKDX+DpsDJ+Rbjkm74nvg2rdx0gwBS+IMdvwJuq3S9pQ==}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@shikijs/core@1.13.0': '@shikijs/core@1.14.1':
resolution: {integrity: sha512-Mj5NVfbAXcD1GnwOTSPl8hBn/T8UDpfFQTptp+p41n/CbUcJtOq98WaRD7Lz3hCglYotUTHUWtzu3JhK6XlkAA==} resolution: {integrity: sha512-KyHIIpKNaT20FtFPFjCQB5WVSTpLR/n+jQXhWHWVUMm9MaOaG9BGOG0MSyt7yA4+Lm+4c9rTc03tt3nYzeYSfw==}
'@trysound/sax@0.2.0': '@trysound/sax@0.2.0':
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
@ -1034,8 +1034,8 @@ packages:
eastasianwidth@0.2.0: eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
electron-to-chromium@1.5.10: electron-to-chromium@1.5.11:
resolution: {integrity: sha512-C3RDERDjrNW262GCRvpoer3a0Ksd66CtgDLxMHhzShQ8fhL4kwnpVXsJPAKg9xJjIROXUbLBrvtOzVAjALMIWA==} resolution: {integrity: sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew==}
emoji-regex@10.3.0: emoji-regex@10.3.0:
resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==}
@ -1812,8 +1812,8 @@ packages:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'} engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
rollup@4.20.0: rollup@4.21.0:
resolution: {integrity: sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==} resolution: {integrity: sha512-vo+S/lfA2lMS7rZ2Qoubi6I5hwZwzXeUIctILZLbHI+laNtvhhOIon2S1JksA5UEDQ7l3vberd0fxK44lTYjbQ==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'} engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true hasBin: true
@ -1851,8 +1851,8 @@ packages:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'} engines: {node: '>=8'}
shiki@1.13.0: shiki@1.14.1:
resolution: {integrity: sha512-e0dWfnONbEv6xl7FJy3XIhsVHQ/65XHDZl92+6H9+4xWjfdo7pmkqG7Kg47KWtDiEtzM5Z+oEfb4vtRvoZ/X9w==} resolution: {integrity: sha512-FujAN40NEejeXdzPt+3sZ3F2dx1U24BY2XTY01+MG8mbxCiA2XukXdcbyMyLAHJ/1AUUnQd1tZlvIjefWWEJeA==}
short-unique-id@4.4.4: short-unique-id@4.4.4:
resolution: {integrity: sha512-oLF1NCmtbiTWl2SqdXZQbo5KM1b7axdp0RgQLq8qCBBLoq+o3A5wmLrNM6bZIh54/a8BJ3l69kTXuxwZ+XCYuw==} resolution: {integrity: sha512-oLF1NCmtbiTWl2SqdXZQbo5KM1b7axdp0RgQLq8qCBBLoq+o3A5wmLrNM6bZIh54/a8BJ3l69kTXuxwZ+XCYuw==}
@ -2169,9 +2169,9 @@ snapshots:
'@antfu/utils@0.7.10': {} '@antfu/utils@0.7.10': {}
'@astro-reactive/common@0.3.0(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4)': '@astro-reactive/common@0.3.0(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)':
dependencies: dependencies:
astro: 4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) astro: 4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
- less - less
@ -2185,11 +2185,11 @@ snapshots:
- terser - terser
- typescript - typescript
'@astro-reactive/form@0.10.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4))(rollup@4.20.0)(typescript@5.5.4)': '@astro-reactive/form@0.10.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))(rollup@4.21.0)(typescript@5.5.4)':
dependencies: dependencies:
'@astro-reactive/common': 0.3.0(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) '@astro-reactive/common': 0.3.0(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
'@astro-reactive/validator': 0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4))(rollup@4.20.0)(typescript@5.5.4) '@astro-reactive/validator': 0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))(rollup@4.21.0)(typescript@5.5.4)
astro: 4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) astro: 4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
short-unique-id: 4.4.4 short-unique-id: 4.4.4
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
@ -2204,10 +2204,10 @@ snapshots:
- terser - terser
- typescript - typescript
'@astro-reactive/validator@0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4))(rollup@4.20.0)(typescript@5.5.4)': '@astro-reactive/validator@0.5.0(@types/node@22.4.0)(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4))(rollup@4.21.0)(typescript@5.5.4)':
dependencies: dependencies:
'@astro-reactive/common': 0.3.0(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) '@astro-reactive/common': 0.3.0(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
astro: 4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) astro: 4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
- less - less
@ -2239,7 +2239,7 @@ snapshots:
remark-parse: 11.0.0 remark-parse: 11.0.0
remark-rehype: 11.1.0 remark-rehype: 11.1.0
remark-smartypants: 3.0.2 remark-smartypants: 3.0.2
shiki: 1.13.0 shiki: 1.14.1
unified: 11.0.5 unified: 11.0.5
unist-util-remove-position: 5.0.0 unist-util-remove-position: 5.0.0
unist-util-visit: 5.0.0 unist-util-visit: 5.0.0
@ -2270,7 +2270,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@ayco/astro-sw@0.7.10': '@ayco/astro-sw@0.8.4':
dependencies: dependencies:
esbuild: 0.23.1 esbuild: 0.23.1
pathe: 1.1.2 pathe: 1.1.2
@ -2692,63 +2692,63 @@ snapshots:
'@oslojs/encoding@0.4.1': {} '@oslojs/encoding@0.4.1': {}
'@rollup/pluginutils@5.1.0(rollup@4.20.0)': '@rollup/pluginutils@5.1.0(rollup@4.21.0)':
dependencies: dependencies:
'@types/estree': 1.0.5 '@types/estree': 1.0.5
estree-walker: 2.0.2 estree-walker: 2.0.2
picomatch: 2.3.1 picomatch: 2.3.1
optionalDependencies: optionalDependencies:
rollup: 4.20.0 rollup: 4.21.0
'@rollup/rollup-android-arm-eabi@4.20.0': '@rollup/rollup-android-arm-eabi@4.21.0':
optional: true optional: true
'@rollup/rollup-android-arm64@4.20.0': '@rollup/rollup-android-arm64@4.21.0':
optional: true optional: true
'@rollup/rollup-darwin-arm64@4.20.0': '@rollup/rollup-darwin-arm64@4.21.0':
optional: true optional: true
'@rollup/rollup-darwin-x64@4.20.0': '@rollup/rollup-darwin-x64@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.20.0': '@rollup/rollup-linux-arm-gnueabihf@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-arm-musleabihf@4.20.0': '@rollup/rollup-linux-arm-musleabihf@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-arm64-gnu@4.20.0': '@rollup/rollup-linux-arm64-gnu@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-arm64-musl@4.20.0': '@rollup/rollup-linux-arm64-musl@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.20.0': '@rollup/rollup-linux-powerpc64le-gnu@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-riscv64-gnu@4.20.0': '@rollup/rollup-linux-riscv64-gnu@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-s390x-gnu@4.20.0': '@rollup/rollup-linux-s390x-gnu@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-x64-gnu@4.20.0': '@rollup/rollup-linux-x64-gnu@4.21.0':
optional: true optional: true
'@rollup/rollup-linux-x64-musl@4.20.0': '@rollup/rollup-linux-x64-musl@4.21.0':
optional: true optional: true
'@rollup/rollup-win32-arm64-msvc@4.20.0': '@rollup/rollup-win32-arm64-msvc@4.21.0':
optional: true optional: true
'@rollup/rollup-win32-ia32-msvc@4.20.0': '@rollup/rollup-win32-ia32-msvc@4.21.0':
optional: true optional: true
'@rollup/rollup-win32-x64-msvc@4.20.0': '@rollup/rollup-win32-x64-msvc@4.21.0':
optional: true optional: true
'@shikijs/core@1.13.0': '@shikijs/core@1.14.1':
dependencies: dependencies:
'@types/hast': 3.0.4 '@types/hast': 3.0.4
@ -2851,9 +2851,9 @@ snapshots:
array-iterate@2.0.1: {} array-iterate@2.0.1: {}
astro-github-stats@0.7.0(astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4)): astro-github-stats@0.7.0(astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)):
dependencies: dependencies:
astro: 4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4) astro: 4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4)
astro-iconify@1.2.0: astro-iconify@1.2.0:
dependencies: dependencies:
@ -2865,7 +2865,7 @@ snapshots:
- debug - debug
- supports-color - supports-color
astro@4.14.2(@types/node@22.4.0)(rollup@4.20.0)(typescript@5.5.4): astro@4.14.2(@types/node@22.4.0)(rollup@4.21.0)(typescript@5.5.4):
dependencies: dependencies:
'@astrojs/compiler': 2.10.3 '@astrojs/compiler': 2.10.3
'@astrojs/internal-helpers': 0.4.1 '@astrojs/internal-helpers': 0.4.1
@ -2878,7 +2878,7 @@ snapshots:
'@babel/traverse': 7.25.3 '@babel/traverse': 7.25.3
'@babel/types': 7.25.2 '@babel/types': 7.25.2
'@oslojs/encoding': 0.4.1 '@oslojs/encoding': 0.4.1
'@rollup/pluginutils': 5.1.0(rollup@4.20.0) '@rollup/pluginutils': 5.1.0(rollup@4.21.0)
'@types/babel__core': 7.20.5 '@types/babel__core': 7.20.5
'@types/cookie': 0.6.0 '@types/cookie': 0.6.0
acorn: 8.12.1 acorn: 8.12.1
@ -2920,7 +2920,7 @@ snapshots:
prompts: 2.4.2 prompts: 2.4.2
rehype: 13.0.1 rehype: 13.0.1
semver: 7.6.3 semver: 7.6.3
shiki: 1.13.0 shiki: 1.14.1
string-width: 7.2.0 string-width: 7.2.0
strip-ansi: 7.1.0 strip-ansi: 7.1.0
tsconfck: 3.1.1(typescript@5.5.4) tsconfck: 3.1.1(typescript@5.5.4)
@ -2985,7 +2985,7 @@ snapshots:
browserslist@4.23.3: browserslist@4.23.3:
dependencies: dependencies:
caniuse-lite: 1.0.30001651 caniuse-lite: 1.0.30001651
electron-to-chromium: 1.5.10 electron-to-chromium: 1.5.11
node-releases: 2.0.18 node-releases: 2.0.18
update-browserslist-db: 1.1.0(browserslist@4.23.3) update-browserslist-db: 1.1.0(browserslist@4.23.3)
@ -3175,7 +3175,7 @@ snapshots:
eastasianwidth@0.2.0: {} eastasianwidth@0.2.0: {}
electron-to-chromium@1.5.10: {} electron-to-chromium@1.5.11: {}
emoji-regex@10.3.0: {} emoji-regex@10.3.0: {}
@ -4235,26 +4235,26 @@ snapshots:
reusify@1.0.4: {} reusify@1.0.4: {}
rollup@4.20.0: rollup@4.21.0:
dependencies: dependencies:
'@types/estree': 1.0.5 '@types/estree': 1.0.5
optionalDependencies: optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.20.0 '@rollup/rollup-android-arm-eabi': 4.21.0
'@rollup/rollup-android-arm64': 4.20.0 '@rollup/rollup-android-arm64': 4.21.0
'@rollup/rollup-darwin-arm64': 4.20.0 '@rollup/rollup-darwin-arm64': 4.21.0
'@rollup/rollup-darwin-x64': 4.20.0 '@rollup/rollup-darwin-x64': 4.21.0
'@rollup/rollup-linux-arm-gnueabihf': 4.20.0 '@rollup/rollup-linux-arm-gnueabihf': 4.21.0
'@rollup/rollup-linux-arm-musleabihf': 4.20.0 '@rollup/rollup-linux-arm-musleabihf': 4.21.0
'@rollup/rollup-linux-arm64-gnu': 4.20.0 '@rollup/rollup-linux-arm64-gnu': 4.21.0
'@rollup/rollup-linux-arm64-musl': 4.20.0 '@rollup/rollup-linux-arm64-musl': 4.21.0
'@rollup/rollup-linux-powerpc64le-gnu': 4.20.0 '@rollup/rollup-linux-powerpc64le-gnu': 4.21.0
'@rollup/rollup-linux-riscv64-gnu': 4.20.0 '@rollup/rollup-linux-riscv64-gnu': 4.21.0
'@rollup/rollup-linux-s390x-gnu': 4.20.0 '@rollup/rollup-linux-s390x-gnu': 4.21.0
'@rollup/rollup-linux-x64-gnu': 4.20.0 '@rollup/rollup-linux-x64-gnu': 4.21.0
'@rollup/rollup-linux-x64-musl': 4.20.0 '@rollup/rollup-linux-x64-musl': 4.21.0
'@rollup/rollup-win32-arm64-msvc': 4.20.0 '@rollup/rollup-win32-arm64-msvc': 4.21.0
'@rollup/rollup-win32-ia32-msvc': 4.20.0 '@rollup/rollup-win32-ia32-msvc': 4.21.0
'@rollup/rollup-win32-x64-msvc': 4.20.0 '@rollup/rollup-win32-x64-msvc': 4.21.0
fsevents: 2.3.3 fsevents: 2.3.3
run-parallel@1.2.0: run-parallel@1.2.0:
@ -4307,9 +4307,9 @@ snapshots:
shebang-regex@3.0.0: {} shebang-regex@3.0.0: {}
shiki@1.13.0: shiki@1.14.1:
dependencies: dependencies:
'@shikijs/core': 1.13.0 '@shikijs/core': 1.14.1
'@types/hast': 3.0.4 '@types/hast': 3.0.4
short-unique-id@4.4.4: {} short-unique-id@4.4.4: {}
@ -4509,7 +4509,7 @@ snapshots:
dependencies: dependencies:
esbuild: 0.21.5 esbuild: 0.21.5
postcss: 8.4.41 postcss: 8.4.41
rollup: 4.20.0 rollup: 4.21.0
optionalDependencies: optionalDependencies:
'@types/node': 22.4.0 '@types/node': 22.4.0
fsevents: 2.3.3 fsevents: 2.3.3

3
src/env.d.ts vendored
View file

@ -1,2 +1 @@
/// <reference path="../.astro/types.d.ts" /> /// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View file

@ -5,15 +5,23 @@
*/ */
const cacheName = `${__prefix ?? 'app'}-v${__version ?? '000'}` const cacheName = `${__prefix ?? 'app'}-v${__version ?? '000'}`
const cleanOldCaches = async () => {
const allowCacheNames = ['cozy-reader', cacheName];
const allCaches = await caches.keys();
allCaches.forEach(key => {
if(!allowCacheNames.includes(key)) {
caches.delete(key);
}
});
}
const addResourcesToCache = async (resources) => { const addResourcesToCache = async (resources) => {
const cache = await caches.open(cacheName); const cache = await caches.open(cacheName);
console.log('[personal-sw]: adding resources to cache...', resources) await cache.addAll(resources);
await cache.addAll(new Set([...resources]));
}; };
const putInCache = async (request, response) => { const putInCache = async (request, response) => {
const cache = await caches.open(cacheName); const cache = await caches.open(cacheName);
console.log('[personal-sw]: adding one response to cache...', request.url)
// if exists, replace // if exists, replace
const keys = await cache.keys(); const keys = await cache.keys();
@ -26,7 +34,7 @@ const putInCache = async (request, response) => {
const cacheAndRevalidate = async ({ request, preloadResponsePromise, fallbackUrl }) => { const cacheAndRevalidate = async ({ request, preloadResponsePromise, fallbackUrl }) => {
const cache = await caches.open(cacheName); const cache = await caches.open(cacheName);
// Try get the resource from the cache // Try get the resource from the cache
@ -34,22 +42,17 @@ const cacheAndRevalidate = async ({ request, preloadResponsePromise, fallbackUrl
try { try {
// get network response for revalidation of stale assets // get network response for revalidation of stale assets
const responseFromNetwork = await fetch(request.clone()); const responseFromNetwork = await fetch(request.clone());
if (responseFromNetwork) { if(responseFromNetwork) {
console.info('[personal-sw]: fetched updated assets', responseFromNetwork.url);
putInCache(request, responseFromNetwork.clone()); putInCache(request, responseFromNetwork.clone());
} }
if (responseFromCache) { if(responseFromCache) {
console.info('[personal-sw]: using cached response', responseFromCache.url);
return responseFromCache; return responseFromCache;
} else{ } else {
console.info('[personal-sw]: using network response', responseFromNetwork.url);
return responseFromNetwork; return responseFromNetwork;
} }
} catch(error) { } catch (error) {
console.info('[personal-sw]: failed to fetch updated assets', request.url); if(responseFromCache) {
if (responseFromCache) {
console.info('[personal-sw]: using cached response', responseFromCache.url);
return responseFromCache; return responseFromCache;
} }
} }
@ -61,28 +64,25 @@ const cacheAndRevalidate = async ({ request, preloadResponsePromise, fallbackUrl
// To avoid those errors, remove or comment out this block of preloadResponse // To avoid those errors, remove or comment out this block of preloadResponse
// code along with enableNavigationPreload() and the "activate" listener. // code along with enableNavigationPreload() and the "activate" listener.
const preloadResponse = await preloadResponsePromise; const preloadResponse = await preloadResponsePromise;
if (preloadResponse) { if(preloadResponse) {
putInCache(request, preloadResponse.clone()); putInCache(request, preloadResponse.clone());
console.info('[personal-sw]: using preload response', preloadResponse.url);
return preloadResponse; return preloadResponse;
} }
try { try {
// Try to get the resource from the network for 5 seconds // Try to get the resource from the network for 5 seconds
const responseFromNetwork = await fetch(request.clone(), {signal: AbortSignal.timeout(5000)}); const responseFromNetwork = await fetch(request.clone());
// response may be used only once // response may be used only once
// we need to save clone to put one copy in cache // we need to save clone to put one copy in cache
// and serve second one // and serve second one
putInCache(request, responseFromNetwork.clone()); putInCache(request, responseFromNetwork.clone());
console.info('[personal-sw]: using network response', responseFromNetwork.url);
return responseFromNetwork; return responseFromNetwork;
} catch (error) { } catch (error) {
// Try the fallback // Try the fallback
const fallbackResponse = await cache.match(fallbackUrl); const fallbackResponse = await cache.match(fallbackUrl);
if (fallbackResponse) { if(fallbackResponse) {
console.info('[personal-sw]: using fallback cached response', fallbackResponse.url);
return fallbackResponse; return fallbackResponse;
} }
@ -97,27 +97,25 @@ const cacheAndRevalidate = async ({ request, preloadResponsePromise, fallbackUrl
}; };
const enableNavigationPreload = async () => { const enableNavigationPreload = async () => {
if (self.registration.navigationPreload) { if(self.registration.navigationPreload) {
// Enable navigation preloads! // Enable navigation preloads!
await self.registration.navigationPreload.enable(); await self.registration.navigationPreload.enable();
} }
}; };
self.addEventListener<any>('activate', (event) => { self.addEventListener('activate', (event) => {
console.log('[personal-sw]: activating...', event) cleanOldCaches();
event.waitUntil(enableNavigationPreload()); event.waitUntil(enableNavigationPreload());
}); });
self.addEventListener<any>('install', (event) => { self.addEventListener('install', (event) => {
console.log('[personal-sw]: installing...', event)
event.waitUntil( event.waitUntil(
addResourcesToCache(__assets ?? []) addResourcesToCache(__assets ?? [])
); );
self.skipWaiting(); // activate updated SW self.skipWaiting(); // activate updated SW
}); });
self.addEventListener<any>('event', (event) => { self.addEventListener('fetch', (event) => {
// ... else, use network first
event.respondWith( event.respondWith(
cacheAndRevalidate({ cacheAndRevalidate({
request: event.request, request: event.request,