Skip to content

Commit

Permalink
Fix: dynamic require
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Feb 25, 2024
1 parent 26926e4 commit 5e7d15e
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"lint": "bun run --bun eslint . --ext js,jsx,ts,tsx,mdx --ignore-path .gitignore --fix --cache --report-unused-disable-directives",
"storybook": "NODE_ENV=storybook storybook dev -p 6006",
"build-storybook": "storybook build",
"postinstall": "patch-package",
"prepare": "lefthook install",
"release": "bunx github:akalanka47000/bunpublish --tag=${TAG:=latest} --provenance",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down Expand Up @@ -100,6 +101,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "0.6.13",
"lefthook": "1.4.3",
"patch-package": "8.0.0",
"postcss": "8.4.23",
"prettier": "2.8.8",
"storybook": "7.3.2",
Expand Down
180 changes: 180 additions & 0 deletions patches/use-sync-external-store+1.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
index c849ab8..348baaa 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
@@ -10,6 +10,8 @@

'use strict';

+import React from 'react';
+
if (process.env.NODE_ENV !== "production") {
(function() {

@@ -23,7 +25,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
- var React = require('react');

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js
index 5e2bebc..ae1e46d 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js
@@ -10,6 +10,8 @@

'use strict';

+import React from 'react';
+
if (process.env.NODE_ENV !== "production") {
(function() {

@@ -23,7 +25,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
- var React = require('react');

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js
index 0e7f3dc..ac8e426 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js
@@ -7,5 +7,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
+'use strict';
+import e from "react";
+function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:q;
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
index 0ca00c7..e457d83 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
@@ -7,5 +7,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
+'use strict';
+import e from "react";
+function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
index 3c875ea..e7ec965 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
@@ -10,6 +10,9 @@

'use strict';

+import React from 'react';
+import shim from 'use-sync-external-store/shim';
+
if (process.env.NODE_ENV !== "production") {
(function() {

@@ -23,8 +26,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
- var React = require('react');
-var shim = require('use-sync-external-store/shim');

/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js
index 84485da..201748b 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js
@@ -7,6 +7,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var h=require("react"),n=require("use-sync-external-store/shim");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
+'use strict';
+import h from "react";
+import n from "use-sync-external-store/shim";
+function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
exports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
u(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
index eacc4be..d99209e 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
@@ -10,6 +10,8 @@

'use strict';

+import React from 'react';
+
if (process.env.NODE_ENV !== "production") {
(function() {

@@ -23,7 +25,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
- var React = require('react');

/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js
index 06bad1a..7ea7656 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js
@@ -7,6 +7,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var g=require("react");function n(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var p="function"===typeof Object.is?Object.is:n,q=g.useSyncExternalStore,r=g.useRef,t=g.useEffect,u=g.useMemo,v=g.useDebugValue;
-exports.useSyncExternalStoreWithSelector=function(a,b,e,l,h){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==h&&f.hasValue){var b=f.value;if(h(b,a))return k=b}return k=a}b=k;if(p(d,a))return b;var e=l(a);if(void 0!==h&&h(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,h]);var d=q(a,c[0],c[1]);
-t(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};
+'use strict';
+import g from "react";
+function n(a, b) { return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b } var p = "function" === typeof Object.is ? Object.is : n, q = g.useSyncExternalStore, r = g.useRef, t = g.useEffect, u = g.useMemo, v = g.useDebugValue;
+exports.useSyncExternalStoreWithSelector = function (a, b, e, l, h) {
+ var c = r(null); if (null === c.current) { var f = { hasValue: !1, value: null }; c.current = f } else f = c.current; c = u(function () { function a(a) { if (!c) { c = !0; d = a; a = l(a); if (void 0 !== h && f.hasValue) { var b = f.value; if (h(b, a)) return k = b } return k = a } b = k; if (p(d, a)) return b; var e = l(a); if (void 0 !== h && h(b, e)) return b; d = a; return k = e } var c = !1, d, k, m = void 0 === e ? null : e; return [function () { return a(b()) }, null === m ? void 0 : function () { return a(m()) }] }, [b, e, l, h]); var d = q(a, c[0], c[1]);
+ t(function () { f.hasValue = !0; f.value = d }, [d]); v(d); return d
+};
diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js
index 82368bc..7d6ddb3 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js
@@ -10,6 +10,8 @@

'use strict';

+import React from 'react';
+
if (process.env.NODE_ENV !== "production") {
(function() {

@@ -23,7 +25,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
- var React = require('react');

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

diff --git a/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.min.js b/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.min.js
index 8d684a6..927067e 100644
--- a/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.min.js
+++ b/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.min.js
@@ -7,4 +7,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var a=require("react").useSyncExternalStore;exports.useSyncExternalStore=a;
+'use strict';
+
+import { useSyncExternalStore } from "react";
+
+exports.useSyncExternalStore = useSyncExternalStore;

0 comments on commit 5e7d15e

Please sign in to comment.