@@ -17,67 +17,70 @@ declare const module: {
17
17
// This function gets unwrapped into global scope, which is why we don't invert
18
18
// if-blocks. Also, you cannot use `return`.
19
19
export default function ( ) {
20
- // Legacy CSS implementations will `eval` browser code in a Node.js context
21
- // to extract CSS. For backwards compatibility, we need to check we're in a
22
- // browser context before continuing.
23
- if (
24
- typeof self !== 'undefined' &&
25
- // AMP / No-JS mode does not inject these helpers:
26
- '$RefreshHelpers$' in self
27
- ) {
28
- var currentExports = module . __proto__ . exports
29
- var prevExports = module . hot . data ?. prevExports ?? null
20
+ // Wrapped in an IIFE to avoid polluting the global scope
21
+ ; ( function ( ) {
22
+ // Legacy CSS implementations will `eval` browser code in a Node.js context
23
+ // to extract CSS. For backwards compatibility, we need to check we're in a
24
+ // browser context before continuing.
25
+ if (
26
+ typeof self !== 'undefined' &&
27
+ // AMP / No-JS mode does not inject these helpers:
28
+ '$RefreshHelpers$' in self
29
+ ) {
30
+ var currentExports = module . __proto__ . exports
31
+ var prevExports = module . hot . data ?. prevExports ?? null
30
32
31
- // This cannot happen in MainTemplate because the exports mismatch between
32
- // templating and execution.
33
- self . $RefreshHelpers$ . registerExportsForReactRefresh (
34
- currentExports ,
35
- module . id
36
- )
33
+ // This cannot happen in MainTemplate because the exports mismatch between
34
+ // templating and execution.
35
+ self . $RefreshHelpers$ . registerExportsForReactRefresh (
36
+ currentExports ,
37
+ module . id
38
+ )
37
39
38
- // A module can be accepted automatically based on its exports, e.g. when
39
- // it is a Refresh Boundary.
40
- if ( self . $RefreshHelpers$ . isReactRefreshBoundary ( currentExports ) ) {
41
- // Save the previous exports on update so we can compare the boundary
42
- // signatures.
43
- module . hot . dispose ( function ( data ) {
44
- data . prevExports = currentExports
45
- } )
46
- // Unconditionally accept an update to this module, we'll check if it's
47
- // still a Refresh Boundary later.
48
- module . hot . accept ( )
40
+ // A module can be accepted automatically based on its exports, e.g. when
41
+ // it is a Refresh Boundary.
42
+ if ( self . $RefreshHelpers$ . isReactRefreshBoundary ( currentExports ) ) {
43
+ // Save the previous exports on update so we can compare the boundary
44
+ // signatures.
45
+ module . hot . dispose ( function ( data ) {
46
+ data . prevExports = currentExports
47
+ } )
48
+ // Unconditionally accept an update to this module, we'll check if it's
49
+ // still a Refresh Boundary later.
50
+ module . hot . accept ( )
49
51
50
- // This field is set when the previous version of this module was a
51
- // Refresh Boundary, letting us know we need to check for invalidation or
52
- // enqueue an update.
53
- if ( prevExports !== null ) {
54
- // A boundary can become ineligible if its exports are incompatible
55
- // with the previous exports.
56
- //
57
- // For example, if you add/remove/change exports, we'll want to
58
- // re-execute the importing modules, and force those components to
59
- // re-render. Similarly, if you convert a class component to a
60
- // function, we want to invalidate the boundary.
61
- if (
62
- self . $RefreshHelpers$ . shouldInvalidateReactRefreshBoundary (
63
- prevExports ,
64
- currentExports
65
- )
66
- ) {
52
+ // This field is set when the previous version of this module was a
53
+ // Refresh Boundary, letting us know we need to check for invalidation or
54
+ // enqueue an update.
55
+ if ( prevExports !== null ) {
56
+ // A boundary can become ineligible if its exports are incompatible
57
+ // with the previous exports.
58
+ //
59
+ // For example, if you add/remove/change exports, we'll want to
60
+ // re-execute the importing modules, and force those components to
61
+ // re-render. Similarly, if you convert a class component to a
62
+ // function, we want to invalidate the boundary.
63
+ if (
64
+ self . $RefreshHelpers$ . shouldInvalidateReactRefreshBoundary (
65
+ prevExports ,
66
+ currentExports
67
+ )
68
+ ) {
69
+ module . hot . invalidate ( )
70
+ } else {
71
+ self . $RefreshHelpers$ . scheduleUpdate ( )
72
+ }
73
+ }
74
+ } else {
75
+ // Since we just executed the code for the module, it's possible that the
76
+ // new exports made it ineligible for being a boundary.
77
+ // We only care about the case when we were _previously_ a boundary,
78
+ // because we already accepted this update (accidental side effect).
79
+ var isNoLongerABoundary = prevExports !== null
80
+ if ( isNoLongerABoundary ) {
67
81
module . hot . invalidate ( )
68
- } else {
69
- self . $RefreshHelpers$ . scheduleUpdate ( )
70
82
}
71
83
}
72
- } else {
73
- // Since we just executed the code for the module, it's possible that the
74
- // new exports made it ineligible for being a boundary.
75
- // We only care about the case when we were _previously_ a boundary,
76
- // because we already accepted this update (accidental side effect).
77
- var isNoLongerABoundary = prevExports !== null
78
- if ( isNoLongerABoundary ) {
79
- module . hot . invalidate ( )
80
- }
81
84
}
82
- }
85
+ } ) ( )
83
86
}
0 commit comments