@atlaspack/transformer-react-refresh-wrap 2.12.1-canary.3365 → 2.12.1-canary.3367

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.
@@ -33,7 +33,7 @@ var _default = exports.default = new (_plugin().Transformer)({
33
33
  let wrapperPath = `@atlaspack/transformer-react-refresh-wrap/${_path().default.basename(__dirname)}/helpers/helpers.js`;
34
34
  let code = await asset.getCode();
35
35
  let map = await asset.getMap();
36
- let name = `$atlaspack$ReactRefreshHelpers$${asset.id.slice(-4)}`;
36
+ let name = `$parcel$ReactRefreshHelpers$${asset.id.slice(-4)}`;
37
37
  code = `var ${name} = require(${JSON.stringify(wrapperPath)});
38
38
  var prevRefreshReg = window.$RefreshReg$;
39
39
  var prevRefreshSig = window.$RefreshSig$;
@@ -43,7 +43,8 @@ var enqueueUpdate = debounce(function () {
43
43
  module.exports.prelude = function (module) {
44
44
  window.__REACT_REFRESH_VERSION_TRANSFORMER = version;
45
45
  window.$RefreshReg$ = function (type, id) {
46
- if (window.__REACT_REFRESH_VERSION_TRANSFORMER !== window.__REACT_REFRESH_VERSION_RUNTIME) {
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
47
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}`);
48
49
  }
49
50
  Refresh.register(type, module.id + ' ' + id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-react-refresh-wrap",
3
- "version": "2.12.1-canary.3365+899380f88",
3
+ "version": "2.12.1-canary.3367+815758ba7",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,12 +13,12 @@
13
13
  "source": "src/ReactRefreshWrapTransformer.js",
14
14
  "engines": {
15
15
  "node": ">= 16.0.0",
16
- "atlaspack": "2.12.1-canary.3365+899380f88"
16
+ "parcel": "2.12.1-canary.3367+815758ba7"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/plugin": "2.12.1-canary.3365+899380f88",
20
- "@atlaspack/utils": "2.12.1-canary.3365+899380f88",
19
+ "@atlaspack/plugin": "2.12.1-canary.3367+815758ba7",
20
+ "@atlaspack/utils": "2.12.1-canary.3367+815758ba7",
21
21
  "react-refresh": ">=0.9 <=0.14"
22
22
  },
23
- "gitHead": "899380f88eabe729bd61fe72e7832ec64db6ae30"
23
+ "gitHead": "815758ba750fdf03c404e4ab67e0930acc51404a"
24
24
  }
@@ -38,7 +38,7 @@ export default (new Transformer({
38
38
 
39
39
  let code = await asset.getCode();
40
40
  let map = await asset.getMap();
41
- let name = `$atlaspack$ReactRefreshHelpers$${asset.id.slice(-4)}`;
41
+ let name = `$parcel$ReactRefreshHelpers$${asset.id.slice(-4)}`;
42
42
 
43
43
  code = `var ${name} = require(${JSON.stringify(wrapperPath)});
44
44
  var prevRefreshReg = window.$RefreshReg$;
@@ -41,9 +41,12 @@ module.exports.prelude = function (module) {
41
41
  window.__REACT_REFRESH_VERSION_TRANSFORMER = version;
42
42
  window.$RefreshReg$ = function (type, id) {
43
43
  if (
44
+ window.__REACT_REFRESH_VERSION_TRANSFORMER &&
45
+ window.__REACT_REFRESH_VERSION_RUNTIME &&
44
46
  window.__REACT_REFRESH_VERSION_TRANSFORMER !==
45
- window.__REACT_REFRESH_VERSION_RUNTIME
47
+ window.__REACT_REFRESH_VERSION_RUNTIME
46
48
  ) {
49
+ // Both versions were set and they did not match
47
50
  throw new Error(
48
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}`,
49
52
  );