@docusaurus/plugin-pwa 4.0.0-canary-6907 → 4.0.0-canary-6909

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.
Files changed (3) hide show
  1. package/lib/index.js +5 -19
  2. package/package.json +11 -14
  3. package/src/index.ts +7 -20
package/lib/index.js CHANGED
@@ -16,24 +16,6 @@ const utils_1 = require("@docusaurus/utils");
16
16
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
17
17
  const theme_translations_1 = require("@docusaurus/theme-translations");
18
18
  const PluginName = 'docusaurus-plugin-pwa';
19
- function getSWBabelLoader() {
20
- return {
21
- loader: require.resolve('babel-loader'),
22
- options: {
23
- babelrc: false,
24
- configFile: false,
25
- presets: [
26
- [
27
- require.resolve('@babel/preset-env'),
28
- {
29
- // See https://x.com/jeffposnick/status/1280223070876315649
30
- targets: 'chrome >= 56',
31
- },
32
- ],
33
- ],
34
- },
35
- };
36
- }
37
19
  function pluginPWA(context, options) {
38
20
  if (process.env.NODE_ENV !== 'production') {
39
21
  return null;
@@ -97,6 +79,10 @@ function pluginPWA(context, options) {
97
79
  const ProgressBarPlugin = await (0, bundler_1.getProgressBarPlugin)({
98
80
  currentBundler: props.currentBundler,
99
81
  });
82
+ // Rspack: builtin:swc-loader, Webpack (deprecated): babel-loader
83
+ const getJSLoader = await (0, bundler_1.createJsLoaderFactory)({
84
+ siteConfig: props.siteConfig,
85
+ });
100
86
  const swWebpackConfig = {
101
87
  entry: require.resolve('./sw.js'),
102
88
  output: {
@@ -132,7 +118,7 @@ function pluginPWA(context, options) {
132
118
  {
133
119
  test: swSourceFileTest,
134
120
  exclude: /node_modules/,
135
- use: getSWBabelLoader(),
121
+ use: getJSLoader({ isServer: false }),
136
122
  },
137
123
  ],
138
124
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-pwa",
3
- "version": "4.0.0-canary-6907",
3
+ "version": "4.0.0-canary-6909",
4
4
  "description": "Docusaurus Plugin to add PWA support.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-pwa.d.ts",
@@ -20,17 +20,14 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@babel/core": "^7.29.7",
24
- "@babel/preset-env": "^7.29.7",
25
- "@docusaurus/bundler": "4.0.0-canary-6907",
26
- "@docusaurus/core": "4.0.0-canary-6907",
27
- "@docusaurus/logger": "4.0.0-canary-6907",
28
- "@docusaurus/theme-common": "4.0.0-canary-6907",
29
- "@docusaurus/theme-translations": "4.0.0-canary-6907",
30
- "@docusaurus/types": "4.0.0-canary-6907",
31
- "@docusaurus/utils": "4.0.0-canary-6907",
32
- "@docusaurus/utils-validation": "4.0.0-canary-6907",
33
- "babel-loader": "^10.1.1",
23
+ "@docusaurus/bundler": "4.0.0-canary-6909",
24
+ "@docusaurus/core": "4.0.0-canary-6909",
25
+ "@docusaurus/logger": "4.0.0-canary-6909",
26
+ "@docusaurus/theme-common": "4.0.0-canary-6909",
27
+ "@docusaurus/theme-translations": "4.0.0-canary-6909",
28
+ "@docusaurus/types": "4.0.0-canary-6909",
29
+ "@docusaurus/utils": "4.0.0-canary-6909",
30
+ "@docusaurus/utils-validation": "4.0.0-canary-6909",
34
31
  "clsx": "^2.1.1",
35
32
  "tslib": "^2.8.1",
36
33
  "webpack": "^5.111.0",
@@ -39,7 +36,7 @@
39
36
  "workbox-window": "^7.4.1"
40
37
  },
41
38
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "4.0.0-canary-6907",
39
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6909",
43
40
  "@types/react-dom": "^19.3.0"
44
41
  },
45
42
  "peerDependencies": {
@@ -49,5 +46,5 @@
49
46
  "engines": {
50
47
  "node": ">=24.21"
51
48
  },
52
- "gitHead": "cef1eb4729aa96d4153a6079ef160d74fe1db32a"
49
+ "gitHead": "5e2a504d84cc304af27b526febd9f9bdb997b290"
53
50
  }
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import path from 'node:path';
9
9
  import {type Configuration} from 'webpack';
10
10
  import {
11
11
  compile,
12
+ createJsLoaderFactory,
12
13
  getProgressBarPlugin,
13
14
  getMinimizers,
14
15
  } from '@docusaurus/bundler';
@@ -21,25 +22,6 @@ import type {PluginOptions} from '@docusaurus/plugin-pwa';
21
22
 
22
23
  const PluginName = 'docusaurus-plugin-pwa';
23
24
 
24
- function getSWBabelLoader() {
25
- return {
26
- loader: require.resolve('babel-loader'),
27
- options: {
28
- babelrc: false,
29
- configFile: false,
30
- presets: [
31
- [
32
- require.resolve('@babel/preset-env'),
33
- {
34
- // See https://x.com/jeffposnick/status/1280223070876315649
35
- targets: 'chrome >= 56',
36
- },
37
- ],
38
- ],
39
- },
40
- };
41
- }
42
-
43
25
  export default function pluginPWA(
44
26
  context: LoadContext,
45
27
  options: PluginOptions,
@@ -138,6 +120,11 @@ export default function pluginPWA(
138
120
  currentBundler: props.currentBundler,
139
121
  });
140
122
 
123
+ // Rspack: builtin:swc-loader, Webpack (deprecated): babel-loader
124
+ const getJSLoader = await createJsLoaderFactory({
125
+ siteConfig: props.siteConfig,
126
+ });
127
+
141
128
  const swWebpackConfig: Configuration = {
142
129
  entry: require.resolve('./sw.js'),
143
130
  output: {
@@ -173,7 +160,7 @@ export default function pluginPWA(
173
160
  {
174
161
  test: swSourceFileTest,
175
162
  exclude: /node_modules/,
176
- use: getSWBabelLoader(),
163
+ use: getJSLoader({isServer: false}),
177
164
  },
178
165
  ],
179
166
  },