npm package diff

Package: rehackt

Versions: 0.0.6 - 0.1.0

Modified:package/index.js

Index: package/index.js
===================================================================
--- package/index.js
+++ package/index.js
@@ -1,2 +1,24 @@
 "use strict";
-module.exports = require("react");
+if (0) {
+  // Trick cjs-module-lexer into adding named exports for all React exports.
+  // (if imported with `import()`, they will appear in `.default` as well.)
+  // This way, cjs-module-lexer will let all of react's (named) exports through unchanged.
+  module.exports = require("react");
+}
+// We don't want bundlers to error when they encounter usage of any of these exports.
+// It's up to the package author to ensure that if they access React internals,
+// they do so in a safe way that won't break if React changes how they use these internals.
+// (e.g. only access them in development, and only in an optional way that won't
+// break if internals are not there or do not have the expected structure)
+// @ts-ignore
+module.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = undefined;
+// @ts-ignore
+module.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;
+// @ts-ignore
+module.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;
+// Here we actually pull in the React library and add everything
+// it exports to our own `module.exports`.
+// If React suddenly were to add one of the above "polyfilled" exports,
+// the React version would overwrite our version, so this should be
+// future-proof.
+Object.assign(module.exports, require("react"));

Modified:package/rsc.js

Index: package/rsc.js
===================================================================
--- package/rsc.js
+++ package/rsc.js
@@ -8,10 +8,12 @@
 }
 
 // missing functions
 module.exports.createContext = polyfillMissingFn("createContext");
+// @ts-ignore
 module.exports.createFactory = polyfillMissingFn("createFactory");
 module.exports.act = polyfillMissingFn("act");
+// @ts-ignore
 module.exports.unstable_act = polyfillMissingFn("unstable_act");
 module.exports.unstable_useCacheRefresh = polyfillMissingFn("unstable_useCacheRefresh");
 module.exports.useContext = polyfillMissingFn("useContext");
 module.exports.useDeferredValue = polyfillMissingFn("useDeferredValue");
@@ -24,8 +26,19 @@
 module.exports.useState = polyfillMissingFn("useState");
 module.exports.useSyncExternalStore = polyfillMissingFn("useSyncExternalStore");
 module.exports.useTransition = polyfillMissingFn("useTransition");
 module.exports.useOptimistic = polyfillMissingFn("useOptimistic");
+// We don't want bundlers to error when they encounter usage of any of these exports.
+// It's up to the package author to ensure that if they access React internals,
+// they do so in a safe way that won't break if React changes how they use these internals.
+// (e.g. only access them in development, and only in an optional way that won't
+// break if internals are not there or do not have the expected structure)
+// @ts-ignore
+module.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = undefined;
+// @ts-ignore
+module.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;
+// @ts-ignore
+module.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;
 
 // missing classes
 module.exports.Component = polyfillMissingClass("Component");
 module.exports.PureComponent = polyfillMissingClass("PureComponent");
@@ -39,9 +52,9 @@
       throw new Error("Context is not available in this environment.");
     },
   };
 };
-
+// @ts-ignore
 module.exports.createFactory = function unsupportedCreateFactory() {
   return function throwNoCreateFactory() {
     throw new Error("createFactory is not available in this environment.");
   };

Modified:package/package.json

Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "rehackt",
-  "version": "0.0.6",
+  "version": "0.1.0",
   "description": "A wrapper around React that will hide hooks from the React Server Component compiler",
   "author": "Lenz Weber-Tronic",
   "repository": {
     "type": "git",
@@ -26,10 +26,10 @@
     "README.md",
     "LICENSE.md"
   ],
   "peerDependencies": {
-    "react": "*",
-    "@types/react": "*"
+    "@types/react": "*",
+    "react": "*"
   },
   "peerDependenciesMeta": {
     "react": {
       "optional": true
@@ -38,10 +38,10 @@
       "optional": true
     }
   },
   "devDependencies": {
-    "react": "^18.3.0-canary-ab31a9ed2-20230824",
-    "@types/node": "^20.5.7"
+    "@types/node": "^20.5.7",
+    "react": "^19.0.0-canary-33a32441e9-20240418"
   },
   "prettier": {
     "printWidth": 120
   }