Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-context-selector

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-context-selector - npm Package Compare versions

Comparing version 2.0.0-alpha.5 to 2.0.0-alpha.6

2

dist/index.modern.js

@@ -1,2 +0,2 @@

import{createMutableSource as e,createContext as r,memo as t,useContext as n,useCallback as o,useMutableSource as c,useRef as u,useMemo as s,createElement as i,useLayoutEffect as a,useEffect as d}from"react";import{unstable_runWithPriority as f,unstable_NormalPriority as l,unstable_UserBlockingPriority as v}from"scheduler";const p="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?d:a,w=Symbol(),m=Symbol(),h=new WeakMap,g=e=>e;function x(n){const o=e({current:n},()=>n),c=r({[w]:o});var a;return c.Provider=(a=c.Provider,t(({value:r,children:t})=>{const n=u({v:r,l:new Set});p(()=>{n.current.v=r,f(l,()=>{n.current.l.forEach(e=>e())})});const o=s(()=>({[w]:e(n,()=>n.current.v)}),[]);return i(a,{value:o},t)})),delete c.Consumer,c}const S=(e,r)=>{const t=e.current.l;return t.add(r),()=>t.delete(r)};function y(e,r=g){const{[w]:t}=n(e);if("production"!==process.env.NODE_ENV&&!t)throw new Error("This useContext requires special context for selector support");const u=o(e=>{const t=r(e.current.v);if("function"==typeof t){if(h.has(t))return h.get(t);const e={[m]:t};return h.set(t,e),e}return t},[r]),s=c(t,u,S);return s&&s[m]?s[m]:s}function C(e){return(...r)=>f(v,()=>e(...r))}export{x as createContext,y as useContext,C as wrapCallbackWithPriority};
import{unstable_createMutableSource as e,createContext as r,memo as t,useContext as n,useCallback as o,unstable_useMutableSource as c,useRef as u,useMemo as s,createElement as i,useLayoutEffect as a,useEffect as d}from"react";import{unstable_runWithPriority as f,unstable_NormalPriority as l,unstable_UserBlockingPriority as v}from"scheduler";const p="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?d:a,w=Symbol(),m=Symbol(),h=new WeakMap,g=e=>e;function x(n){const o=e({current:n},()=>n),c=r({[w]:o});var a;return c.Provider=(a=c.Provider,t(({value:r,children:t})=>{const n=u({v:r,l:new Set});p(()=>{n.current.v=r,f(l,()=>{n.current.l.forEach(e=>e())})});const o=s(()=>({[w]:e(n,()=>n.current.v)}),[]);return i(a,{value:o},t)})),delete c.Consumer,c}const S=(e,r)=>{const t=e.current.l;return t.add(r),()=>t.delete(r)};function y(e,r=g){const{[w]:t}=n(e);if("production"!==process.env.NODE_ENV&&!t)throw new Error("This useContext requires special context for selector support");const u=o(e=>{const t=r(e.current.v);if("function"==typeof t){if(h.has(t))return h.get(t);const e={[m]:t};return h.set(t,e),e}return t},[r]),s=c(t,u,S);return s&&s[m]?s[m]:s}function C(e){return(...r)=>f(v,()=>e(...r))}export{x as createContext,y as useContext,C as wrapCallbackWithPriority};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("scheduler")):"function"==typeof define&&define.amd?define(["exports","react","scheduler"],r):r((e=e||self).useContextSelector={},e.react,e.scheduler)}(this,function(e,r,t){var n="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?r.useEffect:r.useLayoutEffect,u=Symbol(),o=Symbol(),i=new WeakMap,c=function(e){return e},a=function(e,r){var t=e.current.l;return t.add(r),function(){return t.delete(r)}};e.createContext=function(e){var o,i,c=r.createMutableSource({current:e},function(){return e}),a=r.createContext(((o={})[u]=c,o));return a.Provider=(i=a.Provider,r.memo(function(e){var o,c=e.value,a=e.children,f=r.useRef(((o={}).v=c,o.l=new Set,o));n(function(){f.current.v=c,t.unstable_runWithPriority(t.unstable_NormalPriority,function(){f.current.l.forEach(function(e){return e()})})});var l=r.useMemo(function(){var e;return(e={})[u]=r.createMutableSource(f,function(){return f.current.v}),e},[]);return r.createElement(i,{value:l},a)})),delete a.Consumer,a},e.useContext=function(e,t){void 0===t&&(t=c);var n=r.useContext(e)[u];if("production"!==process.env.NODE_ENV&&!n)throw new Error("This useContext requires special context for selector support");var f=r.useCallback(function(e){var r=t(e.current.v);if("function"==typeof r){var n;if(i.has(r))return i.get(r);var u=((n={})[o]=r,n);return i.set(r,u),u}return r},[t]),l=r.useMutableSource(n,f,a);return l&&l[o]?l[o]:l},e.wrapCallbackWithPriority=function(e){return function(){var r=arguments;return t.unstable_runWithPriority(t.unstable_UserBlockingPriority,function(){return e.apply(void 0,[].slice.call(r))})}}});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("scheduler")):"function"==typeof define&&define.amd?define(["exports","react","scheduler"],r):r((e=e||self).useContextSelector={},e.react,e.scheduler)}(this,function(e,r,t){var n="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?r.useEffect:r.useLayoutEffect,u=Symbol(),o=Symbol(),i=new WeakMap,c=function(e){return e},a=function(e,r){var t=e.current.l;return t.add(r),function(){return t.delete(r)}};e.createContext=function(e){var o,i,c=r.unstable_createMutableSource({current:e},function(){return e}),a=r.createContext(((o={})[u]=c,o));return a.Provider=(i=a.Provider,r.memo(function(e){var o,c=e.value,a=e.children,f=r.useRef(((o={}).v=c,o.l=new Set,o));n(function(){f.current.v=c,t.unstable_runWithPriority(t.unstable_NormalPriority,function(){f.current.l.forEach(function(e){return e()})})});var l=r.useMemo(function(){var e;return(e={})[u]=r.unstable_createMutableSource(f,function(){return f.current.v}),e},[]);return r.createElement(i,{value:l},a)})),delete a.Consumer,a},e.useContext=function(e,t){void 0===t&&(t=c);var n=r.useContext(e)[u];if("production"!==process.env.NODE_ENV&&!n)throw new Error("This useContext requires special context for selector support");var f=r.useCallback(function(e){var r=t(e.current.v);if("function"==typeof r){var n;if(i.has(r))return i.get(r);var u=((n={})[o]=r,n);return i.set(r,u),u}return r},[t]),l=r.unstable_useMutableSource(n,f,a);return l&&l[o]?l[o]:l},e.wrapCallbackWithPriority=function(e){return function(){var r=arguments;return t.unstable_runWithPriority(t.unstable_UserBlockingPriority,function(){return e.apply(void 0,[].slice.call(r))})}}});
//# sourceMappingURL=index.umd.js.map
{
"name": "use-context-selector",
"description": "React useContext with selector support in userland",
"version": "2.0.0-alpha.5",
"version": "2.0.0-alpha.6",
"publishConfig": {

@@ -40,19 +40,19 @@ "tag": "next"

"devDependencies": {
"@testing-library/react": "^10.4.3",
"@types/jest": "^26.0.3",
"@types/react": "^16.9.41",
"@testing-library/react": "^10.4.7",
"@types/jest": "^26.0.8",
"@types/react": "^16.9.44",
"@types/react-dom": "^16.9.8",
"@types/scheduler": "^0.16.1",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"documentation": "^13.0.2",
"eslint": "^7.3.1",
"eslint": "^7.6.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.5",
"eslint-plugin-react": "^7.20.5",
"eslint-plugin-react-hooks": "^4.0.8",
"html-webpack-plugin": "^4.3.0",
"jest": "^26.1.0",
"microbundle": "^0.12.2",
"jest": "^26.2.2",
"microbundle": "^0.12.3",
"npm-run-all": "^4.1.5",

@@ -62,6 +62,6 @@ "react": "experimental",

"scheduler": "experimental",
"ts-jest": "^26.1.1",
"ts-loader": "^7.0.5",
"typescript": "^3.9.6",
"webpack": "^4.43.0",
"ts-jest": "^26.1.4",
"ts-loader": "^8.0.2",
"typescript": "^3.9.7",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",

@@ -68,0 +68,0 @@ "webpack-dev-server": "^3.11.0"

@@ -12,3 +12,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

// @ts-ignore
createMutableSource,
unstable_createMutableSource as createMutableSource,
memo,

@@ -21,3 +21,3 @@ useCallback,

// @ts-ignore
useMutableSource,
unstable_useMutableSource as useMutableSource,
useRef,

@@ -24,0 +24,0 @@ } from 'react';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc