@rspack/plugin-react-refresh 1.4.1 → 1.4.2

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
@@ -108,7 +108,7 @@ Compared to the previous approach, this method decouples the React Fast Refresh
108
108
  - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
109
109
  - Default: `/\.([cm]js|[jt]sx?|flow)$/i`
110
110
 
111
- Include files to be processed by the plugin. The value is the same as the `rule.test` option in Rspack.
111
+ 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
112
 
113
113
  ```js
114
114
  new ReactRefreshPlugin({
@@ -121,7 +121,7 @@ new ReactRefreshPlugin({
121
121
  - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
122
122
  - Default: `/node_modules/`
123
123
 
124
- Exclude files from being processed by the plugin. The value is the same as the `rule.exclude` option in Rspack.
124
+ 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
125
 
126
126
  ```js
127
127
  new ReactRefreshPlugin({
@@ -129,6 +129,21 @@ new ReactRefreshPlugin({
129
129
  });
130
130
  ```
131
131
 
132
+ ### resourceQuery
133
+
134
+ - Type: [Rspack.RuleSetCondition](https://rspack.dev/config/module#condition)
135
+ - Default: `undefined`
136
+
137
+ 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.
138
+
139
+ For example, to exclude all resources with the `raw` query, such as `import rawTs from './ReactComponent.ts?raw';`, use the following:
140
+
141
+ ```js
142
+ new ReactRefreshPlugin({
143
+ resourceQuery: { not: /raw/ },
144
+ });
145
+ ```
146
+
132
147
  ### forceEnable
133
148
 
134
149
  - 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/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.2",
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",