v1.0 with SW PWA enabled
This commit is contained in:
21
frontend/node_modules/vite-plugin-pwa/LICENSE
generated
vendored
Normal file
21
frontend/node_modules/vite-plugin-pwa/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
93
frontend/node_modules/vite-plugin-pwa/README.md
generated
vendored
Normal file
93
frontend/node_modules/vite-plugin-pwa/README.md
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
<p align='center'>
|
||||
<img src='https://vite-pwa-org.netlify.app/banner_light.svg' alt="vite-plugin-pwa - Zero-config PWA for Vite"><br>
|
||||
Zero-config PWA Framework-agnostic Plugin for Vite
|
||||
</p>
|
||||
|
||||
<p align='center'>
|
||||
<a href='https://www.npmjs.com/package/vite-plugin-pwa' target="__blank">
|
||||
<img src='https://img.shields.io/npm/v/vite-plugin-pwa?color=33A6B8&label=' alt="NPM version">
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/vite-plugin-pwa" target="__blank">
|
||||
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/vite-plugin-pwa?color=476582&label=">
|
||||
</a>
|
||||
<a href="https://vite-pwa-org.netlify.app/" target="__blank">
|
||||
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/antfu/vite-plugin-pwa" target="__blank">
|
||||
<img alt="GitHub stars" src="https://img.shields.io/github/stars/antfu/vite-plugin-pwa?style=social">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
||||
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- 📖 [**Documentation & guides**](https://vite-pwa-org.netlify.app/)
|
||||
- 👌 **Zero-Config**: sensible built-in default configs for common use cases
|
||||
- 🔩 **Extensible**: expose the full ability to customize the behavior of the plugin
|
||||
- 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
||||
- 🔌 **Offline Support**: generate service worker with offline support (via Workbox)
|
||||
- ⚡ **Fully tree shakable**: auto inject Web App Manifest
|
||||
- 💬 **Prompt for new content**: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
|
||||
- ⚙️ **Stale-while-revalidate**: automatic reload when new content is available
|
||||
- ✨ **Static assets handling**: configure static assets for offline support
|
||||
- 🐞 **Development Support**: debug your custom service worker logic as you develop your application
|
||||
- 🛠️ **Versatile**: integration with meta frameworks: [îles](https://github.com/ElMassimo/iles), [SvelteKit](https://github.com/sveltejs/kit), [VitePress](https://github.com/vuejs/vitepress), [Astro](https://github.com/withastro/astro), [Nuxt 3](https://github.com/nuxt/nuxt) and [Remix](https://github.com/remix-run/remix)
|
||||
- 💥 **PWA Assets Generator**: generate all the PWA assets from a single command and a single source image
|
||||
- 🚀 **PWA Assets Integration**: serving, generating and injecting PWA Assets on the fly in your application
|
||||
|
||||
## 📦 Install
|
||||
|
||||
> From v0.17, `vite-plugin-pwa` requires **Vite 5**.
|
||||
|
||||
> From v0.16 `vite-plugin-pwa` requires **Node 16 or above**: `workbox v7` requires **Node 16 or above**.
|
||||
|
||||
> From v0.13, `vite-plugin-pwa` requires **Vite 3.1 or above**.
|
||||
|
||||
```bash
|
||||
npm i vite-plugin-pwa -D
|
||||
|
||||
# yarn
|
||||
yarn add vite-plugin-pwa -D
|
||||
|
||||
# pnpm
|
||||
pnpm add vite-plugin-pwa -D
|
||||
```
|
||||
|
||||
## 🦄 Usage
|
||||
|
||||
Add `VitePWA` plugin to `vite.config.js / vite.config.ts` and configure it:
|
||||
|
||||
```ts
|
||||
// vite.config.js / vite.config.ts
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
VitePWA()
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Read the [📖 documentation](https://vite-pwa-org.netlify.app/guide/) for a complete guide on how to configure and use
|
||||
this plugin.
|
||||
|
||||
Check out the client type declarations [client.d.ts](./client.d.ts) for built-in frameworks support.
|
||||
|
||||
## 👀 Full config
|
||||
|
||||
Check out the type declaration [src/types.ts](./src/types.ts) and the following links for more details.
|
||||
|
||||
- [Web app manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest)
|
||||
- [Workbox](https://developers.google.com/web/tools/workbox)
|
||||
|
||||
## 📄 License
|
||||
|
||||
[MIT](./LICENSE) License © 2020-PRESENT [Anthony Fu](https://github.com/antfu)
|
||||
6
frontend/node_modules/vite-plugin-pwa/client.d.ts
generated
vendored
Normal file
6
frontend/node_modules/vite-plugin-pwa/client.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import './vue.d.ts'
|
||||
import './preact.d.ts'
|
||||
import './react.d.ts'
|
||||
import './svelte.d.ts'
|
||||
import './solid.d.ts'
|
||||
import './vanillajs.d.ts'
|
||||
84
frontend/node_modules/vite-plugin-pwa/dist/chunk-G4TAN34B.js
generated
vendored
Normal file
84
frontend/node_modules/vite-plugin-pwa/dist/chunk-G4TAN34B.js
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
import {
|
||||
cyan,
|
||||
dim,
|
||||
green,
|
||||
magenta,
|
||||
yellow
|
||||
} from "./chunk-LKBIOQSP.js";
|
||||
|
||||
// src/utils.ts
|
||||
function slash(str) {
|
||||
return str.replace(/\\/g, "/");
|
||||
}
|
||||
function resolveBasePath(base) {
|
||||
if (isAbsolute(base))
|
||||
return base;
|
||||
return !base.startsWith("/") && !base.startsWith("./") ? `/${base}` : base;
|
||||
}
|
||||
function isAbsolute(url) {
|
||||
return url.match(/^(?:[a-z]+:)?\/\//i);
|
||||
}
|
||||
function normalizePath(path) {
|
||||
return path.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
// src/log.ts
|
||||
import { relative } from "node:path";
|
||||
function logSWViteBuild(version, swName, viteOptions, format) {
|
||||
const { logLevel = "info" } = viteOptions;
|
||||
if (logLevel === "silent")
|
||||
return;
|
||||
if (logLevel === "info") {
|
||||
console.info([
|
||||
"",
|
||||
`${cyan(`PWA v${version}`)}`,
|
||||
`Building ${magenta(swName)} service worker ("${magenta(format)}" format)...`
|
||||
].join("\n"));
|
||||
}
|
||||
}
|
||||
function logWorkboxResult(version, throwMaximumFileSizeToCacheInBytes, strategy, buildResult, viteOptions, format = "none") {
|
||||
if (throwMaximumFileSizeToCacheInBytes) {
|
||||
const entries = buildResult.warnings.filter((w) => w.includes("maximumFileSizeToCacheInBytes"));
|
||||
if (entries.length) {
|
||||
const prefix = strategy === "generateSW" ? "workbox" : "injectManifest";
|
||||
throw new Error(`
|
||||
Configure "${prefix}.maximumFileSizeToCacheInBytes" to change the limit: the default value is 2 MiB.
|
||||
Check https://vite-pwa-org.netlify.app/guide/faq.html#missing-assets-from-sw-precache-manifest for more information.
|
||||
Assets exceeding the limit:
|
||||
${entries.map((w) => ` - ${w.replace(". Configure maximumFileSizeToCacheInBytes to change this limit", "")}`).join("\n")}
|
||||
`);
|
||||
}
|
||||
}
|
||||
const { root, logLevel = "info" } = viteOptions;
|
||||
if (logLevel === "silent")
|
||||
return;
|
||||
const { count, size, filePaths, warnings } = buildResult;
|
||||
if (logLevel === "info") {
|
||||
const entries = [
|
||||
"",
|
||||
`${cyan(`PWA v${version}`)}`,
|
||||
`mode ${magenta(strategy)}`
|
||||
];
|
||||
if (strategy === "injectManifest")
|
||||
entries.push(`format: ${magenta(format)}`);
|
||||
entries.push(
|
||||
`precache ${green(`${count} entries`)} ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}`,
|
||||
"files generated",
|
||||
...filePaths.map((p) => ` ${dim(normalizePath(relative(root, p)))}`)
|
||||
);
|
||||
console.info(entries.join("\n"));
|
||||
}
|
||||
warnings && warnings.length > 0 && console.warn(yellow([
|
||||
"warnings",
|
||||
...warnings.map((w) => ` ${w}`),
|
||||
""
|
||||
].join("\n")));
|
||||
}
|
||||
|
||||
export {
|
||||
slash,
|
||||
resolveBasePath,
|
||||
normalizePath,
|
||||
logSWViteBuild,
|
||||
logWorkboxResult
|
||||
};
|
||||
252
frontend/node_modules/vite-plugin-pwa/dist/chunk-I2Z7IWCN.js
generated
vendored
Normal file
252
frontend/node_modules/vite-plugin-pwa/dist/chunk-I2Z7IWCN.js
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
import {
|
||||
yellow
|
||||
} from "./chunk-LKBIOQSP.js";
|
||||
|
||||
// src/constants.ts
|
||||
var FILE_SW_REGISTER = "registerSW.js";
|
||||
var VIRTUAL_MODULES_MAP = {
|
||||
"virtual:pwa-register": "register",
|
||||
"virtual:pwa-register/vue": "vue",
|
||||
"virtual:pwa-register/svelte": "svelte",
|
||||
"virtual:pwa-register/react": "react",
|
||||
"virtual:pwa-register/preact": "preact",
|
||||
"virtual:pwa-register/solid": "solid"
|
||||
};
|
||||
var VIRTUAL_MODULES_RESOLVE_PREFIX = "/@vite-plugin-pwa/";
|
||||
var VIRTUAL_MODULES = Object.keys(VIRTUAL_MODULES_MAP);
|
||||
var defaultInjectManifestVitePlugins = [
|
||||
"alias",
|
||||
"commonjs",
|
||||
"vite:resolve",
|
||||
"vite:esbuild",
|
||||
"replace",
|
||||
"vite:define",
|
||||
"rollup-plugin-dynamic-import-variables",
|
||||
"vite:esbuild-transpile",
|
||||
"vite:json",
|
||||
"vite:terser"
|
||||
];
|
||||
var PWA_INFO_VIRTUAL = "virtual:pwa-info";
|
||||
var RESOLVED_PWA_INFO_VIRTUAL = `\0${PWA_INFO_VIRTUAL}`;
|
||||
var PWA_ASSETS_HEAD_VIRTUAL = "virtual:pwa-assets/head";
|
||||
var RESOLVED_PWA_ASSETS_HEAD_VIRTUAL = `\0${PWA_ASSETS_HEAD_VIRTUAL}`;
|
||||
var PWA_ASSETS_ICONS_VIRTUAL = "virtual:pwa-assets/icons";
|
||||
var RESOLVED_PWA_ASSETS_ICONS_VIRTUAL = `\0${PWA_ASSETS_ICONS_VIRTUAL}`;
|
||||
var DEV_SW_NAME = "dev-sw.js?dev-sw";
|
||||
var DEV_SW_VIRTUAL = `${VIRTUAL_MODULES_RESOLVE_PREFIX}pwa-entry-point-loaded`;
|
||||
var RESOLVED_DEV_SW_VIRTUAL = `\0${DEV_SW_VIRTUAL}`;
|
||||
var DEV_READY_NAME = "vite-pwa-plugin:dev-ready";
|
||||
var DEV_REGISTER_SW_NAME = "vite-plugin-pwa:register-sw";
|
||||
var DEV_PWA_ASSETS_NAME = "vite-plugin-pwa:pwa-assets";
|
||||
|
||||
// src/pwa-assets/utils.ts
|
||||
function mapLink(includeId, link) {
|
||||
const linkObject = {
|
||||
href: link.href,
|
||||
rel: link.rel
|
||||
};
|
||||
if (includeId && link.id)
|
||||
linkObject.id = link.id;
|
||||
if ("media" in link && link.media)
|
||||
linkObject.media = link.media;
|
||||
linkObject.href = link.href;
|
||||
if ("sizes" in link && link.sizes)
|
||||
linkObject.sizes = link.sizes;
|
||||
if ("type" in link && link.type)
|
||||
linkObject.type = link.type;
|
||||
return linkObject;
|
||||
}
|
||||
function extractIcons(instructions) {
|
||||
const icons = {
|
||||
favicon: {},
|
||||
transparent: {},
|
||||
maskable: {},
|
||||
apple: {},
|
||||
appleSplashScreen: {}
|
||||
};
|
||||
if (instructions) {
|
||||
Array.from(Object.values(instructions.favicon)).forEach(({ buffer: _buffer, ...rest }) => {
|
||||
if (rest.url)
|
||||
icons.favicon[rest.url] = { ...rest };
|
||||
});
|
||||
Array.from(Object.values(instructions.transparent)).forEach(({ buffer: _buffer, ...rest }) => {
|
||||
if (rest.url)
|
||||
icons.transparent[rest.url] = { ...rest };
|
||||
});
|
||||
Array.from(Object.values(instructions.maskable)).forEach(({ buffer: _buffer, ...rest }) => {
|
||||
if (rest.url)
|
||||
icons.maskable[rest.url] = { ...rest };
|
||||
});
|
||||
Array.from(Object.values(instructions.apple)).forEach(({ buffer: _buffer, ...rest }) => {
|
||||
if (rest.url)
|
||||
icons.apple[rest.url] = { ...rest };
|
||||
});
|
||||
Array.from(Object.values(instructions.appleSplashScreen)).forEach(({ buffer: _buffer, ...rest }) => {
|
||||
if (rest.url)
|
||||
icons.appleSplashScreen[rest.url] = { ...rest };
|
||||
});
|
||||
}
|
||||
return icons;
|
||||
}
|
||||
|
||||
// src/html.ts
|
||||
function generateSimpleSWRegister(options, dev) {
|
||||
const path = dev ? `${options.base}${DEV_SW_NAME}` : `${options.buildBase}${options.filename}`;
|
||||
if (dev) {
|
||||
const swType = options.devOptions.type ?? "classic";
|
||||
return `if('serviceWorker' in navigator) navigator.serviceWorker.register('${path}', { scope: '${options.scope}', type: '${swType}' })`;
|
||||
}
|
||||
return `
|
||||
if('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('${path}', { scope: '${options.scope}' })
|
||||
})
|
||||
}`.replace(/\n/g, "");
|
||||
}
|
||||
function checkForHtmlHead(html) {
|
||||
if (!html.includes("</head>")) {
|
||||
if (!html.includes("<body>")) {
|
||||
console.warn([
|
||||
"",
|
||||
yellow("PWA WARNING:"),
|
||||
"</head> and <body> tags not found in the html, the service worker and web manifest will not be injected."
|
||||
].join("\n"));
|
||||
return html;
|
||||
} else {
|
||||
console.warn([
|
||||
"",
|
||||
yellow("PWA WARNING:"),
|
||||
"</head> not found in the html, adding it to the html tag: add empty <head></head> to your html to remove this warning."
|
||||
].join("\n"));
|
||||
}
|
||||
return html.replace("<body>", `<head>
|
||||
</head>
|
||||
<body>`);
|
||||
}
|
||||
return html;
|
||||
}
|
||||
function injectServiceWorker(html, options, dev) {
|
||||
const manifest = generateWebManifest(options, dev);
|
||||
if (!dev) {
|
||||
const script = generateRegisterSW(options, dev);
|
||||
if (script) {
|
||||
return checkForHtmlHead(html).replace(
|
||||
"</head>",
|
||||
`${manifest}${script}</head>`
|
||||
);
|
||||
}
|
||||
}
|
||||
return checkForHtmlHead(html).replace(
|
||||
"</head>",
|
||||
`${manifest}</head>`
|
||||
);
|
||||
}
|
||||
function generateWebManifest(options, dev) {
|
||||
const crossorigin = options.useCredentials ? ' crossorigin="use-credentials"' : "";
|
||||
if (dev) {
|
||||
const name = options.devOptions.webManifestUrl ?? `${options.base}${options.manifestFilename}`;
|
||||
return options.manifest ? `<link rel="manifest" href="${name}"${crossorigin}>` : "";
|
||||
} else {
|
||||
return options.manifest ? `<link rel="manifest" href="${options.buildBase}${options.manifestFilename}"${crossorigin}>` : "";
|
||||
}
|
||||
}
|
||||
function generateRegisterSW(options, dev) {
|
||||
if (options.injectRegister === "inline") {
|
||||
return `<script id="vite-plugin-pwa:inline-sw">${generateSimpleSWRegister(options, dev)}</script>`;
|
||||
} else if (options.injectRegister === "script" || options.injectRegister === "script-defer") {
|
||||
const hasDefer = options.injectRegister === "script-defer";
|
||||
return `<script id="vite-plugin-pwa:register-sw" src="${dev ? options.base : options.buildBase}${FILE_SW_REGISTER}"${hasDefer ? " defer" : ""}></script>`;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
function generateRegisterDevSW(base) {
|
||||
const path = `${base.endsWith("/") ? base : `${base}/`}${DEV_SW_VIRTUAL.slice(1)}`;
|
||||
return `<script id="vite-plugin-pwa:register-dev-sw" type="module">
|
||||
import registerDevSW from '${path}';
|
||||
registerDevSW();
|
||||
</script>`;
|
||||
}
|
||||
function generateSWHMR() {
|
||||
return `
|
||||
import.meta.hot.on('${DEV_REGISTER_SW_NAME}', ({ mode, inlinePath, registerPath, scope, swType = 'classic' }) => {
|
||||
if (mode == 'inline') {
|
||||
if('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register(inlinePath, { scope, type: swType });
|
||||
}
|
||||
}
|
||||
else {
|
||||
const registerSW = document.createElement('script');
|
||||
registerSW.setAttribute('id', 'vite-plugin-pwa:register-sw');
|
||||
if (mode === 'script-defer') registerSW.setAttribute('defer', 'defer');
|
||||
registerSW.setAttribute('src', registerPath);
|
||||
document.head.appendChild(registerSW);
|
||||
}
|
||||
});
|
||||
import.meta.hot.on('${DEV_PWA_ASSETS_NAME}', ({ themeColor, links }) => {
|
||||
if (themeColor) {
|
||||
const metaThemeColor = document.querySelector('meta[name="theme-color"]');
|
||||
if (metaThemeColor) {
|
||||
metaThemeColor.content = themeColor.content;
|
||||
} else {
|
||||
const meta = document.createElement('meta');
|
||||
meta.setAttribute('name', 'theme-color');
|
||||
meta.setAttribute('content', themeColor.content);
|
||||
document.head.appendChild(meta);
|
||||
}
|
||||
}
|
||||
if (links) {
|
||||
links.map((l) => {
|
||||
const link = document.querySelector(\`link[href="\${l.href}"]\`) ?? document.createElement('link');
|
||||
if (l.id) link.setAttribute('id', l.id);
|
||||
else link.removeAttribute('id');
|
||||
link.setAttribute('rel', l.rel);
|
||||
link.setAttribute('href', l.href);
|
||||
if (l.media) link.setAttribute('media', l.media);
|
||||
else link.removeAttribute('media');
|
||||
if (l.sizes) link.setAttribute('sizes', l.sizes);
|
||||
else link.removeAttribute('sizes');
|
||||
if (l.type) link.setAttribute('type', l.type);
|
||||
else link.removeAttribute('type');
|
||||
if (!link.parentNode) document.head.appendChild(link);
|
||||
});
|
||||
}
|
||||
});
|
||||
function registerDevSW() {
|
||||
try {
|
||||
import.meta.hot.send('${DEV_READY_NAME}');
|
||||
} catch (e) {
|
||||
console.error('unable to send ${DEV_READY_NAME} message to register service worker in dev mode!', e);
|
||||
}
|
||||
}
|
||||
export default registerDevSW;
|
||||
`;
|
||||
}
|
||||
|
||||
export {
|
||||
FILE_SW_REGISTER,
|
||||
VIRTUAL_MODULES_MAP,
|
||||
VIRTUAL_MODULES_RESOLVE_PREFIX,
|
||||
VIRTUAL_MODULES,
|
||||
defaultInjectManifestVitePlugins,
|
||||
PWA_INFO_VIRTUAL,
|
||||
RESOLVED_PWA_INFO_VIRTUAL,
|
||||
PWA_ASSETS_HEAD_VIRTUAL,
|
||||
RESOLVED_PWA_ASSETS_HEAD_VIRTUAL,
|
||||
PWA_ASSETS_ICONS_VIRTUAL,
|
||||
RESOLVED_PWA_ASSETS_ICONS_VIRTUAL,
|
||||
DEV_SW_NAME,
|
||||
DEV_SW_VIRTUAL,
|
||||
RESOLVED_DEV_SW_VIRTUAL,
|
||||
DEV_READY_NAME,
|
||||
DEV_REGISTER_SW_NAME,
|
||||
DEV_PWA_ASSETS_NAME,
|
||||
generateSimpleSWRegister,
|
||||
checkForHtmlHead,
|
||||
injectServiceWorker,
|
||||
generateWebManifest,
|
||||
generateRegisterSW,
|
||||
generateRegisterDevSW,
|
||||
generateSWHMR,
|
||||
mapLink,
|
||||
extractIcons
|
||||
};
|
||||
100
frontend/node_modules/vite-plugin-pwa/dist/chunk-LKBIOQSP.js
generated
vendored
Normal file
100
frontend/node_modules/vite-plugin-pwa/dist/chunk-LKBIOQSP.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
// node_modules/.pnpm/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
|
||||
var enabled = true;
|
||||
var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
||||
var supportLevel = 0;
|
||||
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
||||
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
|
||||
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") {
|
||||
enabled = false;
|
||||
} else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") {
|
||||
enabled = true;
|
||||
} else if (TERM === "dumb") {
|
||||
enabled = false;
|
||||
} else if ("CI" in globalVar.process.env && [
|
||||
"TRAVIS",
|
||||
"CIRCLECI",
|
||||
"APPVEYOR",
|
||||
"GITLAB_CI",
|
||||
"GITHUB_ACTIONS",
|
||||
"BUILDKITE",
|
||||
"DRONE"
|
||||
].some((vendor) => vendor in globalVar.process.env)) {
|
||||
enabled = true;
|
||||
} else {
|
||||
enabled = process.stdout.isTTY;
|
||||
}
|
||||
if (enabled) {
|
||||
if (process.platform === "win32") {
|
||||
supportLevel = 3;
|
||||
} else {
|
||||
if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) {
|
||||
supportLevel = 3;
|
||||
} else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) {
|
||||
supportLevel = 2;
|
||||
} else {
|
||||
supportLevel = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var options = {
|
||||
enabled,
|
||||
supportLevel
|
||||
};
|
||||
function kolorist(start, end, level = 1) {
|
||||
const open = `\x1B[${start}m`;
|
||||
const close = `\x1B[${end}m`;
|
||||
const regex = new RegExp(`\\x1b\\[${end}m`, "g");
|
||||
return (str) => {
|
||||
return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
|
||||
};
|
||||
}
|
||||
var reset = kolorist(0, 0);
|
||||
var bold = kolorist(1, 22);
|
||||
var dim = kolorist(2, 22);
|
||||
var italic = kolorist(3, 23);
|
||||
var underline = kolorist(4, 24);
|
||||
var inverse = kolorist(7, 27);
|
||||
var hidden = kolorist(8, 28);
|
||||
var strikethrough = kolorist(9, 29);
|
||||
var black = kolorist(30, 39);
|
||||
var red = kolorist(31, 39);
|
||||
var green = kolorist(32, 39);
|
||||
var yellow = kolorist(33, 39);
|
||||
var blue = kolorist(34, 39);
|
||||
var magenta = kolorist(35, 39);
|
||||
var cyan = kolorist(36, 39);
|
||||
var white = kolorist(97, 39);
|
||||
var gray = kolorist(90, 39);
|
||||
var lightGray = kolorist(37, 39);
|
||||
var lightRed = kolorist(91, 39);
|
||||
var lightGreen = kolorist(92, 39);
|
||||
var lightYellow = kolorist(93, 39);
|
||||
var lightBlue = kolorist(94, 39);
|
||||
var lightMagenta = kolorist(95, 39);
|
||||
var lightCyan = kolorist(96, 39);
|
||||
var bgBlack = kolorist(40, 49);
|
||||
var bgRed = kolorist(41, 49);
|
||||
var bgGreen = kolorist(42, 49);
|
||||
var bgYellow = kolorist(43, 49);
|
||||
var bgBlue = kolorist(44, 49);
|
||||
var bgMagenta = kolorist(45, 49);
|
||||
var bgCyan = kolorist(46, 49);
|
||||
var bgWhite = kolorist(107, 49);
|
||||
var bgGray = kolorist(100, 49);
|
||||
var bgLightRed = kolorist(101, 49);
|
||||
var bgLightGreen = kolorist(102, 49);
|
||||
var bgLightYellow = kolorist(103, 49);
|
||||
var bgLightBlue = kolorist(104, 49);
|
||||
var bgLightMagenta = kolorist(105, 49);
|
||||
var bgLightCyan = kolorist(106, 49);
|
||||
var bgLightGray = kolorist(47, 49);
|
||||
|
||||
export {
|
||||
dim,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
magenta,
|
||||
cyan
|
||||
};
|
||||
128
frontend/node_modules/vite-plugin-pwa/dist/client/build/preact.js
generated
vendored
Normal file
128
frontend/node_modules/vite-plugin-pwa/dist/client/build/preact.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
// src/client/build/preact.ts
|
||||
import { useState } from "preact/hooks";
|
||||
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
|
||||
// src/client/build/preact.ts
|
||||
function useRegisterSW(options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
const [needRefresh, setNeedRefresh] = useState(false);
|
||||
const [offlineReady, setOfflineReady] = useState(false);
|
||||
const [updateServiceWorker] = useState(() => {
|
||||
return registerSW({
|
||||
immediate,
|
||||
onOfflineReady() {
|
||||
setOfflineReady(true);
|
||||
onOfflineReady?.();
|
||||
},
|
||||
onNeedRefresh() {
|
||||
setNeedRefresh(true);
|
||||
onNeedRefresh?.();
|
||||
},
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
});
|
||||
});
|
||||
return {
|
||||
needRefresh: [needRefresh, setNeedRefresh],
|
||||
offlineReady: [offlineReady, setOfflineReady],
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
128
frontend/node_modules/vite-plugin-pwa/dist/client/build/react.js
generated
vendored
Normal file
128
frontend/node_modules/vite-plugin-pwa/dist/client/build/react.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
// src/client/build/react.ts
|
||||
import { useState } from "react";
|
||||
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
|
||||
// src/client/build/react.ts
|
||||
function useRegisterSW(options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
const [needRefresh, setNeedRefresh] = useState(false);
|
||||
const [offlineReady, setOfflineReady] = useState(false);
|
||||
const [updateServiceWorker] = useState(() => {
|
||||
return registerSW({
|
||||
immediate,
|
||||
onOfflineReady() {
|
||||
setOfflineReady(true);
|
||||
onOfflineReady?.();
|
||||
},
|
||||
onNeedRefresh() {
|
||||
setNeedRefresh(true);
|
||||
onNeedRefresh?.();
|
||||
},
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
});
|
||||
});
|
||||
return {
|
||||
needRefresh: [needRefresh, setNeedRefresh],
|
||||
offlineReady: [offlineReady, setOfflineReady],
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
90
frontend/node_modules/vite-plugin-pwa/dist/client/build/register.js
generated
vendored
Normal file
90
frontend/node_modules/vite-plugin-pwa/dist/client/build/register.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
export {
|
||||
registerSW
|
||||
};
|
||||
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/solid.js
generated
vendored
Normal file
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/solid.js
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
// src/client/build/solid.ts
|
||||
import { createSignal } from "solid-js";
|
||||
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
|
||||
// src/client/build/solid.ts
|
||||
function useRegisterSW(options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
const [needRefresh, setNeedRefresh] = createSignal(false);
|
||||
const [offlineReady, setOfflineReady] = createSignal(false);
|
||||
const updateServiceWorker = registerSW({
|
||||
immediate,
|
||||
onOfflineReady() {
|
||||
setOfflineReady(true);
|
||||
onOfflineReady?.();
|
||||
},
|
||||
onNeedRefresh() {
|
||||
setNeedRefresh(true);
|
||||
onNeedRefresh?.();
|
||||
},
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
});
|
||||
return {
|
||||
needRefresh: [needRefresh, setNeedRefresh],
|
||||
offlineReady: [offlineReady, setOfflineReady],
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/svelte.js
generated
vendored
Normal file
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/svelte.js
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
// src/client/build/svelte.ts
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
|
||||
// src/client/build/svelte.ts
|
||||
function useRegisterSW(options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
const needRefresh = writable(false);
|
||||
const offlineReady = writable(false);
|
||||
const updateServiceWorker = registerSW({
|
||||
immediate,
|
||||
onOfflineReady() {
|
||||
offlineReady.set(true);
|
||||
onOfflineReady?.();
|
||||
},
|
||||
onNeedRefresh() {
|
||||
needRefresh.set(true);
|
||||
onNeedRefresh?.();
|
||||
},
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
});
|
||||
return {
|
||||
needRefresh,
|
||||
offlineReady,
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/vue.js
generated
vendored
Normal file
126
frontend/node_modules/vite-plugin-pwa/dist/client/build/vue.js
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
// src/client/build/vue.ts
|
||||
import { ref } from "vue";
|
||||
|
||||
// src/client/build/register.ts
|
||||
var autoUpdateMode = "__SW_AUTO_UPDATE__";
|
||||
var selfDestroying = "__SW_SELF_DESTROYING__";
|
||||
var auto = autoUpdateMode === "true";
|
||||
var autoDestroy = selfDestroying === "true";
|
||||
function registerSW(options = {}) {
|
||||
const {
|
||||
immediate = false,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
let wb;
|
||||
let registerPromise;
|
||||
let sendSkipWaitingMessage;
|
||||
const updateServiceWorker = async (_reloadPage = true) => {
|
||||
await registerPromise;
|
||||
if (!auto) {
|
||||
sendSkipWaitingMessage?.();
|
||||
}
|
||||
};
|
||||
async function register() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
wb = await import("workbox-window").then(({ Workbox }) => {
|
||||
return new Workbox("__SW__", { scope: "__SCOPE__", type: "__TYPE__" });
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
return void 0;
|
||||
});
|
||||
if (!wb)
|
||||
return;
|
||||
sendSkipWaitingMessage = () => {
|
||||
wb?.messageSkipWaiting();
|
||||
};
|
||||
if (!autoDestroy) {
|
||||
if (auto) {
|
||||
wb.addEventListener("activated", (event) => {
|
||||
if (event.isUpdate || event.isExternal)
|
||||
window.location.reload();
|
||||
});
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let onNeedRefreshCalled = false;
|
||||
const showSkipWaitingPrompt = () => {
|
||||
onNeedRefreshCalled = true;
|
||||
wb?.addEventListener("controlling", (event) => {
|
||||
if (event.isUpdate)
|
||||
window.location.reload();
|
||||
});
|
||||
onNeedRefresh?.();
|
||||
};
|
||||
wb.addEventListener("installed", (event) => {
|
||||
if (typeof event.isUpdate === "undefined") {
|
||||
if (typeof event.isExternal !== "undefined") {
|
||||
if (event.isExternal)
|
||||
showSkipWaitingPrompt();
|
||||
else
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
} else {
|
||||
!onNeedRefreshCalled && onOfflineReady?.();
|
||||
}
|
||||
} else if (!event.isUpdate) {
|
||||
onOfflineReady?.();
|
||||
}
|
||||
});
|
||||
wb.addEventListener("waiting", showSkipWaitingPrompt);
|
||||
}
|
||||
}
|
||||
wb.register({ immediate }).then((r) => {
|
||||
if (onRegisteredSW)
|
||||
onRegisteredSW("__SW__", r);
|
||||
else
|
||||
onRegistered?.(r);
|
||||
}).catch((e) => {
|
||||
onRegisterError?.(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
registerPromise = register();
|
||||
return updateServiceWorker;
|
||||
}
|
||||
|
||||
// src/client/build/vue.ts
|
||||
function useRegisterSW(options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
onNeedRefresh,
|
||||
onOfflineReady,
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
} = options;
|
||||
const needRefresh = ref(false);
|
||||
const offlineReady = ref(false);
|
||||
const updateServiceWorker = registerSW({
|
||||
immediate,
|
||||
onNeedRefresh() {
|
||||
needRefresh.value = true;
|
||||
onNeedRefresh?.();
|
||||
},
|
||||
onOfflineReady() {
|
||||
offlineReady.value = true;
|
||||
onOfflineReady?.();
|
||||
},
|
||||
onRegistered,
|
||||
onRegisteredSW,
|
||||
onRegisterError
|
||||
});
|
||||
return {
|
||||
updateServiceWorker,
|
||||
offlineReady,
|
||||
needRefresh
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/preact.js
generated
vendored
Normal file
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/preact.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// src/client/dev/preact.ts
|
||||
import { useState } from "preact/hooks";
|
||||
function useRegisterSW(_options = {}) {
|
||||
const needRefresh = useState(false);
|
||||
const offlineReady = useState(false);
|
||||
const updateServiceWorker = (_reloadPage) => {
|
||||
};
|
||||
return {
|
||||
needRefresh,
|
||||
offlineReady,
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/react.js
generated
vendored
Normal file
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/react.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// src/client/dev/react.ts
|
||||
import { useState } from "react";
|
||||
function useRegisterSW(_options = {}) {
|
||||
const needRefresh = useState(false);
|
||||
const offlineReady = useState(false);
|
||||
const updateServiceWorker = (_reloadPage) => {
|
||||
};
|
||||
return {
|
||||
needRefresh,
|
||||
offlineReady,
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
8
frontend/node_modules/vite-plugin-pwa/dist/client/dev/register.js
generated
vendored
Normal file
8
frontend/node_modules/vite-plugin-pwa/dist/client/dev/register.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// src/client/dev/register.ts
|
||||
function registerSW(_options = {}) {
|
||||
return async (_reloadPage = true) => {
|
||||
};
|
||||
}
|
||||
export {
|
||||
registerSW
|
||||
};
|
||||
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/solid.js
generated
vendored
Normal file
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/solid.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// src/client/dev/solid.ts
|
||||
import { createSignal } from "solid-js";
|
||||
function useRegisterSW(_options = {}) {
|
||||
const needRefresh = createSignal(false);
|
||||
const offlineReady = createSignal(false);
|
||||
const updateServiceWorker = (_reloadPage) => {
|
||||
};
|
||||
return {
|
||||
needRefresh,
|
||||
offlineReady,
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/svelte.js
generated
vendored
Normal file
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/svelte.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// src/client/dev/svelte.ts
|
||||
import { writable } from "svelte/store";
|
||||
function useRegisterSW(_options = {}) {
|
||||
const needRefresh = writable(false);
|
||||
const offlineReady = writable(false);
|
||||
const updateServiceWorker = (_reloadPage) => {
|
||||
};
|
||||
return {
|
||||
needRefresh,
|
||||
offlineReady,
|
||||
updateServiceWorker
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/vue.js
generated
vendored
Normal file
16
frontend/node_modules/vite-plugin-pwa/dist/client/dev/vue.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// src/client/dev/vue.ts
|
||||
import { ref } from "vue";
|
||||
function useRegisterSW(_options = {}) {
|
||||
const needRefresh = ref(false);
|
||||
const offlineReady = ref(false);
|
||||
const updateServiceWorker = (_reloadPage) => {
|
||||
};
|
||||
return {
|
||||
updateServiceWorker,
|
||||
offlineReady,
|
||||
needRefresh
|
||||
};
|
||||
}
|
||||
export {
|
||||
useRegisterSW
|
||||
};
|
||||
267
frontend/node_modules/vite-plugin-pwa/dist/generator-Q3R7VIEH.js
generated
vendored
Normal file
267
frontend/node_modules/vite-plugin-pwa/dist/generator-Q3R7VIEH.js
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
import {
|
||||
checkForHtmlHead,
|
||||
extractIcons,
|
||||
mapLink
|
||||
} from "./chunk-I2Z7IWCN.js";
|
||||
import {
|
||||
cyan,
|
||||
red
|
||||
} from "./chunk-LKBIOQSP.js";
|
||||
|
||||
// src/pwa-assets/build.ts
|
||||
import { mkdir } from "node:fs/promises";
|
||||
import { generateAssets } from "@vite-pwa/assets-generator/api/generate-assets";
|
||||
async function generate(assetsGeneratorContext) {
|
||||
await mkdir(assetsGeneratorContext.imageOutDir, { recursive: true });
|
||||
await generateAssets(assetsGeneratorContext.assetsInstructions, true, assetsGeneratorContext.imageOutDir);
|
||||
}
|
||||
|
||||
// src/pwa-assets/config.ts
|
||||
import fs from "node:fs";
|
||||
import { access, readFile } from "node:fs/promises";
|
||||
import { basename, dirname, relative, resolve } from "node:path";
|
||||
import { instructions } from "@vite-pwa/assets-generator/api/instructions";
|
||||
import { loadConfig } from "@vite-pwa/assets-generator/config";
|
||||
async function loadAssetsGeneratorContext(ctx, assetsGeneratorContext) {
|
||||
const root = ctx.viteConfig.root ?? process.cwd();
|
||||
const { config, sources } = await loadConfiguration(root, ctx);
|
||||
if (!config.preset) {
|
||||
console.error([
|
||||
"",
|
||||
cyan(`PWA v${ctx.version}`),
|
||||
red("ERROR: No preset for assets generator found")
|
||||
].join("\n"));
|
||||
return;
|
||||
}
|
||||
const {
|
||||
preset,
|
||||
images,
|
||||
headLinkOptions: userHeadLinkOptions
|
||||
} = config;
|
||||
if (!images) {
|
||||
console.error([
|
||||
"",
|
||||
cyan(`PWA v${ctx.version}`),
|
||||
red("ERROR: No image provided for assets generator")
|
||||
].join("\n"));
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(images)) {
|
||||
if (!images.length) {
|
||||
console.error([
|
||||
"",
|
||||
cyan(`PWA v${ctx.version}`),
|
||||
red("ERROR: No image provided for assets generator")
|
||||
].join("\n"));
|
||||
return;
|
||||
}
|
||||
if (images.length > 1) {
|
||||
console.error([
|
||||
"",
|
||||
cyan(`PWA v${ctx.version}`),
|
||||
red("ERROR: Only one image is supported for assets generator")
|
||||
].join("\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
const pwaAssets = ctx.options.pwaAssets;
|
||||
const useImage = Array.isArray(images) ? images[0] : images;
|
||||
const imageFile = await tryToResolveImage(root, sources, useImage);
|
||||
const publicDir = pwaAssets.integration?.publicDir ?? resolve(root, ctx.viteConfig.publicDir || "public");
|
||||
const outDir = pwaAssets.integration?.outDir ?? resolve(root, ctx.viteConfig.build?.outDir || "dist");
|
||||
const imageName = relative(publicDir, imageFile);
|
||||
const imageOutDir = dirname(resolve(outDir, imageName));
|
||||
const xhtml = userHeadLinkOptions?.xhtml === true;
|
||||
const includeId = userHeadLinkOptions?.includeId === true;
|
||||
const assetsInstructions = await instructions({
|
||||
imageResolver: () => readFile(imageFile),
|
||||
imageName,
|
||||
preset,
|
||||
faviconPreset: userHeadLinkOptions?.preset ?? pwaAssets.htmlPreset,
|
||||
htmlLinks: { xhtml, includeId },
|
||||
basePath: pwaAssets.integration?.baseUrl || ctx.viteConfig.base || "/",
|
||||
resolveSvgName: userHeadLinkOptions?.resolveSvgName ?? ((name) => basename(name))
|
||||
});
|
||||
const {
|
||||
includeHtmlHeadLinks = true,
|
||||
overrideManifestIcons: useOverrideManifestIcons,
|
||||
injectThemeColor = false
|
||||
} = pwaAssets;
|
||||
const overrideManifestIcons = ctx.options.manifest === false || !ctx.options.manifest ? false : "icons" in ctx.options.manifest ? useOverrideManifestIcons : true;
|
||||
if (assetsGeneratorContext === void 0) {
|
||||
return {
|
||||
lastModified: Date.now(),
|
||||
assetsInstructions,
|
||||
cache: /* @__PURE__ */ new Map(),
|
||||
useImage,
|
||||
imageFile,
|
||||
publicDir,
|
||||
outDir,
|
||||
imageName,
|
||||
imageOutDir,
|
||||
xhtml,
|
||||
includeId,
|
||||
// normalize sources
|
||||
sources: sources.map((source) => source.replace(/\\/g, "/")),
|
||||
injectThemeColor,
|
||||
includeHtmlHeadLinks,
|
||||
overrideManifestIcons
|
||||
};
|
||||
}
|
||||
assetsGeneratorContext.lastModified = Date.now();
|
||||
assetsGeneratorContext.assetsInstructions = assetsInstructions;
|
||||
assetsGeneratorContext.useImage = useImage;
|
||||
assetsGeneratorContext.imageFile = imageFile;
|
||||
assetsGeneratorContext.outDir = outDir;
|
||||
assetsGeneratorContext.imageName = imageName;
|
||||
assetsGeneratorContext.imageOutDir = imageOutDir;
|
||||
assetsGeneratorContext.xhtml = xhtml;
|
||||
assetsGeneratorContext.includeId = includeId;
|
||||
assetsGeneratorContext.injectThemeColor = injectThemeColor;
|
||||
assetsGeneratorContext.includeHtmlHeadLinks = includeHtmlHeadLinks;
|
||||
assetsGeneratorContext.overrideManifestIcons = overrideManifestIcons;
|
||||
assetsGeneratorContext.cache.clear();
|
||||
}
|
||||
async function loadConfiguration(root, ctx) {
|
||||
const pwaAssets = ctx.options.pwaAssets;
|
||||
if (pwaAssets.config === false) {
|
||||
return await loadConfig(root, {
|
||||
config: false,
|
||||
preset: pwaAssets.preset,
|
||||
images: pwaAssets.images,
|
||||
logLevel: "silent"
|
||||
});
|
||||
}
|
||||
return await loadConfig(
|
||||
root,
|
||||
typeof pwaAssets.config === "boolean" ? root : { config: pwaAssets.config }
|
||||
);
|
||||
}
|
||||
async function checkFileExists(pathname) {
|
||||
try {
|
||||
await access(pathname, fs.constants.R_OK);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function tryToResolveImage(root, sources, image) {
|
||||
const imagePath = resolve(root, image);
|
||||
if (await checkFileExists(imagePath)) {
|
||||
return imagePath;
|
||||
}
|
||||
for (const source of sources) {
|
||||
const sourceImage = resolve(dirname(source), image);
|
||||
if (await checkFileExists(sourceImage)) {
|
||||
return sourceImage;
|
||||
}
|
||||
}
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
// src/pwa-assets/dev.ts
|
||||
async function findIconAsset(path, { assetsInstructions, cache, lastModified }) {
|
||||
let resolved = cache.get(path);
|
||||
if (resolved) {
|
||||
resolved.age = Date.now() - lastModified;
|
||||
return resolved;
|
||||
}
|
||||
const iconAsset = assetsInstructions.transparent[path] ?? assetsInstructions.maskable[path] ?? assetsInstructions.apple[path] ?? assetsInstructions.favicon[path] ?? assetsInstructions.appleSplashScreen[path];
|
||||
if (!iconAsset)
|
||||
return;
|
||||
if (iconAsset) {
|
||||
resolved = {
|
||||
path,
|
||||
mimeType: iconAsset.mimeType,
|
||||
buffer: iconAsset.buffer(),
|
||||
lastModified: Date.now(),
|
||||
age: 0
|
||||
};
|
||||
cache.set(path, resolved);
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
async function checkHotUpdate(file, ctx, assetsGeneratorContext) {
|
||||
const result = assetsGeneratorContext.sources.includes(file);
|
||||
if (result)
|
||||
await loadAssetsGeneratorContext(ctx, assetsGeneratorContext);
|
||||
return result;
|
||||
}
|
||||
|
||||
// src/pwa-assets/html.ts
|
||||
import { generateHtmlMarkup } from "@vite-pwa/assets-generator/api/generate-html-markup";
|
||||
function transformIndexHtml(html, ctx, assetsGeneratorContext) {
|
||||
if (assetsGeneratorContext.injectThemeColor) {
|
||||
const manifest = ctx.options.manifest;
|
||||
if (manifest && "theme_color" in manifest && manifest.theme_color) {
|
||||
html = checkForHtmlHead(html).replace(
|
||||
"</head>",
|
||||
`
|
||||
<meta name="theme-color" content="${manifest.theme_color}"></head>`
|
||||
);
|
||||
}
|
||||
}
|
||||
if (assetsGeneratorContext.includeHtmlHeadLinks) {
|
||||
const link = generateHtmlMarkup(assetsGeneratorContext.assetsInstructions);
|
||||
if (link.length)
|
||||
html = checkForHtmlHead(html).replace("</head>", `
|
||||
${link.join("\n")}</head>`);
|
||||
}
|
||||
return html;
|
||||
}
|
||||
function resolveHtmlAssets(ctx, assetsGeneratorContext) {
|
||||
const header = {
|
||||
links: [],
|
||||
themeColor: void 0
|
||||
};
|
||||
if (assetsGeneratorContext.injectThemeColor) {
|
||||
const manifest = ctx.options.manifest;
|
||||
if (manifest && "theme_color" in manifest && manifest.theme_color)
|
||||
header.themeColor = { name: "theme-color", content: manifest.theme_color };
|
||||
}
|
||||
if (assetsGeneratorContext.includeHtmlHeadLinks) {
|
||||
const includeId = assetsGeneratorContext.includeId;
|
||||
const instruction = assetsGeneratorContext.assetsInstructions;
|
||||
const favicon = Array.from(Object.values(instruction.favicon));
|
||||
const apple = Array.from(Object.values(instruction.apple));
|
||||
const appleSplashScreen = Array.from(Object.values(instruction.appleSplashScreen));
|
||||
favicon.forEach((icon) => icon.linkObject && header.links.push(mapLink(includeId, icon.linkObject)));
|
||||
apple.forEach((icon) => icon.linkObject && header.links.push(mapLink(includeId, icon.linkObject)));
|
||||
appleSplashScreen.forEach((icon) => icon.linkObject && header.links.push(mapLink(includeId, icon.linkObject)));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
// src/pwa-assets/manifest.ts
|
||||
import { generateManifestIconsEntry } from "@vite-pwa/assets-generator/api/generate-manifest-icons-entry";
|
||||
function injectManifestIcons(ctx, assetsGeneratorContext) {
|
||||
if (!assetsGeneratorContext.overrideManifestIcons)
|
||||
return;
|
||||
const manifest = ctx.options.manifest;
|
||||
if (manifest) {
|
||||
manifest.icons = generateManifestIconsEntry(
|
||||
"object",
|
||||
assetsGeneratorContext.assetsInstructions
|
||||
).icons;
|
||||
}
|
||||
}
|
||||
|
||||
// src/pwa-assets/generator.ts
|
||||
async function loadInstructions(ctx) {
|
||||
const assetsGeneratorContext = await loadAssetsGeneratorContext(ctx);
|
||||
if (!assetsGeneratorContext)
|
||||
return;
|
||||
return {
|
||||
generate: () => generate(assetsGeneratorContext),
|
||||
findIconAsset: (path) => findIconAsset(path, assetsGeneratorContext),
|
||||
resolveHtmlAssets: () => resolveHtmlAssets(ctx, assetsGeneratorContext),
|
||||
transformIndexHtml: (html) => transformIndexHtml(html, ctx, assetsGeneratorContext),
|
||||
injectManifestIcons: () => injectManifestIcons(ctx, assetsGeneratorContext),
|
||||
instructions: () => assetsGeneratorContext.assetsInstructions,
|
||||
icons: () => extractIcons(assetsGeneratorContext.assetsInstructions),
|
||||
checkHotUpdate: (file) => checkHotUpdate(file, ctx, assetsGeneratorContext)
|
||||
};
|
||||
}
|
||||
export {
|
||||
loadInstructions
|
||||
};
|
||||
2166
frontend/node_modules/vite-plugin-pwa/dist/index.cjs
generated
vendored
Normal file
2166
frontend/node_modules/vite-plugin-pwa/dist/index.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
820
frontend/node_modules/vite-plugin-pwa/dist/index.d.cts
generated
vendored
Normal file
820
frontend/node_modules/vite-plugin-pwa/dist/index.d.cts
generated
vendored
Normal file
@ -0,0 +1,820 @@
|
||||
import { BuildOptions, Plugin, UserConfig, ResolvedConfig, InlineConfig } from 'vite';
|
||||
import { ImageAssetsInstructions, IconAsset, FaviconLink, HtmlLink, AppleSplashScreenLink, HtmlLinkPreset } from '@vite-pwa/assets-generator/api';
|
||||
import { BuiltInPreset, Preset } from '@vite-pwa/assets-generator/config';
|
||||
import { RollupOptions, OutputBundle, PluginContext } from 'rollup';
|
||||
import { GenerateSWOptions, InjectManifestOptions, ManifestEntry, RuntimeCaching } from 'workbox-build';
|
||||
|
||||
interface PWAHtmlLink {
|
||||
id?: string;
|
||||
rel: 'apple-touch-startup-image' | 'apple-touch-icon' | 'icon';
|
||||
href: string;
|
||||
media?: string;
|
||||
sizes?: string;
|
||||
type?: string;
|
||||
}
|
||||
interface ColorSchemeMeta {
|
||||
name: string;
|
||||
content: string;
|
||||
}
|
||||
interface ResolvedIconAsset {
|
||||
path: string;
|
||||
mimeType: string;
|
||||
buffer: Promise<Buffer>;
|
||||
age: number;
|
||||
lastModified: number;
|
||||
}
|
||||
interface PWAHtmlAssets {
|
||||
links: PWAHtmlLink[];
|
||||
themeColor?: ColorSchemeMeta;
|
||||
}
|
||||
interface PWAAssetsIcons {
|
||||
favicon: Record<string, Omit<IconAsset<FaviconLink>, 'buffer'>>;
|
||||
transparent: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
maskable: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
apple: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
appleSplashScreen: Record<string, Omit<IconAsset<AppleSplashScreenLink>, 'buffer'>>;
|
||||
}
|
||||
interface PWAAssetsGenerator {
|
||||
generate: () => Promise<void>;
|
||||
findIconAsset: (path: string) => Promise<ResolvedIconAsset | undefined>;
|
||||
resolveHtmlAssets: () => PWAHtmlAssets;
|
||||
transformIndexHtml: (html: string) => string;
|
||||
injectManifestIcons: () => void;
|
||||
instructions: () => ImageAssetsInstructions;
|
||||
icons: () => PWAAssetsIcons;
|
||||
checkHotUpdate: (path: string) => Promise<boolean>;
|
||||
}
|
||||
|
||||
type InjectManifestVitePlugins = string[] | ((vitePluginIds: string[]) => string[]);
|
||||
type CustomInjectManifestOptions = InjectManifestOptions & {
|
||||
/**
|
||||
* Configure the format to use in the Rollup build.
|
||||
*
|
||||
* @default 'es'
|
||||
*/
|
||||
rollupFormat?: 'es' | 'iife';
|
||||
/**
|
||||
* Configure the custom Vite build target option.
|
||||
*
|
||||
* @default Vite build target option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
target?: BuildOptions['target'];
|
||||
/**
|
||||
* Configure the custom Vite build minify option.
|
||||
*
|
||||
* @default Vite build minify option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
minify?: BuildOptions['minify'];
|
||||
/**
|
||||
* Configure the custom Vite build sourcemap option.
|
||||
*
|
||||
* @default Vite build sourcemap option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
sourcemap?: BuildOptions['sourcemap'];
|
||||
/**
|
||||
* Should use `process.env.NODE_ENV` to remove dead code?
|
||||
*
|
||||
* If you want to keep logs from `workbox` modules, you can set this option to `true`,
|
||||
* the plugin will configure `process.env.NODE_ENV` to `"development"`.
|
||||
*
|
||||
* If this option is not configured, the plugin will use `process.env.NODE_ENV`.
|
||||
*
|
||||
* @default `process.env.NODE_ENV === 'production'`
|
||||
* @since v0.18.0
|
||||
*/
|
||||
enableWorkboxModulesLogs?: true;
|
||||
/**
|
||||
* `Vite` plugin ids to use on `Rollup` build.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*
|
||||
* @deprecated use `plugins` instead
|
||||
*/
|
||||
vitePlugins?: InjectManifestVitePlugins;
|
||||
/**
|
||||
* Since `v0.15.0` you can add plugins to build your service worker.
|
||||
*
|
||||
* When using `injectManifest` there are 2 builds, your application and the service worker.
|
||||
* If you're using custom configuration for your service worker (for example custom plugins) you can use this option to configure the service worker build.
|
||||
* Both configurations cannot be shared, and so you'll need to duplicate the configuration, with the exception of `define`.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*
|
||||
* This option will be ignored if `buildPlugins.rollup` is configured.
|
||||
*
|
||||
* @deprecated use `buildPlugins` instead
|
||||
*/
|
||||
plugins?: Plugin[];
|
||||
/**
|
||||
* Since `v0.18.0` you can add custom Rollup and/or Vite plugins to build your service worker.
|
||||
*
|
||||
* **WARN**: don't share plugins between the application and the service worker build, you need to include new plugins for each configuration.
|
||||
*
|
||||
* If you are using `plugins` option, use this option to configure the Rollup plugins or move them to `vite` option.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*/
|
||||
buildPlugins?: {
|
||||
rollup?: RollupOptions['plugins'];
|
||||
vite?: UserConfig['plugins'];
|
||||
};
|
||||
/**
|
||||
* Since `v0.15.0` you can add custom Rollup options to build your service worker: we expose the same configuration to build a worker using Vite.
|
||||
*/
|
||||
rollupOptions?: Omit<RollupOptions, 'plugins' | 'output'>;
|
||||
/**
|
||||
* Environment options.
|
||||
*
|
||||
* @since v0.19.6
|
||||
*/
|
||||
envOptions?: {
|
||||
/**
|
||||
* Configure Vite `envDir` option.
|
||||
*
|
||||
* @default Vite `envDir`.
|
||||
*/
|
||||
envDir?: UserConfig['envDir'];
|
||||
/**
|
||||
* Configure Vite `envPrefix` option.
|
||||
*
|
||||
* @default Vite `envPrefix`.
|
||||
*/
|
||||
envPrefix?: UserConfig['envPrefix'];
|
||||
};
|
||||
};
|
||||
interface PWAIntegration {
|
||||
beforeBuildServiceWorker?: (options: ResolvedVitePWAOptions) => void | Promise<void>;
|
||||
closeBundleOrder?: 'pre' | 'post' | null;
|
||||
configureOptions?: (viteOptions: ResolvedConfig, options: Partial<VitePWAOptions>) => void | Promise<void>;
|
||||
/**
|
||||
* Allow integrations to configure Vite options for custom service worker build.
|
||||
*
|
||||
* @param options Vite options for custom service worker build.
|
||||
* @see src/vite-build.ts module
|
||||
* @since v0.19.6
|
||||
*/
|
||||
configureCustomSWViteBuild?: (options: InlineConfig) => void | Promise<void>;
|
||||
}
|
||||
/**
|
||||
* PWA assets generation and injection options.
|
||||
*/
|
||||
interface PWAAssetsOptions {
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* PWA assets generation and injection.
|
||||
*
|
||||
* By default, the plugin will search for the pwa assets generator configuration file in the root directory of your project:
|
||||
* - pwa-assets.config.js
|
||||
* - pwa-assets.config.mjs
|
||||
* - pwa-assets.config.cjs
|
||||
* - pwa-assets.config.ts
|
||||
* - pwa-assets.config.cts
|
||||
* - pwa-assets.config.mts
|
||||
*
|
||||
* If using a string path, it should be relative to the root directory of your project.
|
||||
*
|
||||
* Setting to `false` will disable config resolving.
|
||||
*
|
||||
* **WARNING**: You can use only one image in the configuration file.
|
||||
*
|
||||
* @default false
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/cli.html#configurations
|
||||
*/
|
||||
config?: string | boolean;
|
||||
/**
|
||||
* Preset to use.
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* Setting this option `false` will disable PWA assets generation (if the `config` option is also disabled).
|
||||
*
|
||||
* @default 'minimal-2023'
|
||||
*/
|
||||
preset?: false | BuiltInPreset | Preset;
|
||||
/**
|
||||
* Path relative to `root` folder where to find the image to use for generating PWA assets.
|
||||
*
|
||||
* Can be also relative to any of the PWA Assets configuration files.
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* @default `public/favicon.svg`
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
* The preset to use for head links (favicon links).
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal-2023
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal
|
||||
* @default '2023'
|
||||
*/
|
||||
htmlPreset?: HtmlLinkPreset;
|
||||
/**
|
||||
* Should the plugin include html head links?
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
includeHtmlHeadLinks?: boolean;
|
||||
/**
|
||||
* Should the plugin override the PWA web manifest icons' entry?
|
||||
*
|
||||
* The plugin will auto-detect the icons from the manifest, if missing, then the plugin will ignore this option and will include the icons.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
overrideManifestIcons?: boolean;
|
||||
/**
|
||||
* Should the PWA web manifest `theme_color` be injected in the html head?
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
injectThemeColor?: boolean;
|
||||
/**
|
||||
* PWA Assets integration support.
|
||||
*
|
||||
* This option should be only used by integrations, it is not meant to be used by end users.
|
||||
*/
|
||||
integration?: {
|
||||
/**
|
||||
* The base url for the PWA assets.
|
||||
*
|
||||
* @default `vite.base`
|
||||
*/
|
||||
baseUrl?: string;
|
||||
/**
|
||||
* The public directory to resolve the image: should be an absolute path.
|
||||
*
|
||||
* @default `vite.root/vite.publicDir`
|
||||
*/
|
||||
publicDir?: string;
|
||||
/**
|
||||
* The output directory: should be an absolute path.
|
||||
*
|
||||
* @default `vite.root/vite.build.outDir`
|
||||
*/
|
||||
outDir?: string;
|
||||
};
|
||||
}
|
||||
interface ResolvedPWAAssetsOptions extends Required<Omit<PWAAssetsOptions, 'image' | 'integration'>> {
|
||||
integration?: PWAAssetsOptions['integration'];
|
||||
images: string[];
|
||||
}
|
||||
/**
|
||||
* Plugin options.
|
||||
*/
|
||||
interface VitePWAOptions {
|
||||
/**
|
||||
* Build mode.
|
||||
*
|
||||
* From `v0.18.0` this option is ignored when using `injectManifest` strategy:
|
||||
* - the new Vite build will use the same mode as the application when using `injectManifest` strategy.
|
||||
* - if you don't want to minify your service worker, configure `injectManifest.minify = false` in your PWA configuration.
|
||||
* - if you want the sourcemap only for the service worker, configure `injectManifest.sourcemap = true` in your PWA configuration.
|
||||
* - if you want workbox logs in your service worker when using production build, configure `injectManifest.enableWorkboxModulesLogs = true` in your PWA configuration.
|
||||
* - you can use `import.meta.env.MODE` to access the Vite mode inside your service worker.
|
||||
* - you can use `import.meta.env.DEV` or `import.meta.env.PROD` to check if the service worker is
|
||||
* running on development or production (equivalent to `process.env.NODE_ENV`),
|
||||
* check Vite [NODE_ENV and Modes](https://vitejs.dev/guide/env-and-mode#node-env-and-modes) docs.
|
||||
*
|
||||
* @see https://vitejs.dev/guide/env-and-mode#node-env-and-modes
|
||||
* @default process.env.NODE_ENV or "production"
|
||||
*/
|
||||
mode?: 'development' | 'production';
|
||||
/**
|
||||
* @default 'public'
|
||||
*/
|
||||
srcDir?: string;
|
||||
/**
|
||||
* @default 'dist'
|
||||
*/
|
||||
outDir?: string;
|
||||
/**
|
||||
* @default 'sw.js'
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* @default 'manifest.webmanifest'
|
||||
*/
|
||||
manifestFilename?: string;
|
||||
/**
|
||||
* @default 'generateSW'
|
||||
*/
|
||||
strategies?: 'generateSW' | 'injectManifest';
|
||||
/**
|
||||
* The scope to register the Service Worker
|
||||
*
|
||||
* @default same as `base` of Vite's config
|
||||
*/
|
||||
scope?: string;
|
||||
/**
|
||||
* Inject the service worker register inlined in the index.html
|
||||
*
|
||||
* With `auto` set, depends on whether you used the `import { registerSW } from 'virtual:pwa-register'`
|
||||
* it will do nothing or use the `script` mode
|
||||
*
|
||||
* `inline` - inject a simple register, inlined with the generated html
|
||||
*
|
||||
* `script` - inject `<script/>` in `<head>` with `src` attribute to a generated script to register the service worker
|
||||
*
|
||||
* `script-defer` - inject `<script defer />` in `<head>`, with `src` attribute to a generated script to register the service worker
|
||||
*
|
||||
* `null` - deprecated, use `false` instead
|
||||
*
|
||||
* `false` - do nothing, you will need to register the sw you self, or imports from `virtual:pwa-register`
|
||||
*
|
||||
* @default 'auto'
|
||||
*/
|
||||
injectRegister: 'inline' | 'script' | 'script-defer' | 'auto' | null | false;
|
||||
/**
|
||||
* Mode for the virtual register.
|
||||
* Does NOT available for `injectRegister` set to `inline` or `script`
|
||||
*
|
||||
* `prompt` - you will need to show a popup/dialog to the user to confirm the reload.
|
||||
*
|
||||
* `autoUpdate` - when new content is available, the new service worker will update caches and reload all browser
|
||||
* windows/tabs with the application open automatically, it must take the control for the application to work
|
||||
* properly.
|
||||
*
|
||||
* @default 'prompt'
|
||||
*/
|
||||
registerType?: 'prompt' | 'autoUpdate';
|
||||
/**
|
||||
* Minify the generated manifest
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
minify: boolean;
|
||||
/**
|
||||
* The manifest object
|
||||
*/
|
||||
manifest: Partial<ManifestOptions> | false;
|
||||
/**
|
||||
* Whether to add the `crossorigin="use-credentials"` attribute to `<link rel="manifest">`
|
||||
* @default false
|
||||
*/
|
||||
useCredentials?: boolean;
|
||||
/**
|
||||
* The workbox object for `generateSW`
|
||||
*/
|
||||
workbox: Partial<GenerateSWOptions>;
|
||||
/**
|
||||
* The workbox object for `injectManifest`
|
||||
*/
|
||||
injectManifest: Partial<CustomInjectManifestOptions>;
|
||||
/**
|
||||
* Override Vite's base options only for PWA
|
||||
*
|
||||
* @default "base" options from Vite
|
||||
*/
|
||||
base?: string;
|
||||
/**
|
||||
* `public` resources to be added to the PWA manifest.
|
||||
*
|
||||
* You don't need to add `manifest` icons here, it will be auto included.
|
||||
*
|
||||
* The `public` directory will be resolved from Vite's `publicDir` option directory.
|
||||
*/
|
||||
includeAssets: string | string[] | undefined;
|
||||
/**
|
||||
* By default, the icons listed on `manifest` option will be included
|
||||
* on the service worker *precache* if present under Vite's `publicDir`
|
||||
* option directory.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
includeManifestIcons: boolean;
|
||||
/**
|
||||
* Disable service worker registration and generation on `build`?
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disable: boolean;
|
||||
/**
|
||||
* Vite PWA Integration.
|
||||
*/
|
||||
integration?: PWAIntegration;
|
||||
/**
|
||||
* Development options.
|
||||
*/
|
||||
devOptions?: DevOptions;
|
||||
/**
|
||||
* Unregister the service worker?
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
selfDestroying?: boolean;
|
||||
/**
|
||||
* When Vite's build folder is not the same as your base root folder, configure it here.
|
||||
*
|
||||
* This option will be useful for integrations like `vite-plugin-laravel` where Vite's build folder is `public/build` but Laravel's base path is `public`.
|
||||
*
|
||||
* This option will be used to configure the path for the `service worker`, `registerSW.js` and the web manifest assets.
|
||||
*
|
||||
* For example, if your base path is `/`, then, in your Laravel PWA configuration use `buildPath: '/build/'`.
|
||||
*
|
||||
* @default `vite.base`.
|
||||
*/
|
||||
buildBase?: string;
|
||||
/**
|
||||
* PWA assets generation and injection.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
pwaAssets?: PWAAssetsOptions;
|
||||
/**
|
||||
* From version `0.20.2`, the plugin will throw an error if the `maximumFileSizeToCacheInBytes` warning is present when building the service worker.
|
||||
*
|
||||
* If you want the old behavior when building the service worker, set this option to `true`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
showMaximumFileSizeToCacheInBytesWarning?: boolean;
|
||||
}
|
||||
interface ResolvedServiceWorkerOptions {
|
||||
format: 'es' | 'iife';
|
||||
plugins?: Plugin[];
|
||||
rollupOptions: RollupOptions;
|
||||
}
|
||||
interface ResolvedVitePWAOptions extends Required<Omit<VitePWAOptions, 'pwaAssets' | 'showMaximumFileSizeToCacheInBytesWarning'>> {
|
||||
swSrc: string;
|
||||
swDest: string;
|
||||
workbox: GenerateSWOptions;
|
||||
injectManifest: InjectManifestOptions;
|
||||
rollupFormat: 'es' | 'iife';
|
||||
vitePlugins: InjectManifestVitePlugins;
|
||||
buildPlugins?: CustomInjectManifestOptions['buildPlugins'];
|
||||
injectManifestRollupOptions: ResolvedServiceWorkerOptions;
|
||||
injectManifestBuildOptions: {
|
||||
target?: BuildOptions['target'];
|
||||
minify?: BuildOptions['minify'];
|
||||
sourcemap?: BuildOptions['sourcemap'];
|
||||
enableWorkboxModulesLogs?: true;
|
||||
};
|
||||
injectManifestEnvOptions: {
|
||||
envDir: ResolvedConfig['envDir'];
|
||||
envPrefix: ResolvedConfig['envPrefix'];
|
||||
};
|
||||
pwaAssets: false | ResolvedPWAAssetsOptions;
|
||||
throwMaximumFileSizeToCacheInBytes: boolean;
|
||||
}
|
||||
interface ShareTargetFiles {
|
||||
name: string;
|
||||
accept: string | string[];
|
||||
}
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
|
||||
*/
|
||||
type LaunchHandlerClientMode = 'auto' | 'focus-existing' | 'navigate-existing' | 'navigate-new';
|
||||
type Display = 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser';
|
||||
type DisplayOverride = Display | 'window-controls-overlay';
|
||||
type IconPurpose = 'monochrome' | 'maskable' | 'any';
|
||||
interface Nothing {
|
||||
}
|
||||
/**
|
||||
* type StringLiteralUnion<'maskable'> = 'maskable' | string
|
||||
* This has auto completion whereas `'maskable' | string` doesn't
|
||||
* Adapted from https://github.com/microsoft/TypeScript/issues/29729
|
||||
*/
|
||||
type StringLiteralUnion<T extends U, U = string> = T | (U & Nothing);
|
||||
type ScopeExtensionsType = 'origin';
|
||||
/**
|
||||
* @see https://w3c.github.io/manifest/#manifest-image-resources
|
||||
*/
|
||||
interface IconResource {
|
||||
sizes?: string;
|
||||
src: string;
|
||||
type?: string;
|
||||
/**
|
||||
* **NOTE**: string values for backward compatibility with the old type.
|
||||
*/
|
||||
purpose?: StringLiteralUnion<IconPurpose> | IconPurpose[];
|
||||
}
|
||||
interface ManifestOptions {
|
||||
/**
|
||||
* @default _npm_package_name_
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* @default _npm_package_name_
|
||||
*/
|
||||
short_name: string;
|
||||
/**
|
||||
* @default _npm_package_description_
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/icons
|
||||
* @see https://w3c.github.io/manifest/#icons-member
|
||||
*/
|
||||
icons: IconResource[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/file_handlers
|
||||
* @see https://wicg.github.io/manifest-incubations/#file_handlers-member
|
||||
*/
|
||||
file_handlers: {
|
||||
action: string;
|
||||
accept: Record<string, string[]>;
|
||||
}[];
|
||||
/**
|
||||
* @default `routerBase`
|
||||
*/
|
||||
start_url: string;
|
||||
/**
|
||||
* Restricts what web pages can be viewed while the manifest is applied
|
||||
*/
|
||||
scope: string;
|
||||
/**
|
||||
* A string that represents the identity for the application
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Defines the default orientation for all the website's top-level
|
||||
*/
|
||||
orientation: 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary';
|
||||
/**
|
||||
* @default `standalone`
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display
|
||||
* @see https://w3c.github.io/manifest/#display-member
|
||||
*/
|
||||
display: Display;
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override
|
||||
* @see https://wicg.github.io/manifest-incubations/#display_override-member
|
||||
*/
|
||||
display_override: DisplayOverride[];
|
||||
/**
|
||||
* @default `#ffffff`
|
||||
*/
|
||||
background_color: string;
|
||||
/**
|
||||
* @default `#42b883`
|
||||
*/
|
||||
theme_color: string;
|
||||
/**
|
||||
* @default `ltr`
|
||||
*/
|
||||
dir: 'ltr' | 'rtl';
|
||||
/**
|
||||
* @default `en`
|
||||
*/
|
||||
lang: string;
|
||||
/**
|
||||
* @default A combination of `routerBase` and `options.build.publicPath`
|
||||
*/
|
||||
publicPath: string;
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
related_applications: {
|
||||
platform: string;
|
||||
url: string;
|
||||
id?: string;
|
||||
}[];
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
prefer_related_applications: boolean;
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
protocol_handlers: {
|
||||
protocol: string;
|
||||
url: string;
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts
|
||||
* @see https://w3c.github.io/manifest/#shortcuts-member
|
||||
*/
|
||||
shortcuts: {
|
||||
name: string;
|
||||
short_name?: string;
|
||||
url: string;
|
||||
description?: string;
|
||||
icons?: IconResource[];
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/screenshots
|
||||
*/
|
||||
screenshots: {
|
||||
src: string;
|
||||
sizes: string;
|
||||
label?: string;
|
||||
platform?: 'android' | 'ios' | 'kaios' | 'macos' | 'windows' | 'windows10x' | 'chrome_web_store' | 'play' | 'itunes' | 'microsoft-inbox' | 'microsoft-store' | string;
|
||||
form_factor?: 'narrow' | 'wide';
|
||||
type?: string;
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
categories: string[];
|
||||
/**
|
||||
* @default ''
|
||||
*/
|
||||
iarc_rating_id: string;
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
|
||||
* @see https://w3c.github.io/web-share-target/level-2/#share_target-member
|
||||
*/
|
||||
share_target: {
|
||||
action: string;
|
||||
method?: 'GET' | 'POST';
|
||||
enctype?: string;
|
||||
params: {
|
||||
title?: string;
|
||||
text?: string;
|
||||
url?: string;
|
||||
files?: ShareTargetFiles | ShareTargetFiles[];
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @see https://github.com/WICG/pwa-url-handler/blob/main/handle_links/explainer.md#handle_links-manifest-member
|
||||
*/
|
||||
handle_links?: 'auto' | 'preferred' | 'not-preferred';
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
|
||||
*/
|
||||
launch_handler?: {
|
||||
client_mode: LaunchHandlerClientMode | LaunchHandlerClientMode[];
|
||||
};
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/sidebar#enable-sidebar-support-in-your-pwa
|
||||
*/
|
||||
edge_side_panel?: {
|
||||
preferred_width?: number;
|
||||
};
|
||||
/**
|
||||
* @see https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/scope_extensions
|
||||
* @default []
|
||||
*/
|
||||
scope_extensions: {
|
||||
origin: string;
|
||||
/**
|
||||
* @default 'origin'
|
||||
*/
|
||||
type?: StringLiteralUnion<ScopeExtensionsType>;
|
||||
}[];
|
||||
}
|
||||
interface WebManifestData {
|
||||
href: string;
|
||||
useCredentials: boolean;
|
||||
/**
|
||||
* Returns the corresponding link tag: `<link rel="manifest" href="<webManifestUrl>" />`.
|
||||
*/
|
||||
toLinkTag: () => string;
|
||||
}
|
||||
interface RegisterSWData {
|
||||
shouldRegisterSW: boolean;
|
||||
/**
|
||||
* When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*
|
||||
* @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
|
||||
*/
|
||||
inline: boolean;
|
||||
/**
|
||||
* When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*/
|
||||
mode: 'inline' | 'script' | 'script-defer';
|
||||
/**
|
||||
* The path for the inline script: will contain the service worker url.
|
||||
*/
|
||||
inlinePath: string;
|
||||
/**
|
||||
* The path for the src script for `registerSW.js`.
|
||||
*/
|
||||
registerPath: string;
|
||||
/**
|
||||
* The scope for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
scope: string;
|
||||
/**
|
||||
* The type for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
type: WorkerType;
|
||||
/**
|
||||
* Returns the corresponding script tag if `shouldRegisterSW` returns `true`.
|
||||
*/
|
||||
toScriptTag: () => string | undefined;
|
||||
}
|
||||
interface VitePluginPWAAPI {
|
||||
/**
|
||||
* Is the plugin disabled?
|
||||
*/
|
||||
disabled: boolean;
|
||||
/**
|
||||
* Running on dev server?
|
||||
*/
|
||||
pwaInDevEnvironment: boolean;
|
||||
/**
|
||||
* Returns the PWA web manifest url for the manifest link:
|
||||
* <link rel="manifest" href="<webManifestUrl>" />
|
||||
*
|
||||
* Will also return if the manifest will require credentials:
|
||||
* <link rel="manifest" href="<webManifestUrl>" crossorigin="use-credentials" />
|
||||
*/
|
||||
webManifestData: () => WebManifestData | undefined;
|
||||
/**
|
||||
* How the service worker is being registered in the application.
|
||||
*
|
||||
* This option will help some integrations to inject the corresponding script in the head.
|
||||
*/
|
||||
registerSWData: () => RegisterSWData | undefined;
|
||||
extendManifestEntries: (fn: ExtendManifestEntriesHook) => void;
|
||||
generateBundle: (bundle?: OutputBundle, pluginCtx?: PluginContext) => OutputBundle | undefined;
|
||||
generateSW: () => Promise<void>;
|
||||
pwaAssetsGenerator: () => Promise<PWAAssetsGenerator | undefined>;
|
||||
}
|
||||
type ExtendManifestEntriesHook = (manifestEntries: (string | ManifestEntry)[]) => (string | ManifestEntry)[] | undefined;
|
||||
/**
|
||||
* Development options.
|
||||
*/
|
||||
interface DevOptions {
|
||||
/**
|
||||
* Should the service worker be available on development?.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* The service worker type.
|
||||
*
|
||||
* @default 'classic'
|
||||
*/
|
||||
type?: WorkerType;
|
||||
/**
|
||||
* This option will enable you to not use the `runtimeConfig` configured on `workbox.runtimeConfig` plugin option.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disableRuntimeConfig?: boolean;
|
||||
/**
|
||||
* This option will allow you to configure the `navigateFallback` when using `registerRoute` for `offline` support:
|
||||
* configure here the corresponding `url`, for example `navigateFallback: 'index.html'`.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `injectManifest` strategy.
|
||||
*
|
||||
* @default 'index.html'
|
||||
*/
|
||||
navigateFallback?: string;
|
||||
/**
|
||||
* This option will allow you to configure the `navigateFallbackAllowlist`: new option from version `v0.12.4`.
|
||||
*
|
||||
* Since we need at least the entry point in the service worker's precache manifest, we don't want the rest of the assets to be intercepted by the service worker.
|
||||
*
|
||||
* If you configure this option, the plugin will use it instead the default.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default [/^\/$/]
|
||||
*/
|
||||
navigateFallbackAllowlist?: RegExp[];
|
||||
/**
|
||||
* On dev mode the `manifest.webmanifest` file can be on other path.
|
||||
*
|
||||
* For example, **SvelteKit** will request `/_app/manifest.webmanifest`, when `webmanifest` added to the output bundle, **SvelteKit** will copy it to the `/_app/` folder.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default `${vite.base}${pwaOptions.manifestFilename}`
|
||||
* @deprecated This option has been deprecated from version `v0.12.4`, the plugin will use navigateFallbackAllowlist instead.
|
||||
* @see navigateFallbackAllowlist
|
||||
*/
|
||||
webManifestUrl?: string;
|
||||
/**
|
||||
* Where to store generated service worker in development when using `generateSW` strategy.
|
||||
*
|
||||
* Use it with caution, it should be used only by framework integrations.
|
||||
*
|
||||
* @default resolve(viteConfig.root, 'dev-dist')
|
||||
*/
|
||||
resolveTempFolder?: () => string | Promise<string>;
|
||||
/**
|
||||
* Suppress workbox-build warnings?.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
* If enabled, `globPatterns` will be changed to `[*.js]` and a new empty `suppress-warnings.js` file will be created in `dev-dist` folder.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
suppressWarnings?: boolean;
|
||||
}
|
||||
|
||||
declare const cachePreset: RuntimeCaching[];
|
||||
|
||||
declare const defaultInjectManifestVitePlugins: string[];
|
||||
|
||||
declare function VitePWA(userOptions?: Partial<VitePWAOptions>): Plugin[];
|
||||
|
||||
export { type CustomInjectManifestOptions, type DevOptions, type Display, type DisplayOverride, type ExtendManifestEntriesHook, type IconPurpose, type IconResource, type InjectManifestVitePlugins, type LaunchHandlerClientMode, type ManifestOptions, type VitePWAOptions as Options, type PWAAssetsOptions, type PWAIntegration, type RegisterSWData, type ResolvedPWAAssetsOptions, type ResolvedServiceWorkerOptions, type ResolvedVitePWAOptions, type ScopeExtensionsType, type ShareTargetFiles, type StringLiteralUnion, VitePWA, type VitePWAOptions, type VitePluginPWAAPI, type WebManifestData, cachePreset, defaultInjectManifestVitePlugins };
|
||||
820
frontend/node_modules/vite-plugin-pwa/dist/index.d.ts
generated
vendored
Normal file
820
frontend/node_modules/vite-plugin-pwa/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,820 @@
|
||||
import { BuildOptions, Plugin, UserConfig, ResolvedConfig, InlineConfig } from 'vite';
|
||||
import { ImageAssetsInstructions, IconAsset, FaviconLink, HtmlLink, AppleSplashScreenLink, HtmlLinkPreset } from '@vite-pwa/assets-generator/api';
|
||||
import { BuiltInPreset, Preset } from '@vite-pwa/assets-generator/config';
|
||||
import { RollupOptions, OutputBundle, PluginContext } from 'rollup';
|
||||
import { GenerateSWOptions, InjectManifestOptions, ManifestEntry, RuntimeCaching } from 'workbox-build';
|
||||
|
||||
interface PWAHtmlLink {
|
||||
id?: string;
|
||||
rel: 'apple-touch-startup-image' | 'apple-touch-icon' | 'icon';
|
||||
href: string;
|
||||
media?: string;
|
||||
sizes?: string;
|
||||
type?: string;
|
||||
}
|
||||
interface ColorSchemeMeta {
|
||||
name: string;
|
||||
content: string;
|
||||
}
|
||||
interface ResolvedIconAsset {
|
||||
path: string;
|
||||
mimeType: string;
|
||||
buffer: Promise<Buffer>;
|
||||
age: number;
|
||||
lastModified: number;
|
||||
}
|
||||
interface PWAHtmlAssets {
|
||||
links: PWAHtmlLink[];
|
||||
themeColor?: ColorSchemeMeta;
|
||||
}
|
||||
interface PWAAssetsIcons {
|
||||
favicon: Record<string, Omit<IconAsset<FaviconLink>, 'buffer'>>;
|
||||
transparent: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
maskable: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
apple: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
|
||||
appleSplashScreen: Record<string, Omit<IconAsset<AppleSplashScreenLink>, 'buffer'>>;
|
||||
}
|
||||
interface PWAAssetsGenerator {
|
||||
generate: () => Promise<void>;
|
||||
findIconAsset: (path: string) => Promise<ResolvedIconAsset | undefined>;
|
||||
resolveHtmlAssets: () => PWAHtmlAssets;
|
||||
transformIndexHtml: (html: string) => string;
|
||||
injectManifestIcons: () => void;
|
||||
instructions: () => ImageAssetsInstructions;
|
||||
icons: () => PWAAssetsIcons;
|
||||
checkHotUpdate: (path: string) => Promise<boolean>;
|
||||
}
|
||||
|
||||
type InjectManifestVitePlugins = string[] | ((vitePluginIds: string[]) => string[]);
|
||||
type CustomInjectManifestOptions = InjectManifestOptions & {
|
||||
/**
|
||||
* Configure the format to use in the Rollup build.
|
||||
*
|
||||
* @default 'es'
|
||||
*/
|
||||
rollupFormat?: 'es' | 'iife';
|
||||
/**
|
||||
* Configure the custom Vite build target option.
|
||||
*
|
||||
* @default Vite build target option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
target?: BuildOptions['target'];
|
||||
/**
|
||||
* Configure the custom Vite build minify option.
|
||||
*
|
||||
* @default Vite build minify option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
minify?: BuildOptions['minify'];
|
||||
/**
|
||||
* Configure the custom Vite build sourcemap option.
|
||||
*
|
||||
* @default Vite build sourcemap option
|
||||
* @since v0.18.0
|
||||
*/
|
||||
sourcemap?: BuildOptions['sourcemap'];
|
||||
/**
|
||||
* Should use `process.env.NODE_ENV` to remove dead code?
|
||||
*
|
||||
* If you want to keep logs from `workbox` modules, you can set this option to `true`,
|
||||
* the plugin will configure `process.env.NODE_ENV` to `"development"`.
|
||||
*
|
||||
* If this option is not configured, the plugin will use `process.env.NODE_ENV`.
|
||||
*
|
||||
* @default `process.env.NODE_ENV === 'production'`
|
||||
* @since v0.18.0
|
||||
*/
|
||||
enableWorkboxModulesLogs?: true;
|
||||
/**
|
||||
* `Vite` plugin ids to use on `Rollup` build.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*
|
||||
* @deprecated use `plugins` instead
|
||||
*/
|
||||
vitePlugins?: InjectManifestVitePlugins;
|
||||
/**
|
||||
* Since `v0.15.0` you can add plugins to build your service worker.
|
||||
*
|
||||
* When using `injectManifest` there are 2 builds, your application and the service worker.
|
||||
* If you're using custom configuration for your service worker (for example custom plugins) you can use this option to configure the service worker build.
|
||||
* Both configurations cannot be shared, and so you'll need to duplicate the configuration, with the exception of `define`.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*
|
||||
* This option will be ignored if `buildPlugins.rollup` is configured.
|
||||
*
|
||||
* @deprecated use `buildPlugins` instead
|
||||
*/
|
||||
plugins?: Plugin[];
|
||||
/**
|
||||
* Since `v0.18.0` you can add custom Rollup and/or Vite plugins to build your service worker.
|
||||
*
|
||||
* **WARN**: don't share plugins between the application and the service worker build, you need to include new plugins for each configuration.
|
||||
*
|
||||
* If you are using `plugins` option, use this option to configure the Rollup plugins or move them to `vite` option.
|
||||
*
|
||||
* **WARN**: this option is for advanced usage, beware, you can break your application build.
|
||||
*/
|
||||
buildPlugins?: {
|
||||
rollup?: RollupOptions['plugins'];
|
||||
vite?: UserConfig['plugins'];
|
||||
};
|
||||
/**
|
||||
* Since `v0.15.0` you can add custom Rollup options to build your service worker: we expose the same configuration to build a worker using Vite.
|
||||
*/
|
||||
rollupOptions?: Omit<RollupOptions, 'plugins' | 'output'>;
|
||||
/**
|
||||
* Environment options.
|
||||
*
|
||||
* @since v0.19.6
|
||||
*/
|
||||
envOptions?: {
|
||||
/**
|
||||
* Configure Vite `envDir` option.
|
||||
*
|
||||
* @default Vite `envDir`.
|
||||
*/
|
||||
envDir?: UserConfig['envDir'];
|
||||
/**
|
||||
* Configure Vite `envPrefix` option.
|
||||
*
|
||||
* @default Vite `envPrefix`.
|
||||
*/
|
||||
envPrefix?: UserConfig['envPrefix'];
|
||||
};
|
||||
};
|
||||
interface PWAIntegration {
|
||||
beforeBuildServiceWorker?: (options: ResolvedVitePWAOptions) => void | Promise<void>;
|
||||
closeBundleOrder?: 'pre' | 'post' | null;
|
||||
configureOptions?: (viteOptions: ResolvedConfig, options: Partial<VitePWAOptions>) => void | Promise<void>;
|
||||
/**
|
||||
* Allow integrations to configure Vite options for custom service worker build.
|
||||
*
|
||||
* @param options Vite options for custom service worker build.
|
||||
* @see src/vite-build.ts module
|
||||
* @since v0.19.6
|
||||
*/
|
||||
configureCustomSWViteBuild?: (options: InlineConfig) => void | Promise<void>;
|
||||
}
|
||||
/**
|
||||
* PWA assets generation and injection options.
|
||||
*/
|
||||
interface PWAAssetsOptions {
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* PWA assets generation and injection.
|
||||
*
|
||||
* By default, the plugin will search for the pwa assets generator configuration file in the root directory of your project:
|
||||
* - pwa-assets.config.js
|
||||
* - pwa-assets.config.mjs
|
||||
* - pwa-assets.config.cjs
|
||||
* - pwa-assets.config.ts
|
||||
* - pwa-assets.config.cts
|
||||
* - pwa-assets.config.mts
|
||||
*
|
||||
* If using a string path, it should be relative to the root directory of your project.
|
||||
*
|
||||
* Setting to `false` will disable config resolving.
|
||||
*
|
||||
* **WARNING**: You can use only one image in the configuration file.
|
||||
*
|
||||
* @default false
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/cli.html#configurations
|
||||
*/
|
||||
config?: string | boolean;
|
||||
/**
|
||||
* Preset to use.
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* Setting this option `false` will disable PWA assets generation (if the `config` option is also disabled).
|
||||
*
|
||||
* @default 'minimal-2023'
|
||||
*/
|
||||
preset?: false | BuiltInPreset | Preset;
|
||||
/**
|
||||
* Path relative to `root` folder where to find the image to use for generating PWA assets.
|
||||
*
|
||||
* Can be also relative to any of the PWA Assets configuration files.
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* @default `public/favicon.svg`
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
* The preset to use for head links (favicon links).
|
||||
*
|
||||
* If the `config` option is enabled, this option will be ignored.
|
||||
*
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal-2023
|
||||
* @see https://vite-pwa-org.netlify.app/assets-generator/#preset-minimal
|
||||
* @default '2023'
|
||||
*/
|
||||
htmlPreset?: HtmlLinkPreset;
|
||||
/**
|
||||
* Should the plugin include html head links?
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
includeHtmlHeadLinks?: boolean;
|
||||
/**
|
||||
* Should the plugin override the PWA web manifest icons' entry?
|
||||
*
|
||||
* The plugin will auto-detect the icons from the manifest, if missing, then the plugin will ignore this option and will include the icons.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
overrideManifestIcons?: boolean;
|
||||
/**
|
||||
* Should the PWA web manifest `theme_color` be injected in the html head?
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
injectThemeColor?: boolean;
|
||||
/**
|
||||
* PWA Assets integration support.
|
||||
*
|
||||
* This option should be only used by integrations, it is not meant to be used by end users.
|
||||
*/
|
||||
integration?: {
|
||||
/**
|
||||
* The base url for the PWA assets.
|
||||
*
|
||||
* @default `vite.base`
|
||||
*/
|
||||
baseUrl?: string;
|
||||
/**
|
||||
* The public directory to resolve the image: should be an absolute path.
|
||||
*
|
||||
* @default `vite.root/vite.publicDir`
|
||||
*/
|
||||
publicDir?: string;
|
||||
/**
|
||||
* The output directory: should be an absolute path.
|
||||
*
|
||||
* @default `vite.root/vite.build.outDir`
|
||||
*/
|
||||
outDir?: string;
|
||||
};
|
||||
}
|
||||
interface ResolvedPWAAssetsOptions extends Required<Omit<PWAAssetsOptions, 'image' | 'integration'>> {
|
||||
integration?: PWAAssetsOptions['integration'];
|
||||
images: string[];
|
||||
}
|
||||
/**
|
||||
* Plugin options.
|
||||
*/
|
||||
interface VitePWAOptions {
|
||||
/**
|
||||
* Build mode.
|
||||
*
|
||||
* From `v0.18.0` this option is ignored when using `injectManifest` strategy:
|
||||
* - the new Vite build will use the same mode as the application when using `injectManifest` strategy.
|
||||
* - if you don't want to minify your service worker, configure `injectManifest.minify = false` in your PWA configuration.
|
||||
* - if you want the sourcemap only for the service worker, configure `injectManifest.sourcemap = true` in your PWA configuration.
|
||||
* - if you want workbox logs in your service worker when using production build, configure `injectManifest.enableWorkboxModulesLogs = true` in your PWA configuration.
|
||||
* - you can use `import.meta.env.MODE` to access the Vite mode inside your service worker.
|
||||
* - you can use `import.meta.env.DEV` or `import.meta.env.PROD` to check if the service worker is
|
||||
* running on development or production (equivalent to `process.env.NODE_ENV`),
|
||||
* check Vite [NODE_ENV and Modes](https://vitejs.dev/guide/env-and-mode#node-env-and-modes) docs.
|
||||
*
|
||||
* @see https://vitejs.dev/guide/env-and-mode#node-env-and-modes
|
||||
* @default process.env.NODE_ENV or "production"
|
||||
*/
|
||||
mode?: 'development' | 'production';
|
||||
/**
|
||||
* @default 'public'
|
||||
*/
|
||||
srcDir?: string;
|
||||
/**
|
||||
* @default 'dist'
|
||||
*/
|
||||
outDir?: string;
|
||||
/**
|
||||
* @default 'sw.js'
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* @default 'manifest.webmanifest'
|
||||
*/
|
||||
manifestFilename?: string;
|
||||
/**
|
||||
* @default 'generateSW'
|
||||
*/
|
||||
strategies?: 'generateSW' | 'injectManifest';
|
||||
/**
|
||||
* The scope to register the Service Worker
|
||||
*
|
||||
* @default same as `base` of Vite's config
|
||||
*/
|
||||
scope?: string;
|
||||
/**
|
||||
* Inject the service worker register inlined in the index.html
|
||||
*
|
||||
* With `auto` set, depends on whether you used the `import { registerSW } from 'virtual:pwa-register'`
|
||||
* it will do nothing or use the `script` mode
|
||||
*
|
||||
* `inline` - inject a simple register, inlined with the generated html
|
||||
*
|
||||
* `script` - inject `<script/>` in `<head>` with `src` attribute to a generated script to register the service worker
|
||||
*
|
||||
* `script-defer` - inject `<script defer />` in `<head>`, with `src` attribute to a generated script to register the service worker
|
||||
*
|
||||
* `null` - deprecated, use `false` instead
|
||||
*
|
||||
* `false` - do nothing, you will need to register the sw you self, or imports from `virtual:pwa-register`
|
||||
*
|
||||
* @default 'auto'
|
||||
*/
|
||||
injectRegister: 'inline' | 'script' | 'script-defer' | 'auto' | null | false;
|
||||
/**
|
||||
* Mode for the virtual register.
|
||||
* Does NOT available for `injectRegister` set to `inline` or `script`
|
||||
*
|
||||
* `prompt` - you will need to show a popup/dialog to the user to confirm the reload.
|
||||
*
|
||||
* `autoUpdate` - when new content is available, the new service worker will update caches and reload all browser
|
||||
* windows/tabs with the application open automatically, it must take the control for the application to work
|
||||
* properly.
|
||||
*
|
||||
* @default 'prompt'
|
||||
*/
|
||||
registerType?: 'prompt' | 'autoUpdate';
|
||||
/**
|
||||
* Minify the generated manifest
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
minify: boolean;
|
||||
/**
|
||||
* The manifest object
|
||||
*/
|
||||
manifest: Partial<ManifestOptions> | false;
|
||||
/**
|
||||
* Whether to add the `crossorigin="use-credentials"` attribute to `<link rel="manifest">`
|
||||
* @default false
|
||||
*/
|
||||
useCredentials?: boolean;
|
||||
/**
|
||||
* The workbox object for `generateSW`
|
||||
*/
|
||||
workbox: Partial<GenerateSWOptions>;
|
||||
/**
|
||||
* The workbox object for `injectManifest`
|
||||
*/
|
||||
injectManifest: Partial<CustomInjectManifestOptions>;
|
||||
/**
|
||||
* Override Vite's base options only for PWA
|
||||
*
|
||||
* @default "base" options from Vite
|
||||
*/
|
||||
base?: string;
|
||||
/**
|
||||
* `public` resources to be added to the PWA manifest.
|
||||
*
|
||||
* You don't need to add `manifest` icons here, it will be auto included.
|
||||
*
|
||||
* The `public` directory will be resolved from Vite's `publicDir` option directory.
|
||||
*/
|
||||
includeAssets: string | string[] | undefined;
|
||||
/**
|
||||
* By default, the icons listed on `manifest` option will be included
|
||||
* on the service worker *precache* if present under Vite's `publicDir`
|
||||
* option directory.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
includeManifestIcons: boolean;
|
||||
/**
|
||||
* Disable service worker registration and generation on `build`?
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disable: boolean;
|
||||
/**
|
||||
* Vite PWA Integration.
|
||||
*/
|
||||
integration?: PWAIntegration;
|
||||
/**
|
||||
* Development options.
|
||||
*/
|
||||
devOptions?: DevOptions;
|
||||
/**
|
||||
* Unregister the service worker?
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
selfDestroying?: boolean;
|
||||
/**
|
||||
* When Vite's build folder is not the same as your base root folder, configure it here.
|
||||
*
|
||||
* This option will be useful for integrations like `vite-plugin-laravel` where Vite's build folder is `public/build` but Laravel's base path is `public`.
|
||||
*
|
||||
* This option will be used to configure the path for the `service worker`, `registerSW.js` and the web manifest assets.
|
||||
*
|
||||
* For example, if your base path is `/`, then, in your Laravel PWA configuration use `buildPath: '/build/'`.
|
||||
*
|
||||
* @default `vite.base`.
|
||||
*/
|
||||
buildBase?: string;
|
||||
/**
|
||||
* PWA assets generation and injection.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
pwaAssets?: PWAAssetsOptions;
|
||||
/**
|
||||
* From version `0.20.2`, the plugin will throw an error if the `maximumFileSizeToCacheInBytes` warning is present when building the service worker.
|
||||
*
|
||||
* If you want the old behavior when building the service worker, set this option to `true`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
showMaximumFileSizeToCacheInBytesWarning?: boolean;
|
||||
}
|
||||
interface ResolvedServiceWorkerOptions {
|
||||
format: 'es' | 'iife';
|
||||
plugins?: Plugin[];
|
||||
rollupOptions: RollupOptions;
|
||||
}
|
||||
interface ResolvedVitePWAOptions extends Required<Omit<VitePWAOptions, 'pwaAssets' | 'showMaximumFileSizeToCacheInBytesWarning'>> {
|
||||
swSrc: string;
|
||||
swDest: string;
|
||||
workbox: GenerateSWOptions;
|
||||
injectManifest: InjectManifestOptions;
|
||||
rollupFormat: 'es' | 'iife';
|
||||
vitePlugins: InjectManifestVitePlugins;
|
||||
buildPlugins?: CustomInjectManifestOptions['buildPlugins'];
|
||||
injectManifestRollupOptions: ResolvedServiceWorkerOptions;
|
||||
injectManifestBuildOptions: {
|
||||
target?: BuildOptions['target'];
|
||||
minify?: BuildOptions['minify'];
|
||||
sourcemap?: BuildOptions['sourcemap'];
|
||||
enableWorkboxModulesLogs?: true;
|
||||
};
|
||||
injectManifestEnvOptions: {
|
||||
envDir: ResolvedConfig['envDir'];
|
||||
envPrefix: ResolvedConfig['envPrefix'];
|
||||
};
|
||||
pwaAssets: false | ResolvedPWAAssetsOptions;
|
||||
throwMaximumFileSizeToCacheInBytes: boolean;
|
||||
}
|
||||
interface ShareTargetFiles {
|
||||
name: string;
|
||||
accept: string | string[];
|
||||
}
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
|
||||
*/
|
||||
type LaunchHandlerClientMode = 'auto' | 'focus-existing' | 'navigate-existing' | 'navigate-new';
|
||||
type Display = 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser';
|
||||
type DisplayOverride = Display | 'window-controls-overlay';
|
||||
type IconPurpose = 'monochrome' | 'maskable' | 'any';
|
||||
interface Nothing {
|
||||
}
|
||||
/**
|
||||
* type StringLiteralUnion<'maskable'> = 'maskable' | string
|
||||
* This has auto completion whereas `'maskable' | string` doesn't
|
||||
* Adapted from https://github.com/microsoft/TypeScript/issues/29729
|
||||
*/
|
||||
type StringLiteralUnion<T extends U, U = string> = T | (U & Nothing);
|
||||
type ScopeExtensionsType = 'origin';
|
||||
/**
|
||||
* @see https://w3c.github.io/manifest/#manifest-image-resources
|
||||
*/
|
||||
interface IconResource {
|
||||
sizes?: string;
|
||||
src: string;
|
||||
type?: string;
|
||||
/**
|
||||
* **NOTE**: string values for backward compatibility with the old type.
|
||||
*/
|
||||
purpose?: StringLiteralUnion<IconPurpose> | IconPurpose[];
|
||||
}
|
||||
interface ManifestOptions {
|
||||
/**
|
||||
* @default _npm_package_name_
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* @default _npm_package_name_
|
||||
*/
|
||||
short_name: string;
|
||||
/**
|
||||
* @default _npm_package_description_
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/icons
|
||||
* @see https://w3c.github.io/manifest/#icons-member
|
||||
*/
|
||||
icons: IconResource[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/file_handlers
|
||||
* @see https://wicg.github.io/manifest-incubations/#file_handlers-member
|
||||
*/
|
||||
file_handlers: {
|
||||
action: string;
|
||||
accept: Record<string, string[]>;
|
||||
}[];
|
||||
/**
|
||||
* @default `routerBase`
|
||||
*/
|
||||
start_url: string;
|
||||
/**
|
||||
* Restricts what web pages can be viewed while the manifest is applied
|
||||
*/
|
||||
scope: string;
|
||||
/**
|
||||
* A string that represents the identity for the application
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Defines the default orientation for all the website's top-level
|
||||
*/
|
||||
orientation: 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary';
|
||||
/**
|
||||
* @default `standalone`
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display
|
||||
* @see https://w3c.github.io/manifest/#display-member
|
||||
*/
|
||||
display: Display;
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override
|
||||
* @see https://wicg.github.io/manifest-incubations/#display_override-member
|
||||
*/
|
||||
display_override: DisplayOverride[];
|
||||
/**
|
||||
* @default `#ffffff`
|
||||
*/
|
||||
background_color: string;
|
||||
/**
|
||||
* @default `#42b883`
|
||||
*/
|
||||
theme_color: string;
|
||||
/**
|
||||
* @default `ltr`
|
||||
*/
|
||||
dir: 'ltr' | 'rtl';
|
||||
/**
|
||||
* @default `en`
|
||||
*/
|
||||
lang: string;
|
||||
/**
|
||||
* @default A combination of `routerBase` and `options.build.publicPath`
|
||||
*/
|
||||
publicPath: string;
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
related_applications: {
|
||||
platform: string;
|
||||
url: string;
|
||||
id?: string;
|
||||
}[];
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
prefer_related_applications: boolean;
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
protocol_handlers: {
|
||||
protocol: string;
|
||||
url: string;
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts
|
||||
* @see https://w3c.github.io/manifest/#shortcuts-member
|
||||
*/
|
||||
shortcuts: {
|
||||
name: string;
|
||||
short_name?: string;
|
||||
url: string;
|
||||
description?: string;
|
||||
icons?: IconResource[];
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/screenshots
|
||||
*/
|
||||
screenshots: {
|
||||
src: string;
|
||||
sizes: string;
|
||||
label?: string;
|
||||
platform?: 'android' | 'ios' | 'kaios' | 'macos' | 'windows' | 'windows10x' | 'chrome_web_store' | 'play' | 'itunes' | 'microsoft-inbox' | 'microsoft-store' | string;
|
||||
form_factor?: 'narrow' | 'wide';
|
||||
type?: string;
|
||||
}[];
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
categories: string[];
|
||||
/**
|
||||
* @default ''
|
||||
*/
|
||||
iarc_rating_id: string;
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
|
||||
* @see https://w3c.github.io/web-share-target/level-2/#share_target-member
|
||||
*/
|
||||
share_target: {
|
||||
action: string;
|
||||
method?: 'GET' | 'POST';
|
||||
enctype?: string;
|
||||
params: {
|
||||
title?: string;
|
||||
text?: string;
|
||||
url?: string;
|
||||
files?: ShareTargetFiles | ShareTargetFiles[];
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @see https://github.com/WICG/pwa-url-handler/blob/main/handle_links/explainer.md#handle_links-manifest-member
|
||||
*/
|
||||
handle_links?: 'auto' | 'preferred' | 'not-preferred';
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/launch_handler#launch_handler_item_values
|
||||
*/
|
||||
launch_handler?: {
|
||||
client_mode: LaunchHandlerClientMode | LaunchHandlerClientMode[];
|
||||
};
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/sidebar#enable-sidebar-support-in-your-pwa
|
||||
*/
|
||||
edge_side_panel?: {
|
||||
preferred_width?: number;
|
||||
};
|
||||
/**
|
||||
* @see https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/scope_extensions
|
||||
* @default []
|
||||
*/
|
||||
scope_extensions: {
|
||||
origin: string;
|
||||
/**
|
||||
* @default 'origin'
|
||||
*/
|
||||
type?: StringLiteralUnion<ScopeExtensionsType>;
|
||||
}[];
|
||||
}
|
||||
interface WebManifestData {
|
||||
href: string;
|
||||
useCredentials: boolean;
|
||||
/**
|
||||
* Returns the corresponding link tag: `<link rel="manifest" href="<webManifestUrl>" />`.
|
||||
*/
|
||||
toLinkTag: () => string;
|
||||
}
|
||||
interface RegisterSWData {
|
||||
shouldRegisterSW: boolean;
|
||||
/**
|
||||
* When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*
|
||||
* @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
|
||||
*/
|
||||
inline: boolean;
|
||||
/**
|
||||
* When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*/
|
||||
mode: 'inline' | 'script' | 'script-defer';
|
||||
/**
|
||||
* The path for the inline script: will contain the service worker url.
|
||||
*/
|
||||
inlinePath: string;
|
||||
/**
|
||||
* The path for the src script for `registerSW.js`.
|
||||
*/
|
||||
registerPath: string;
|
||||
/**
|
||||
* The scope for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
scope: string;
|
||||
/**
|
||||
* The type for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
type: WorkerType;
|
||||
/**
|
||||
* Returns the corresponding script tag if `shouldRegisterSW` returns `true`.
|
||||
*/
|
||||
toScriptTag: () => string | undefined;
|
||||
}
|
||||
interface VitePluginPWAAPI {
|
||||
/**
|
||||
* Is the plugin disabled?
|
||||
*/
|
||||
disabled: boolean;
|
||||
/**
|
||||
* Running on dev server?
|
||||
*/
|
||||
pwaInDevEnvironment: boolean;
|
||||
/**
|
||||
* Returns the PWA web manifest url for the manifest link:
|
||||
* <link rel="manifest" href="<webManifestUrl>" />
|
||||
*
|
||||
* Will also return if the manifest will require credentials:
|
||||
* <link rel="manifest" href="<webManifestUrl>" crossorigin="use-credentials" />
|
||||
*/
|
||||
webManifestData: () => WebManifestData | undefined;
|
||||
/**
|
||||
* How the service worker is being registered in the application.
|
||||
*
|
||||
* This option will help some integrations to inject the corresponding script in the head.
|
||||
*/
|
||||
registerSWData: () => RegisterSWData | undefined;
|
||||
extendManifestEntries: (fn: ExtendManifestEntriesHook) => void;
|
||||
generateBundle: (bundle?: OutputBundle, pluginCtx?: PluginContext) => OutputBundle | undefined;
|
||||
generateSW: () => Promise<void>;
|
||||
pwaAssetsGenerator: () => Promise<PWAAssetsGenerator | undefined>;
|
||||
}
|
||||
type ExtendManifestEntriesHook = (manifestEntries: (string | ManifestEntry)[]) => (string | ManifestEntry)[] | undefined;
|
||||
/**
|
||||
* Development options.
|
||||
*/
|
||||
interface DevOptions {
|
||||
/**
|
||||
* Should the service worker be available on development?.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* The service worker type.
|
||||
*
|
||||
* @default 'classic'
|
||||
*/
|
||||
type?: WorkerType;
|
||||
/**
|
||||
* This option will enable you to not use the `runtimeConfig` configured on `workbox.runtimeConfig` plugin option.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disableRuntimeConfig?: boolean;
|
||||
/**
|
||||
* This option will allow you to configure the `navigateFallback` when using `registerRoute` for `offline` support:
|
||||
* configure here the corresponding `url`, for example `navigateFallback: 'index.html'`.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `injectManifest` strategy.
|
||||
*
|
||||
* @default 'index.html'
|
||||
*/
|
||||
navigateFallback?: string;
|
||||
/**
|
||||
* This option will allow you to configure the `navigateFallbackAllowlist`: new option from version `v0.12.4`.
|
||||
*
|
||||
* Since we need at least the entry point in the service worker's precache manifest, we don't want the rest of the assets to be intercepted by the service worker.
|
||||
*
|
||||
* If you configure this option, the plugin will use it instead the default.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default [/^\/$/]
|
||||
*/
|
||||
navigateFallbackAllowlist?: RegExp[];
|
||||
/**
|
||||
* On dev mode the `manifest.webmanifest` file can be on other path.
|
||||
*
|
||||
* For example, **SvelteKit** will request `/_app/manifest.webmanifest`, when `webmanifest` added to the output bundle, **SvelteKit** will copy it to the `/_app/` folder.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
*
|
||||
* @default `${vite.base}${pwaOptions.manifestFilename}`
|
||||
* @deprecated This option has been deprecated from version `v0.12.4`, the plugin will use navigateFallbackAllowlist instead.
|
||||
* @see navigateFallbackAllowlist
|
||||
*/
|
||||
webManifestUrl?: string;
|
||||
/**
|
||||
* Where to store generated service worker in development when using `generateSW` strategy.
|
||||
*
|
||||
* Use it with caution, it should be used only by framework integrations.
|
||||
*
|
||||
* @default resolve(viteConfig.root, 'dev-dist')
|
||||
*/
|
||||
resolveTempFolder?: () => string | Promise<string>;
|
||||
/**
|
||||
* Suppress workbox-build warnings?.
|
||||
*
|
||||
* **WARNING**: this option will only be used when using `generateSW` strategy.
|
||||
* If enabled, `globPatterns` will be changed to `[*.js]` and a new empty `suppress-warnings.js` file will be created in `dev-dist` folder.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
suppressWarnings?: boolean;
|
||||
}
|
||||
|
||||
declare const cachePreset: RuntimeCaching[];
|
||||
|
||||
declare const defaultInjectManifestVitePlugins: string[];
|
||||
|
||||
declare function VitePWA(userOptions?: Partial<VitePWAOptions>): Plugin[];
|
||||
|
||||
export { type CustomInjectManifestOptions, type DevOptions, type Display, type DisplayOverride, type ExtendManifestEntriesHook, type IconPurpose, type IconResource, type InjectManifestVitePlugins, type LaunchHandlerClientMode, type ManifestOptions, type VitePWAOptions as Options, type PWAAssetsOptions, type PWAIntegration, type RegisterSWData, type ResolvedPWAAssetsOptions, type ResolvedServiceWorkerOptions, type ResolvedVitePWAOptions, type ScopeExtensionsType, type ShareTargetFiles, type StringLiteralUnion, VitePWA, type VitePWAOptions, type VitePluginPWAAPI, type WebManifestData, cachePreset, defaultInjectManifestVitePlugins };
|
||||
1275
frontend/node_modules/vite-plugin-pwa/dist/index.js
generated
vendored
Normal file
1275
frontend/node_modules/vite-plugin-pwa/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
139
frontend/node_modules/vite-plugin-pwa/dist/vite-build-BGK4YAIU.js
generated
vendored
Normal file
139
frontend/node_modules/vite-plugin-pwa/dist/vite-build-BGK4YAIU.js
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
import {
|
||||
logSWViteBuild,
|
||||
logWorkboxResult,
|
||||
normalizePath
|
||||
} from "./chunk-G4TAN34B.js";
|
||||
import "./chunk-LKBIOQSP.js";
|
||||
|
||||
// src/vite-build.ts
|
||||
import { promises as fs } from "node:fs";
|
||||
import { basename, dirname, relative, resolve } from "node:path";
|
||||
async function buildSW(version, options, viteOptions, workboxPromise) {
|
||||
await options.integration?.beforeBuildServiceWorker?.(options);
|
||||
const { build } = await import("vite");
|
||||
const {
|
||||
inlineConfig,
|
||||
format,
|
||||
swName,
|
||||
swMjsName
|
||||
} = prepareViteBuild(options, viteOptions);
|
||||
logSWViteBuild(version, normalizePath(relative(viteOptions.root, options.swSrc)), viteOptions, format);
|
||||
await options.integration?.configureCustomSWViteBuild?.(inlineConfig);
|
||||
await build(inlineConfig);
|
||||
if (format !== "iife") {
|
||||
const swDestDir = dirname(options.swDest);
|
||||
const mjsPath = resolve(swDestDir, swMjsName);
|
||||
const jsPath = resolve(swDestDir, swName);
|
||||
await fs.rename(mjsPath, jsPath);
|
||||
const mjsMapPath = `${mjsPath}.map`;
|
||||
const sourceMap = await fs.lstat(mjsMapPath).then((s) => s.isFile()).catch(() => false);
|
||||
if (sourceMap) {
|
||||
await Promise.all([
|
||||
fs.readFile(jsPath, "utf-8").then((content) => fs.writeFile(
|
||||
jsPath,
|
||||
content.replace(`${swMjsName}.map`, `${swName}.map`),
|
||||
"utf-8"
|
||||
)),
|
||||
fs.rename(mjsMapPath, `${jsPath}.map`)
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (!options.injectManifest.injectionPoint)
|
||||
return;
|
||||
const injectManifestOptions = {
|
||||
...options.injectManifest,
|
||||
// this will not fail since there is an injectionPoint
|
||||
swSrc: options.injectManifest.swDest
|
||||
};
|
||||
const { injectManifest } = await workboxPromise;
|
||||
const buildResult = await injectManifest(injectManifestOptions);
|
||||
logWorkboxResult(
|
||||
version,
|
||||
options.throwMaximumFileSizeToCacheInBytes,
|
||||
"injectManifest",
|
||||
buildResult,
|
||||
viteOptions,
|
||||
format
|
||||
);
|
||||
}
|
||||
function prepareViteBuild(options, viteOptions) {
|
||||
const define = { ...viteOptions.define ?? {} };
|
||||
const nodeEnv = options.injectManifestBuildOptions.enableWorkboxModulesLogs ? "development" : process["env"]["NODE_ENV"] || "production";
|
||||
define["process.env.NODE_ENV"] = JSON.stringify(nodeEnv);
|
||||
const buildPlugins = options.buildPlugins;
|
||||
const {
|
||||
format,
|
||||
plugins,
|
||||
rollupOptions
|
||||
} = options.injectManifestRollupOptions;
|
||||
const inlineConfig = {
|
||||
root: viteOptions.root,
|
||||
base: viteOptions.base,
|
||||
resolve: viteOptions.resolve,
|
||||
mode: viteOptions.mode,
|
||||
envDir: options.injectManifestEnvOptions.envDir,
|
||||
envPrefix: options.injectManifestEnvOptions.envPrefix,
|
||||
// don't copy anything from public folder
|
||||
publicDir: false,
|
||||
build: {
|
||||
target: options.injectManifestBuildOptions.target,
|
||||
minify: options.injectManifestBuildOptions.minify,
|
||||
sourcemap: options.injectManifestBuildOptions.sourcemap,
|
||||
outDir: options.outDir,
|
||||
emptyOutDir: false
|
||||
},
|
||||
configFile: false,
|
||||
define,
|
||||
plugins: buildPlugins?.vite
|
||||
};
|
||||
const swName = basename(options.swDest);
|
||||
const swMjsName = swName.replace(/\.js$/, ".mjs");
|
||||
if (format !== "iife") {
|
||||
if (viteOptions.build.sourcemap) {
|
||||
Object.assign(inlineConfig, {
|
||||
...inlineConfig,
|
||||
esbuild: {
|
||||
sourcemap: viteOptions.build.sourcemap === "hidden" ? true : viteOptions.build.sourcemap
|
||||
}
|
||||
});
|
||||
}
|
||||
Object.assign(inlineConfig.build, {
|
||||
...inlineConfig.build,
|
||||
modulePreload: false,
|
||||
rollupOptions: {
|
||||
...rollupOptions,
|
||||
plugins: buildPlugins?.rollup ?? plugins,
|
||||
input: options.swSrc,
|
||||
output: {
|
||||
entryFileNames: swMjsName,
|
||||
inlineDynamicImports: true
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Object.assign(inlineConfig.build, {
|
||||
...inlineConfig.build,
|
||||
lib: {
|
||||
entry: options.swSrc,
|
||||
name: "app",
|
||||
formats: [format]
|
||||
},
|
||||
rollupOptions: {
|
||||
...rollupOptions,
|
||||
plugins: buildPlugins?.rollup ?? plugins,
|
||||
output: {
|
||||
entryFileNames: swName
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
inlineConfig,
|
||||
swName,
|
||||
swMjsName,
|
||||
format
|
||||
};
|
||||
}
|
||||
export {
|
||||
buildSW
|
||||
};
|
||||
1
frontend/node_modules/vite-plugin-pwa/index.d.ts
generated
vendored
Normal file
1
frontend/node_modules/vite-plugin-pwa/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './dist'
|
||||
66
frontend/node_modules/vite-plugin-pwa/info.d.ts
generated
vendored
Normal file
66
frontend/node_modules/vite-plugin-pwa/info.d.ts
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
declare module 'virtual:pwa-info' {
|
||||
export interface PwaInfo {
|
||||
pwaInDevEnvironment: boolean
|
||||
/**
|
||||
* The web manifest will be always here.
|
||||
*/
|
||||
webManifest: {
|
||||
href: string
|
||||
useCredentials: boolean
|
||||
/**
|
||||
* The link tag with or without `crossorigin`:
|
||||
* - `<link rel="manifest" href="<webManifestUrl>" />`.
|
||||
* - `<link rel="manifest" href="<webManifestUrl>" crossorigin="use-credentials" />`.
|
||||
*/
|
||||
linkTag: string
|
||||
}
|
||||
/**
|
||||
* The service worker data will be exposed only if required, that's, will **NOT** be exposed if:
|
||||
* - not using `pwaPluginOptions.injectRegister` with `script`, `script-defer` or `inline` values
|
||||
* - if using `pwaPluginOptions.injectRegister` with `auto` (default) and importing any of the virtual modules
|
||||
*/
|
||||
registerSW?: {
|
||||
/**
|
||||
* When this flag is `true` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*
|
||||
* @deprecated From `v0.17.2` this flag is deprecated, use `mode` instead.
|
||||
*/
|
||||
inline: boolean
|
||||
/**
|
||||
* When this flag is `inline` the service worker must be registered via inline script otherwise registered via script with src attribute `registerSW.js`.
|
||||
*/
|
||||
mode: 'inline' | 'script' | 'script-defer'
|
||||
/**
|
||||
* The path for the inline script: will contain the service worker url.
|
||||
*/
|
||||
inlinePath: string
|
||||
/**
|
||||
* The path for the src script for `registerSW.js`.
|
||||
*/
|
||||
registerPath: string
|
||||
/**
|
||||
* The scope for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
scope: string
|
||||
/**
|
||||
* The type for the service worker: only required for `inline: true`.
|
||||
*/
|
||||
type: 'classic' | 'module'
|
||||
/**
|
||||
* The script tag if `shouldRegisterSW` returns `true`.
|
||||
*/
|
||||
scriptTag?: string
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the PWA information if available.
|
||||
*
|
||||
* This property will be `undefined` if:
|
||||
* - SSR build
|
||||
* - PWA is disabled: `pwaPluginOptions.disable = true`
|
||||
* - running `Dev Server` and `pwaPluginOptions.devOptions.enabled = false` (default).
|
||||
*
|
||||
* @returns The PWA information.
|
||||
*/
|
||||
export const pwaInfo: PwaInfo | undefined
|
||||
}
|
||||
156
frontend/node_modules/vite-plugin-pwa/package.json
generated
vendored
Normal file
156
frontend/node_modules/vite-plugin-pwa/package.json
generated
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"name": "vite-plugin-pwa",
|
||||
"type": "module",
|
||||
"version": "1.2.0",
|
||||
"description": "Zero-config PWA for Vite",
|
||||
"author": "antfu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/antfu",
|
||||
"homepage": "https://github.com/vite-pwa/vite-plugin-pwa#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vite-pwa/vite-plugin-pwa.git"
|
||||
},
|
||||
"bugs": "https://github.com/vite-pwa/vite-plugin-pwa/issues",
|
||||
"keywords": [
|
||||
"react",
|
||||
"pwa",
|
||||
"vue",
|
||||
"vitepress",
|
||||
"preact",
|
||||
"svelte",
|
||||
"sveltekit",
|
||||
"workbox",
|
||||
"solidjs",
|
||||
"vite",
|
||||
"vite-plugin"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"./types": {
|
||||
"types": "./types/index.d.ts"
|
||||
},
|
||||
"./preact": {
|
||||
"types": "./preact.d.ts"
|
||||
},
|
||||
"./react": {
|
||||
"types": "./react.d.ts"
|
||||
},
|
||||
"./solid": {
|
||||
"types": "./solid.d.ts"
|
||||
},
|
||||
"./svelte": {
|
||||
"types": "./svelte.d.ts"
|
||||
},
|
||||
"./vanillajs": {
|
||||
"types": "./vanillajs.d.ts"
|
||||
},
|
||||
"./vue": {
|
||||
"types": "./vue.d.ts"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./client.d.ts"
|
||||
},
|
||||
"./info": {
|
||||
"types": "./info.d.ts"
|
||||
},
|
||||
"./pwa-assets": {
|
||||
"types": "./pwa-assets.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./*": "./*"
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist",
|
||||
"types"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vite-pwa/assets-generator": "^1.0.0",
|
||||
"vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
|
||||
"workbox-build": "^7.4.0",
|
||||
"workbox-window": "^7.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vite-pwa/assets-generator": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.3.6",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"tinyglobby": "^0.2.10",
|
||||
"workbox-build": "^7.4.0",
|
||||
"workbox-window": "^7.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^4.11.0",
|
||||
"@antfu/ni": "^0.21.9",
|
||||
"@playwright/test": "^1.40.0",
|
||||
"@rolldown/pluginutils": "1.0.0-beta.31",
|
||||
"@types/debug": "^4.1.12",
|
||||
"@types/node": "^18.17.14",
|
||||
"@types/prompts": "^2.4.8",
|
||||
"@types/react": "^18.2.21",
|
||||
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
||||
"@vite-pwa/assets-generator": "^1.0.0",
|
||||
"bumpp": "^9.2.0",
|
||||
"eslint": "^9.23.0",
|
||||
"esno": "0.17.0",
|
||||
"kolorist": "^1.8.0",
|
||||
"preact": "^10.19.7",
|
||||
"prompts": "^2.4.2",
|
||||
"publint": "^0.2.5",
|
||||
"react": "^18.2.0",
|
||||
"solid-js": "^1.8.5",
|
||||
"svelte": "^4.2.5",
|
||||
"tsup": "^7.3.0",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.12",
|
||||
"vitest": "1.0.0-beta.4",
|
||||
"vue": "^3.3.8"
|
||||
},
|
||||
"scripts": {
|
||||
"docs": "pnpm -C docs run dev",
|
||||
"docs:build": "pnpm -C docs run build",
|
||||
"docs:serve": "pnpm -C docs run serve",
|
||||
"docs:preview": "pnpm -C docs run preview",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "nr lint --fix",
|
||||
"dev": "esno scripts/dev.ts",
|
||||
"build": "rimraf dist && esno scripts/build.ts",
|
||||
"build-js-example-on-root": "vite build --outDir=../../dist-examples-root -c ./examples/vanilla-js-custom-sw/vite.config.js ./examples/vanilla-js-custom-sw",
|
||||
"build-vue-example-on-root": "DEBUG=vite-plugin-pwa BASE_URL=/ SOURCE_MAP=true CLAIMS=true vite build --outDir=../../dist-examples-root -c ./examples/vue-router/vite.config.ts ./examples/vue-router",
|
||||
"release": "bumpp",
|
||||
"examples": "esno scripts/run-examples.ts",
|
||||
"example:vue:dev:cdn": "pnpm -C examples/vue-basic-cdn run dev",
|
||||
"example:vue:build:cdn": "pnpm -C examples/vue-basic-cdn run build",
|
||||
"example:vue:start:cdn": "pnpm -C examples/vue-basic-cdn run start",
|
||||
"deploy": "nr build && nr docs:build",
|
||||
"test-vue": "pnpm -C examples/vue-router run test",
|
||||
"test-react": "pnpm -C examples/react-router run test",
|
||||
"test-preact": "pnpm -C examples/preact-router run test",
|
||||
"test-solid": "pnpm -C examples/solid-router run test",
|
||||
"test-svelte": "pnpm -C examples/svelte-routify run test",
|
||||
"test-typescript": "pnpm -C examples/vanilla-ts-no-ip run test",
|
||||
"test": "nr test-vue && nr test-react && nr test-preact && nr test-solid && nr test-typescript",
|
||||
"test:node20": "nr test-vue && nr test-react && nr test-preact && nr test-solid && nr test-svelte && nr test-typescript",
|
||||
"test:vite-ecosystem-ci": "nr test-typescript"
|
||||
}
|
||||
}
|
||||
19
frontend/node_modules/vite-plugin-pwa/preact.d.ts
generated
vendored
Normal file
19
frontend/node_modules/vite-plugin-pwa/preact.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
declare module 'virtual:pwa-register/preact' {
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore ignore when preact/hooks is not installed
|
||||
import type { Dispatch, StateUpdater } from 'preact/hooks'
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): {
|
||||
needRefresh: [boolean, Dispatch<StateUpdater<boolean>>]
|
||||
offlineReady: [boolean, Dispatch<StateUpdater<boolean>>]
|
||||
/**
|
||||
* Reloads the current window to allow the service worker take the control.
|
||||
*
|
||||
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
||||
*/
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
}
|
||||
40
frontend/node_modules/vite-plugin-pwa/pwa-assets.d.ts
generated
vendored
Normal file
40
frontend/node_modules/vite-plugin-pwa/pwa-assets.d.ts
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/* WARNING: these virtual modules are meant to be used by integrations and not being consumed directly from applications */
|
||||
|
||||
declare module 'virtual:pwa-assets/head' {
|
||||
export interface PWAAssetHeadLink {
|
||||
id?: string
|
||||
rel: 'apple-touch-startup-image' | 'apple-touch-icon' | 'icon'
|
||||
href: string
|
||||
media?: string
|
||||
sizes?: string
|
||||
type?: string
|
||||
}
|
||||
|
||||
export interface ColorSchemeMeta {
|
||||
name: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export interface PWAAssetsHead {
|
||||
links: PWAAssetHeadLink[]
|
||||
themeColor?: ColorSchemeMeta
|
||||
}
|
||||
|
||||
export const pwaAssetsHead: PWAAssetsHead
|
||||
}
|
||||
|
||||
declare module 'virtual:pwa-assets/icons' {
|
||||
import type { AppleSplashScreenLink, FaviconLink, HtmlLink, IconAsset } from '@vite-pwa/assets-generator/api'
|
||||
|
||||
export type PWAAssetIcon<T extends HtmlLink> = Omit<IconAsset<T>, 'buffer'>
|
||||
|
||||
export interface PWAAssetsIcons {
|
||||
favicon: Record<string, PWAAssetIcon<FaviconLink>>
|
||||
transparent: Record<string, PWAAssetIcon<HtmlLink>>
|
||||
maskable: Record<string, PWAAssetIcon<HtmlLink>>
|
||||
apple: Record<string, PWAAssetIcon<HtmlLink>>
|
||||
appleSplashScreen: Record<string, PWAAssetIcon<AppleSplashScreenLink>>
|
||||
}
|
||||
|
||||
export const pwaAssetsIcons: PWAAssetsIcons
|
||||
}
|
||||
19
frontend/node_modules/vite-plugin-pwa/react.d.ts
generated
vendored
Normal file
19
frontend/node_modules/vite-plugin-pwa/react.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
declare module 'virtual:pwa-register/react' {
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore ignore when react is not installed
|
||||
import type { Dispatch, SetStateAction } from 'react'
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): {
|
||||
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>]
|
||||
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>]
|
||||
/**
|
||||
* Reloads the current window to allow the service worker take the control.
|
||||
*
|
||||
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
||||
*/
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
}
|
||||
19
frontend/node_modules/vite-plugin-pwa/solid.d.ts
generated
vendored
Normal file
19
frontend/node_modules/vite-plugin-pwa/solid.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
declare module 'virtual:pwa-register/solid' {
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore ignore when solid-js is not installed
|
||||
import type { Accessor, Setter } from 'solid-js'
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): {
|
||||
needRefresh: [Accessor<boolean>, Setter<boolean>]
|
||||
offlineReady: [Accessor<boolean>, Setter<boolean>]
|
||||
/**
|
||||
* Reloads the current window to allow the service worker take the control.
|
||||
*
|
||||
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
||||
*/
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
}
|
||||
19
frontend/node_modules/vite-plugin-pwa/svelte.d.ts
generated
vendored
Normal file
19
frontend/node_modules/vite-plugin-pwa/svelte.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
declare module 'virtual:pwa-register/svelte' {
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore ignore when svelte is not installed
|
||||
import type { Writable } from 'svelte/store'
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): {
|
||||
needRefresh: Writable<boolean>
|
||||
offlineReady: Writable<boolean>
|
||||
/**
|
||||
* Reloads the current window to allow the service worker take the control.
|
||||
*
|
||||
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
||||
*/
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
}
|
||||
20
frontend/node_modules/vite-plugin-pwa/types/index.d.ts
generated
vendored
Normal file
20
frontend/node_modules/vite-plugin-pwa/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
export interface RegisterSWOptions {
|
||||
immediate?: boolean
|
||||
onNeedRefresh?: () => void
|
||||
onOfflineReady?: () => void
|
||||
/**
|
||||
* Called only if `onRegisteredSW` is not provided.
|
||||
*
|
||||
* @deprecated Use `onRegisteredSW` instead.
|
||||
* @param registration The service worker registration if available.
|
||||
*/
|
||||
onRegistered?: (registration: ServiceWorkerRegistration | undefined) => void
|
||||
/**
|
||||
* Called once the service worker is registered (requires version `0.12.8+`).
|
||||
*
|
||||
* @param swScriptUrl The service worker script url.
|
||||
* @param registration The service worker registration if available.
|
||||
*/
|
||||
onRegisteredSW?: (swScriptUrl: string, registration: ServiceWorkerRegistration | undefined) => void
|
||||
onRegisterError?: (error: any) => void
|
||||
}
|
||||
3
frontend/node_modules/vite-plugin-pwa/types/package.json
generated
vendored
Normal file
3
frontend/node_modules/vite-plugin-pwa/types/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
13
frontend/node_modules/vite-plugin-pwa/vanillajs.d.ts
generated
vendored
Normal file
13
frontend/node_modules/vite-plugin-pwa/vanillajs.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
declare module 'virtual:pwa-register' {
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
/**
|
||||
* Registers the service worker returning a callback to reload the current page when an update is found.
|
||||
*
|
||||
* @param options the options to register the service worker.
|
||||
* @return (reloadPage?: boolean) => Promise<void> From version 0.13.2+ `reloadPage` param is not used anymore.
|
||||
*/
|
||||
export function registerSW(options?: RegisterSWOptions): (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
19
frontend/node_modules/vite-plugin-pwa/vue.d.ts
generated
vendored
Normal file
19
frontend/node_modules/vite-plugin-pwa/vue.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
declare module 'virtual:pwa-register/vue' {
|
||||
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore ignore when vue is not installed
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
export type { RegisterSWOptions }
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): {
|
||||
needRefresh: Ref<boolean>
|
||||
offlineReady: Ref<boolean>
|
||||
/**
|
||||
* Reloads the current window to allow the service worker take the control.
|
||||
*
|
||||
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
||||
*/
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user