Skip to content

Instantly share code, notes, and snippets.

@t3dotgg
Created April 6, 2021 03:05
Show Gist options
  • Save t3dotgg/68d827bf2f39db59bd9a14026d22929e to your computer and use it in GitHub Desktop.
Save t3dotgg/68d827bf2f39db59bd9a14026d22929e to your computer and use it in GitHub Desktop.
diff --git a/node_modules/pubnub-react/.DS_Store b/node_modules/pubnub-react/.DS_Store
new file mode 100644
index 0000000..c31aa91
Binary files /dev/null and b/node_modules/pubnub-react/.DS_Store differ
diff --git a/node_modules/pubnub-react/dist/.DS_Store b/node_modules/pubnub-react/dist/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/node_modules/pubnub-react/dist/.DS_Store differ
diff --git a/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js b/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js
index 8017ac7..20b50d8 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js
+++ b/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js
@@ -4,7 +4,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
var React = require('react');
var React__default = _interopDefault(React);
-var invariant = _interopDefault(require('ts-invariant'));
var PubNubContext =
/*#__PURE__*/
@@ -24,7 +23,11 @@ var PubNubProvider = function PubNubProvider(_ref) {
client: client
};
}, [client]);
- !contextValue.client ? invariant(false, 'PubNubProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.') : void 0;
+
+ if (!contextValue.client) {
+ throw new Error('PubNubProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
+ }
+
React__default.useEffect(function () {
appendPnsdk(contextValue.client);
}, []);
@@ -36,13 +39,21 @@ var PubNubProvider = function PubNubProvider(_ref) {
var PubNubConsumer = function PubNubConsumer(_ref) {
var children = _ref.children;
var context = React__default.useContext(PubNubContext);
- !(context && context.client) ? invariant(false, 'Could not find "client" in the context of PubNubConsumer. ' + 'Wrap the root component in an <PubNubProvider>.') : void 0;
+
+ if (!context || !context.client) {
+ throw new Error('Could not find "client" in the context of PubNubConsumer. ' + 'Wrap the root component in an <PubNubProvider>.');
+ }
+
return React__default.createElement(React__default.Fragment, null, children(context.client));
};
function usePubNub() {
var context = React.useContext(PubNubContext);
- !(context && context.client) ? invariant(false, 'No PubNub Client instance can be found. Please ensure that you ' + 'have called `PubNubProvider` higher up in your tree.') : void 0;
+
+ if (!context || !context.client) {
+ throw new Error('No PubNub Client instance can be found. Please ensure that you ' + 'have called `PubNubProvider` higher up in your tree.');
+ }
+
return context.client;
}
diff --git a/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js.map b/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js.map
index 991b152..3ab4c75 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js.map
+++ b/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js.map
@@ -1 +1 @@
-{"version":3,"file":"pubnub-react.cjs.development.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubProvider.tsx","../src/context/PubNubConsumer.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n invariant(\n contextValue.client,\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n\n return <>{children(context!.client)}</>;\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","appendPnsdk","pubnub","_addPnsdkSuffix","PubNubProvider","client","children","contextValue","useMemo","invariant","useEffect","Provider","value","PubNubConsumer","context","useContext","usePubNub"],"mappings":";;;;;;;;AAOO,IAAMA,aAAa;;AAAGC,cAAK,CAACC,aAAN,CAC3B,IAD2B,CAAtB;;ACIP,SAASC,WAAT,CAAqBC,MAArB;MACM,OAAOA,MAAM,CAACC,eAAd,KAAkC,UAAtC,EAAkD;IAChDD,MAAM,CAACC,eAAP,CAAuB,aAAvB;;;;AAIJ,IAAaC,cAAc,GAA0C,SAAxDA,cAAwD;MACnEC,cAAAA;MACAC,gBAAAA;MAEMC,YAAY,GAAGR,cAAK,CAACS,OAAN,CAAc;WAC1B;MAAEH,MAAM,EAANA;KAAT;GADmB,EAElB,CAACA,MAAD,CAFkB,CAArB;GAKEE,YAAY,CAACF,MADf,IAAAI,SAAS,QAEP,2DACE,qDAHK,CAAT,CAAA;EAMAV,cAAK,CAACW,SAAN,CAAgB;IACdT,WAAW,CAACM,YAAY,CAACF,MAAd,CAAX;GADF,EAEG,EAFH;SAKEN,4BAAA,CAACD,aAAa,CAACa,QAAf;IAAwBC,KAAK,EAAEL;GAA/B,EACGD,QADH,CADF;CAlBK;;ICPMO,cAAc,GAAkC,SAAhDA,cAAgD;MAAGP,gBAAAA;MACxDQ,OAAO,GAAGf,cAAK,CAACgB,UAAN,CAAiBjB,aAAjB,CAAhB;IAGEgB,OAAO,IAAIA,OAAO,CAACT,MADrB,KAAAI,SAAS,QAEP,+DACE,iDAHK,CAAT,CAAA;SAMOV,4BAAA,wBAAA,MAAA,EAAGO,QAAQ,CAACQ,OAAQ,CAACT,MAAV,CAAX,CAAP;CATK;;SCJSW;MACRF,OAAO,GAAGC,gBAAU,CAACjB,aAAD,CAA1B;IAGEgB,OAAO,IAAIA,OAAO,CAACT,MADrB,KAAAI,SAAS,QAEP,oEACE,sDAHK,CAAT,CAAA;SAMOK,OAAQ,CAACT,MAAhB;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"pubnub-react.cjs.development.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubProvider.tsx","../src/context/PubNubConsumer.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n if (!contextValue.client) {\n throw new Error(\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n }\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n }\n\n return <>{children(context!.client)}</>;\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n }\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","appendPnsdk","pubnub","_addPnsdkSuffix","PubNubProvider","client","children","contextValue","useMemo","Error","useEffect","Provider","value","PubNubConsumer","context","useContext","usePubNub"],"mappings":";;;;;;;AAOO,IAAMA,aAAa;;AAAGC,cAAK,CAACC,aAAN,CAC3B,IAD2B,CAAtB;;ACGP,SAASC,WAAT,CAAqBC,MAArB;MACM,OAAOA,MAAM,CAACC,eAAd,KAAkC,UAAtC,EAAkD;IAChDD,MAAM,CAACC,eAAP,CAAuB,aAAvB;;;;AAIJ,IAAaC,cAAc,GAA0C,SAAxDA,cAAwD;MACnEC,cAAAA;MACAC,gBAAAA;MAEMC,YAAY,GAAGR,cAAK,CAACS,OAAN,CAAc;WAC1B;MAAEH,MAAM,EAANA;KAAT;GADmB,EAElB,CAACA,MAAD,CAFkB,CAArB;;MAII,CAACE,YAAY,CAACF,MAAlB,EAA0B;UAClB,IAAII,KAAJ,CACJ,2DACE,qDAFE,CAAN;;;EAMFV,cAAK,CAACW,SAAN,CAAgB;IACdT,WAAW,CAACM,YAAY,CAACF,MAAd,CAAX;GADF,EAEG,EAFH;SAKEN,4BAAA,CAACD,aAAa,CAACa,QAAf;IAAwBC,KAAK,EAAEL;GAA/B,EACGD,QADH,CADF;CAnBK;;ICRMO,cAAc,GAAkC,SAAhDA,cAAgD;MAAGP,gBAAAA;MACxDQ,OAAO,GAAGf,cAAK,CAACgB,UAAN,CAAiBjB,aAAjB,CAAhB;;MAEI,CAACgB,OAAD,IAAY,CAACA,OAAO,CAACT,MAAzB,EAAiC;UACzB,IAAII,KAAJ,CACJ,+DACE,iDAFE,CAAN;;;SAMKV,4BAAA,wBAAA,MAAA,EAAGO,QAAQ,CAACQ,OAAQ,CAACT,MAAV,CAAX,CAAP;CAVK;;SCHSW;MACRF,OAAO,GAAGC,gBAAU,CAACjB,aAAD,CAA1B;;MAEI,CAACgB,OAAD,IAAY,CAACA,OAAO,CAACT,MAAzB,EAAiC;UACzB,IAAII,KAAJ,CACJ,oEACE,sDAFE,CAAN;;;SAMKK,OAAQ,CAACT,MAAhB;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js b/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js
index 56223d3..e303f4b 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js
+++ b/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js
@@ -1,2 +1,2 @@
-"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=e(t),r=e(require("ts-invariant")),u=n.createContext(null);exports.PubNubConsumer=function(e){var t=e.children,i=n.useContext(u);return i&&i.client||r(!1),n.createElement(n.Fragment,null,t(i.client))},exports.PubNubProvider=function(e){var t=e.client,i=e.children,c=n.useMemo(function(){return{client:t}},[t]);return c.client||r(!1),n.useEffect(function(){var e;"function"==typeof(e=c.client)._addPnsdkSuffix&&e._addPnsdkSuffix("React/2.1.0")},[]),n.createElement(u.Provider,{value:c},i)},exports.usePubNub=function(){var e=t.useContext(u);return e&&e.client||r(!1),e.client};
+"use strict";var e,n=require("react"),t=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,r=t.createContext(null);exports.PubNubConsumer=function(e){var n=e.children,u=t.useContext(r);if(!u||!u.client)throw new Error('Could not find "client" in the context of PubNubConsumer. Wrap the root component in an <PubNubProvider>.');return t.createElement(t.Fragment,null,n(u.client))},exports.PubNubProvider=function(e){var n=e.client,u=e.children,o=t.useMemo(function(){return{client:n}},[n]);if(!o.client)throw new Error('PubNubProvider was not passed a client instance. Make sure you pass in your client via the "client" prop.');return t.useEffect(function(){var e;"function"==typeof(e=o.client)._addPnsdkSuffix&&e._addPnsdkSuffix("React/2.1.0")},[]),t.createElement(r.Provider,{value:o},u)},exports.usePubNub=function(){var e=n.useContext(r);if(!e||!e.client)throw new Error("No PubNub Client instance can be found. Please ensure that you have called `PubNubProvider` higher up in your tree.");return e.client};
//# sourceMappingURL=pubnub-react.cjs.production.min.js.map
diff --git a/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js.map b/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js.map
index d81bd9b..5b94f93 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js.map
+++ b/node_modules/pubnub-react/dist/pubnub-react.cjs.production.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"pubnub-react.cjs.production.min.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubConsumer.tsx","../src/context/PubNubProvider.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n\n return <>{children(context!.client)}</>;\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n invariant(\n contextValue.client,\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","children","context","useContext","client","invariant","contextValue","useMemo","useEffect","pubnub","_addPnsdkSuffix","Provider","value"],"mappings":"8IAOaA,EAAgBC,EAAMC,cACjC,6BCE2D,gBAAGC,IAAAA,SACxDC,EAAUH,EAAMI,WAAWL,UAG/BI,GAAWA,EAAQE,QADrBC,MAMON,gCAAGE,EAASC,EAASE,iCCFuC,gBACnEA,IAAAA,OACAH,IAAAA,SAEMK,EAAeP,EAAMQ,QAAQ,iBAC1B,CAAEH,OAAAA,IACR,CAACA,WAGFE,EAAaF,QADfC,MAMAN,EAAMS,UAAU,WApBlB,IAAqBC,EACmB,mBADnBA,EAqBLH,EAAaF,QApBTM,iBAChBD,EAAOC,gBAAgB,gBAoBtB,IAGDX,gBAACD,EAAca,UAASC,MAAON,GAC5BL,qCC9BCC,EAAUC,aAAWL,UAGzBI,GAAWA,EAAQE,QADrBC,MAMOH,EAASE"}
\ No newline at end of file
+{"version":3,"file":"pubnub-react.cjs.production.min.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubConsumer.tsx","../src/context/PubNubProvider.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n }\n\n return <>{children(context!.client)}</>;\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n if (!contextValue.client) {\n throw new Error(\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n }\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n }\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","children","context","useContext","client","Error","contextValue","useMemo","useEffect","pubnub","_addPnsdkSuffix","Provider","value"],"mappings":"6FAOaA,EAAgBC,EAAMC,cACjC,6BCA2D,gBAAGC,IAAAA,SACxDC,EAAUH,EAAMI,WAAWL,OAE5BI,IAAYA,EAAQE,aACjB,IAAIC,MACR,oHAKGN,gCAAGE,EAASC,EAASE,iCCFuC,gBACnEA,IAAAA,OACAH,IAAAA,SAEMK,EAAeP,EAAMQ,QAAQ,iBAC1B,CAAEH,OAAAA,IACR,CAACA,QAECE,EAAaF,aACV,IAAIC,MACR,oHAKJN,EAAMS,UAAU,WArBlB,IAAqBC,EACmB,mBADnBA,EAsBLH,EAAaF,QArBTM,iBAChBD,EAAOC,gBAAgB,gBAqBtB,IAGDX,gBAACD,EAAca,UAASC,MAAON,GAC5BL,qCC/BCC,EAAUC,aAAWL,OAEtBI,IAAYA,EAAQE,aACjB,IAAIC,MACR,8HAKGH,EAASE"}
\ No newline at end of file
diff --git a/node_modules/pubnub-react/dist/pubnub-react.esm.js b/node_modules/pubnub-react/dist/pubnub-react.esm.js
index c2a7ea5..9dffab7 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.esm.js
+++ b/node_modules/pubnub-react/dist/pubnub-react.esm.js
@@ -1,5 +1,4 @@
import React, { useContext } from 'react';
-import invariant from 'ts-invariant';
var PubNubContext =
/*#__PURE__*/
@@ -19,7 +18,11 @@ var PubNubProvider = function PubNubProvider(_ref) {
client: client
};
}, [client]);
- !contextValue.client ? process.env.NODE_ENV !== "production" ? invariant(false, 'PubNubProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.') : invariant(false) : void 0;
+
+ if (!contextValue.client) {
+ throw new Error('PubNubProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
+ }
+
React.useEffect(function () {
appendPnsdk(contextValue.client);
}, []);
@@ -31,13 +34,21 @@ var PubNubProvider = function PubNubProvider(_ref) {
var PubNubConsumer = function PubNubConsumer(_ref) {
var children = _ref.children;
var context = React.useContext(PubNubContext);
- !(context && context.client) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find "client" in the context of PubNubConsumer. ' + 'Wrap the root component in an <PubNubProvider>.') : invariant(false) : void 0;
+
+ if (!context || !context.client) {
+ throw new Error('Could not find "client" in the context of PubNubConsumer. ' + 'Wrap the root component in an <PubNubProvider>.');
+ }
+
return React.createElement(React.Fragment, null, children(context.client));
};
function usePubNub() {
var context = useContext(PubNubContext);
- !(context && context.client) ? process.env.NODE_ENV !== "production" ? invariant(false, 'No PubNub Client instance can be found. Please ensure that you ' + 'have called `PubNubProvider` higher up in your tree.') : invariant(false) : void 0;
+
+ if (!context || !context.client) {
+ throw new Error('No PubNub Client instance can be found. Please ensure that you ' + 'have called `PubNubProvider` higher up in your tree.');
+ }
+
return context.client;
}
diff --git a/node_modules/pubnub-react/dist/pubnub-react.esm.js.map b/node_modules/pubnub-react/dist/pubnub-react.esm.js.map
index 8b1269a..9cde75e 100644
--- a/node_modules/pubnub-react/dist/pubnub-react.esm.js.map
+++ b/node_modules/pubnub-react/dist/pubnub-react.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"pubnub-react.esm.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubProvider.tsx","../src/context/PubNubConsumer.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n invariant(\n contextValue.client,\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n\n return <>{children(context!.client)}</>;\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\nimport invariant from 'ts-invariant';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n invariant(\n context && context.client,\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","appendPnsdk","pubnub","_addPnsdkSuffix","PubNubProvider","client","children","contextValue","useMemo","invariant","useEffect","Provider","value","PubNubConsumer","context","useContext","usePubNub"],"mappings":";;;AAOO,IAAMA,aAAa;;AAAGC,KAAK,CAACC,aAAN,CAC3B,IAD2B,CAAtB;;ACIP,SAASC,WAAT,CAAqBC,MAArB;MACM,OAAOA,MAAM,CAACC,eAAd,KAAkC,UAAtC,EAAkD;IAChDD,MAAM,CAACC,eAAP,CAAuB,aAAvB;;;;AAIJ,IAAaC,cAAc,GAA0C,SAAxDA,cAAwD;MACnEC,cAAAA;MACAC,gBAAAA;MAEMC,YAAY,GAAGR,KAAK,CAACS,OAAN,CAAc;WAC1B;MAAEH,MAAM,EAANA;KAAT;GADmB,EAElB,CAACA,MAAD,CAFkB,CAArB;GAKEE,YAAY,CAACF,MADf,2CAAAI,SAAS,QAEP,2DACE,qDAHK,CAAT,GAAAA,SAAS,OAAT;EAMAV,KAAK,CAACW,SAAN,CAAgB;IACdT,WAAW,CAACM,YAAY,CAACF,MAAd,CAAX;GADF,EAEG,EAFH;SAKEN,mBAAA,CAACD,aAAa,CAACa,QAAf;IAAwBC,KAAK,EAAEL;GAA/B,EACGD,QADH,CADF;CAlBK;;ICPMO,cAAc,GAAkC,SAAhDA,cAAgD;MAAGP,gBAAAA;MACxDQ,OAAO,GAAGf,KAAK,CAACgB,UAAN,CAAiBjB,aAAjB,CAAhB;IAGEgB,OAAO,IAAIA,OAAO,CAACT,MADrB,4CAAAI,SAAS,QAEP,+DACE,iDAHK,CAAT,GAAAA,SAAS,OAAT;SAMOV,mBAAA,eAAA,MAAA,EAAGO,QAAQ,CAACQ,OAAQ,CAACT,MAAV,CAAX,CAAP;CATK;;SCJSW;MACRF,OAAO,GAAGC,UAAU,CAACjB,aAAD,CAA1B;IAGEgB,OAAO,IAAIA,OAAO,CAACT,MADrB,4CAAAI,SAAS,QAEP,oEACE,sDAHK,CAAT,GAAAA,SAAS,OAAT;SAMOK,OAAQ,CAACT,MAAhB;;;;;"}
\ No newline at end of file
+{"version":3,"file":"pubnub-react.esm.js","sources":["../src/context/PubNubContext.tsx","../src/context/PubNubProvider.tsx","../src/context/PubNubConsumer.tsx","../src/hooks/usePubNub.ts"],"sourcesContent":["import React from 'react';\nimport PubNub from 'pubnub';\n\nexport interface PubNubContextValue {\n client: PubNub;\n}\n\nexport const PubNubContext = React.createContext<PubNubContextValue | null>(\n null\n);\n","import React from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubProviderProps<PubNubInstance> {\n client: PubNubInstance;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nfunction appendPnsdk(pubnub: any) {\n if (typeof pubnub._addPnsdkSuffix === 'function') {\n pubnub._addPnsdkSuffix('React/__VERSION__');\n }\n}\n\nexport const PubNubProvider: React.FC<PubNubProviderProps<PubNub>> = ({\n client,\n children,\n}) => {\n const contextValue = React.useMemo(() => {\n return { client };\n }, [client]);\n\n if (!contextValue.client) {\n throw new Error(\n 'PubNubProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n }\n\n React.useEffect(() => {\n appendPnsdk(contextValue.client);\n }, []);\n\n return (\n <PubNubContext.Provider value={contextValue}>\n {children}\n </PubNubContext.Provider>\n );\n};\n","import React from 'react';\nimport PubNub from 'pubnub';\nimport { PubNubContext } from './PubNubContext';\n\nexport interface PubNubConsumerProps {\n children: (client: PubNub) => React.ReactChild | null;\n}\n\nexport const PubNubConsumer: React.FC<PubNubConsumerProps> = ({ children }) => {\n const context = React.useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'Could not find \"client\" in the context of PubNubConsumer. ' +\n 'Wrap the root component in an <PubNubProvider>.'\n );\n }\n\n return <>{children(context!.client)}</>;\n};\n","import { useContext } from 'react';\nimport PubNub from 'pubnub';\n\nimport { PubNubContext } from '../context/PubNubContext';\n\nexport function usePubNub(): PubNub {\n const context = useContext(PubNubContext);\n\n if (!context || !context.client) {\n throw new Error(\n 'No PubNub Client instance can be found. Please ensure that you ' +\n 'have called `PubNubProvider` higher up in your tree.'\n );\n }\n\n return context!.client;\n}\n"],"names":["PubNubContext","React","createContext","appendPnsdk","pubnub","_addPnsdkSuffix","PubNubProvider","client","children","contextValue","useMemo","Error","useEffect","Provider","value","PubNubConsumer","context","useContext","usePubNub"],"mappings":";;AAOO,IAAMA,aAAa;;AAAGC,KAAK,CAACC,aAAN,CAC3B,IAD2B,CAAtB;;ACGP,SAASC,WAAT,CAAqBC,MAArB;MACM,OAAOA,MAAM,CAACC,eAAd,KAAkC,UAAtC,EAAkD;IAChDD,MAAM,CAACC,eAAP,CAAuB,aAAvB;;;;AAIJ,IAAaC,cAAc,GAA0C,SAAxDA,cAAwD;MACnEC,cAAAA;MACAC,gBAAAA;MAEMC,YAAY,GAAGR,KAAK,CAACS,OAAN,CAAc;WAC1B;MAAEH,MAAM,EAANA;KAAT;GADmB,EAElB,CAACA,MAAD,CAFkB,CAArB;;MAII,CAACE,YAAY,CAACF,MAAlB,EAA0B;UAClB,IAAII,KAAJ,CACJ,2DACE,qDAFE,CAAN;;;EAMFV,KAAK,CAACW,SAAN,CAAgB;IACdT,WAAW,CAACM,YAAY,CAACF,MAAd,CAAX;GADF,EAEG,EAFH;SAKEN,mBAAA,CAACD,aAAa,CAACa,QAAf;IAAwBC,KAAK,EAAEL;GAA/B,EACGD,QADH,CADF;CAnBK;;ICRMO,cAAc,GAAkC,SAAhDA,cAAgD;MAAGP,gBAAAA;MACxDQ,OAAO,GAAGf,KAAK,CAACgB,UAAN,CAAiBjB,aAAjB,CAAhB;;MAEI,CAACgB,OAAD,IAAY,CAACA,OAAO,CAACT,MAAzB,EAAiC;UACzB,IAAII,KAAJ,CACJ,+DACE,iDAFE,CAAN;;;SAMKV,mBAAA,eAAA,MAAA,EAAGO,QAAQ,CAACQ,OAAQ,CAACT,MAAV,CAAX,CAAP;CAVK;;SCHSW;MACRF,OAAO,GAAGC,UAAU,CAACjB,aAAD,CAA1B;;MAEI,CAACgB,OAAD,IAAY,CAACA,OAAO,CAACT,MAAzB,EAAiC;UACzB,IAAII,KAAJ,CACJ,oEACE,sDAFE,CAAN;;;SAMKK,OAAQ,CAACT,MAAhB;;;;;"}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment