@rspack/plugin-react-refresh 1.5.2 → 1.5.3

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.
@@ -1,13 +1,4 @@
1
1
  /* global __react_refresh_error_overlay__, __react_refresh_socket__, __resourceQuery */
2
- /**
3
- * The following code is modified based on
4
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f1c8b9a44198449093ca95f85af5df97925e1cfc/client/ErrorOverlayEntry.js
5
- *
6
- * MIT Licensed
7
- * Author Michael Mok
8
- * Copyright (c) 2019 Michael Mok
9
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/LICENSE
10
- */
11
2
  const events = require('./utils/errorEventHandlers.js');
12
3
  const formatWebpackErrors = require('./utils/formatWebpackErrors.js');
13
4
  const runWithRetry = require('./utils/retry.js');
@@ -1,12 +1,3 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f1c8b9a44198449093ca95f85af5df97925e1cfc/overlay/index.js
4
- *
5
- * MIT Licensed
6
- * Author Michael Mok
7
- * Copyright (c) 2019 Michael Mok
8
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/LICENSE
9
- */
10
1
  const RuntimeErrorFooter = require('./components/RuntimeErrorFooter.js');
11
2
  const RuntimeErrorHeader = require('./components/RuntimeErrorHeader.js');
12
3
  const CompileErrorContainer = require('./containers/CompileErrorContainer.js');
@@ -1,8 +1,6 @@
1
- // Thanks https://github.com/pmmmwh/react-refresh-webpack-plugin
2
1
  const RefreshUtils = require('./refreshUtils');
3
2
  const RefreshRuntime = require('react-refresh/runtime');
4
3
 
5
- // Port from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/loader/utils/getRefreshModuleRuntime.js#L29
6
4
  function refresh(moduleId, webpackHot) {
7
5
  const currentExports = RefreshUtils.getModuleExports(moduleId);
8
6
  const fn = (exports) => {
@@ -1,13 +1,3 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/client/ReactRefreshEntry.js
4
- *
5
- * MIT Licensed
6
- * Author Michael Mok
7
- * Copyright (c) 2019 Michael Mok
8
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/LICENSE
9
- */
10
-
11
1
  var RefreshRuntime = require('react-refresh/runtime');
12
2
  var safeThis = (function () {
13
3
  // copied from core-js-pure/features/global-this
@@ -1,13 +1,3 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/lib/runtime/RefreshUtils.js
4
- *
5
- * MIT Licensed
6
- * Author Michael Mok
7
- * Copyright (c) 2019 Michael Mok
8
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/LICENSE
9
- */
10
-
11
1
  /* global __webpack_require__ */
12
2
  var Refresh = require('react-refresh/runtime');
13
3
 
@@ -1,15 +1,8 @@
1
1
  /* eslint-disable */
2
2
  // @ts-nocheck
3
3
  /**
4
- * The following code is modified based on
5
- * https://github.com/mahdyar/ansi-html-community/blob/b86cc3f1fa1d118477877352f0eafe1a70fd20ab/index.js
6
- *
7
- * Supported:
8
- * - added support for 24-bit RGB colors.
9
- *
10
- * Apache 2.0 Licensed
11
- * Author @Tjatse
12
- * https://github.com/mahdyar/ansi-html-community/blob/master/LICENSE
4
+ * The following code is modified based on mahdyar/ansi-html-community
5
+ * Added support for 24-bit RGB colors.
13
6
  */
14
7
  'use strict';
15
8
 
package/dist/index.js CHANGED
@@ -167,7 +167,7 @@ function getSocketIntegration(integrationType) {
167
167
  return resolvedSocketIntegration;
168
168
  }
169
169
  function addEntry(entry, compiler) {
170
- new compiler.webpack.EntryPlugin(compiler.context, entry, {
170
+ new compiler.rspack.EntryPlugin(compiler.context, entry, {
171
171
  name: void 0
172
172
  }).apply(compiler);
173
173
  }
@@ -194,7 +194,7 @@ class ReactRefreshRspackPlugin {
194
194
  if (this.options.injectEntry) for (const entry of addEntries.prependEntries)addEntry(entry, compiler);
195
195
  if (false !== this.options.overlay && this.options.overlay.sockIntegration) addSocketEntry(this.options.overlay.sockIntegration, compiler);
196
196
  for (const entry of addEntries.overlayEntries)addEntry(entry, compiler);
197
- new compiler.webpack.ProvidePlugin({
197
+ new compiler.rspack.ProvidePlugin({
198
198
  $ReactRefreshRuntime$: reactRefreshPath
199
199
  }).apply(compiler);
200
200
  if (this.options.injectLoader) compiler.options.module.rules.unshift({
@@ -217,7 +217,7 @@ class ReactRefreshRspackPlugin {
217
217
  use: ReactRefreshRspackPlugin.loader
218
218
  });
219
219
  const definedModules = {
220
- __react_refresh_library__: JSON.stringify(compiler.webpack.Template.toIdentifier(this.options.library || compiler.options.output.uniqueName || compiler.options.output.library)),
220
+ __react_refresh_library__: JSON.stringify(compiler.rspack.Template.toIdentifier(this.options.library || compiler.options.output.uniqueName || compiler.options.output.library)),
221
221
  __reload_on_runtime_errors__: this.options.reloadOnRuntimeErrors
222
222
  };
223
223
  const providedModules = {
@@ -230,8 +230,8 @@ class ReactRefreshRspackPlugin {
230
230
  if (this.options.overlay.module) providedModules.__react_refresh_error_overlay__ = require.resolve(this.options.overlay.module);
231
231
  if (this.options.overlay.sockIntegration) providedModules.__react_refresh_socket__ = getSocketIntegration(this.options.overlay.sockIntegration);
232
232
  }
233
- new compiler.webpack.DefinePlugin(definedModules).apply(compiler);
234
- new compiler.webpack.ProvidePlugin(providedModules).apply(compiler);
233
+ new compiler.rspack.DefinePlugin(definedModules).apply(compiler);
234
+ new compiler.rspack.ProvidePlugin(providedModules).apply(compiler);
235
235
  compiler.options.resolve.alias = {
236
236
  'react-refresh': getRefreshRuntimeDirPath(),
237
237
  ...compiler.options.resolve.alias
@@ -1,15 +1,5 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f770d3962c388da01eeda7079bff5f40c93992d2/sockets/WHMEventSource.js
4
- *
5
- * MIT Licensed
6
- * Author Michael Mok
7
- * Copyright (c) 2019 Michael Mok
8
- * https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f770d3962c388da01eeda7079bff5f40c93992d2/LICENSE
9
- */
10
1
  /**
11
2
  * The hard-coded singleton key for webpack-hot-middleware's client instance.
12
- *
13
3
  * [Ref](https://github.com/webpack-contrib/webpack-hot-middleware/blob/cb29abb9dde435a1ac8e9b19f82d7d36b1093198/client.js#L152)
14
4
  */
15
5
  declare const singletonKey = "__webpack_hot_middleware_reporter__";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/plugin-react-refresh",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "repository": "https://github.com/rspack-contrib/rspack-plugin-react-refresh",
5
5
  "license": "MIT",
6
6
  "description": "React refresh plugin for Rspack",
@@ -32,25 +32,21 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@biomejs/biome": "^1.9.4",
35
- "@rslib/core": "^0.15.1",
36
- "@rspack/core": "^1.5.8",
37
- "@types/jest": "29.5.14",
38
- "@types/node": "^22.17.0",
39
- "bumpp": "^10.2.3",
35
+ "@rslib/core": "^0.17.0",
36
+ "@rspack/core": "^1.6.0",
37
+ "@rstest/core": "^0.6.1",
38
+ "@types/node": "^22.18.13",
39
+ "bumpp": "^10.3.1",
40
40
  "cac": "^6.7.14",
41
- "cross-env": "^10.0.0",
41
+ "cross-env": "^10.1.0",
42
42
  "execa": "9.6.0",
43
- "fs-extra": "11.3.0",
44
- "jest": "29.7.0",
45
- "jest-cli": "29.7.0",
46
- "jest-environment-node": "29.7.0",
43
+ "fs-extra": "11.3.2",
47
44
  "nano-staged": "^0.8.0",
48
- "react-refresh": "^0.17.0",
49
- "semver": "7.7.2",
45
+ "react-refresh": "^0.18.0",
46
+ "semver": "7.7.3",
50
47
  "simple-git-hooks": "^2.13.1",
51
- "ts-jest": "29.4.0",
52
48
  "ts-node": "^10.9.2",
53
- "typescript": "5.9.2"
49
+ "typescript": "5.9.3"
54
50
  },
55
51
  "dependencies": {
56
52
  "error-stack-parser": "^2.1.4",
@@ -74,7 +70,7 @@
74
70
  "dev": "rslib build -w",
75
71
  "lint": "biome check .",
76
72
  "lint:write": "biome check . --write",
77
- "test": "jest --colors",
73
+ "test": "rstest",
78
74
  "release": "node ./scripts/release.mjs",
79
75
  "bump": "npx bumpp --no-push --no-tag --no-commit"
80
76
  }