Skip to content

Commit 52d2390

Browse files
committed
chore(backporting): backported some changes from @serwist/next@8.0.0
1 parent 974326e commit 52d2390

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1379
-2124
lines changed

.changeset/clean-kangaroos-turn.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@ducanh2912/next-pwa": major
3+
---
4+
5+
chore(backporting): backported some changes from `@serwist/next@8.0.0`
6+
7+
- Removed `buildExcludes`.
8+
- Simply use `workboxOptions.exclude` as a replacement.
9+
- Removed `customWorkerDir`.
10+
- Use `customWorkerSrc` instead.
11+
- Removed `browserslist`, `swcMinify`, `watchWorkersInDev`.
12+
- We now create child compilers on Next.js's compiler instead of starting separate Webpack processes.
13+
- This also means you don't need to have `@swc/core` installed anymore.
14+
- Change the default value for `dest` from `".next"` to `"public"`.
15+
- You should change it to `".next"` in your project if there's demand, but I'd recommend using `"public"` instead.
16+
- Fixed the custom worker and the fallback worker not working...
17+
- I'm seriously sorry... This was caused by `next-pwa`'s `importScripts` not being passed to Workbox.

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ coverage/
5454
LICENSE
5555
CODE_OF_CONDUCT.md
5656

57-
tsconfig.json
57+
tsconfig.json
58+
docs/.contentlayer

docs/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@
1010
},
1111
"dependencies": {
1212
"@ducanh2912/next-pwa": "workspace:*",
13-
"@mantine/hooks": "7.2.2",
14-
"@tabler/icons-react": "2.40.0",
13+
"@mantine/hooks": "7.3.1",
14+
"@tabler/icons-react": "2.43.0",
1515
"bright": "0.8.4",
1616
"client-only": "0.0.1",
1717
"contentlayer": "0.3.4",
1818
"highlight.js": "11.9.0",
19-
"next": "14.0.3",
19+
"next": "14.0.4",
2020
"next-contentlayer": "0.3.4",
2121
"react": "18.2.0",
2222
"react-dom": "18.2.0",
2323
"react-wrap-balancer": "1.1.0",
2424
"server-only": "0.0.1",
25-
"tailwind-merge": "2.0.0",
25+
"tailwind-merge": "2.1.0",
2626
"uuid": "9.0.1",
27-
"zustand": "4.4.6"
27+
"zustand": "4.4.7"
2828
},
2929
"devDependencies": {
3030
"@types/extend": "3.0.4",
3131
"@types/hast": "3.0.3",
3232
"@types/mdast": "4.0.3",
3333
"@types/mdx": "2.0.10",
34-
"@types/node": "20.9.1",
35-
"@types/react": "18.2.37",
36-
"@types/react-dom": "18.2.15",
34+
"@types/node": "20.10.4",
35+
"@types/react": "18.2.43",
36+
"@types/react-dom": "18.2.17",
3737
"@types/uuid": "9.0.7",
3838
"autoprefixer": "10.4.16",
3939
"extend": "3.0.2",
@@ -45,11 +45,11 @@
4545
"mdast-util-to-markdown": "2.1.0",
4646
"mdast-util-to-string": "4.0.0",
4747
"mdx-bundler": "10.0.1",
48-
"postcss": "8.4.31",
48+
"postcss": "8.4.32",
4949
"rehype-highlight": "7.0.0",
5050
"rehype-sanitize": "6.0.0",
51-
"tailwindcss": "3.3.5",
52-
"typescript": "5.4.0-dev.20231118",
51+
"tailwindcss": "3.3.6",
52+
"typescript": "5.4.0-dev.20231210",
5353
"unified": "10.1.2",
5454
"unist-util-is": "6.0.0",
5555
"unist-util-visit": "5.0.0"

docs/src/app/(home)/code-showcase.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ const withPWA = require("@ducanh2912/next-pwa").default({
5252
// register: true,
5353
// scope: "/app",
5454
// sw: "service-worker.js",
55-
// customWorkerDir: "service-worker",
55+
// customWorkerDest: "service-worker",
5656
// cacheStartUrl: true,
5757
// dynamicStartUrl: true,
5858
// dynamicStartUrlRedirect: "/foo/bar",
5959
// cacheOnFrontendNav: true,
6060
// aggressiveFrontEndNavCaching: true,
6161
// scope: "/beta",
62-
// swcMinify: true,
6362
// workboxOptions: {},
6463
// ...
6564
});

docs/src/app/icon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const size = {
1313
height: 32,
1414
};
1515

16+
export const generateStaticParams = () => [];
17+
1618
const Icon = async () => {
1719
const notoSansMono = await fs.readFile(
1820
path.join(__dirname, "../shared/notoSansMono.ttf")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use client";
2+
import { Heading } from "@/components/Heading";
3+
4+
export const ReloadButton = () => {
5+
return (
6+
<button
7+
onClick={() => window.location.reload()}
8+
className="ml-2 [&>span]:!my-0"
9+
>
10+
<Heading type="subtitle">Try reloading?</Heading>
11+
</button>
12+
);
13+
};

docs/src/app/~offline/page.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Heading } from "@/components/Heading.js";
2+
3+
import { ReloadButton } from "./ReloadButton.js";
4+
5+
const Page = () => {
6+
return (
7+
<div className="flex w-full items-center justify-center self-stretch">
8+
<Heading type="title-large">offline. </Heading>
9+
<ReloadButton />
10+
</div>
11+
);
12+
};
13+
14+
export default Page;

examples/basic/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
},
1212
"dependencies": {
1313
"@ducanh2912/next-pwa": "latest",
14-
"next": "14.0.3",
14+
"next": "14.0.4",
1515
"react": "18.2.0",
1616
"react-dom": "18.2.0"
1717
},
1818
"devDependencies": {
19-
"@types/node": "20.9.1",
20-
"@types/react": "18.2.37",
21-
"@types/react-dom": "18.2.15",
22-
"typescript": "5.2.2"
19+
"@types/node": "20.10.4",
20+
"@types/react": "18.2.43",
21+
"@types/react-dom": "18.2.17",
22+
"typescript": "5.3.3"
2323
}
2424
}

examples/custom-server/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const withPWA = require("@ducanh2912/next-pwa").default({
55
/** @type {import("next").NextConfig} */
66
const nextConfig = {
77
reactStrictMode: true,
8-
swcMinify: true,
98
};
109

1110
module.exports = withPWA(nextConfig);

examples/custom-server/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
"@fastify/compress": "6.5.0",
1515
"cross-env": "7.0.3",
1616
"fastify": "4.24.3",
17-
"next": "14.0.3",
17+
"next": "14.0.4",
1818
"react": "18.2.0",
1919
"react-dom": "18.2.0"
2020
},
2121
"devDependencies": {
22-
"@swc/core": "1.3.96",
23-
"@types/node": "20.9.1",
24-
"@types/react": "18.2.37",
25-
"@types/react-dom": "18.2.15",
26-
"nodemon": "3.0.1",
22+
"@swc/core": "1.3.100",
23+
"@types/node": "20.10.4",
24+
"@types/react": "18.2.43",
25+
"@types/react-dom": "18.2.17",
26+
"nodemon": "3.0.2",
2727
"rimraf": "5.0.5",
28-
"ts-node": "10.9.1",
29-
"typescript": "5.2.2"
28+
"ts-node": "10.9.2",
29+
"typescript": "5.3.3"
3030
}
3131
}

0 commit comments

Comments
 (0)