@parcel/transformer-react-refresh-wrap 2.11.0 → 2.13.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.
|
@@ -18,7 +18,7 @@ function _plugin() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _interopRequireDefault(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
function shouldExclude(asset, options) {
|
|
23
23
|
return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isLibrary || 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' || v.specifier === '@emotion/react' || v.specifier === '@emotion/react/jsx-runtime' || v.specifier === '@emotion/react/jsx-dev-runtime');
|
|
24
24
|
}
|
package/lib/helpers/helpers.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var Refresh = require('react-refresh/runtime');
|
|
4
|
+
var {
|
|
5
|
+
version
|
|
6
|
+
} = require('react-refresh/package.json');
|
|
4
7
|
function debounce(func, delay) {
|
|
5
8
|
if (process.env.NODE_ENV === 'test') {
|
|
6
9
|
return function (args) {
|
|
@@ -33,12 +36,17 @@ var enqueueUpdate = debounce(function () {
|
|
|
33
36
|
Refresh.performReactRefresh();
|
|
34
37
|
}, 30);
|
|
35
38
|
|
|
36
|
-
//
|
|
39
|
+
// Everything below is either adapted or copied from
|
|
37
40
|
// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js
|
|
38
41
|
// MIT License - Copyright (c) Facebook, Inc. and its affiliates.
|
|
39
42
|
|
|
40
43
|
module.exports.prelude = function (module) {
|
|
44
|
+
window.__REACT_REFRESH_VERSION_TRANSFORMER = version;
|
|
41
45
|
window.$RefreshReg$ = function (type, id) {
|
|
46
|
+
if (window.__REACT_REFRESH_VERSION_TRANSFORMER && window.__REACT_REFRESH_VERSION_RUNTIME && window.__REACT_REFRESH_VERSION_TRANSFORMER !== window.__REACT_REFRESH_VERSION_RUNTIME) {
|
|
47
|
+
// Both versions were set and they did not match
|
|
48
|
+
throw new Error(`react-refresh versions did not match between transformer and runtime. Please check your dependencies. Transformer: ${window.__REACT_REFRESH_VERSION_TRANSFORMER}, Runtime: ${window.__REACT_REFRESH_VERSION_RUNTIME}`);
|
|
49
|
+
}
|
|
42
50
|
Refresh.register(type, module.id + ' ' + id);
|
|
43
51
|
};
|
|
44
52
|
window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
|
|
@@ -93,7 +101,7 @@ function isReactRefreshBoundary(exports) {
|
|
|
93
101
|
}
|
|
94
102
|
var hasExports = false;
|
|
95
103
|
var areAllExportsComponents = true;
|
|
96
|
-
let isESM =
|
|
104
|
+
let isESM = '__esModule' in exports;
|
|
97
105
|
for (var key in exports) {
|
|
98
106
|
hasExports = true;
|
|
99
107
|
if (key === '__esModule') {
|
|
@@ -134,7 +142,7 @@ function getRefreshBoundarySignature(exports) {
|
|
|
134
142
|
// (This is important for legacy environments.)
|
|
135
143
|
return signature;
|
|
136
144
|
}
|
|
137
|
-
let isESM =
|
|
145
|
+
let isESM = '__esModule' in exports;
|
|
138
146
|
for (var key in exports) {
|
|
139
147
|
if (key === '__esModule') {
|
|
140
148
|
continue;
|
|
@@ -159,7 +167,7 @@ function registerExportsForReactRefresh(module) {
|
|
|
159
167
|
// (This is important for legacy environments.)
|
|
160
168
|
return;
|
|
161
169
|
}
|
|
162
|
-
let isESM =
|
|
170
|
+
let isESM = '__esModule' in exports;
|
|
163
171
|
for (var key in exports) {
|
|
164
172
|
var desc = Object.getOwnPropertyDescriptor(exports, key);
|
|
165
173
|
if (desc && desc.get && !isESM) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-react-refresh-wrap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"main": "lib/ReactRefreshWrapTransformer.js",
|
|
17
17
|
"source": "src/ReactRefreshWrapTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
20
|
-
"parcel": "^2.
|
|
19
|
+
"node": ">= 16.0.0",
|
|
20
|
+
"parcel": "^2.13.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/plugin": "2.
|
|
24
|
-
"@parcel/utils": "2.
|
|
25
|
-
"react-refresh": "
|
|
23
|
+
"@parcel/plugin": "2.13.0",
|
|
24
|
+
"@parcel/utils": "2.13.0",
|
|
25
|
+
"react-refresh": ">=0.9 <=0.14"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "a53f8f3ba1025c7ea8653e9719e0a61ef9717079"
|
|
28
28
|
}
|
package/src/helpers/helpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var Refresh = require('react-refresh/runtime');
|
|
2
|
+
var {version} = require('react-refresh/package.json');
|
|
2
3
|
|
|
3
4
|
function debounce(func, delay) {
|
|
4
5
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -32,12 +33,24 @@ var enqueueUpdate = debounce(function () {
|
|
|
32
33
|
Refresh.performReactRefresh();
|
|
33
34
|
}, 30);
|
|
34
35
|
|
|
35
|
-
//
|
|
36
|
+
// Everything below is either adapted or copied from
|
|
36
37
|
// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js
|
|
37
38
|
// MIT License - Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
39
|
|
|
39
40
|
module.exports.prelude = function (module) {
|
|
41
|
+
window.__REACT_REFRESH_VERSION_TRANSFORMER = version;
|
|
40
42
|
window.$RefreshReg$ = function (type, id) {
|
|
43
|
+
if (
|
|
44
|
+
window.__REACT_REFRESH_VERSION_TRANSFORMER &&
|
|
45
|
+
window.__REACT_REFRESH_VERSION_RUNTIME &&
|
|
46
|
+
window.__REACT_REFRESH_VERSION_TRANSFORMER !==
|
|
47
|
+
window.__REACT_REFRESH_VERSION_RUNTIME
|
|
48
|
+
) {
|
|
49
|
+
// Both versions were set and they did not match
|
|
50
|
+
throw new Error(
|
|
51
|
+
`react-refresh versions did not match between transformer and runtime. Please check your dependencies. Transformer: ${window.__REACT_REFRESH_VERSION_TRANSFORMER}, Runtime: ${window.__REACT_REFRESH_VERSION_RUNTIME}`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
41
54
|
Refresh.register(type, module.id + ' ' + id);
|
|
42
55
|
};
|
|
43
56
|
window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
|