UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 5.32 kB
{"ast":null,"code":"import invariant from 'fbjs/lib/invariant';\nimport * as React from 'react';\nexport default class StateSafePureComponent extends React.PureComponent {\n constructor(props) {\n super(props);\n this._inAsyncStateUpdate = false;\n this._installSetStateHooks();\n }\n setState(partialState, callback) {\n if (typeof partialState === 'function') {\n super.setState((state, props) => {\n this._inAsyncStateUpdate = true;\n var ret;\n try {\n ret = partialState(state, props);\n } catch (err) {\n throw err;\n } finally {\n this._inAsyncStateUpdate = false;\n }\n return ret;\n }, callback);\n } else {\n super.setState(partialState, callback);\n }\n }\n _installSetStateHooks() {\n var that = this;\n var props = this.props,\n state = this.state;\n Object.defineProperty(this, 'props', {\n get() {\n invariant(!that._inAsyncStateUpdate, '\"this.props\" should not be accessed during state updates');\n return props;\n },\n set(newProps) {\n props = newProps;\n }\n });\n Object.defineProperty(this, 'state', {\n get() {\n invariant(!that._inAsyncStateUpdate, '\"this.state\" should not be acceessed during state updates');\n return state;\n },\n set(newState) {\n state = newState;\n }\n });\n }\n}","map":{"version":3,"names":["invariant","React","StateSafePureComponent","PureComponent","constructor","props","_inAsyncStateUpdate","_installSetStateHooks","setState","partialState","callback","state","ret","err","that","Object","defineProperty","get","set","newProps","newState"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/StateSafePureComponent.js"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n\nimport invariant from 'fbjs/lib/invariant';\nimport * as React from 'react';\n\n/**\n * `setState` is called asynchronously, and should not rely on the value of\n * `this.props` or `this.state`:\n * https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous\n *\n * SafePureComponent adds runtime enforcement, to catch cases where these\n * variables are read in a state updater function, instead of the ones passed\n * in.\n */\nexport default class StateSafePureComponent extends React.PureComponent {\n constructor(props) {\n super(props);\n this._inAsyncStateUpdate = false;\n this._installSetStateHooks();\n }\n setState(partialState, callback) {\n if (typeof partialState === 'function') {\n super.setState((state, props) => {\n this._inAsyncStateUpdate = true;\n var ret;\n try {\n ret = partialState(state, props);\n } catch (err) {\n throw err;\n } finally {\n this._inAsyncStateUpdate = false;\n }\n return ret;\n }, callback);\n } else {\n super.setState(partialState, callback);\n }\n }\n _installSetStateHooks() {\n var that = this;\n var props = this.props,\n state = this.state;\n Object.defineProperty(this, 'props', {\n get() {\n invariant(!that._inAsyncStateUpdate, '\"this.props\" should not be accessed during state updates');\n return props;\n },\n set(newProps) {\n props = newProps;\n }\n });\n Object.defineProperty(this, 'state', {\n get() {\n invariant(!that._inAsyncStateUpdate, '\"this.state\" should not be acceessed during state updates');\n return state;\n },\n set(newState) {\n state = newState;\n }\n });\n }\n}"],"mappings":"AAUA,OAAOA,SAAS,MAAM,oBAAoB;AAC1C,OAAO,KAAKC,KAAK,MAAM,OAAO;AAW9B,eAAe,MAAMC,sBAAsB,SAASD,KAAK,CAACE,aAAa,CAAC;EACtEC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,mBAAmB,GAAG,KAAK;IAChC,IAAI,CAACC,qBAAqB,CAAC,CAAC;EAC9B;EACAC,QAAQA,CAACC,YAAY,EAAEC,QAAQ,EAAE;IAC/B,IAAI,OAAOD,YAAY,KAAK,UAAU,EAAE;MACtC,KAAK,CAACD,QAAQ,CAAC,CAACG,KAAK,EAAEN,KAAK,KAAK;QAC/B,IAAI,CAACC,mBAAmB,GAAG,IAAI;QAC/B,IAAIM,GAAG;QACP,IAAI;UACFA,GAAG,GAAGH,YAAY,CAACE,KAAK,EAAEN,KAAK,CAAC;QAClC,CAAC,CAAC,OAAOQ,GAAG,EAAE;UACZ,MAAMA,GAAG;QACX,CAAC,SAAS;UACR,IAAI,C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