@rspack/plugin-react-refresh 1.0.3 → 1.1.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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Compiler } from '@rspack/core';
2
2
  import type { NormalizedPluginOptions, PluginOptions } from './options';
3
3
  export type { PluginOptions };
4
+ export declare const loader = "builtin:react-refresh-loader";
4
5
  declare class ReactRefreshRspackPlugin {
5
6
  options: NormalizedPluginOptions;
6
7
  static deprecated_runtimePaths: string[];
package/dist/index.js CHANGED
@@ -2,12 +2,14 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ exports.loader = void 0;
5
6
  const node_path_1 = __importDefault(require("node:path"));
6
7
  const options_1 = require("./options");
7
8
  const paths_1 = require("./paths");
8
9
  const getAdditionalEntries_1 = require("./utils/getAdditionalEntries");
9
10
  const getSocketIntegration_1 = require("./utils/getSocketIntegration");
10
11
  const getIntegrationEntry_1 = require("./utils/getIntegrationEntry");
12
+ exports.loader = 'builtin:react-refresh-loader';
11
13
  function addEntry(entry, compiler) {
12
14
  new compiler.webpack.EntryPlugin(compiler.context, entry, {
13
15
  name: undefined,
@@ -51,15 +53,17 @@ class ReactRefreshRspackPlugin {
51
53
  new compiler.webpack.ProvidePlugin({
52
54
  $ReactRefreshRuntime$: paths_1.reactRefreshPath,
53
55
  }).apply(compiler);
54
- compiler.options.module.rules.unshift({
55
- // biome-ignore lint: exists
56
- include: this.options.include,
57
- exclude: {
56
+ if (this.options.injectLoader) {
57
+ compiler.options.module.rules.unshift({
58
58
  // biome-ignore lint: exists
59
- or: [this.options.exclude, [...paths_1.runtimePaths]].filter(Boolean),
60
- },
61
- use: 'builtin:react-refresh-loader',
62
- });
59
+ include: this.options.include,
60
+ exclude: {
61
+ // biome-ignore lint: exists
62
+ or: [this.options.exclude, [...paths_1.runtimePaths]].filter(Boolean),
63
+ },
64
+ use: exports.loader,
65
+ });
66
+ }
63
67
  const definedModules = {
64
68
  // For Multiple Instance Mode
65
69
  __react_refresh_library__: JSON.stringify(compiler.webpack.Template.toIdentifier(this.options.library ||
package/dist/options.d.ts CHANGED
@@ -41,6 +41,11 @@ export type PluginOptions = {
41
41
  * @default false
42
42
  */
43
43
  overlay?: boolean | Partial<OverlayOptions>;
44
+ /**
45
+ * Whether to inject the builtin:react-refresh-loader
46
+ * @default true
47
+ */
48
+ injectLoader?: boolean;
44
49
  };
45
50
  export interface NormalizedPluginOptions extends Required<PluginOptions> {
46
51
  overlay: false | OverlayOptions;
package/dist/options.js CHANGED
@@ -32,6 +32,7 @@ function normalizeOptions(options) {
32
32
  d(options, 'include', /\.([cm]js|[jt]sx?|flow)$/i);
33
33
  d(options, 'library');
34
34
  d(options, 'forceEnable', false);
35
+ d(options, 'injectLoader', true);
35
36
  options.overlay = normalizeOverlay(options.overlay);
36
37
  return options;
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/plugin-react-refresh",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "repository": "https://github.com/rspack-contrib/rspack-plugin-react-refresh",
5
5
  "license": "MIT",
6
6
  "description": "React refresh plugin for rspack",
@@ -29,27 +29,27 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@biomejs/biome": "^1.9.4",
32
- "@rspack/core": "1.1.4",
32
+ "@rspack/core": "1.3.1",
33
33
  "@types/jest": "29.5.14",
34
- "@types/node": "^22.10.1",
34
+ "@types/node": "^22.13.17",
35
35
  "cross-env": "^7.0.3",
36
- "execa": "9.5.1",
37
- "fs-extra": "11.2.0",
36
+ "execa": "9.5.2",
37
+ "fs-extra": "11.3.0",
38
38
  "jest": "29.7.0",
39
39
  "jest-cli": "29.7.0",
40
40
  "jest-environment-node": "29.7.0",
41
41
  "nano-staged": "^0.8.0",
42
- "react-refresh": "^0.14.2",
43
- "semver": "7.6.3",
44
- "simple-git-hooks": "^2.11.1",
45
- "ts-jest": "29.2.5",
42
+ "react-refresh": "^0.17.0",
43
+ "semver": "7.7.1",
44
+ "simple-git-hooks": "^2.12.1",
45
+ "ts-jest": "29.3.1",
46
46
  "ts-node": "^10.9.2",
47
- "typescript": "5.7.2",
47
+ "typescript": "5.8.2",
48
48
  "@continuous-auth/client": "2.3.2"
49
49
  },
50
50
  "dependencies": {
51
51
  "error-stack-parser": "^2.1.4",
52
- "html-entities": "^2.5.2"
52
+ "html-entities": "^2.6.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react-refresh": ">=0.10.0 <1.0.0",