diff --git a/.eslintrc.json b/.eslintrc.json
index adff7ddb..d5fa6408 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,15 +1,16 @@
{
- "extends": "@antfu",
+ "extends": ["@antfu"],
"overrides": [
{
"files": [
"**/*.md/*.*"
],
"rules": {
- "@typescript-eslint/no-this-alias": "off",
- "n/handle-callback-err": "off",
+ "no-restricted-imports": "off",
"no-restricted-syntax": "off",
- "no-labels": "off"
+ "no-labels": "off",
+ "@typescript-eslint/no-unused-vars": "off",
+ "@typescript-eslint/no-var-requires": "off"
}
}
]
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 00000000..ce6e56a4
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1,4 @@
+ignore-workspace-root-check=true
+shamefully-hoist=true
+strict-peer-dependencies=false
+auto-install-peers=true
diff --git a/README.md b/README.md
index ba35d80d..ed5db0fe 100644
--- a/README.md
+++ b/README.md
@@ -71,11 +71,11 @@ export default {
Read the [📖 documentation](https://vite-plugin-pwa.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.
+Check out the client type declarations [client.d.ts](packages/vite-plugin-pwa/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.
+Check out the type declaration [src/types.ts](packages/vite-plugin-pwa/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)
diff --git a/docs/.vitepress/components.d.ts b/docs/.vitepress/components.d.ts
index 19b7059b..9b2f4709 100644
--- a/docs/.vitepress/components.d.ts
+++ b/docs/.vitepress/components.d.ts
@@ -3,6 +3,8 @@
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
+export {}
+
declare module '@vue/runtime-core' {
export interface GlobalComponents {
CleanupOutdatedCaches: typeof import('./theme/components/CleanupOutdatedCaches.md')['default']
@@ -24,5 +26,3 @@ declare module '@vue/runtime-core' {
TypeScriptError2307: typeof import('./theme/components/TypeScriptError2307.md')['default']
}
}
-
-export {}
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 41fff717..c0edbf7d 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -1,5 +1,7 @@
import { defineConfig } from 'vitepress'
import { version } from '../../package.json'
+import { pwa } from '../scripts/pwa'
+import { buildEnd } from '../scripts/build'
const Guide = [
{
@@ -328,4 +330,10 @@ export default defineConfig({
'/workbox/': prepareSidebar(4),
},
},
+ vite: {
+ plugins: [
+ pwa(),
+ ],
+ },
+ buildEnd,
})
diff --git a/docs/frameworks/sveltekit.md b/docs/frameworks/sveltekit.md
index 0803c5d3..631bd9ad 100644
--- a/docs/frameworks/sveltekit.md
+++ b/docs/frameworks/sveltekit.md
@@ -63,6 +63,7 @@ Pages which are not prerendered or are generated with a unique adapter will need
As an example, when using [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static) with `generateSW` strategy and `Prompt for update` behavior, you will need:
::: details 1) add pwa.js script
+
```js
import { copyFileSync } from 'fs'
import { resolveConfig } from 'vite'
@@ -187,6 +188,7 @@ export { pwaConfiguration }
:::
::: details 4) add Vite Plugin PWA to svelte.config.js
+
```js
import adapter from '@sveltejs/adapter-static'
import preprocess from 'svelte-preprocess'
diff --git a/docs/guide/development.md b/docs/guide/development.md
index 29032624..8555ebeb 100644
--- a/docs/guide/development.md
+++ b/docs/guide/development.md
@@ -129,7 +129,7 @@ export default defineConfig({
/* other options */
}
})
- ]
+ ]
})
```
:::
diff --git a/docs/guide/faq.md b/docs/guide/faq.md
index e49ba581..57c780dd 100644
--- a/docs/guide/faq.md
+++ b/docs/guide/faq.md
@@ -34,7 +34,9 @@ or `main.js`:
import { registerSW } from 'virtual:pwa-register'
const updateSW = registerSW({
- onRegisterError(error) {}
+ onRegisterError(error) {
+ console.log('error register sw', error)
+ }
})
```
diff --git a/docs/package.json b/docs/package.json
index 16306851..4693af28 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -9,25 +9,25 @@
"serve": "npm run build && serve .vitepress/dist"
},
"dependencies": {
- "@vueuse/core": "^8.7.5",
- "@vueuse/shared": "^8.7.5",
- "vue": "^3.2.37"
+ "@vueuse/core": "^9.2.0",
+ "@vueuse/shared": "^9.2.0",
+ "vue": "^3.2.38"
},
"devDependencies": {
"@types/fs-extra": "^9.0.13",
- "@vitejs/plugin-vue": "^2.3.3",
- "@vueuse/core": "^8.7.5",
+ "@vitejs/plugin-vue": "^3.1.0",
+ "@vueuse/core": "^9.2.0",
"esbuild-register": "^3.3.3",
- "eslint": "^8.19.0",
+ "eslint": "^8.23.0",
"fast-glob": "^3.2.11",
"fs-extra": "^10.1.0",
"https-localhost": "^4.7.1",
- "typescript": "^4.7.4",
- "unocss": "^0.38.2",
- "unplugin-vue-components": "^0.19.9",
- "vite": "^2.9.13",
+ "typescript": "^4.8.2",
+ "unocss": "^0.45.18",
+ "unplugin-vue-components": "^0.22.4",
+ "vite": "^3.1.0",
"vite-plugin-pwa": "workspace:*",
- "vitepress": "^1.0.0-alpha.4",
- "workbox-window": "^6.5.3"
+ "vitepress": "^1.0.0-alpha.13",
+ "workbox-window": "^6.5.4"
}
}
diff --git a/docs/plugins/navbar.ts b/docs/plugins/navbar.ts
index 2954106a..7629b451 100644
--- a/docs/plugins/navbar.ts
+++ b/docs/plugins/navbar.ts
@@ -5,7 +5,7 @@ export default function NavbarFix(): Plugin {
name: 'vitepress-sidebar-logo-fix',
enforce: 'pre',
transform(code, id) {
- if (id.includes('VPNavBarTitle.vue') && !id.endsWith('.css')) {
+ if (id.includes('VPNavBarTitle.vue') && !id.endsWith('.css') && !id.includes('&setup=')) {
return `
+