Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: support Vite 5 #598

Merged
merged 8 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"rules": {
"@typescript-eslint/no-this-alias": "off",
"n/handle-callback-err": "off",
"no-restricted-globals": "off",
"no-restricted-syntax": "off",
"no-labels": "off"
}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ Zero-config PWA Framework-agnostic Plugin for Vite

## 📦 Install

> From v0.13, `vite-plugin-pwa` requires **Vite 3.1 or above**.
> 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

Expand Down
1 change: 0 additions & 1 deletion docs/frameworks/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ const pwaConfiguration = {
e.url = `/${url.substring(0, url.lastIndexOf('/'))}`
else if (url.endsWith('.html'))
e.url = `/${url.substring(0, url.length - '.html'.length)}`

}

return e
Expand Down
1 change: 0 additions & 1 deletion docs/frameworks/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export default {
catch {
console.log('PWA disabled.')
}

},
methods: {
async closePromptUpdateSW() {
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const preconnect = `
<link rel="preconnect" crossorigin="anonymous" href="${gstatic}">
`

export const optimizePages = async () => {
export async function optimizePages() {
const names = await fg('./.vitepress/dist/**/*.html', { onlyFiles: true })

await Promise.all(names.map(async (i) => {
Expand Down
26 changes: 13 additions & 13 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext",
"incremental": false,
"target": "es2016",
"lib": ["DOM", "ESNext"],
"strict": true,
"esModuleInterop": true,
"incremental": false,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
},
"types": [
"@types/fs-extra",
"node",
"vite/client",
"vite-plugin-pwa/client",
"vitepress"
],
"paths": {
"~/*": ["src/*"]
}
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"skipLibCheck": true
},
"include": [
"./*.ts",
Expand Down
8 changes: 4 additions & 4 deletions examples/preact-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
"preact-router": "^4.1.2"
},
"devDependencies": {
"@preact/preset-vite": "^2.6.0",
"@rollup/plugin-replace": "^5.0.2",
"@preact/preset-vite": "^2.7.0",
"@rollup/plugin-replace": "^5.0.5",
"https-localhost": "^4.7.1",
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*",
"workbox-core": "^7.0.0",
"workbox-precaching": "^7.0.0",
Expand Down
16 changes: 8 additions & 8 deletions examples/preact-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"jsx": "react-jsx",
"jsxImportSource": "preact",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "preact",
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"skipLibCheck": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
}
4 changes: 2 additions & 2 deletions examples/preact-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": ["vite.config.ts"]
}
20 changes: 10 additions & 10 deletions examples/react-router/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example-react-router",
"version": "0.0.0",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "rimraf dev-dist && DEBUG=vite-plugin-pwa SW_DEV=true vite --force",
Expand Down Expand Up @@ -50,21 +50,21 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.15.0",
"react-router": "^6.19.0",
"react-router-config": "^5.1.1",
"react-router-dom": "^6.15.0"
"react-router-dom": "^6.19.0"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-router-config": "^5.0.7",
"@rollup/plugin-replace": "^5.0.5",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/react-router-config": "^5.0.10",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^4.1.0",
"@vitejs/plugin-react": "^4.2.0",
"https-localhost": "^4.7.1",
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*",
"workbox-core": "^7.0.0",
"workbox-precaching": "^7.0.0",
Expand Down
14 changes: 7 additions & 7 deletions examples/react-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"jsx": "react-jsx",
"useDefineForClassFields": true,
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"skipLibCheck": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
}
4 changes: 2 additions & 2 deletions examples/react-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": ["vite.config.ts"]
}
10 changes: 5 additions & 5 deletions examples/solid-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
"test": "nr test-build-claims && nr test-build-sw-claims"
},
"dependencies": {
"@solidjs/router": "^0.8.3",
"solid-js": "^1.7.11"
"@solidjs/router": "^0.9.1",
"solid-js": "^1.8.5"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-replace": "^5.0.5",
"https-localhost": "^4.7.1",
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*",
"vite-plugin-solid": "^2.7.2",
"workbox-core": "^7.0.0",
Expand Down
16 changes: 8 additions & 8 deletions examples/solid-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"jsx": "preserve",
"jsxImportSource": "solid-js",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable", "WebWorker"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"skipLibCheck": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
}
4 changes: 2 additions & 2 deletions examples/solid-router/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": ["vite.config.ts"]
}
16 changes: 8 additions & 8 deletions examples/svelte-routify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@
"test": "nr test-build-claims && nr test-build-sw-claims"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-replace": "^5.0.5",
"@roxi/routify": "^2.18.12",
"@sveltejs/vite-plugin-svelte": "^2.4.6",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tsconfig/svelte": "^5.0.2",
"eslint": "^8.48.0",
"eslint": "^8.54.0",
"eslint-plugin-svelte3": "^4.0.0",
"https-localhost": "^4.7.1",
"rimraf": "^5.0.1",
"svelte": "^4.2.0",
"svelte-check": "^3.5.2",
"svelte-preprocess": "^5.0.4",
"rimraf": "^5.0.5",
"svelte": "^4.2.5",
"svelte-check": "^3.6.0",
"svelte-preprocess": "^5.1.0",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*",
"workbox-core": "^7.0.0",
"workbox-precaching": "^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/vanilla-ts-dev-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"serve": "serve dist"
},
"devDependencies": {
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*"
}
}
10 changes: 5 additions & 5 deletions examples/vanilla-ts-dev-options/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"],

/* Bundler mode */
"moduleResolution": "bundler",
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vite-plugin-pwa/info"],
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"skipLibCheck": true
},
"include": ["src"]
}
4 changes: 2 additions & 2 deletions examples/vanilla-ts-no-ip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"test": "nr test-generate-sw && nr test-custom-sw"
},
"devDependencies": {
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite": "^5.0.0",
"vite-plugin-pwa": "workspace:*",
"workbox-cacheable-response": "^7.0.0",
"workbox-core": "^7.0.0",
Expand Down
Loading