@rspack/plugin-react-refresh 1.4.1 → 1.4.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.
package/README.md CHANGED
@@ -37,8 +37,6 @@ Import the plugin in your code:
37
37
  // Named import (recommended)
38
38
  import { ReactRefreshRspackPlugin } from "@rspack/plugin-react-refresh";
39
39
 
40
- // Default import
41
- import ReactRefreshRspackPlugin from "@rspack/plugin-react-refresh";
42
40
  ```
43
41
 
44
42
  - CommonJS:
@@ -108,7 +106,7 @@ Compared to the previous approach, this method decouples the React Fast Refresh
108
106
  - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
109
107
  - Default: `/\.([cm]js|[jt]sx?|flow)$/i`
110
108
 
111
- Include files to be processed by the plugin. The value is the same as the `rule.test` option in Rspack.
109
+ Include files to be processed by the plugin. The value is the same as the [rule.test](https://rspack.dev/config/module#ruletest) option in Rspack.
112
110
 
113
111
  ```js
114
112
  new ReactRefreshPlugin({
@@ -121,7 +119,7 @@ new ReactRefreshPlugin({
121
119
  - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
122
120
  - Default: `/node_modules/`
123
121
 
124
- Exclude files from being processed by the plugin. The value is the same as the `rule.exclude` option in Rspack.
122
+ Exclude files from being processed by the plugin. The value is the same as the [rule.exclude](https://rspack.dev/config/module#ruleexclude) option in Rspack.
125
123
 
126
124
  ```js
127
125
  new ReactRefreshPlugin({
@@ -129,6 +127,21 @@ new ReactRefreshPlugin({
129
127
  });
130
128
  ```
131
129
 
130
+ ### resourceQuery
131
+
132
+ - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
133
+ - Default: `undefined`
134
+
135
+ Can be used to exclude certain resources from being processed by the plugin by the resource query. The value is the same as the [rule.resourceQuery](https://rspack.dev/config/module#ruleresourcequery) option in Rspack.
136
+
137
+ For example, to exclude all resources with the `raw` query, such as `import rawTs from './ReactComponent.ts?raw';`, use the following:
138
+
139
+ ```js
140
+ new ReactRefreshPlugin({
141
+ resourceQuery: { not: /raw/ },
142
+ });
143
+ ```
144
+
132
145
  ### forceEnable
133
146
 
134
147
  - Type: `boolean`
package/dist/index.js CHANGED
@@ -64,6 +64,7 @@ class ReactRefreshRspackPlugin {
64
64
  // biome-ignore lint: exists
65
65
  or: [this.options.exclude, [...paths_1.runtimePaths]].filter(Boolean),
66
66
  },
67
+ resourceQuery: this.options.resourceQuery,
67
68
  use: ReactRefreshRspackPlugin.loader,
68
69
  });
69
70
  }
package/dist/options.d.ts CHANGED
@@ -14,14 +14,29 @@ export type PluginOptions = {
14
14
  * Include files to be processed by the plugin.
15
15
  * The value is the same as the `rule.test` option in Rspack.
16
16
  * @default /\.([cm]js|[jt]sx?|flow)$/i
17
+ * @see https://rspack.dev/config/module#ruletest
17
18
  */
18
19
  include?: RuleSetCondition | null;
19
20
  /**
20
21
  * Exclude files from being processed by the plugin.
21
22
  * The value is the same as the `rule.exclude` option in Rspack.
22
23
  * @default /node_modules/
24
+ * @see https://rspack.dev/config/module#ruleexclude
23
25
  */
24
26
  exclude?: RuleSetCondition | null;
27
+ /**
28
+ * Can be used to exclude certain resources from being processed by
29
+ * the plugin by the resource query.
30
+ * @see https://rspack.dev/config/module#ruleresourcequery
31
+ *
32
+ * @example
33
+ * To exclude all resources with the `raw` query, such as
34
+ * `import rawTs from './ReactComponent.ts?raw';`, use the following:
35
+ * ```ts
36
+ * { resourceQuery: { not: /raw/ } }
37
+ * ```
38
+ */
39
+ resourceQuery?: RuleSetCondition;
25
40
  /**
26
41
  * Sets a namespace for the React Refresh runtime.
27
42
  * It is most useful when multiple instances of React Refresh is running
package/exports/index.cjs CHANGED
@@ -1,4 +1,7 @@
1
1
  // CommonJS wrapper
2
2
  const { ReactRefreshRspackPlugin } = require('../dist/index.js');
3
3
 
4
+ // default export will be deprecated in next major version
4
5
  module.exports = ReactRefreshRspackPlugin;
6
+
7
+ module.exports.ReactRefreshRspackPlugin = ReactRefreshRspackPlugin;
package/exports/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // ES modules wrapper
2
2
  import { ReactRefreshRspackPlugin } from '../dist/index.js';
3
-
3
+ // default export will be deprecated in next major version
4
4
  export default ReactRefreshRspackPlugin;
5
5
  export { ReactRefreshRspackPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/plugin-react-refresh",
3
- "version": "1.4.1",
3
+ "version": "1.4.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",
@@ -33,10 +33,10 @@
33
33
  "devDependencies": {
34
34
  "@biomejs/biome": "^1.9.4",
35
35
  "@continuous-auth/client": "2.3.2",
36
- "@rslib/core": "^0.6.7",
37
- "@rspack/core": "1.3.1",
36
+ "@rslib/core": "^0.6.8",
37
+ "@rspack/core": "1.3.8",
38
38
  "@types/jest": "29.5.14",
39
- "@types/node": "^22.13.17",
39
+ "@types/node": "^22.15.3",
40
40
  "cross-env": "^7.0.3",
41
41
  "execa": "9.5.2",
42
42
  "fs-extra": "11.3.0",
@@ -46,10 +46,10 @@
46
46
  "nano-staged": "^0.8.0",
47
47
  "react-refresh": "^0.17.0",
48
48
  "semver": "7.7.1",
49
- "simple-git-hooks": "^2.12.1",
50
- "ts-jest": "29.3.1",
49
+ "simple-git-hooks": "^2.13.0",
50
+ "ts-jest": "29.3.2",
51
51
  "ts-node": "^10.9.2",
52
- "typescript": "5.8.2"
52
+ "typescript": "5.8.3"
53
53
  },
54
54
  "dependencies": {
55
55
  "error-stack-parser": "^2.1.4",