@next/react-refresh-utils 15.6.0-canary.8 → 16.0.0-beta.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.
@@ -0,0 +1,6 @@
1
+ import type { Compiler } from 'webpack';
2
+ declare class ReactRefreshRspackPlugin {
3
+ static loader: string;
4
+ apply(compiler: Compiler): void;
5
+ }
6
+ export default ReactRefreshRspackPlugin;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const PLUGIN_NAME = 'ReactRefreshRspackPlugin';
4
+ class ReactRefreshRspackPlugin {
5
+ apply(compiler) {
6
+ new compiler.webpack.ProvidePlugin({
7
+ $ReactRefreshRuntime$: require.resolve('./internal/RspackReactRefresh'),
8
+ }).apply(compiler);
9
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
10
+ compilation.hooks.additionalTreeRuntimeRequirements.tap(PLUGIN_NAME, (_, runtimeRequirements) => {
11
+ runtimeRequirements.add(compiler.webpack.RuntimeGlobals.moduleCache);
12
+ });
13
+ });
14
+ }
15
+ }
16
+ ReactRefreshRspackPlugin.loader = 'builtin:react-refresh-loader';
17
+ exports.default = ReactRefreshRspackPlugin;
18
+ //# sourceMappingURL=ReactRefreshRspackPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactRefreshRspackPlugin.js","sourceRoot":"","sources":["../ReactRefreshRspackPlugin.ts"],"names":[],"mappings":";;AAEA,MAAM,WAAW,GAAG,0BAA0B,CAAA;AAE9C,MAAM,wBAAwB;IAG5B,KAAK,CAAC,QAAkB;QACtB,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;YACjC,qBAAqB,EAAE,OAAO,CAAC,OAAO,CAAC,+BAA+B,CAAC;SACxE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAElB,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;YAC1D,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,GAAG,CACrD,WAAW,EACX,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE;gBACzB,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;YACtE,CAAC,CACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAfM,+BAAM,GAAG,8BAA8B,CAAA;AAkBhD,kBAAe,wBAAwB,CAAA"}
@@ -12,7 +12,7 @@ function default_1() {
12
12
  // to extract CSS. For backwards compatibility, we need to check we're in a
13
13
  // browser context before continuing.
14
14
  if (typeof self !== 'undefined' &&
15
- // AMP / No-JS mode does not inject these helpers:
15
+ // No-JS mode does not inject these helpers:
16
16
  '$RefreshHelpers$' in self) {
17
17
  // @ts-ignore __webpack_module__ is global
18
18
  var currentExports = __webpack_module__.exports;
@@ -1 +1 @@
1
- {"version":3,"file":"ReactRefreshModule.runtime.js","sourceRoot":"","sources":["../../internal/ReactRefreshModule.runtime.ts"],"names":[],"mappings":";;AAkBA,4BAwEC;AA1ED,+EAA+E;AAC/E,4CAA4C;AAC5C;IACE,yDAAyD;IACzD,CAAC;IAAA,CAAC;;QACA,2EAA2E;QAC3E,2EAA2E;QAC3E,qCAAqC;QACrC,IACE,OAAO,IAAI,KAAK,WAAW;YAC3B,kDAAkD;YAClD,kBAAkB,IAAI,IAAI,EAC1B,CAAC;YACD,0CAA0C;YAC1C,IAAI,cAAc,GAAG,kBAAkB,CAAC,OAAO,CAAA;YAC/C,0CAA0C;YAC1C,IAAI,aAAa,GACf,MAAA,MAAA,kBAAkB,CAAC,GAAG,CAAC,IAAI,0CAAE,aAAa,mCAAI,IAAI,CAAA;YAEpD,0EAA0E;YAC1E,4BAA4B;YAC5B,IAAI,CAAC,gBAAgB,CAAC,8BAA8B,CAClD,cAAc,EACd,kBAAkB,CAAC,EAAE,CACtB,CAAA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ChD,IACE,IAAI,CAAC,gBAAgB,CAAC,oCAAoC,CACxD,aAAa,EACb,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,cAAc,CAAC,CAClE,EACD,CAAC;wBACD,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;oBACrC,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAA;oBACxC,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,yEAAyE;gBACzE,uDAAuD;gBACvD,oEAAoE;gBACpE,oEAAoE;gBACpE,IAAI,mBAAmB,GAAG,aAAa,KAAK,IAAI,CAAA;gBAChD,IAAI,mBAAmB,EAAE,CAAC;oBACxB,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,EAAE,CAAA;AACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function refresh(moduleId: any, webpackHot: any): void;
2
+ export { register, createSignatureFunctionForTransform, } from 'react-refresh/runtime';
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createSignatureFunctionForTransform = exports.register = void 0;
7
+ exports.refresh = refresh;
8
+ const helpers_1 = __importDefault(require("./helpers"));
9
+ // Extracts exports from a webpack module object.
10
+ function getModuleExports(moduleId) {
11
+ if (typeof moduleId === 'undefined') {
12
+ // `moduleId` is unavailable, which indicates that this module is not in the cache,
13
+ // which means we won't be able to capture any exports,
14
+ // and thus they cannot be refreshed safely.
15
+ // These are likely runtime or dynamically generated modules.
16
+ return {};
17
+ }
18
+ var maybeModule = __webpack_require__.c[moduleId];
19
+ if (typeof maybeModule === 'undefined') {
20
+ // `moduleId` is available but the module in cache is unavailable,
21
+ // which indicates the module is somehow corrupted (e.g. broken Webpack `module` globals).
22
+ // We will warn the user (as this is likely a mistake) and assume they cannot be refreshed.
23
+ console.warn('[React Refresh] Failed to get exports for module: ' + moduleId + '.');
24
+ return {};
25
+ }
26
+ var exportsOrPromise = maybeModule.exports;
27
+ if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) {
28
+ return exportsOrPromise.then(function (exports) {
29
+ return exports;
30
+ });
31
+ }
32
+ return exportsOrPromise;
33
+ }
34
+ function executeRuntime(moduleExports, moduleId, webpackHot) {
35
+ var _a, _b;
36
+ helpers_1.default.registerExportsForReactRefresh(moduleExports, moduleId);
37
+ if (webpackHot) {
38
+ var isHotUpdate = !!webpackHot.data;
39
+ var prevSignature = (_b = (_a = webpackHot.data) === null || _a === void 0 ? void 0 : _a.prevSignature) !== null && _b !== void 0 ? _b : null;
40
+ if (helpers_1.default.isReactRefreshBoundary(moduleExports)) {
41
+ webpackHot.dispose(
42
+ // Save the previous exports signature on update so we can compare the boundary
43
+ // signatures. We avoid saving exports themselves since it causes memory leaks (https://github.com/vercel/next.js/pull/53797)
44
+ function hotDisposeCallback(data) {
45
+ data.prevSignature =
46
+ helpers_1.default.getRefreshBoundarySignature(moduleExports);
47
+ });
48
+ webpackHot.accept();
49
+ // This field is set when the previous version of this module was a
50
+ // Refresh Boundary, letting us know we need to check for invalidation or
51
+ // enqueue an update.
52
+ if (prevSignature !== null) {
53
+ if (isHotUpdate) {
54
+ if (helpers_1.default.shouldInvalidateReactRefreshBoundary(prevSignature, helpers_1.default.getRefreshBoundarySignature(moduleExports))) {
55
+ webpackHot.invalidate();
56
+ }
57
+ else {
58
+ helpers_1.default.scheduleUpdate();
59
+ }
60
+ }
61
+ }
62
+ }
63
+ else {
64
+ if (isHotUpdate && prevSignature !== null) {
65
+ webpackHot.invalidate();
66
+ }
67
+ }
68
+ }
69
+ }
70
+ // Port from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/loader/utils/getRefreshModuleRuntime.js#L29
71
+ function refresh(moduleId, webpackHot) {
72
+ const currentExports = getModuleExports(moduleId);
73
+ const fn = (exports) => {
74
+ executeRuntime(exports, moduleId, webpackHot);
75
+ };
76
+ if (typeof Promise !== 'undefined' && currentExports instanceof Promise) {
77
+ currentExports.then(fn);
78
+ }
79
+ else {
80
+ fn(currentExports);
81
+ }
82
+ }
83
+ var runtime_1 = require("react-refresh/runtime");
84
+ Object.defineProperty(exports, "register", { enumerable: true, get: function () { return runtime_1.register; } });
85
+ Object.defineProperty(exports, "createSignatureFunctionForTransform", { enumerable: true, get: function () { return runtime_1.createSignatureFunctionForTransform; } });
86
+ //# sourceMappingURL=RspackReactRefresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RspackReactRefresh.js","sourceRoot":"","sources":["../../internal/RspackReactRefresh.ts"],"names":[],"mappings":";;;;;;AAgFA,0BAUC;AA1FD,wDAAsC;AAMtC,iDAAiD;AACjD,SAAS,gBAAgB,CAAC,QAAgB;IACxC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,mFAAmF;QACnF,uDAAuD;QACvD,4CAA4C;QAC5C,6DAA6D;QAC7D,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,WAAW,GAAG,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACjD,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,kEAAkE;QAClE,0FAA0F;QAC1F,2FAA2F;QAC3F,OAAO,CAAC,IAAI,CACV,oDAAoD,GAAG,QAAQ,GAAG,GAAG,CACtE,CAAA;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,gBAAgB,GAAG,WAAW,CAAC,OAAO,CAAA;IAC1C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,gBAAgB,YAAY,OAAO,EAAE,CAAC;QAC1E,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,OAAO;YAC5C,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;I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AAc,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACjD,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE;QACrB,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;IAC/C,CAAC,CAAA;IACD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,cAAc,YAAY,OAAO,EAAE,CAAC;QACxE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,cAAc,CAAC,CAAA;IACpB,CAAC;AACH,CAAC;AAED,iDAG8B;AAF5B,mGAAA,QAAQ,OAAA;AACR,8HAAA,mCAAmC,OAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const runtime_1 = __importDefault(require("react-refresh/runtime"));
7
+ if (typeof self !== 'undefined') {
8
+ var $RefreshInjected$ = '__reactRefreshInjected';
9
+ // Only inject the runtime if it hasn't been injected
10
+ if (!self[$RefreshInjected$]) {
11
+ runtime_1.default.injectIntoGlobalHook(self);
12
+ // Empty implementation to avoid "ReferenceError: variable is not defined" in module which didn't pass builtin:react-refresh-loader
13
+ self.$RefreshSig$ = () => (type) => type;
14
+ self.$RefreshReg$ = () => { };
15
+ // Mark the runtime as injected to prevent double-injection
16
+ self[$RefreshInjected$] = true;
17
+ }
18
+ }
19
+ //# sourceMappingURL=rspack-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack-runtime.js","sourceRoot":"","sources":["../rspack-runtime.ts"],"names":[],"mappings":";;;;;AAAA,oEAAkD;AAKlD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;IAChC,IAAI,iBAAiB,GAAG,wBAAwB,CAAA;IAEhD,qDAAqD;IACrD,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC7B,iBAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAEzC,mIAAmI;QACnI,IAAI,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;QACxC,IAAI,CAAC,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QAE5B,2DAA2D;QAC3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IAChC,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/react-refresh-utils",
3
- "version": "15.6.0-canary.8",
3
+ "version": "16.0.0-beta.0",
4
4
  "description": "An experimental package providing utilities for React Refresh.",
5
5
  "repository": {
6
6
  "url": "vercel/next.js",