@graphcommerce/next-config 6.2.0-canary.94 → 6.2.0-canary.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.2.0-canary.95
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2030](https://github.com/graphcommerce-org/graphcommerce/pull/2030) [`15939ca62`](https://github.com/graphcommerce-org/graphcommerce/commit/15939ca62021c28f7d60382c65927aed15c1ac84) - next-pwa dependency change and next-image caching optimalization ([@mikekeehnen](https://github.com/mikekeehnen))
8
+
3
9
  ## 6.2.0-canary.94
4
10
 
5
11
  ## 6.2.0-canary.93
package/dist/index.js CHANGED
@@ -20,3 +20,4 @@ __exportStar(require("./utils/packageRoots"), exports);
20
20
  __exportStar(require("./withGraphCommerce"), exports);
21
21
  __exportStar(require("./generated/config"), exports);
22
22
  __exportStar(require("./config"), exports);
23
+ __exportStar(require("./runtimeCachingOptimizations"), exports);
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runtimeCachingOptimizations = void 0;
4
+ exports.runtimeCachingOptimizations = [
5
+ {
6
+ urlPattern: /\/_next\/image\?url=.+$/i,
7
+ handler: 'StaleWhileRevalidate',
8
+ options: {
9
+ cacheName: 'next-image',
10
+ expiration: {
11
+ maxEntries: 1000,
12
+ maxAgeSeconds: 168 * 60 * 60,
13
+ matchOptions: { ignoreVary: true },
14
+ },
15
+ },
16
+ },
17
+ {
18
+ urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
19
+ handler: 'NetworkFirst',
20
+ options: {
21
+ cacheName: 'next-data',
22
+ expiration: {
23
+ maxEntries: 32,
24
+ maxAgeSeconds: 24 * 60 * 60, // 24 hours
25
+ },
26
+ },
27
+ },
28
+ ];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.2.0-canary.94",
5
+ "version": "6.2.0-canary.95",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -21,7 +21,8 @@
21
21
  "js-yaml-loader": "^1.2.2",
22
22
  "lodash": "^4.17.21",
23
23
  "znv": "^0.3.2",
24
- "zod": "^3.21.4"
24
+ "zod": "^3.21.4",
25
+ "workbox-build": "^7.0.0"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/circular-dependency-plugin": "^5.0.5",
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './utils/packageRoots'
7
7
  export * from './withGraphCommerce'
8
8
  export * from './generated/config'
9
9
  export * from './config'
10
+ export * from './runtimeCachingOptimizations'
10
11
 
11
12
  export type PluginProps<P extends Record<string, unknown> = Record<string, unknown>> = P & {
12
13
  Prev: React.FC<P>
@@ -0,0 +1,27 @@
1
+ import { RuntimeCaching } from 'workbox-build'
2
+
3
+ export const runtimeCachingOptimizations: RuntimeCaching[] = [
4
+ {
5
+ urlPattern: /\/_next\/image\?url=.+$/i,
6
+ handler: 'StaleWhileRevalidate',
7
+ options: {
8
+ cacheName: 'next-image',
9
+ expiration: {
10
+ maxEntries: 1000, // 1000 images
11
+ maxAgeSeconds: 168 * 60 * 60, // 1 week
12
+ matchOptions: { ignoreVary: true },
13
+ },
14
+ },
15
+ },
16
+ {
17
+ urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
18
+ handler: 'NetworkFirst',
19
+ options: {
20
+ cacheName: 'next-data',
21
+ expiration: {
22
+ maxEntries: 32,
23
+ maxAgeSeconds: 24 * 60 * 60, // 24 hours
24
+ },
25
+ },
26
+ },
27
+ ]