refactor: migrate from shiki to shikiji (#2520)

This commit is contained in:
ocavue 2023-12-21 02:54:40 +08:00 committed by GitHub
parent e63473a5f8
commit 74138a9a58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 124 additions and 223 deletions

View file

@ -39,9 +39,7 @@ if (import.meta.env.PROD) {
/^\/oauth\//,
/^\/signin\//,
/^\/web-share-target\//,
// exclude shiki: has its own cache
/^\/shiki\//,
// exclude shiki: has its own cache
// exclude emoji: has its own cache
/^\/emojis\//,
// exclude sw: if the user navigates to it, fallback to index.html
/^\/sw.js$/,
@ -65,19 +63,6 @@ if (import.meta.env.PROD) {
],
}),
)
// include shiki cache
registerRoute(
({ sameOrigin, url }) =>
sameOrigin && url.pathname.startsWith('/shiki/'),
new StaleWhileRevalidate({
cacheName: 'elk-shiki',
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
// 365 days max
new ExpirationPlugin({ purgeOnQuotaError: true, maxAgeSeconds: 60 * 60 * 24 * 365 }),
],
}),
)
// include emoji icons
registerRoute(
({ sameOrigin, request, url }) =>