diff --git a/package-lock.json b/package-lock.json index 1c634dc1..7cf75702 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kasia", - "version": "0.6.1", + "version": "0.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kasia", - "version": "0.6.1", + "version": "0.6.2", "dependencies": { "@headlessui/react": "2.2.1", "@tailwindcss/vite": "4.1.3", @@ -41,7 +41,7 @@ "@types/react": "19.1.0", "@types/react-dom": "19.1.4", "@types/uuid": "^10.0.0", - "@vitejs/plugin-react": "^4.5.1", + "@vitejs/plugin-react": "^4.7.0", "@vitest/browser": "^3.2.4", "autoprefixer": "^10.4.21", "babel-plugin-react-compiler": "^19.1.0-rc.2", @@ -3783,9 +3783,9 @@ } }, "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.19", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.19.tgz", - "integrity": "sha512-3FL3mnMbPu0muGOCaKAhhFEYmqv9eTfPSJRJmANrCwtgK8VuxpsZDGK+m0LYAGoyO8+0j5uRe4PeyPDK1yA/hA==", + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", "dev": true, "license": "MIT" }, @@ -5691,16 +5691,16 @@ } }, "node_modules/@vitejs/plugin-react": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.6.0.tgz", - "integrity": "sha512-5Kgff+m8e2PB+9j51eGHEpn5kUzRKH2Ry0qGoe8ItJg7pqnkPrYPkDQZGgGmTa0EGarHrkjLvOdU3b1fzI8otQ==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.27.4", + "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-beta.19", + "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, @@ -5708,7 +5708,7 @@ "node": "^14.18.0 || >=16.0.0" }, "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0" + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "node_modules/@vitest/browser": { diff --git a/package.json b/package.json index 49c98cf5..4352d64e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@types/react": "19.1.0", "@types/react-dom": "19.1.4", "@types/uuid": "^10.0.0", - "@vitejs/plugin-react": "^4.5.1", + "@vitejs/plugin-react": "^4.7.0", "@vitest/browser": "^3.2.4", "autoprefixer": "^10.4.21", "babel-plugin-react-compiler": "^19.1.0-rc.2", diff --git a/public/_headers b/public/_headers new file mode 100644 index 00000000..5e576f21 --- /dev/null +++ b/public/_headers @@ -0,0 +1,32 @@ +/ + Cache-Control: no-cache, no-store, must-revalidate + Pragma: no-cache + Expires: 0 + +/index.html + Cache-Control: no-cache, no-store, must-revalidate + Pragma: no-cache + Expires: 0 + +/*.html + Cache-Control: no-cache, no-store, must-revalidate + Pragma: no-cache + Expires: 0 + +/assets/* + Cache-Control: public, max-age=31536000, immutable + +/*.webmanifest + Cache-Control: no-cache + +/sw.js + Cache-Control: no-cache + +/workbox-*.js + Cache-Control: no-cache + +/*.png + Cache-Control: public, max-age=604800 + +/*.svg + Cache-Control: public, max-age=604800 diff --git a/vite.config.ts b/vite.config.ts index cc084644..8a43e723 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -78,6 +78,34 @@ const webPlugins: PluginOption[] = [ workbox: { // 14 mb maximumFileSizeToCacheInBytes: 14000000, + cleanupOutdatedCaches: true, + skipWaiting: true, + clientsClaim: true, + runtimeCaching: [ + // Navigations (index.html) + { + urlPattern: ({ request, sameOrigin }) => + sameOrigin && request.mode === "navigate", + handler: "NetworkFirst", + options: { + cacheName: "html-pages", + networkTimeoutSeconds: 5, + }, + }, + // JS/CSS/Workers + { + urlPattern: ({ request }) => + ["script", "style", "worker"].includes(request.destination), + handler: "StaleWhileRevalidate", + options: { cacheName: "assets" }, + }, + // Images + { + urlPattern: ({ request }) => request.destination === "image", + handler: "StaleWhileRevalidate", + options: { cacheName: "images" }, + }, + ], }, }), ];