PASSAGGIO A VITE !

AGG. 1.1.23
This commit is contained in:
Surya Paolo
2025-03-01 14:14:43 +01:00
parent f0098e57b2
commit bc960d38a1
1044 changed files with 5323 additions and 10823777 deletions

View File

@@ -1,4 +1,4 @@
/* eslint-disable import/namespace */
/* eslint-disable no-undef */
import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { clientsClaim, setCacheNameDetails, skipWaiting } from 'workbox-core';
@@ -15,6 +15,7 @@ import { ExpirationPlugin } from 'workbox-expiration';
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.5.4/workbox-sw.js');
self.addEventListener('install', () => self.skipWaiting());
@@ -34,16 +35,16 @@ self.addEventListener('activate', (event) => {
});
const APP_VERSION = "1.1.22";
const VITE_APP_VERSION = "1.1.23";
console.log(' [ VER-' + APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker');
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker');
importScripts('js/idb.js', 'js/storage.js');
let port = self.location.hostname.startsWith('test') ? 3001 : 3000;
let ISTEST = self.location.hostname.startsWith('test');
let ISLOCALE = self.location.hostname.startsWith('localhost');
console.log('SW- app ver ' + APP_VERSION + ' on port ' + port);
console.log('SW- app ver ' + VITE_APP_VERSION + ' on port ' + port);
// Function helpers
@@ -90,7 +91,7 @@ if (workbox) {
registerRoute(
new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
new CacheFirst({
cacheName: `images-upload-${APP_VERSION}`,
cacheName: `images-upload-${VITE_APP_VERSION}`,
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
@@ -101,7 +102,7 @@ if (workbox) {
registerRoute(
new RegExp(/\.(?:svg)$/),
new CacheFirst({
cacheName: `svg-${APP_VERSION}`,
cacheName: `svg-${VITE_APP_VERSION}`,
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
@@ -112,7 +113,7 @@ if (workbox) {
registerRoute(
new RegExp(/.*(?:googleapis|gstatic)\.com.*$/),
new StaleWhileRevalidate({
cacheName: `google-fonts-${APP_VERSION}`,
cacheName: `google-fonts-${VITE_APP_VERSION}`,
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
new ExpirationPlugin({ maxEntries: 30 }),
@@ -123,7 +124,7 @@ if (workbox) {
registerRoute(
new RegExp(/.*\/(?:icons).*$/),
new CacheFirst({
cacheName: `icon-cache-${APP_VERSION}`,
cacheName: `icon-cache-${VITE_APP_VERSION}`,
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
new ExpirationPlugin({ maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
@@ -134,7 +135,7 @@ if (workbox) {
registerRoute(
new RegExp(/\.(?:js|css|font)$/),
new StaleWhileRevalidate({
cacheName: `js-css-fonts-${APP_VERSION}`,
cacheName: `js-css-fonts-${VITE_APP_VERSION}`,
plugins: [
new CacheableResponsePlugin({ statuses: [200] }),
],
@@ -470,4 +471,4 @@ if (workbox) {
});
} else {
console.warn('Workbox could not be loaded.');
}
}

View File

@@ -1,6 +1,3 @@
/* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import "quasar/dist/types/feature-flag";
declare module "quasar/dist/types/feature-flag" {

View File

@@ -1,10 +0,0 @@
/* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import "quasar/dist/types/feature-flag";
declare module "quasar/dist/types/feature-flag" {
interface QuasarFeatureFlags {
pwa: true;
}
}

View File

@@ -5,14 +5,14 @@
import { register } from 'register-service-worker'
register(process.env.SERVICE_WORKER_FILE ? process.env.SERVICE_WORKER_FILE : '', {
register(import.meta.env.VITE_SERVICE_WORKER_FILE ? import.meta.env.VITE_SERVICE_WORKER_FILE : '', {
scope: '/',
ready() {
console.log('READY::: App is being served from cache by a service worker ' + process.env.SERVICE_WORKER_FILE)
console.log('READY::: App is being served from cache by a service worker ' + import.meta.env.VITE_SERVICE_WORKER_FILE)
},
registered(registration) { // registration -> a ServiceWorkerRegistration instance
console.log('REGISTERED::: !!!', process.env.SERVICE_WORKER_FILE)
console.log('REGISTERED::: !!!', import.meta.env.VITE_SERVICE_WORKER_FILE)
},
cached(registration) {
console.log('CACHED::: Content has been cached for offline use.')
@@ -35,4 +35,4 @@ register(process.env.SERVICE_WORKER_FILE ? process.env.SERVICE_WORKER_FILE : '',
},
});
// ServiceWorkerRegistration: https://developer.mozilla.org/enUs/docs/Web/API/ServiceWorkerRegistration
// ServiceWorkerRegistration: https://developer.mozilla.org/enUs/docs/Web/API/ServiceWorkerRegistration