@parcel/transformer-react-refresh-wrap 2.0.0-canary.1712 → 2.0.0-canary.1714

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.
@@ -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) {
@@ -38,7 +41,11 @@ var enqueueUpdate = debounce(function () {
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) {
47
+ 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
+ }
42
49
  Refresh.register(type, module.id + ' ' + id);
43
50
  };
44
51
  window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/transformer-react-refresh-wrap",
3
- "version": "2.0.0-canary.1712+1afd7f7d2",
3
+ "version": "2.0.0-canary.1714+21bc8d4b5",
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": ">= 16.0.0",
20
- "parcel": "^2.0.0-canary.1710+1afd7f7d2"
20
+ "parcel": "^2.0.0-canary.1712+21bc8d4b5"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/plugin": "2.0.0-canary.1712+1afd7f7d2",
24
- "@parcel/utils": "2.0.0-canary.1712+1afd7f7d2",
23
+ "@parcel/plugin": "2.0.0-canary.1714+21bc8d4b5",
24
+ "@parcel/utils": "2.0.0-canary.1714+21bc8d4b5",
25
25
  "react-refresh": ">=0.9 <=0.14"
26
26
  },
27
- "gitHead": "1afd7f7d2894679880ff0d2b644a61d8734f3f89"
27
+ "gitHead": "21bc8d4b585c0a898e1b7644f27e3fea128ee9c9"
28
28
  }
@@ -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') {
@@ -37,7 +38,16 @@ var enqueueUpdate = debounce(function () {
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
+ ) {
47
+ throw new Error(
48
+ `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
+ );
50
+ }
41
51
  Refresh.register(type, module.id + ' ' + id);
42
52
  };
43
53
  window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;