@next/react-refresh-utils 12.0.11-canary.6 → 12.1.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.
- package/internal/ReactRefreshModule.runtime.js +10 -7
- package/loader.js +10 -2
- package/package.json +2 -2
|
@@ -13,22 +13,25 @@ function default_1() {
|
|
|
13
13
|
if (typeof self !== 'undefined' &&
|
|
14
14
|
// AMP / No-JS mode does not inject these helpers:
|
|
15
15
|
'$RefreshHelpers$' in self) {
|
|
16
|
-
|
|
17
|
-
var
|
|
16
|
+
// @ts-ignore __webpack_module__ is global
|
|
17
|
+
var currentExports = __webpack_module__.exports;
|
|
18
|
+
// @ts-ignore __webpack_module__ is global
|
|
19
|
+
var prevExports = (_b = (_a = __webpack_module__.hot.data) === null || _a === void 0 ? void 0 : _a.prevExports) !== null && _b !== void 0 ? _b : null;
|
|
18
20
|
// This cannot happen in MainTemplate because the exports mismatch between
|
|
19
21
|
// templating and execution.
|
|
20
|
-
self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports,
|
|
22
|
+
self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, __webpack_module__.id);
|
|
21
23
|
// A module can be accepted automatically based on its exports, e.g. when
|
|
22
24
|
// it is a Refresh Boundary.
|
|
23
25
|
if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {
|
|
24
26
|
// Save the previous exports on update so we can compare the boundary
|
|
25
27
|
// signatures.
|
|
26
|
-
|
|
28
|
+
__webpack_module__.hot.dispose(function (data) {
|
|
27
29
|
data.prevExports = currentExports;
|
|
28
30
|
});
|
|
29
31
|
// Unconditionally accept an update to this module, we'll check if it's
|
|
30
32
|
// still a Refresh Boundary later.
|
|
31
|
-
|
|
33
|
+
// @ts-ignore importMeta is replaced in the loader
|
|
34
|
+
global.importMeta.webpackHot.accept();
|
|
32
35
|
// This field is set when the previous version of this module was a
|
|
33
36
|
// Refresh Boundary, letting us know we need to check for invalidation or
|
|
34
37
|
// enqueue an update.
|
|
@@ -41,7 +44,7 @@ function default_1() {
|
|
|
41
44
|
// re-render. Similarly, if you convert a class component to a
|
|
42
45
|
// function, we want to invalidate the boundary.
|
|
43
46
|
if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevExports, currentExports)) {
|
|
44
|
-
|
|
47
|
+
__webpack_module__.hot.invalidate();
|
|
45
48
|
}
|
|
46
49
|
else {
|
|
47
50
|
self.$RefreshHelpers$.scheduleUpdate();
|
|
@@ -55,7 +58,7 @@ function default_1() {
|
|
|
55
58
|
// because we already accepted this update (accidental side effect).
|
|
56
59
|
var isNoLongerABoundary = prevExports !== null;
|
|
57
60
|
if (isNoLongerABoundary) {
|
|
58
|
-
|
|
61
|
+
__webpack_module__.hot.invalidate();
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
}
|
package/loader.js
CHANGED
|
@@ -5,9 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const ReactRefreshModule_runtime_1 = __importDefault(require("./internal/ReactRefreshModule.runtime"));
|
|
7
7
|
let refreshModuleRuntime = ReactRefreshModule_runtime_1.default.toString();
|
|
8
|
-
refreshModuleRuntime = refreshModuleRuntime
|
|
8
|
+
refreshModuleRuntime = refreshModuleRuntime
|
|
9
|
+
.slice(refreshModuleRuntime.indexOf('{') + 1, refreshModuleRuntime.lastIndexOf('}'))
|
|
10
|
+
// Given that the import above executes the module we need to make sure it does not crash on `import.meta` not being allowed.
|
|
11
|
+
.replace('global.importMeta', 'import.meta');
|
|
12
|
+
let commonJsrefreshModuleRuntime = refreshModuleRuntime.replace('import.meta.webpackHot', 'module.hot');
|
|
9
13
|
const ReactRefreshLoader = function ReactRefreshLoader(source, inputSourceMap) {
|
|
10
|
-
this.callback(null, `${source}\n\n;${
|
|
14
|
+
this.callback(null, `${source}\n\n;${
|
|
15
|
+
// Account for commonjs not supporting `import.meta
|
|
16
|
+
this.resourcePath.endsWith('.cjs')
|
|
17
|
+
? commonJsrefreshModuleRuntime
|
|
18
|
+
: refreshModuleRuntime}`, inputSourceMap);
|
|
11
19
|
};
|
|
12
20
|
exports.default = ReactRefreshLoader;
|
|
13
21
|
//# sourceMappingURL=loader.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next/react-refresh-utils",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "An experimental package providing utilities for React Refresh.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "vercel/next.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react-refresh": "0.8.3"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "8545fd1bb02244ced9e8dc9584a764aeae296cd0"
|
|
34
34
|
}
|