@docusaurus/plugin-pwa 3.3.2 → 3.4.0

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
@@ -14,8 +14,10 @@ const webpackbar_1 = tslib_1.__importDefault(require("webpackbar"));
14
14
  const terser_webpack_plugin_1 = tslib_1.__importDefault(require("terser-webpack-plugin"));
15
15
  const workbox_build_1 = require("workbox-build");
16
16
  const utils_1 = require("@docusaurus/utils");
17
+ const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
17
18
  const utils_2 = require("@docusaurus/core/lib/webpack/utils");
18
19
  const theme_translations_1 = require("@docusaurus/theme-translations");
20
+ const PluginName = 'docusaurus-plugin-pwa';
19
21
  const isProd = process.env.NODE_ENV === 'production';
20
22
  function getSWBabelLoader() {
21
23
  return {
@@ -38,10 +40,14 @@ function getSWBabelLoader() {
38
40
  };
39
41
  }
40
42
  function pluginPWA(context, options) {
41
- const { outDir, baseUrl, i18n: { currentLocale }, } = context;
43
+ const { outDir, baseUrl, i18n: { currentLocale }, siteConfig, } = context;
42
44
  const { debug, offlineModeActivationStrategies, injectManifestConfig, pwaHead, swCustom, swRegister, } = options;
45
+ if (siteConfig.future.experimental_router === 'hash') {
46
+ logger_1.default.warn(`${PluginName} does not support the Hash Router and will be disabled.`);
47
+ return { name: PluginName };
48
+ }
43
49
  return {
44
- name: 'docusaurus-plugin-pwa',
50
+ name: PluginName,
45
51
  getThemePath() {
46
52
  return '../lib/theme';
47
53
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-pwa",
3
- "version": "3.3.2",
3
+ "version": "3.4.0",
4
4
  "description": "Docusaurus Plugin to add PWA support.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-pwa.d.ts",
@@ -22,12 +22,13 @@
22
22
  "dependencies": {
23
23
  "@babel/core": "^7.23.3",
24
24
  "@babel/preset-env": "^7.23.3",
25
- "@docusaurus/core": "3.3.2",
26
- "@docusaurus/theme-common": "3.3.2",
27
- "@docusaurus/theme-translations": "3.3.2",
28
- "@docusaurus/types": "3.3.2",
29
- "@docusaurus/utils": "3.3.2",
30
- "@docusaurus/utils-validation": "3.3.2",
25
+ "@docusaurus/core": "3.4.0",
26
+ "@docusaurus/logger": "3.4.0",
27
+ "@docusaurus/theme-common": "3.4.0",
28
+ "@docusaurus/theme-translations": "3.4.0",
29
+ "@docusaurus/types": "3.4.0",
30
+ "@docusaurus/utils": "3.4.0",
31
+ "@docusaurus/utils-validation": "3.4.0",
31
32
  "babel-loader": "^9.1.3",
32
33
  "clsx": "^2.0.0",
33
34
  "core-js": "^3.31.1",
@@ -41,7 +42,7 @@
41
42
  "workbox-window": "^7.0.0"
42
43
  },
43
44
  "devDependencies": {
44
- "@docusaurus/module-type-aliases": "3.3.2",
45
+ "@docusaurus/module-type-aliases": "3.4.0",
45
46
  "fs-extra": "^11.1.0"
46
47
  },
47
48
  "peerDependencies": {
@@ -51,5 +52,5 @@
51
52
  "engines": {
52
53
  "node": ">=18.0"
53
54
  },
54
- "gitHead": "bc638d674bfbde1e254ef306697f47e764b5e107"
55
+ "gitHead": "49e9a2143274a8dd795659b417b470bc42abbd6e"
55
56
  }
package/src/index.ts CHANGED
@@ -11,11 +11,14 @@ import WebpackBar from 'webpackbar';
11
11
  import Terser from 'terser-webpack-plugin';
12
12
  import {injectManifest} from 'workbox-build';
13
13
  import {normalizeUrl} from '@docusaurus/utils';
14
+ import logger from '@docusaurus/logger';
14
15
  import {compile} from '@docusaurus/core/lib/webpack/utils';
15
16
  import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
16
17
  import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types';
17
18
  import type {PluginOptions} from '@docusaurus/plugin-pwa';
18
19
 
20
+ const PluginName = 'docusaurus-plugin-pwa';
21
+
19
22
  const isProd = process.env.NODE_ENV === 'production';
20
23
 
21
24
  function getSWBabelLoader() {
@@ -47,6 +50,7 @@ export default function pluginPWA(
47
50
  outDir,
48
51
  baseUrl,
49
52
  i18n: {currentLocale},
53
+ siteConfig,
50
54
  } = context;
51
55
  const {
52
56
  debug,
@@ -57,8 +61,15 @@ export default function pluginPWA(
57
61
  swRegister,
58
62
  } = options;
59
63
 
64
+ if (siteConfig.future.experimental_router === 'hash') {
65
+ logger.warn(
66
+ `${PluginName} does not support the Hash Router and will be disabled.`,
67
+ );
68
+ return {name: PluginName};
69
+ }
70
+
60
71
  return {
61
- name: 'docusaurus-plugin-pwa',
72
+ name: PluginName,
62
73
 
63
74
  getThemePath() {
64
75
  return '../lib/theme';