@parcel/transformer-react-refresh-wrap 2.0.0 → 2.2.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.
|
@@ -28,7 +28,7 @@ function _plugin() {
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
30
|
function shouldExclude(asset, options) {
|
|
31
|
-
return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isWorker() || asset.env.isWorklet() || options.mode !== 'development' || !asset.getDependencies().find(v => v.specifier === 'react' || v.specifier === 'react/jsx-runtime');
|
|
31
|
+
return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isWorker() || asset.env.isWorklet() || options.mode !== 'development' || !asset.getDependencies().find(v => v.specifier === 'react' || v.specifier === 'react/jsx-runtime' || v.specifier === 'react/jsx-dev-runtime');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var _default = new (_plugin().Transformer)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-react-refresh-wrap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"source": "src/ReactRefreshWrapTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "^2.
|
|
20
|
+
"parcel": "^2.2.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/plugin": "^2.
|
|
24
|
-
"@parcel/utils": "^2.
|
|
23
|
+
"@parcel/plugin": "^2.2.0",
|
|
24
|
+
"@parcel/utils": "^2.2.0",
|
|
25
25
|
"react-refresh": "^0.9.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4745cd3023f8d5a5adcf9e565d5b82d1418dc262"
|
|
28
28
|
}
|
|
@@ -13,7 +13,12 @@ function shouldExclude(asset, options) {
|
|
|
13
13
|
options.mode !== 'development' ||
|
|
14
14
|
!asset
|
|
15
15
|
.getDependencies()
|
|
16
|
-
.find(
|
|
16
|
+
.find(
|
|
17
|
+
v =>
|
|
18
|
+
v.specifier === 'react' ||
|
|
19
|
+
v.specifier === 'react/jsx-runtime' ||
|
|
20
|
+
v.specifier === 'react/jsx-dev-runtime',
|
|
21
|
+
)
|
|
17
22
|
);
|
|
18
23
|
}
|
|
19
24
|
|
package/src/helpers/helpers.js
CHANGED
|
@@ -2,21 +2,21 @@ var Refresh = require('react-refresh/runtime');
|
|
|
2
2
|
|
|
3
3
|
function debounce(func, delay) {
|
|
4
4
|
if (process.env.NODE_ENV === 'test') {
|
|
5
|
-
return function(args) {
|
|
5
|
+
return function (args) {
|
|
6
6
|
func.call(null, args);
|
|
7
7
|
};
|
|
8
8
|
} else {
|
|
9
9
|
var timeout = undefined;
|
|
10
|
-
return function(args) {
|
|
10
|
+
return function (args) {
|
|
11
11
|
clearTimeout(timeout);
|
|
12
|
-
timeout = setTimeout(function() {
|
|
12
|
+
timeout = setTimeout(function () {
|
|
13
13
|
timeout = undefined;
|
|
14
14
|
func.call(null, args);
|
|
15
15
|
}, delay);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
var enqueueUpdate = debounce(function() {
|
|
19
|
+
var enqueueUpdate = debounce(function () {
|
|
20
20
|
Refresh.performReactRefresh();
|
|
21
21
|
}, 30);
|
|
22
22
|
|
|
@@ -24,19 +24,19 @@ var enqueueUpdate = debounce(function() {
|
|
|
24
24
|
// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js
|
|
25
25
|
// MIT License - Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
26
|
|
|
27
|
-
module.exports.prelude = function(module) {
|
|
28
|
-
window.$RefreshReg$ = function(type, id) {
|
|
27
|
+
module.exports.prelude = function (module) {
|
|
28
|
+
window.$RefreshReg$ = function (type, id) {
|
|
29
29
|
Refresh.register(type, module.id + ' ' + id);
|
|
30
30
|
};
|
|
31
31
|
window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
module.exports.postlude = function(module) {
|
|
34
|
+
module.exports.postlude = function (module) {
|
|
35
35
|
if (isReactRefreshBoundary(module.exports)) {
|
|
36
36
|
registerExportsForReactRefresh(module);
|
|
37
37
|
|
|
38
38
|
if (module.hot) {
|
|
39
|
-
module.hot.dispose(function(data) {
|
|
39
|
+
module.hot.dispose(function (data) {
|
|
40
40
|
if (Refresh.hasUnrecoverableErrors()) {
|
|
41
41
|
window.location.reload();
|
|
42
42
|
}
|
|
@@ -44,7 +44,7 @@ module.exports.postlude = function(module) {
|
|
|
44
44
|
data.prevExports = module.exports;
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
module.hot.accept(function(getParents) {
|
|
47
|
+
module.hot.accept(function (getParents) {
|
|
48
48
|
var prevExports = module.hot.data.prevExports;
|
|
49
49
|
var nextExports = module.exports;
|
|
50
50
|
// Since we just executed the code for it, it's possible
|