@rspack/plugin-react-refresh 2.0.2 → 2.0.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/client/refreshUtils.js +9 -3
- package/package.json +21 -20
package/client/refreshUtils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* global __webpack_require__ */
|
|
2
1
|
import {
|
|
3
2
|
getFamilyByType,
|
|
4
3
|
isLikelyComponentType,
|
|
@@ -77,6 +76,8 @@ function createDebounceUpdate() {
|
|
|
77
76
|
* @type {number | undefined}
|
|
78
77
|
*/
|
|
79
78
|
let refreshTimeout;
|
|
79
|
+
/** @type {Array<function(): void>} */
|
|
80
|
+
let callbacks = [];
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* Performs React Refresh on a delay.
|
|
@@ -84,15 +85,20 @@ function createDebounceUpdate() {
|
|
|
84
85
|
* @returns {void}
|
|
85
86
|
*/
|
|
86
87
|
const enqueueUpdate = (callback) => {
|
|
88
|
+
if (callback) {
|
|
89
|
+
callbacks.push(callback);
|
|
90
|
+
}
|
|
87
91
|
if (typeof refreshTimeout !== 'undefined') {
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
refreshTimeout = setTimeout(() => {
|
|
92
96
|
refreshTimeout = undefined;
|
|
97
|
+
const pendingCallbacks = callbacks;
|
|
98
|
+
callbacks = [];
|
|
93
99
|
performReactRefresh();
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
for (const pendingCallback of pendingCallbacks) {
|
|
101
|
+
pendingCallback();
|
|
96
102
|
}
|
|
97
103
|
}, 30);
|
|
98
104
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/plugin-react-refresh",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"repository":
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/rstackjs/rspack-plugin-react-refresh"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/rstackjs/rspack-plugin-react-refresh#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/rstackjs/rspack-plugin-react-refresh/issues"
|
|
11
|
+
},
|
|
5
12
|
"license": "MIT",
|
|
6
13
|
"description": "React refresh plugin for Rspack",
|
|
7
14
|
"type": "module",
|
|
@@ -19,19 +26,12 @@
|
|
|
19
26
|
"client",
|
|
20
27
|
"dist"
|
|
21
28
|
],
|
|
22
|
-
"simple-git-hooks": {
|
|
23
|
-
"pre-commit": "pnpm run lint:write"
|
|
24
|
-
},
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"prettier": "^3.8.3",
|
|
32
|
-
"react-refresh": "^0.18.0",
|
|
33
|
-
"simple-git-hooks": "^2.13.1",
|
|
34
|
-
"typescript": "^6.0.3"
|
|
30
|
+
"@rspack/core": "2.2.9",
|
|
31
|
+
"@types/node": "^24.19.2",
|
|
32
|
+
"react-refresh": "^0.19.0",
|
|
33
|
+
"rstack": "^0.8.3",
|
|
34
|
+
"typescript": "^7.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@rspack/core": "^2.0.0",
|
|
@@ -47,12 +47,13 @@
|
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
50
|
+
"build": "rs lib",
|
|
51
|
+
"bump": "pnpm version -m \"release: v%s\"",
|
|
52
|
+
"check": "rs check",
|
|
53
|
+
"dev": "rs lib -w",
|
|
54
|
+
"format": "rs fmt",
|
|
55
|
+
"lint": "rs lint",
|
|
55
56
|
"release": "node ./scripts/release.js",
|
|
56
|
-
"
|
|
57
|
+
"test": "rs test"
|
|
57
58
|
}
|
|
58
59
|
}
|