@docusaurus/plugin-pwa 2.0.0-beta.18 → 2.0.0-beta.19

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/lib/index.js CHANGED
@@ -112,7 +112,7 @@ function pluginPWA(context, options) {
112
112
  optimization: {
113
113
  splitChunks: false,
114
114
  minimize: !debug,
115
- // see https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
115
+ // See https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
116
116
  minimizer: debug
117
117
  ? []
118
118
  : [
@@ -123,7 +123,8 @@ function pluginPWA(context, options) {
123
123
  },
124
124
  plugins: [
125
125
  new webpack_1.default.EnvironmentPlugin({
126
- PWA_SW_CUSTOM: swCustom || '', // fallback value required with Webpack 5
126
+ // Fallback value required with Webpack 5
127
+ PWA_SW_CUSTOM: swCustom || '',
127
128
  }),
128
129
  new LogPlugin_1.default({
129
130
  name: 'Service Worker',
@@ -151,7 +152,7 @@ function pluginPWA(context, options) {
151
152
  // @ts-expect-error: internal API?
152
153
  ...(workbox_build_1.injectManifest.globPatterns ?? []),
153
154
  ],
154
- // those attributes are not overrideable
155
+ // Those attributes are not overrideable
155
156
  swDest,
156
157
  swSrc: swDest,
157
158
  globDirectory: props.outDir,
package/lib/registerSw.js CHANGED
@@ -16,7 +16,7 @@ const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES =
16
16
  const PWA_DEBUG = process.env.PWA_DEBUG;
17
17
  /* eslint-enable prefer-destructuring */
18
18
 
19
- const debug = PWA_DEBUG; // shortcut
19
+ const debug = PWA_DEBUG; // Shortcut
20
20
 
21
21
  const MAX_MOBILE_WIDTH = 940;
22
22
 
@@ -101,7 +101,7 @@ async function getActiveStrategies() {
101
101
  return isActive ? strategyName : undefined;
102
102
  }),
103
103
  );
104
- return activeStrategies.filter(Boolean); // remove undefined values
104
+ return activeStrategies.filter(Boolean);
105
105
  }
106
106
 
107
107
  async function isOfflineModeEnabled() {
package/lib/sw.js CHANGED
@@ -18,7 +18,7 @@ function parseSwParams() {
18
18
  return params;
19
19
  }
20
20
 
21
- // doc advises against dynamic imports in SW
21
+ // Doc advises against dynamic imports in SW
22
22
  // https://developers.google.com/web/tools/workbox/guides/using-bundlers#code_splitting_and_dynamic_imports
23
23
  // https://twitter.com/sebastienlorber/status/1280155204575518720
24
24
  // but looks it's working fine as it's inlined by webpack, need to double check
@@ -73,7 +73,8 @@ function getPossibleURLs(url) {
73
73
  // eslint-disable-next-line no-underscore-dangle
74
74
  const precacheManifest = self.__WB_MANIFEST;
75
75
  const controller = new PrecacheController({
76
- fallbackToNetwork: true, // safer to turn this true?
76
+ // Safer to turn this true?
77
+ fallbackToNetwork: true,
77
78
  });
78
79
 
79
80
  if (params.offlineMode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-pwa",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Docusaurus Plugin to add PWA support.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-pwa.d.ts",
@@ -20,31 +20,31 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@babel/core": "^7.17.8",
24
- "@babel/preset-env": "^7.16.11",
25
- "@docusaurus/core": "2.0.0-beta.18",
26
- "@docusaurus/theme-common": "2.0.0-beta.18",
27
- "@docusaurus/theme-translations": "2.0.0-beta.18",
28
- "@docusaurus/utils": "2.0.0-beta.18",
29
- "@docusaurus/utils-validation": "2.0.0-beta.18",
30
- "babel-loader": "^8.2.4",
23
+ "@babel/core": "^7.17.10",
24
+ "@babel/preset-env": "^7.17.10",
25
+ "@docusaurus/core": "2.0.0-beta.19",
26
+ "@docusaurus/theme-common": "2.0.0-beta.19",
27
+ "@docusaurus/theme-translations": "2.0.0-beta.19",
28
+ "@docusaurus/utils": "2.0.0-beta.19",
29
+ "@docusaurus/utils-validation": "2.0.0-beta.19",
30
+ "babel-loader": "^8.2.5",
31
31
  "clsx": "^1.1.1",
32
- "core-js": "^3.21.1",
32
+ "core-js": "^3.22.3",
33
33
  "terser-webpack-plugin": "^5.3.1",
34
- "tslib": "^2.3.1",
35
- "webpack": "^5.70.0",
34
+ "tslib": "^2.4.0",
35
+ "webpack": "^5.72.0",
36
36
  "webpack-merge": "^5.8.0",
37
- "workbox-build": "^6.5.2",
38
- "workbox-precaching": "^6.5.2",
39
- "workbox-window": "^6.5.2"
37
+ "workbox-build": "^6.5.3",
38
+ "workbox-precaching": "^6.5.3",
39
+ "workbox-window": "^6.5.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "2.0.0-beta.18",
43
- "fs-extra": "^10.0.1"
42
+ "@docusaurus/module-type-aliases": "2.0.0-beta.19",
43
+ "fs-extra": "^10.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": "^16.8.4 || ^17.0.0",
47
47
  "react-dom": "^16.8.4 || ^17.0.0"
48
48
  },
49
- "gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
49
+ "gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
50
50
  }
package/src/index.ts CHANGED
@@ -150,7 +150,7 @@ export default function pluginPWA(
150
150
  optimization: {
151
151
  splitChunks: false,
152
152
  minimize: !debug,
153
- // see https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
153
+ // See https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
154
154
  minimizer: debug
155
155
  ? []
156
156
  : [
@@ -161,7 +161,8 @@ export default function pluginPWA(
161
161
  },
162
162
  plugins: [
163
163
  new webpack.EnvironmentPlugin({
164
- PWA_SW_CUSTOM: swCustom || '', // fallback value required with Webpack 5
164
+ // Fallback value required with Webpack 5
165
+ PWA_SW_CUSTOM: swCustom || '',
165
166
  }),
166
167
  new LogPlugin({
167
168
  name: 'Service Worker',
@@ -192,7 +193,7 @@ export default function pluginPWA(
192
193
  // @ts-expect-error: internal API?
193
194
  ...(injectManifest.globPatterns ?? []),
194
195
  ],
195
- // those attributes are not overrideable
196
+ // Those attributes are not overrideable
196
197
  swDest,
197
198
  swSrc: swDest,
198
199
  globDirectory: props.outDir,
@@ -66,7 +66,7 @@ declare module '@docusaurus/plugin-pwa' {
66
66
  tagName: string;
67
67
  href?: string;
68
68
  content?: string;
69
- [attributeName: string]: string | boolean;
69
+ [attributeName: string]: string | boolean | undefined;
70
70
  }[];
71
71
  /**
72
72
  * Useful for additional Workbox rules. You can do whatever a service worker
@@ -81,6 +81,8 @@ declare module '@docusaurus/plugin-pwa' {
81
81
  */
82
82
  swRegister: string | false;
83
83
  };
84
+
85
+ export type Options = Partial<PluginOptions>;
84
86
  }
85
87
 
86
88
  declare module '@theme/PwaReloadPopup' {
package/src/registerSw.js CHANGED
@@ -16,7 +16,7 @@ const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES =
16
16
  const PWA_DEBUG = process.env.PWA_DEBUG;
17
17
  /* eslint-enable prefer-destructuring */
18
18
 
19
- const debug = PWA_DEBUG; // shortcut
19
+ const debug = PWA_DEBUG; // Shortcut
20
20
 
21
21
  const MAX_MOBILE_WIDTH = 940;
22
22
 
@@ -101,7 +101,7 @@ async function getActiveStrategies() {
101
101
  return isActive ? strategyName : undefined;
102
102
  }),
103
103
  );
104
- return activeStrategies.filter(Boolean); // remove undefined values
104
+ return activeStrategies.filter(Boolean);
105
105
  }
106
106
 
107
107
  async function isOfflineModeEnabled() {
package/src/sw.js CHANGED
@@ -18,7 +18,7 @@ function parseSwParams() {
18
18
  return params;
19
19
  }
20
20
 
21
- // doc advises against dynamic imports in SW
21
+ // Doc advises against dynamic imports in SW
22
22
  // https://developers.google.com/web/tools/workbox/guides/using-bundlers#code_splitting_and_dynamic_imports
23
23
  // https://twitter.com/sebastienlorber/status/1280155204575518720
24
24
  // but looks it's working fine as it's inlined by webpack, need to double check
@@ -73,7 +73,8 @@ function getPossibleURLs(url) {
73
73
  // eslint-disable-next-line no-underscore-dangle
74
74
  const precacheManifest = self.__WB_MANIFEST;
75
75
  const controller = new PrecacheController({
76
- fallbackToNetwork: true, // safer to turn this true?
76
+ // Safer to turn this true?
77
+ fallbackToNetwork: true,
77
78
  });
78
79
 
79
80
  if (params.offlineMode) {