refactor: migrate from shiki to shikiji (#2520)
This commit is contained in:
parent
e63473a5f8
commit
74138a9a58
17 changed files with 124 additions and 223 deletions
|
@ -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 }) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue