Socket
Socket
Sign inDemoInstall

react-refresh

Package Overview
Dependencies
0
Maintainers
10
Versions
1554
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-357a61324-20220516 to 0.0.0-experimental-36e62c603-20240418

cjs/react-refresh-babel.production.js

22

cjs/react-refresh-babel.development.js

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -173,3 +173,3 @@ * This source code is licensed under the MIT license found in the

}
} else ;

@@ -274,2 +274,20 @@ break;

case 'React.useDebugValue':
case 'useId':
case 'React.useId':
case 'useDeferredValue':
case 'React.useDeferredValue':
case 'useTransition':
case 'React.useTransition':
case 'useInsertionEffect':
case 'React.useInsertionEffect':
case 'useSyncExternalStore':
case 'React.useSyncExternalStore':
case 'useFormStatus':
case 'React.useFormStatus':
case 'useFormState':
case 'React.useFormState':
case 'useActionState':
case 'React.useActionState':
case 'useOptimistic':
case 'React.useOptimistic':
return true;

@@ -276,0 +294,0 @@

50

cjs/react-refresh-babel.production.min.js

@@ -1,24 +0,26 @@

/**
* @license React
* react-refresh-babel.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';module.exports=function(r){function t(a,b){var c=a.scope.generateUidIdentifier("c");l.has(a)||l.set(a,[]);l.get(a).push({handle:c,persistentID:b});return c}function u(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function m(a,b,c){var d=b.node;switch(d.type){case "Identifier":if(!u(d.name))break;c(a,d,null);return!0;case "FunctionDeclaration":return c(a,d.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===d.body.type)break;c(a,d,b);return!0;case "FunctionExpression":return c(a,
d,b),!0;case "CallExpression":var e=b.get("arguments");if(void 0===e||0===e.length)break;var g=b.get("callee");switch(g.node.type){case "MemberExpression":case "Identifier":g=g.getSource();if(!m(a+"$"+g,e[0],c))return!1;c(a,d,b);return!0;default:return!1}case "VariableDeclarator":if(e=d.init,null!==e&&(g=d.id.name,u(g))){switch(e.type){case "ArrowFunctionExpression":case "FunctionExpression":break;case "CallExpression":d=e.callee;var f=d.type;if("Import"===f||"Identifier"===f&&(0===d.name.indexOf("require")||
0===d.name.indexOf("import")))return!1;break;case "TaggedTemplateExpression":break;default:return!1}d=b.get("init");if(m(a,d,c))return!0;g=b.scope.getBinding(g);if(void 0===g)return;b=!1;g=g.referencePaths;for(f=0;f<g.length;f++){var h=g[f];if(!h.node||"JSXIdentifier"===h.node.type||"Identifier"===h.node.type){h=h.parent;if("JSXOpeningElement"===h.type)b=!0;else if("CallExpression"===h.type){h=h.callee;var v=void 0;switch(h.type){case "Identifier":v=h.name;break;case "MemberExpression":v=h.property.name}switch(v){case "createElement":case "jsx":case "jsxDEV":case "jsxs":b=
!0}}if(b)return c(a,e,d),!0}}}}return!1}function x(a){a=n.get(a);return void 0===a?null:{key:a.map(function(a){return a.name+"{"+a.key+"}"}).join("\n"),customHooks:a.filter(function(a){a:switch(a.name){case "useState":case "React.useState":case "useReducer":case "React.useReducer":case "useEffect":case "React.useEffect":case "useLayoutEffect":case "React.useLayoutEffect":case "useMemo":case "React.useMemo":case "useCallback":case "React.useCallback":case "useRef":case "React.useRef":case "useContext":case "React.useContext":case "useImperativeHandle":case "React.useImperativeHandle":case "useDebugValue":case "React.useDebugValue":a=
!0;break a;default:a=!1}return!a}).map(function(a){return f.cloneDeep(a.callee)})}}function C(a){a=a.hub.file;var b=y.get(a);if(void 0!==b)return b;b=!1;for(var c=a.ast.comments,d=0;d<c.length;d++)if(-1!==c[d].value.indexOf("@refresh reset")){b=!0;break}y.set(a,b);return b}function w(a,b,c){var d=b.key;b=b.customHooks;var e=C(c.path),g=[];b.forEach(function(a){switch(a.type){case "MemberExpression":if("Identifier"===a.object.type)var b=a.object.name;break;case "Identifier":b=a.name}c.hasBinding(b)?
g.push(a):e=!0});b=d;"function"!==typeof require||p.emitFullSignatures||(b=require("crypto").createHash("sha1").update(d).digest("base64"));a=[a,f.stringLiteral(b)];(e||0<g.length)&&a.push(f.booleanLiteral(e));0<g.length&&a.push(f.functionExpression(null,[],f.blockStatement([f.returnStatement(f.arrayExpression(g))])));return a}function D(a){for(var b=[];;){if(!a)return b;var c=a.parentPath;if(!c)return b;if("AssignmentExpression"===c.node.type&&a.node===c.node.right)a=c;else if("CallExpression"===
c.node.type&&a.node!==c.node.callee)b.push(c),a=c;else return b}}var p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"===typeof r.env){var z=r.env();if("development"!==z&&!p.skipEnvCheck)throw Error('React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "'+z+'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.');}var f=r.types,E=f.identifier(p.refreshReg||"$RefreshReg$"),A=f.identifier(p.refreshSig||
"$RefreshSig$"),l=new Map,y=new WeakMap,k=new WeakSet,q=new WeakSet,B=new WeakSet,n=new WeakMap,F={CallExpression:function(a){var b=a.node.callee,c=null;switch(b.type){case "Identifier":c=b.name;break;case "MemberExpression":c=b.property.name}if(null!==c&&/^use[A-Z]/.test(c)&&(b=a.scope.getFunctionParent(),null!==b)){b=b.block;n.has(b)||n.set(b,[]);b=n.get(b);var d="";"VariableDeclarator"===a.parent.type&&(d=a.parentPath.get("id").getSource());var e=a.get("arguments");"useState"===c&&0<e.length?d+=
"("+e[0].getSource()+")":"useReducer"===c&&1<e.length&&(d+="("+e[1].getSource()+")");b.push({callee:a.node.callee,name:c,key:d})}}};return{visitor:{ExportDefaultDeclaration:function(a){var b=a.node,c=b.declaration,d=a.get("declaration");if("CallExpression"===c.type&&!k.has(b)){k.add(b);var e=a.parentPath;m("%default%",d,function(a,b,d){null!==d&&(a=t(e,a),d.replaceWith(f.assignmentExpression("=",a,b)))})}},FunctionDeclaration:{enter:function(a){var b=a.node,c="";switch(a.parent.type){case "Program":var d=
a;var e=a.parentPath;break;case "TSModuleBlock":d=a;e=d.parentPath.parentPath;break;case "ExportNamedDeclaration":d=a.parentPath;e=d.parentPath;break;case "ExportDefaultDeclaration":d=a.parentPath;e=d.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==e.type;){if("TSModuleDeclaration"===e.type){if("Program"!==e.parentPath.type&&"ExportNamedDeclaration"!==e.parentPath.type)return;c=e.node.id.name+"$"+c}e=e.parentPath}var g=
b.id;null!==g&&(g=g.name,u(g)&&!k.has(b)&&(k.add(b),m(c+g,a,function(a,b){a=t(e,a);d.insertAfter(f.expressionStatement(f.assignmentExpression("=",a,b)))})))},exit:function(a){var b=a.node,c=b.id;if(null!==c){var d=x(b);if(null!==d&&!q.has(b)){q.add(b);b=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:b,init:f.callExpression(A,[])});a.get("body").unshiftContainer("body",f.expressionStatement(f.callExpression(b,[])));var e=null;a.find(function(a){if(a.parentPath.isBlock())return e=a,!0});
null!==e&&e.insertAfter(f.expressionStatement(f.callExpression(b,w(c,d,e.scope))))}}}},"ArrowFunctionExpression|FunctionExpression":{exit:function(a){var b=a.node,c=x(b);if(null!==c&&!q.has(b)){q.add(b);var d=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:d,init:f.callExpression(A,[])});"BlockStatement"!==a.node.body.type&&(a.node.body=f.blockStatement([f.returnStatement(a.node.body)]));a.get("body").unshiftContainer("body",f.expressionStatement(f.callExpression(d,[])));if("VariableDeclarator"===
a.parent.type){var e=null;a.find(function(a){if(a.parentPath.isBlock())return e=a,!0});null!==e&&e.insertAfter(f.expressionStatement(f.callExpression(d,w(a.parent.id,c,e.scope))))}else[a].concat(D(a)).forEach(function(a){a.replaceWith(f.callExpression(d,w(a.node,c,a.scope)))})}}},VariableDeclaration:function(a){var b=a.node,c="";switch(a.parent.type){case "Program":var d=a;var e=a.parentPath;break;case "TSModuleBlock":d=a;e=d.parentPath.parentPath;break;case "ExportNamedDeclaration":d=a.parentPath;
e=d.parentPath;break;case "ExportDefaultDeclaration":d=a.parentPath;e=d.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==e.type;){if("TSModuleDeclaration"===e.type){if("Program"!==e.parentPath.type&&"ExportNamedDeclaration"!==e.parentPath.type)return;c=e.node.id.name+"$"+c}e=e.parentPath}if(!k.has(b)&&(k.add(b),a=a.get("declarations"),1===a.length)){var g=a[0];m(c+g.node.id.name,g,function(a,b,c){null!==c&&(a=t(e,a),"VariableDeclarator"===
c.parent.type?d.insertAfter(f.expressionStatement(f.assignmentExpression("=",a,g.node.id))):c.replaceWith(f.assignmentExpression("=",a,b)))})}},Program:{enter:function(a){a.traverse(F)},exit:function(a){var b=l.get(a);if(void 0!==b){var c=a.node;if(!B.has(c)){B.add(c);l.delete(a);var d=[];a.pushContainer("body",f.variableDeclaration("var",d));b.forEach(function(b){var c=b.handle;a.pushContainer("body",f.expressionStatement(f.callExpression(E,[c,f.stringLiteral(b.persistentID)])));d.push(f.variableDeclarator(c))})}}}}}}};
/*
React
react-refresh-babel.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'use strict';module.exports=function(u){function v(a,b){var e=a.scope.generateUidIdentifier("c");n.has(a)||n.set(a,[]);n.get(a).push({handle:e,persistentID:b});return e}function w(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function p(a,b,e){var c=b.node;switch(c.type){case "Identifier":if(!w(c.name))break;e(a,c,null);return!0;case "FunctionDeclaration":return e(a,c.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===c.body.type)break;e(a,c,b);return!0;case "FunctionExpression":return e(a,
c,b),!0;case "CallExpression":var d=b.get("arguments");if(void 0===d||0===d.length)break;var f=b.get("callee");switch(f.node.type){case "MemberExpression":case "Identifier":f=f.getSource();if(!p(a+"$"+f,d[0],e))return!1;e(a,c,b);return!0;default:return!1}case "VariableDeclarator":if(d=c.init,null!==d&&(f=c.id.name,w(f))){switch(d.type){case "ArrowFunctionExpression":case "FunctionExpression":break;case "CallExpression":c=d.callee;var h=c.type;if("Import"===h||"Identifier"===h&&(0===c.name.indexOf("require")||
0===c.name.indexOf("import")))return!1;break;case "TaggedTemplateExpression":break;default:return!1}c=b.get("init");if(p(a,c,e))return!0;f=b.scope.getBinding(f);if(void 0===f)return;b=!1;f=f.referencePaths;for(h=0;h<f.length;h++){var k=f[h];if(!k.node||"JSXIdentifier"===k.node.type||"Identifier"===k.node.type){k=k.parent;if("JSXOpeningElement"===k.type)b=!0;else if("CallExpression"===k.type){k=k.callee;var l=void 0;switch(k.type){case "Identifier":l=k.name;break;case "MemberExpression":l=k.property.name}switch(l){case "createElement":case "jsx":case "jsxDEV":case "jsxs":b=
!0}}if(b)return e(a,d,c),!0}}}}return!1}function y(a){a=q.get(a);return void 0===a?null:{key:a.map(function(b){return b.name+"{"+b.key+"}"}).join("\n"),customHooks:a.filter(function(b){a:switch(b.name){case "useState":case "React.useState":case "useReducer":case "React.useReducer":case "useEffect":case "React.useEffect":case "useLayoutEffect":case "React.useLayoutEffect":case "useMemo":case "React.useMemo":case "useCallback":case "React.useCallback":case "useRef":case "React.useRef":case "useContext":case "React.useContext":case "useImperativeHandle":case "React.useImperativeHandle":case "useDebugValue":case "React.useDebugValue":case "useId":case "React.useId":case "useDeferredValue":case "React.useDeferredValue":case "useTransition":case "React.useTransition":case "useInsertionEffect":case "React.useInsertionEffect":case "useSyncExternalStore":case "React.useSyncExternalStore":case "useFormStatus":case "React.useFormStatus":case "useFormState":case "React.useFormState":case "useActionState":case "React.useActionState":case "useOptimistic":case "React.useOptimistic":b=
!0;break a;default:b=!1}return!b}).map(function(b){return g.cloneDeep(b.callee)})}}function D(a){a=a.hub.file;var b=z.get(a);if(void 0!==b)return b;b=!1;for(var e=a.ast.comments,c=0;c<e.length;c++)if(-1!==e[c].value.indexOf("@refresh reset")){b=!0;break}z.set(a,b);return b}function x(a,b,e){var c=b.key;b=b.customHooks;var d=D(e.path),f=[];b.forEach(function(h){switch(h.type){case "MemberExpression":if("Identifier"===h.object.type)var k=h.object.name;break;case "Identifier":k=h.name}e.hasBinding(k)?
f.push(h):d=!0});b=c;"function"!==typeof require||r.emitFullSignatures||(b=require("crypto").createHash("sha1").update(c).digest("base64"));a=[a,g.stringLiteral(b)];(d||0<f.length)&&a.push(g.booleanLiteral(d));0<f.length&&a.push(g.functionExpression(null,[],g.blockStatement([g.returnStatement(g.arrayExpression(f))])));return a}function E(a){for(var b=[];;){if(!a)return b;var e=a.parentPath;if(!e)return b;if("AssignmentExpression"===e.node.type&&a.node===e.node.right)a=e;else if("CallExpression"===
e.node.type&&a.node!==e.node.callee)b.push(e),a=e;else return b}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"===typeof u.env){var A=u.env();if("development"!==A&&!r.skipEnvCheck)throw Error('React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "'+A+'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.');}var g=u.types,F=g.identifier(r.refreshReg||"$RefreshReg$"),B=g.identifier(r.refreshSig||
"$RefreshSig$"),n=new Map,z=new WeakMap,m=new WeakSet,t=new WeakSet,C=new WeakSet,q=new WeakMap,G={CallExpression:function(a){var b=a.node.callee,e=null;switch(b.type){case "Identifier":e=b.name;break;case "MemberExpression":e=b.property.name}if(null!==e&&/^use[A-Z]/.test(e)&&(b=a.scope.getFunctionParent(),null!==b)){b=b.block;q.has(b)||q.set(b,[]);b=q.get(b);var c="";"VariableDeclarator"===a.parent.type&&(c=a.parentPath.get("id").getSource());var d=a.get("arguments");"useState"===e&&0<d.length?c+=
"("+d[0].getSource()+")":"useReducer"===e&&1<d.length&&(c+="("+d[1].getSource()+")");b.push({callee:a.node.callee,name:e,key:c})}}};return{visitor:{ExportDefaultDeclaration:function(a){var b=a.node,e=b.declaration,c=a.get("declaration");if("CallExpression"===e.type&&!m.has(b)){m.add(b);var d=a.parentPath;p("%default%",c,function(f,h,k){null!==k&&(f=v(d,f),k.replaceWith(g.assignmentExpression("=",f,h)))})}},FunctionDeclaration:{enter:function(a){var b=a.node,e="";switch(a.parent.type){case "Program":var c=
a;var d=a.parentPath;break;case "TSModuleBlock":c=a;d=c.parentPath.parentPath;break;case "ExportNamedDeclaration":c=a.parentPath;d=c.parentPath;break;case "ExportDefaultDeclaration":c=a.parentPath;d=c.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==d.type;){if("TSModuleDeclaration"===d.type){if("Program"!==d.parentPath.type&&"ExportNamedDeclaration"!==d.parentPath.type)return;e=d.node.id.name+"$"+e}d=d.parentPath}var f=
b.id;null!==f&&(f=f.name,w(f)&&!m.has(b)&&(m.add(b),p(e+f,a,function(h,k){h=v(d,h);c.insertAfter(g.expressionStatement(g.assignmentExpression("=",h,k)))})))},exit:function(a){var b=a.node,e=b.id;if(null!==e){var c=y(b);if(null!==c&&!t.has(b)){t.add(b);b=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:b,init:g.callExpression(B,[])});a.get("body").unshiftContainer("body",g.expressionStatement(g.callExpression(b,[])));var d=null;a.find(function(f){if(f.parentPath.isBlock())return d=f,!0});
null!==d&&d.insertAfter(g.expressionStatement(g.callExpression(b,x(e,c,d.scope))))}}}},"ArrowFunctionExpression|FunctionExpression":{exit:function(a){var b=a.node,e=y(b);if(null!==e&&!t.has(b)){t.add(b);var c=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:c,init:g.callExpression(B,[])});"BlockStatement"!==a.node.body.type&&(a.node.body=g.blockStatement([g.returnStatement(a.node.body)]));a.get("body").unshiftContainer("body",g.expressionStatement(g.callExpression(c,[])));if("VariableDeclarator"===
a.parent.type){var d=null;a.find(function(f){if(f.parentPath.isBlock())return d=f,!0});null!==d&&d.insertAfter(g.expressionStatement(g.callExpression(c,x(a.parent.id,e,d.scope))))}else[a].concat(E(a)).forEach(function(f){f.replaceWith(g.callExpression(c,x(f.node,e,f.scope)))})}}},VariableDeclaration:function(a){var b=a.node,e="";switch(a.parent.type){case "Program":var c=a;var d=a.parentPath;break;case "TSModuleBlock":c=a;d=c.parentPath.parentPath;break;case "ExportNamedDeclaration":c=a.parentPath;
d=c.parentPath;break;case "ExportDefaultDeclaration":c=a.parentPath;d=c.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==d.type;){if("TSModuleDeclaration"===d.type){if("Program"!==d.parentPath.type&&"ExportNamedDeclaration"!==d.parentPath.type)return;e=d.node.id.name+"$"+e}d=d.parentPath}if(!m.has(b)&&(m.add(b),a=a.get("declarations"),1===a.length)){var f=a[0];p(e+f.node.id.name,f,function(h,k,l){null!==l&&(h=v(d,h),"VariableDeclarator"===
l.parent.type?c.insertAfter(g.expressionStatement(g.assignmentExpression("=",h,f.node.id))):l.replaceWith(g.assignmentExpression("=",h,k)))})}},Program:{enter:function(a){a.traverse(G)},exit:function(a){var b=n.get(a);if(void 0!==b){var e=a.node;if(!C.has(e)){C.add(e);n.delete(a);var c=[];a.pushContainer("body",g.variableDeclaration("var",c));b.forEach(function(d){var f=d.handle;a.pushContainer("body",g.expressionStatement(g.callExpression(F,[f,g.stringLiteral(d.persistentID)])));c.push(g.variableDeclarator(f))})}}}}}}};
//# sourceMappingURL=react-refresh-babel.production.min.js.map

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -29,3 +29,2 @@ * This source code is licensed under the MIT license found in the

// that have actually been edited here. This keeps checks fast.
// $FlowIssue

@@ -45,6 +44,4 @@ var updatedFamiliesByType = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call.

// If there is no WeakMap, we won't attempt to do retrying.
// $FlowIssue
var rootElements = // $FlowIssue
typeof WeakMap === 'function' ? new WeakMap() : null;
var rootElements = typeof WeakMap === 'function' ? new WeakMap() : null;
var isPerformingRefresh = false;

@@ -51,0 +48,0 @@

@@ -1,10 +0,12 @@

/**
* @license React
* react-refresh-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
React
react-refresh-runtime.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'use strict';throw Error("React Refresh runtime should not be included in the production bundle.");
//# sourceMappingURL=react-refresh-runtime.production.min.js.map

@@ -7,4 +7,4 @@ {

],
"version": "0.0.0-experimental-357a61324-20220516",
"homepage": "https://reactjs.org/",
"version": "0.0.0-experimental-36e62c603-20240418",
"homepage": "https://react.dev/",
"bugs": "https://github.com/facebook/react/issues",

@@ -17,4 +17,3 @@ "license": "MIT",

"runtime.js",
"cjs/",
"umd/"
"cjs/"
],

@@ -21,0 +20,0 @@ "main": "runtime.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc