Showing preview only (1,678K chars total). Download the full file or copy to clipboard to get everything.
Repository: facebookexperimental/Recoil
Branch: main
Commit: c1b97f3a0117
Files: 345
Total size: 1.5 MB
Directory structure:
gitextract_bj3knz1n/
├── .eslintignore
├── .eslintrc.js
├── .flowconfig
├── .github/
│ └── workflows/
│ ├── nightly.yml
│ └── nodejs.yml
├── .gitignore
├── .prettierignore
├── .prettierrc
├── .watchmanconfig
├── CHANGELOG-recoil-relay.md
├── CHANGELOG-recoil-sync.md
├── CHANGELOG-recoil.md
├── CHANGELOG-refine.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README-recoil-relay.md
├── README-recoil-sync.md
├── README-refine.md
├── README.md
├── babel.config.json
├── eslint-rules/
│ └── no-fb-only.js
├── flow-typed/
│ ├── jest.js
│ ├── npm/
│ │ ├── ReactDOM_vx.x.x.js
│ │ ├── ReactTestUtils_vx.x.x.js
│ │ ├── d3-array_vx.x.x.js
│ │ ├── d3-collection_vx.x.x.js
│ │ ├── d3-interpolate_vx.x.x.js
│ │ ├── d3-scale_vx.x.x.js
│ │ ├── d3-selection_vx.x.x.js
│ │ ├── d3-transition_vx.x.x.js
│ │ ├── d3_vx.x.x.js
│ │ ├── hamt_plus_vx.x.x.js
│ │ ├── immutable_vx.x.x.js
│ │ ├── jest_v26.x.x.js
│ │ ├── jsondiffpatch-for-react_vx.x.x.js
│ │ ├── nullthrows_vx.x.x.js
│ │ └── react-dom_v18.x.x.js
│ ├── package.json.js
│ └── public-stubs.js
├── jest.config.js
├── package.json
├── packages/
│ ├── recoil/
│ │ ├── Recoil_index.js
│ │ ├── adt/
│ │ │ ├── Recoil_ArrayKeyedMap.js
│ │ │ ├── Recoil_Loadable.js
│ │ │ ├── Recoil_PersistentMap.js
│ │ │ ├── Recoil_Queue.js
│ │ │ ├── Recoil_Wrapper.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_ArrayKeyedMap-test.js
│ │ │ └── Recoil_Loadable-test.js
│ │ ├── caches/
│ │ │ ├── Recoil_CacheImplementationType.js
│ │ │ ├── Recoil_CachePolicy.js
│ │ │ ├── Recoil_LRUCache.js
│ │ │ ├── Recoil_MapCache.js
│ │ │ ├── Recoil_TreeCache.js
│ │ │ ├── Recoil_TreeCacheImplementationType.js
│ │ │ ├── Recoil_cacheFromPolicy.js
│ │ │ ├── Recoil_treeCacheFromPolicy.js
│ │ │ ├── Recoil_treeCacheLRU.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_LRUCache-test.js
│ │ │ ├── Recoil_MapCache-test.js
│ │ │ ├── Recoil_TreeCache-test.js
│ │ │ ├── Recoil_cacheFromPolicy-test.js
│ │ │ ├── Recoil_treeCacheFromPolicy-test.js
│ │ │ └── Recoil_treeCacheLRU-test.js
│ │ ├── contrib/
│ │ │ ├── devtools_connector/
│ │ │ │ └── RecoilDevTools_Connector.react.js
│ │ │ └── uri_persistence/
│ │ │ ├── Recoil_Link.js
│ │ │ └── __tests__/
│ │ │ └── Recoil_Link-test.js
│ │ ├── core/
│ │ │ ├── Recoil_AtomicUpdates.js
│ │ │ ├── Recoil_Batching.js
│ │ │ ├── Recoil_FunctionalCore.js
│ │ │ ├── Recoil_Graph.js
│ │ │ ├── Recoil_GraphTypes.js
│ │ │ ├── Recoil_Keys.js
│ │ │ ├── Recoil_Node.js
│ │ │ ├── Recoil_ReactMode.js
│ │ │ ├── Recoil_RecoilRoot.js
│ │ │ ├── Recoil_RecoilValue.js
│ │ │ ├── Recoil_RecoilValueInterface.js
│ │ │ ├── Recoil_RetainedBy.js
│ │ │ ├── Recoil_Retention.js
│ │ │ ├── Recoil_RetentionZone.js
│ │ │ ├── Recoil_Snapshot.js
│ │ │ ├── Recoil_SnapshotCache.js
│ │ │ ├── Recoil_State.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_RecoilRoot-test.js
│ │ │ ├── Recoil_RecoilValueInterface-test.js
│ │ │ ├── Recoil_Retention-test.js
│ │ │ ├── Recoil_Snapshot-test.js
│ │ │ ├── Recoil_batcher-test.js
│ │ │ ├── Recoil_core-test.js
│ │ │ ├── Recoil_perf-test.js
│ │ │ └── Recoil_useRecoilStoreID-test.js
│ │ ├── hooks/
│ │ │ ├── Recoil_Hooks.js
│ │ │ ├── Recoil_SnapshotHooks.js
│ │ │ ├── Recoil_useGetRecoilValueInfo.js
│ │ │ ├── Recoil_useRecoilBridgeAcrossReactRoots.js
│ │ │ ├── Recoil_useRecoilCallback.js
│ │ │ ├── Recoil_useRecoilRefresher.js
│ │ │ ├── Recoil_useRecoilTransaction.js
│ │ │ ├── Recoil_useRetain.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_Hooks_TRANSITION_SUPPORT_UNSTABLE-test.js
│ │ │ ├── Recoil_PublicHooks-test.js
│ │ │ ├── Recoil_React-test.js
│ │ │ ├── Recoil_useGetRecoilValueInfo-test.js
│ │ │ ├── Recoil_useGotoRecoilSnapshot-test.js
│ │ │ ├── Recoil_useRecoilBridgeAcrossReactRoots-test.js
│ │ │ ├── Recoil_useRecoilCallback-test.js
│ │ │ ├── Recoil_useRecoilInterface-test.js
│ │ │ ├── Recoil_useRecoilRefresher-test.js
│ │ │ ├── Recoil_useRecoilSnapshot-test.js
│ │ │ ├── Recoil_useRecoilStateReset-test.js
│ │ │ ├── Recoil_useRecoilTransaction-test.js
│ │ │ ├── Recoil_useRecoilTransactionObserver-test.js
│ │ │ ├── Recoil_useRecoilValueLoadable-test.js
│ │ │ ├── Recoil_useTransactionObservation_DEPRECATED-test.js
│ │ │ └── Recoil_useTransition-test.js
│ │ ├── package-for-release.json
│ │ ├── package.json
│ │ └── recoil_values/
│ │ ├── Recoil_WaitFor.js
│ │ ├── Recoil_WaitFor.js.flow
│ │ ├── Recoil_atom.js
│ │ ├── Recoil_atomFamily.js
│ │ ├── Recoil_callbackTypes.js
│ │ ├── Recoil_constSelector.js
│ │ ├── Recoil_errorSelector.js
│ │ ├── Recoil_readOnlySelector.js
│ │ ├── Recoil_selector.js
│ │ ├── Recoil_selectorFamily.js
│ │ ├── __flowtests__/
│ │ │ └── Recoil_WaitFor-flowtest.js
│ │ └── __tests__/
│ │ ├── Recoil_WaitFor-test.js
│ │ ├── Recoil_atom-test.js
│ │ ├── Recoil_atomFamily-test.js
│ │ ├── Recoil_atomWithFallback-test.js
│ │ ├── Recoil_constSelector-test.js
│ │ ├── Recoil_errorSelector-test.js
│ │ ├── Recoil_selector-test.js
│ │ ├── Recoil_selectorFamily-test.js
│ │ └── Recoil_selectorHooks-test.js
│ ├── recoil-relay/
│ │ ├── RecoilRelay_Environments.js
│ │ ├── RecoilRelay_graphQLMutationEffect.js
│ │ ├── RecoilRelay_graphQLQueryEffect.js
│ │ ├── RecoilRelay_graphQLSelector.js
│ │ ├── RecoilRelay_graphQLSelectorFamily.js
│ │ ├── RecoilRelay_graphQLSubscriptionEffect.js
│ │ ├── RecoilRelay_index.js
│ │ ├── __test_utils__/
│ │ │ └── RecoilRelay_mockRelayEnvironment.js
│ │ ├── __tests__/
│ │ │ ├── RecoilRelay_RecoilRelayEnvironment-test.js
│ │ │ ├── RecoilRelay_graphQLMutationEffect-test.js
│ │ │ ├── RecoilRelay_graphQLQueryEffect-test.js
│ │ │ ├── RecoilRelay_graphQLSelector-test.js
│ │ │ ├── RecoilRelay_graphQLSelectorFamily-test.js
│ │ │ ├── RecoilRelay_graphQLSubscriptionEffect-test.js
│ │ │ └── mock-graphql/
│ │ │ ├── RecoilRelay_MockQueries.js
│ │ │ └── schema.graphql
│ │ ├── package-for-release.json
│ │ └── package.json
│ ├── recoil-sync/
│ │ ├── RecoilSync.js
│ │ ├── RecoilSync_URL.js
│ │ ├── RecoilSync_URLJSON.js
│ │ ├── RecoilSync_URLTransit.js
│ │ ├── RecoilSync_index.js
│ │ ├── __test_utils__/
│ │ │ └── RecoilSync_MockURLSerialization.js
│ │ ├── __tests__/
│ │ │ ├── RecoilSync-test.js
│ │ │ ├── RecoilSync_URL-test.js
│ │ │ ├── RecoilSync_URLCompound-test.js
│ │ │ ├── RecoilSync_URLInterface-test.js
│ │ │ ├── RecoilSync_URLJSON-test.js
│ │ │ ├── RecoilSync_URLListen-test.js
│ │ │ ├── RecoilSync_URLPush-test.js
│ │ │ ├── RecoilSync_URLTransit-test.js
│ │ │ └── RecoilSync_URLTransitJSON-test.js
│ │ ├── package-for-release.json
│ │ └── package.json
│ ├── refine/
│ │ ├── Refine_API.js
│ │ ├── Refine_Checkers.js
│ │ ├── Refine_ContainerCheckers.js
│ │ ├── Refine_JSON.js
│ │ ├── Refine_PrimitiveCheckers.js
│ │ ├── Refine_UtilityCheckers.js
│ │ ├── Refine_index.js
│ │ ├── __tests__/
│ │ │ ├── Refine-test.js
│ │ │ ├── Refine_Containers-test.js
│ │ │ ├── Refine_JSON-test.js
│ │ │ ├── Refine_Primitives-test.js
│ │ │ └── Refine_Utilities-test.js
│ │ ├── package-for-release.json
│ │ └── package.json
│ └── shared/
│ ├── __test_utils__/
│ │ ├── Recoil_ReactRenderModes.js
│ │ └── Recoil_TestingUtils.js
│ ├── package.json
│ ├── polyfill/
│ │ ├── ReactBatchedUpdates.js
│ │ ├── ReactBatchedUpdates.native.js
│ │ ├── err.js
│ │ ├── expectationViolation.js
│ │ ├── invariant.js
│ │ ├── recoverableViolation.js
│ │ └── sprintf.js
│ └── util/
│ ├── Recoil_CopyOnWrite.js
│ ├── Recoil_Environment.js
│ ├── Recoil_Memoize.js
│ ├── Recoil_PerformanceTimings.js
│ ├── Recoil_ReactBatchedUpdates.js
│ ├── Recoil_RecoilEnv.js
│ ├── Recoil_concatIterables.js
│ ├── Recoil_deepFreezeValue.js
│ ├── Recoil_differenceSets.js
│ ├── Recoil_err.js
│ ├── Recoil_expectationViolation.js
│ ├── Recoil_filterIterable.js
│ ├── Recoil_filterMap.js
│ ├── Recoil_filterSet.js
│ ├── Recoil_gkx.js
│ ├── Recoil_invariant.js
│ ├── Recoil_isNode.js
│ ├── Recoil_isPromise.js
│ ├── Recoil_lazyProxy.js
│ ├── Recoil_mapIterable.js
│ ├── Recoil_mapMap.js
│ ├── Recoil_mergeMaps.js
│ ├── Recoil_nullthrows.js
│ ├── Recoil_recoverableViolation.js
│ ├── Recoil_shallowArrayEqual.js
│ ├── Recoil_someSet.js
│ ├── Recoil_stableStringify.js
│ ├── Recoil_unionSets.js
│ ├── Recoil_useComponentName.js
│ ├── Recoil_usePrevious.js
│ ├── Recoil_useRefInitOnce.js
│ └── __tests__/
│ ├── Recoil_Memoize-test.js
│ ├── Recoil_RecoilEnv-test.js
│ ├── Recoil_deepFreezeValue-test.js
│ ├── Recoil_lazyProxy-test.js
│ └── Recoil_stableStringify-test.js
├── packages-ext/
│ ├── recoil-devtools/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── flow.js
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── constants/
│ │ │ │ └── Constants.js
│ │ │ ├── manifest.json
│ │ │ ├── pages/
│ │ │ │ ├── Background/
│ │ │ │ │ ├── Background.js
│ │ │ │ │ ├── __tests__/
│ │ │ │ │ │ └── Background.test.js
│ │ │ │ │ └── index.html
│ │ │ │ ├── Content/
│ │ │ │ │ ├── ContentScript.js
│ │ │ │ │ └── __tests__/
│ │ │ │ │ └── ContentScript.test.js
│ │ │ │ ├── Devtools/
│ │ │ │ │ ├── DevtoolsScript.js
│ │ │ │ │ └── index.html
│ │ │ │ ├── Page/
│ │ │ │ │ └── PageScript.js
│ │ │ │ └── Popup/
│ │ │ │ ├── ConnectionContext.js
│ │ │ │ ├── Devpanel.html
│ │ │ │ ├── Items/
│ │ │ │ │ ├── CollapsibleItem.js
│ │ │ │ │ ├── DiffItem.js
│ │ │ │ │ ├── Item.js
│ │ │ │ │ ├── ItemDependencies.js
│ │ │ │ │ ├── ItemDescription.js
│ │ │ │ │ ├── ItemLabel.js
│ │ │ │ │ ├── ItemMoreItems.js
│ │ │ │ │ ├── ItemValue.js
│ │ │ │ │ ├── NodeName.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── PopupApp.js
│ │ │ │ ├── PopupComponent.js
│ │ │ │ ├── PopupDependencyGraph.js
│ │ │ │ ├── PopupDiff.js
│ │ │ │ ├── PopupHeader.js
│ │ │ │ ├── PopupMainContent.js
│ │ │ │ ├── PopupScript.js
│ │ │ │ ├── PopupSidebar.js
│ │ │ │ ├── PopupSidebarTransaction.js
│ │ │ │ ├── PopupSnapshot.js
│ │ │ │ ├── Snapshot/
│ │ │ │ │ ├── AtomList.js
│ │ │ │ │ ├── SearchContext.js
│ │ │ │ │ ├── SelectorList.js
│ │ │ │ │ ├── SnapshotSearch.js
│ │ │ │ │ └── snapshotHooks.js
│ │ │ │ ├── Tabs.js
│ │ │ │ ├── index.html
│ │ │ │ └── useSelectionHooks.js
│ │ │ ├── types/
│ │ │ │ └── DevtoolsTypes.js
│ │ │ └── utils/
│ │ │ ├── Connection.js
│ │ │ ├── EvictableList.js
│ │ │ ├── GraphUtils.js
│ │ │ ├── Logger.js
│ │ │ ├── ObjectEntries.js
│ │ │ ├── ObjectValues.js
│ │ │ ├── Serialization.js
│ │ │ ├── Store.js
│ │ │ ├── TXHashtable.js
│ │ │ ├── __tests__/
│ │ │ │ ├── EvictableListTest.js
│ │ │ │ ├── Recoil_DevTools_GraphUtils.test.js
│ │ │ │ ├── Recoil_DevTools_TXHashtable.test.js
│ │ │ │ └── SerializationTest.js
│ │ │ ├── debounce.js
│ │ │ ├── getStyle.js
│ │ │ └── sankey/
│ │ │ ├── CV2_D3.js
│ │ │ ├── CV2_memoize.js
│ │ │ ├── Sankey.js
│ │ │ ├── SankeyGraph.js
│ │ │ ├── SankeyGraphLayout.js
│ │ │ ├── compactArray.js
│ │ │ └── isImmutable.js
│ │ ├── utils/
│ │ │ ├── build.js
│ │ │ ├── env.js
│ │ │ └── webserver.js
│ │ └── webpack.config.js
│ └── todo-example/
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src/
│ ├── App.css
│ ├── App.js
│ ├── components/
│ │ └── Todo/
│ │ ├── TodoItem.jsx
│ │ ├── TodoItemCreator.jsx
│ │ ├── TodoList.jsx
│ │ ├── TodoListFilters.jsx
│ │ ├── TodoListStats.jsx
│ │ ├── Todo_state.js
│ │ └── Todo_types.js
│ ├── index.css
│ └── index.js
├── relay.config.js
├── rollup.config.js
├── scripts/
│ ├── build.mjs
│ ├── deploy_nightly_build.js
│ ├── pack.mjs
│ ├── project-root-dir.mjs
│ ├── rollup-configs.mjs
│ └── utils.mjs
├── setupJestMock.js
└── typescript/
├── index.d.ts
├── recoil-relay-test.ts
├── recoil-relay.d.ts
├── recoil-sync-test.ts
├── recoil-sync.d.ts
├── recoil-test.ts
├── recoil.d.ts
├── refine-test.ts
├── refine.d.ts
├── tsconfig.json
└── tslint.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintignore
================================================
node_modules
yarn.lock
docs
cjs/
es/
native/
recoil_devtools_ext/
================================================
FILE: .eslintrc.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.
*
* @format
*/
const rulesDirPlugin = require('eslint-plugin-rulesdir');
const path = require('path');
const OFF = 0;
const WARNING = 1;
const ERROR = 2;
rulesDirPlugin.RULES_DIR = path.resolve(__dirname, './eslint-rules');
module.exports = {
env: {
browser: true,
es2020: true,
},
extends: ['plugin:react/recommended'],
parser: 'hermes-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 11,
sourceType: 'module',
},
plugins: ['flowtype', 'react', 'jest', 'fb-www', 'rulesdir', 'relay'],
rules: {
strict: 0,
'jsx-a11y/href-no-hash': OFF,
'react/jsx-key': OFF,
'react/prop-types': OFF,
'rulesdir/no-fb-only': OFF,
},
settings: {
react: {
version: 'detect',
},
},
};
================================================
FILE: .flowconfig
================================================
[ignore]
.*/__tests__.*
.*/node_modules.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/cjs/.*
# Disable for now as the NPM dependencies don't seem to be working...
<PROJECT_ROOT>/packages/recoil-sync/.*
<PROJECT_ROOT>/packages/recoil-relay/.*
<PROJECT_ROOT>/packages-ext/todo-example/.*
<PROJECT_ROOT>/packages-ext/recoil-devtools/.*
[include]
[libs]
node_modules/flow-interfaces-chrome/interfaces
[options]
module.system=node
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeEmpty
suppress_type=$FlowOSSFixMe
module.name_mapper='React' -> '<PROJECT_ROOT>/node_modules/react'
module.name_mapper='ReactDOMLegacy_DEPRECATED' -> '<PROJECT_ROOT>/node_modules/react-dom'
module.name_mapper='ReactNative' -> '<PROJECT_ROOT>/node_modules/react-native'
module.name_mapper='ReactTestUtils' -> '<PROJECT_ROOT>/node_modules/react-dom/test-utils'
module.name_mapper='Recoil' -> '<PROJECT_ROOT>/packages/recoil'
module.name_mapper='recoil' -> '<PROJECT_ROOT>/packages/recoil'
module.name_mapper='recoil-sync' -> '<PROJECT_ROOT>/packages/recoil-syync'
module.name_mapper='recoil-relay' -> '<PROJECT_ROOT>/packages/recoil-relay'
module.name_mapper='refine' -> '<PROJECT_ROOT>/packages/refine'
module.name_mapper='recoil-shared' -> '<PROJECT_ROOT>/packages/shared'
module.name_mapper='relay-runtime' -> '<PROJECT_ROOT>/node_modules/relay-runtime/index.js.flow'
module.name_mapper='react-relay' -> '<PROJECT_ROOT>/node_modules/react-relay'
module.name_mapper='relay-test-utils' -> '<PROJECT_ROOT>/node_modules/relay-test-utils'
exact_by_default=true
babel_loose_array_spread=true
enums=true
[strict]
deprecated-type
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[lints]
all=warn
[version]
^0.207.0
================================================
FILE: .github/workflows/nightly.yml
================================================
name: Nightly Push
on:
schedule:
- cron: '0 8 * * *' # every day at 8 am UTC / 1 am PDT / 4 am EDT
jobs:
deploy-nightly:
if: github.repository_owner == 'facebookexperimental'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# config GIT so it can do git push
- uses: fregante/setup-git-user@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm i -g yarn
- run: yarn install --frozen-lockfile
- run: yarn deploy-nightly
================================================
FILE: .github/workflows/nodejs.yml
================================================
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x, 18.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
react: ['17.0.2', '18.1.0']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g yarn
- run: cd packages-ext/recoil-devtools && yarn install --frozen-lockfile
- run: yarn install --frozen-lockfile
- name: Install React (Unix/Mac)
run: >
sed -i'' -e 's/\("react\(-dom\)\{0,1\}\(-test-renderer\)\{0,1\}": "\).*"/\1${{ matrix.react }}"/g' package.json
if: matrix.os != 'windows-latest'
- name: Install React (Windows)
run: >
sed -i 's/\(""react\(-dom\)\\{0,1\\}\(-test-renderer\)\\{0,1\\}"": ""\).*""/\1${{ matrix.react }}""/g' package.json
if: matrix.os == 'windows-latest'
- run: yarn install
- run: yarn flow
- run: yarn test:typescript
- run: yarn test
- run: yarn lint
- run: yarn build
- run: yarn run pack
- name: Create package
uses: actions/upload-artifact@v3
with:
name: package
path: "build/recoil/*.tgz"
================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# build outputs
build
cjs
es
native
umd
/index.d.ts
nightly-build-files
# Mac
.DS_Store
# NPM Package lock since we use yarn.lock
package-lock.json
# Generated documentation from the docs branch
/docs
# Generated files for recoil-relay unit tests
packages/recoil-relay/__tests__/mock-graphql/__generated__
================================================
FILE: .prettierignore
================================================
node_modules/
build/
cjs/
es/
umd/
flow-typed/
recoil_devtools_ext/
yarn.lock
script/project-root-dir.js
*.md
================================================
FILE: .prettierrc
================================================
{
"arrowParens": "avoid",
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"bracketSameLine": true,
"overrides": [
{
"files": ["*.js"],
"options": {
"parser": "flow"
}
},
{
"files": ["*.ts"],
"options": {
"parser": "typescript"
}
}
]
}
================================================
FILE: .watchmanconfig
================================================
{}
================================================
FILE: CHANGELOG-recoil-relay.md
================================================
# Change Log
## UPCOMING
**_Add new changes here as they land_**
## 0.1.0 (2022-06-2)
Initial open source release
================================================
FILE: CHANGELOG-recoil-sync.md
================================================
# Change Log
## UPCOMING
**_Add new changes here as they land_**
- Migrate from deprecated `substr()` to `substring()` for browser support (#2089)
## 0.2.0 (2022-10-06)
- Export `updateItems()` for the `listen` prop callback in `<RecoilSync>` in addition to `updateItem()` and `updateAllKnownItems()`. (#2017, #2035)
- Removing parameter from URL will reset atoms when using location `queryParams` with a `param`. This is also a slight breaking change when an atom might sync with multiple URL params. (#1900, #1976)
- Add dev warning if unstable `<RecoilURLSyncTransit>` `handlers` prop is detected. (#2044)
## 0.1.1 (2022-08-18)
- Use `@recoiljs/refine` version 0.1.1 with fixes.
## 0.1.0 (2022-06-21)
Initial open source release
================================================
FILE: CHANGELOG-recoil.md
================================================
# Change Log
## UPCOMING
**_Add new changes here as they land_**
## 0.7.7 (2023-03-01)
- Fix potential unhandled promise rejection in `useRecoilCallback()` (#2075)
- Add OSS support for GateKeeper feature toggling via `RecoilEnv.RECOIL_GKS_ENABLED` (#2078)
- Fix resolving suspense of async selectors used with SSR (#2073, #1960)
- Fix SSR with some versions of React DOM used with Next.JS 13 (#2082, #2086)
## 0.7.6 (2022-10-06)
- Workaround for React 18 environments with nested renderers that don't support `useSyncExternalStore()` (#2001, #2010)
- Expose flag to disable "duplicate atom key" checking / logging, as it was too noisy in environments such as NextJS. (#733, #2020, #2046)
- Import `RecoilEnv` from the recoil package, and set `RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED = false` in code to disable the checking and logging.
- We also support `process.env.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false` in NodeJS environments such as NextJs
- Caution: This does infact disable all checks for duplicate atom keys, so use with caution!
## 0.7.5 (2022-08-11)
- Fix useRecoilSnapshot() with React's Fast Refresh during development (#1891)
- Fix useRecoilSnapshot() and recoil-sync with changed browser behavior starting with Chrome v104 (#1943, #1936)
## 0.7.4 (2022-06-21)
- Fix missing flow types (#1857)
- Cleanup memory leak when using atoms with selector defaults. (#1821, #1840, #1844)
## 0.7.3 (2022-06-01)
- Atom effects can initialize or set atoms to wrapped values (#1681)
- Add `parentStoreID_UNSTABLE` to atom effects which is the ID of the parent store it cloned from, such as the host `<RecoilRoot>` store for `useRecoilCallback()` snapshots. (#1744)
- Enable atoms and selectors to be used in family parameters (#1740)
## 0.7.2 (2022-04-13)
- Selector cache lookup optimizations (#1720, #1736)
- Allow async selectors to re-evaluate when async dependencies are discovered with stale state (#1736)
## 0.7.1 (2022-04-12)
### Typing
- Add explicit `children` prop to `<RecoilRoot>` and `useRecoilBridgeAcrossReactRoots_UNSTABLE()` for TypeScript for `@types/react` with React 18 (#1718, #1717, #1726, #1731)
- Update typing for family parameters to better support Map, Set, and classes with `toJSON()`. (#1709, #1703)
### Fixes
- Avoid dev-mode console error with React 18 when using shared async selectors across multiple `<RecoilRoot>`'s. (#1712)
- Cleanup potential memory leak when using async selectors (#1714)
- Fix potentially hung async selectors when shared across multiple roots that depend on atoms initialized with promises that don't resolve (#1714)
## 0.7 (2022-03-31)
### New Features
- The `default` value is now optional for `atom()` and `atomFamily()`. If not provided the atom will initialize to a pending state. (#1639)
- Add `getStoreID()` method to `Snapshot` (#1612)
- Publish `RecoilLoadable.loading()` factory for making an async `Loadable` which never resolves. (#1641)
### Breaking Changes
- Selector's `get()` and Atom's `default` can now accept a `Loadable` to put the node in that state.
If you wish to store a `Loadable`, `Promise`, or `RecoilValue` directly you can wrap it with `selector.value()` or `atom.value()`. (#1640)
- `useRecoilCallback()` now provides a snapshot for the latest state instead of the latest rendered state, which had bugs (#1610, #1604)
### Improvements / Optimizations
- Automatically retain snapshots for the duration of async callbacks. (#1632)
- Optimization for more selector dependencies. 2x improvement with 100 dependencies, 4x with 1,000, and now able to support 10,000+. (#1651, #1515, #914)
- Better error reporting when selectors provide inconsistent results (#1696)
### Fixes
- Avoid spurious console errors from effects when calling `setSelf()` from `onSet()` handlers. (#1589, #1582)
- Freezing user values in dev mode now works in JS environments without the `Window` interface. (#1571)
## 0.6.1 (2022-01-29)
- Fix postInstall script (#1577)
## 0.6 (2022-01-28)
- React 18
- Leverage new React 18 APIs for improved safety and optimizations. (#1488)
- Fixes for `<StrictMode>` (#1473, #1444, #1509).
- Experimental support for `useTransition()` using hooks with `_TRANSITION_SUPPORT_UNSTABLE` suffix. (#1572, #1560)
- Recoil updates now re-render earlier:
- Recoil and React state changes from the same batch now stay in sync. (#1076)
- Renders now occur before transaction observers instead of after.
### New Features
- Add `refresh()` to the `useRecoilCallback()` interface for refreshing selector caches. (#1413)
- Callbacks from selector's `getCallback()` can now mutate, refresh, and transact Recoil state, in addition to reading it, for parity with `useRecoilCallback()`. (#1498)
- Recoil StoreID's for `<RecoilRoot>` and `Snapshot` stores accessible via `useRecoilStoreID()` hook (#1417) or `storeID` parameter for atom effects (#1414).
- `RecoilLoadable.all()` and `RecoilLoadable.of()` now accept either literal values, async Promises, or Loadables. (#1455, #1442)
- Add `.isRetained()` method for Snapshots and check if snapshot is already released when using `.retain()` (#1546)
### Other Fixes and Optimizations
- Reduce overhead of snapshot cloning
- Only clone the current snapshot for callbacks if the callback actually uses it. (#1501)
- Cache the cloned snapshots from callbacks unless there was a state change. (#1533)
- Fix transitive selector refresh for some cases (#1409)
- Fix some corner cases with async selectors and multiple stores (#1568)
- Atom Effects
- Run atom effects when atoms are initialized from a set during a transaction from `useRecoilTransaction_UNSTABLE()` (#1466, #1569)
- Atom effects are cleaned up when initialized by a Snapshot which is released. (#1511, #1532)
- Unsubscribe `onSet()` handlers in atom effects when atoms are cleaned up. (#1509)
- Call `onSet()` when atoms are initialized with `<RecoilRoot initializeState={...} >` (#1519, #1511)
- Avoid extra re-renders in some cases when a component uses a different atom/selector. (#825)
- `<RecoilRoot>` will only call `initializeState()` once during the initial render. (#1372)
- Lazily compute the properties of `useGetRecoilValueInfo_UNSTABLE()` and `Snapshot#getInfo_UNSTABLE()` results (#1549)
- Memoize the results of lazy proxies. (#1548)
### Breaking Changes
- Rename atom effects from `effects_UNSTABLE` to just `effects`, as the interface is mostly stabilizing. (#1520)
- Atom effect initialization takes precedence over initialization with `<RecoilRoot initializeState={...} >`. (#1509)
- `useGetRecoilValueInfo_UNSTABLE()` and `Snapshot#getInfo_UNSTABLE()` always report the node `type`. (#1547)
## 0.5.2 (2021-11-07)
- Fix TypeScript exports (#1397)
## 0.5.1 (2021-11-05)
- Fix TypeScript exports (#1389)
## 0.5.0 (2021-11-03)
- Added `useRecoilRefresher_UNSTABLE()` hook which forces a selector to re-run it's `get()`, and is a no-op for an atom. (#972, #1294, #1302)
- Atom effect improvements:
- Add `getLoadable()`, `getPromise()`, and `getInfo_UNSTABLE()` to Atom Effects interface for reading other atoms. (#1205, #1210)
- Add `isReset` parameter to `onSet()` callback to know if the atom is being reset or not. (#1358, #1345)
- `Loadable` improvements:
- Publish `RecoilLoadable` interface with factories and type checking for Loadables. (#1263, #1264, #1312)
- Ability to map Loadables with other Loadables. (#1180)
- Re-implement Loadable as classes. (#1315)
- Improved dev-mode checks:
- Atoms freeze default, initialized, and async values. Selectors should not freeze upstream dependencies. (#1261, #1259)
- Perform runtime check that required options are provided when creating atoms and selectors. (#1324)
- Fix user-thrown promises in selectors for some cases.
- Allow class instances in family parameters for Flow
## 0.4.1 (2021-08-26)
- Performance optimizations to suppress re-rendering components:
- When subscribed selectors evaluate to the same value. (#749, #952)
- On initial render when not using React Concurrent Mode (#820)
- When selector async deps resolve, but React re-renders before chained promises have executed.
- Fixed #1072 where in some cases selectors with async deps would not update in response to state updates
## 0.4 (2021-07-30)
### New Features
- Selector cache configuration: introduced `cachePolicy_UNSTABLE` option for selectors and selector families. This option allows you to control the behavior of how the selector evicts entries from its internal cache.
- Improved `useRecoilTransaction_UNSTABLE()` hook for transactions with multiple atoms (#1085)
### Fixes and Optimizations
- Fix TypeScript typing for `selectorFamily()`, `getCallback()`, `useGetRecoilValueInfo()`, and `Snapshot#getNodes()` (#1060, #1116, #1123)
- Allow mutable values in selectors to be used with waitFor\*() helpers (#1074, #1096)
- Atom Effects fixes:
- Fix onSet() handler to get the proper new value when an atom is reset or has an async default Promise that resolves (#1059, #1050, #738) (Slightly breaking change)
- Fix support for multiple Atom effects cleanup handlers (#1125)
- Fix selector subscriptions when atoms with effects are initialized via a `Snapshot` (#1135, #1107)
- Optimization for async selectors when dependencies resolve to cached values (#1037)
- Remove unnecessary warning message (#1034, #1062)
## 0.3.1 (2021-5-18)
- Fix TypeScript exports
## 0.3.0 (2021-5-14)
For supporting garbage collection in the future there is a slight breaking change that `Snapshot`'s will only be valid for the duration of the callback or render. A new `retain()` API can be used to persist them longer. This is not enforced yet, but Recoil will now provide a warning in dev-mode if a `Snapshot` is used past its lifetime. (#1006)
### New Features / Improvements
- Add `override` prop to `<RecoilRoot>` (#973)
- Add `getCallback()` to selector evaluation interface (#989)
- Improved TypeScript and Flow typing for `Loadable`s (#966, #1022)
### Performance Optimizations
- Improve scalability (time and memory) of Atom families by cleaning up a legacy feature.
### Bug Fixes
- Throwing an error in an async selector should be properly caught by `<ErrorBoundary>`'s (#998, #1017)
- Fix for Atom Effects `onSet()` should not be called when triggered from `setSelf()` initializing with a Promise or from the same `onSet()` handler. (#974, #979, #953, #986)
- Improved support for Safari (#967, #609)
- Objects stored in selectors are properly frozen in dev mode (#911)
## 0.2.0 (2021-3-18)
### Major improvements
- More reliable async selectors
- Improved performance using HAMT data structures (b7d1cfddec66dae).
### Other improvements
- Changed semantics of waitForAny() such that it will always return loadables unless everything is loading. This better aligns behaviour of waitForAny() and waitForNone()
- Added a waitForAllSettled helper analogous to Promise.allSettled. (4c95591)
- Friendly error message for misuse of useRecoilCallback (#870)
- Friendly error message if you try to use an async function as a selector setter, which is not supported. (#777)
- Improved React Native support. (#748, #702)
- Added useGetRecoilValueInfo_UNSTABLE() hook for dev tools. (#713, #714)
### Bug fixes
- Selectors now treat any non-Promise that is thrown as an error, rather than only instances of Error. (f0e66f727)
- A child of RecoilRoot could sometimes have its state updated after being unmounted. (#917)
- The error message for missing RecoilRoot wasn't displayed on React experimental releases. (#712)
- IE 11 compatibility (#894, d27c800d8)
- Errors shouldn't be frozen (#852)
- Atom effects could fail to initialize atoms in certain cases (#775).
- Async selectors would fail with multiple React roots (a618a3).
## 0.1.3 (2021-3-2)
- Fixed peer dependencies
## 0.1.2 (2020-10-30)
- Fix TypeScript exports
## 0.1.1 (2020-10-29)
- Performance Improvements
- Experimental React Native support
- Experimental Atom Effects
- Experimental Snapshot construction
## 0.0.13 (2020-09-16)
- Fix for bug affecting SSR
## 0.0.12 (2020-09-15)
- Fix for bug affecting SSR on development builds
## 0.0.11 (2020-09-15)
- Experimental React Concurrent Mode Support
- Performance
- Flow Types
- ES, CommonJS, and UMD packages
- Synchronization Across React Roots
- Preliminary Developer Tools API
- Test Infrastructure Fixes
## 0.0.10 (2020-06-18)
### Bug Fix
- Fix exports for snapshot hooks
## 0.0.9 (2020-06-17)
### Features
- TypeScript support now rolled into Recoil repository and package.
- Recoil Snapshot API for observing and managing global Recoil state.
### Improvements
- Throw error with meaningful message if user doesn't use an atom or selector with most Recoil hooks (#205) - Thanks @alexandrzavalii
- Improve testing (#321, #318, #294, #262, #295) - Thanks @aaronabramov, @Komalov, @mondaychen, @drarmstr, and @tyler-mitchell
- Improve open-source build (#249, #203, #33) - Thanks to @tony-go, @acutmore, and @jaredpalmer
### Bug Fixes
- Some fixes for Server Side Rendering, though we do not officially support it yet. (#233, #220, #284) - Thanks @fyber-LJX, @Chrischuck, and @aulneau
- Fix selectors recording dependency subscriptions in some cases (#296) - Thanks @drarmstr
- Fix updaters in `useRecoilCallback()` getting current state (#260) - Thanks @drarmstr
- Fix error messages when throwing certain errors in the open-source build. (#199) - Thanks @jonthomp
- Reduce Flow errors for open-source builds (#308) - Thanks @Komalov
## 0.0.8 (2020-05-30)
### Bug Fixes
- Build system and repository syncing fixed.
- Fixed a bug where atoms that stored self-referential structures would cause an infinite loop. (#153)
- Fixed bugs affecting Server-Side Rendering. (#53)
### Features
- TypeScript support is now available via DefinitelyTyped.
- `atomFamily` and `selectorFamily`: these provide a standard way to create atoms and selectors using memoized functions. Compared with doing this yourself, in the future these will help with memory management.
- `noWait`, `waitForNone`, `waitForAny`, `waitForAll`: helpers for concurrency and other advanced logic in async selectors.
- `constSelector` and `errorSelector`: selectors that always evaluate to a constant or always throw an error.
- `readOnlySelector`: wraps a read-write atom or selector in a read-only interface, for when you need type covariance.
================================================
FILE: CHANGELOG-refine.md
================================================
# Change Log
## UPCOMING
**_Add new changes here as they land_**
## 0.1.1 (2022-08-17)
- Rename `boolean()` export to `bool()` since `boolean` is a reserved word (#1922, #1962, #1971)
- Remove reference to `native` directory in `package.json` to cleanup errors for `react-native`. (#1931)
- Export `Path` class for custom checkers. (#1950, #1956)
- Extend the failure message of `union()` and `or()` with each type. (#1961)
## 0.1.0 (2022-06-21)
Initial open source release
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
This Code of Conduct also applies outside the project spaces when there is a
reasonable belief that an individual's behavior may have a negative impact on
the project or its community.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@fb.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Recoil
We want to make contributing to this project as easy and transparent as
possible.
## Our Development Process
Some people will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
## The `main` Branch is Unsafe
We will do our best to keep main in good shape, with tests passing at all times. But we will sometimes make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.
## Pull Requests
We actively welcome your pull requests.
1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints and is formatted with `prettier`. Run `yarn format` to run `prettier` on all files.
6. If you haven't already, complete the Contributor License Agreement ("CLA").
## Getting in Touch
Please file issues liberally. That's the easiest way to contact us in a way that
ensures everyone working on Recoil can see it. We are eager for your questions, input, and to hear about your experience.
## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.
Complete your CLA here: <https://code.facebook.com/cla>
## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.
## License
By contributing to Recoil, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README-recoil-relay.md
================================================
# Recoil Relay · [](https://www.npmjs.com/package/recoil-relay) [](https://github.com/facebookexperimental/Recoil/actions) [](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [](https://twitter.com/recoiljs)
The `recoil-relay` library helps [Recoil](https://recoiljs.org) perform type safe and efficient queries using [GraphQL](https://graphql.org/) with the [Relay](https://relay.dev) library.
Please see the [**Recoil Relay GraphQL Documentation**](https://recoiljs.org/docs/recoil-relay/introduction)
`recoil-relay` provides `graphQLSelector()` and `graphQLSelectorFamily()` selectors which can easily query with GraphQL. The queries are synced with the Recoil data-flow graph so downstream selectors can derive state from them, they can depend on upstream Recoil state, and they are automatically subscribed to any changes in the graph from Relay. Everything stays in sync automatically.
## Example
After setting up your Relay environment adding a GraphQL query is as simple as defining a [GraphQL selector](https://recoiljs.org/docs/recoil-relay/graphql-selectors).
```jsx
const userNameQuery = graphQLSelector({
key: 'UserName',
environment: myEnvironment,
query: graphql`
query UserQuery($id: ID!) {
user(id: $id) {
name
}
}
`,
variables: ({get}) => ({id: get(currentIDAtom)}),
mapResponse: data => data.user?.name,
});
```
Then use it like any other Recoil [selector](https://recoiljs.org/docs/api-reference/core/selector):
```jsx
function MyComponent() {
const userName = useRecoilValue(userNameQuery);
return <span>{userName}</span>;
}
```
## Installation
Please see the [Recoil installation guide](https://recoiljs.org/docs/introduction/installation) for installing Recoil and the [Relay documentation](https://relay.dev/docs/getting-started/installation-and-setup/) for installing and setting up the Relay library, GraphQL compiler, Babel plugin, and ESLint plugin. Then add `recoil-relay` as a dependency.
## Contributing
Development of Recoil happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Recoil.
- [Code of Conduct](./CODE_OF_CONDUCT.md)
- [Contributing Guide](./CONTRIBUTING.md)
### License
Recoil is [MIT licensed](./LICENSE).
================================================
FILE: README-recoil-sync.md
================================================
# Recoil Sync · [](https://www.npmjs.com/package/recoil-sync) [](https://github.com/facebookexperimental/Recoil/actions) [](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [](https://twitter.com/recoiljs)
The `recoil-sync` package provides an add-on library to help synchronize [Recoil](https://recoiljs.org/) state with external systems.
Please see the [**Recoil Sync Documentation**](https://recoiljs.org/docs/recoil-sync/introduction)
In Recoil, simple [asynchronous data queries](https://recoiljs.org/docs/guides/asynchronous-data-queries) can be implemented via selectors or `useEffect()` and [atom effects](https://recoiljs.org/docs/guides/atom-effects) can be used for bi-directional syncing of individual atoms. The `recoil-sync` add-on package provides some additional functionality:
* **Batching Atomic Transactions** - Updates for multiple atoms can be batched together as a single transaction with the external system. This can be important if an atomic transaction is required for consistent state of related atoms.
* **Abstract and Flexible** - This API allows users to specify what atoms to sync separately from describing the mechanism of how to sync. This allows components to use atoms and sync with different systems in different environments without changing their implementation. For example, a component may use atoms that persist to the URL when used in a stand-alone tool while persisting to a custom user database when embedded in another tool.
* **Validation and Backward Compatibility** - When dealing with state from external sources it is important to validate the input. When state is persisted beyond the lifetime of an app it can also be important to consider backward compatibility of previous versions of state. `recoil-sync` and [`refine`](https://recoiljs.org/docs/refine/introduction) help provide this functionality.
* **Complex Mapping of Atoms to External Storage** - There may not be a one-to-one mapping between atoms and external storage items. Atoms may migrate to use newer versions of items, may pull props from multiple items, just a piece of some compound state, or other complex mappings.
* **Sync with React Hooks or Props** - This library enables syncing atoms with React hooks or props that are not accessible from atom effects.
The `recoil-sync` library also provides built-in implementations for external stores, such as [syncing with the browser URL](https://recoiljs.org/docs/recoil-sync/url-persistence).
---
The basic idea is that a [`syncEffect()`](https://recoiljs.org/docs/recoil-sync/sync-effect) can be added to each atom that you wish to sync, and then a [`<RecoilSync/>`](https://recoiljs.org/docs/recoil-sync/api/RecoilSync) is added inside your `<RecoilRoot>` to specify how to sync those atoms. You can use built-in stores such as [`<RecoilURLSyncJSON>`](https://recoiljs.org/docs/recoil-sync/url-persistence), [make your own](https://recoiljs.org/docs/recoil-sync/implement-store), or sync different groups of atoms with different stores.
## Example
### URL Persistence
Here is a simple example [syncing an atom with the browser URL](https://recoiljs.org/docs/recoil-sync/url-persistence):
```jsx
const currentUserState = atom<number>({
key: 'CurrentUser',
default: 0,
effects: [
syncEffect({ refine: number() }),
],
});
```
Then, at the root of your application, simply include `<RecoilURLSyncJSON />` to sync all of those tagged atoms with the URL
```jsx
function MyApp() {
return (
<RecoilRoot>
<RecoilURLSyncJSON location={{part: 'queryParams'}}>
...
</RecoilURLSyncJSON>
</RecoilRoot>
)
}
```
That's it! Now this atom will initialize its state based on the URL during initial load, any state mutations will update the URL, and changes in the URL (such as the back button) will update the atom. See more examples in the [Sync Effect](https://recoiljs.org/docs/recoil-sync/sync-effect), [Store Implementation](https://recoiljs.org/docs/recoil-sync/implement-store), and [URL Persistence](https://recoiljs.org/docs/recoil-sync/url-persistence) guides.
## Installation
Please see the [Recoil installation guide](https://recoiljs.org/docs/introduction/installation) and add `recoil-sync` as an additional dependency. `recoil-sync` also includes the [`refine`](https://recoiljs.org/docs/refine/introduction) library.
## Contributing
Development of Recoil happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Recoil.
- [Code of Conduct](./CODE_OF_CONDUCT.md)
- [Contributing Guide](./CONTRIBUTING.md)
### License
Recoil is [MIT licensed](./LICENSE).
================================================
FILE: README-refine.md
================================================
# Refine · [](https://www.npmjs.com/package/@recoiljs/refine) [](https://github.com/facebookexperimental/Recoil/actions) [](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [](https://twitter.com/recoiljs)
**Refine** is a type-refinement / validator combinator library for mixed / unknown values in Flow or TypeScript.
Refine is currently released as [@recoiljs/refine](https://www.npmjs.com/package/@recoiljs/refine) on NPM.
Please see the [**Refine Documentation**](https://recoiljs.org/docs/refine/Introduction). To get started learning about Refine, check out the documentation on the core concepts of [Utilities](https://recoiljs.org/docs/refine/api/Utilities) and [Checkers](https://recoiljs.org/docs/refine/api/Checkers).
## Why would I want to use Refine?
- Refine is useful when your code encounters `unknown` TypeScript type or `mixed` Flow type values and you need to [assert those values have a specific static type](https://recoiljs.org/docs/refine/Introduction#type-refinement-example).
- Refine provides an API for building type-refinement helper functions which can validate that an unknown value conforms to an expected type.
- Refine can validate input values and [upgrade from previous versions](https://recoiljs.org/docs/refine/Introduction#backward-compatible-example).
## Type Refinement Example
Coerce unknown types to a strongly typed variable. [`assertion()`](https://recoiljs.org/docs/refine/api/Utilities#assertion) will throw if the input doesn't match the expected type while [`coercion()`](https://recoiljs.org/docs/refine/api/Utilities#coercion) will return `null`.
```jsx
const myObjectChecker = object({
numberProperty: number(),
stringProperty: optional(string()),
arrayProperty: array(number()),
});
const myObjectAssertion = assertion(myObjectChecker);
const myObject: CheckerReturnType<myObjectChecker> = myObjectAssertion({
numberProperty: 123,
stringProperty: 'hello',
arrayProperty: [1, 2, 3],
});
```
## Backward Compatible Example
Using [`match()`](https://recoiljs.org/docs/refine/api/Advanced_Checkers#match) and [`asType()`](https://recoiljs.org/docs/refine/api/Advanced_Checkers#asType) you can upgrade from previous types to the latest version.
```jsx
const myChecker: Checker<{str: string}> = match(
object({str: string()}),
asType(string(), str => ({str: str})),
asType(number(), num => ({str: String(num)})),
);
const obj1: {str: string} = coercion(myChecker({str: 'hello'}));
const obj2: {str: string} = coercion(myChecker('hello'));
const obj3: {str: string} = coercion(myChecker(123));
```
## JSON Parser Example
Refine wraps `JSON` to provide a built-in strongly typed parser.
```jsx
const myParser = jsonParser(array(object({num: number()})));
const result = myParser('[{"num": 1}, {"num": 2}]');
if (result != null) {
// we can now access values in num typesafe way
assert(result[0].num === 1);
} else {
// value failed to match parser spec
}
```
## Usage in Recoil Sync
The **Recoil Sync** library leverages **Refine** for type refinement, input validation, and upgrading types for backward compatibility. See the [`recoil-sync` docs](https://recoiljs.org/docs/recoil-sync/introduction) for more details.
## Installation
Refine is currently bundled as part of the [Recoil Sync](https://recoiljs.org/docs/recoil-sync/introduction) package.
## Contributing
Development of Recoil happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Recoil.
- [Code of Conduct](./CODE_OF_CONDUCT.md)
- [Contributing Guide](./CONTRIBUTING.md)
### License
Recoil is [MIT licensed](./LICENSE).
================================================
FILE: README.md
================================================
# Recoil · [](https://www.npmjs.com/package/recoil) [](https://github.com/facebookexperimental/Recoil/actions) [](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [](https://twitter.com/recoiljs)
Recoil is an experimental state management framework for React.
Website: https://recoiljs.org
## Documentation
Documentation: https://recoiljs.org/docs/introduction/core-concepts
API Reference: https://recoiljs.org/docs/api-reference/core/RecoilRoot
Tutorials: https://recoiljs.org/resources
## Installation
The Recoil package lives in [npm](https://www.npmjs.com/get-npm). Please see the [installation guide](https://recoiljs.org/docs/introduction/installation)
To install the latest stable version, run the following command:
```shell
npm install recoil
```
Or if you're using [yarn](https://classic.yarnpkg.com/en/docs/install/):
```shell
yarn add recoil
```
Or if you're using [bower](https://bower.io/#install-bower):
```shell
bower install --save recoil
```
## Contributing
Development of Recoil happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Recoil.
- [Code of Conduct](./CODE_OF_CONDUCT.md)
- [Contributing Guide](./CONTRIBUTING.md)
### License
Recoil is [MIT licensed](./LICENSE).
================================================
FILE: babel.config.json
================================================
{
"presets": ["@babel/react", "@babel/flow"],
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"React": "react",
"ReactDOMLegacy_DEPRECATED": "react-dom",
"ReactNative": "react-native",
"ReactTestUtils": "react-dom/test-utils"
}
}
],
"relay",
"babel-preset-fbjs/plugins/dev-expression",
"@babel/plugin-proposal-class-properties",
"@babel/proposal-nullish-coalescing-operator",
"@babel/proposal-optional-chaining",
"@babel/transform-flow-strip-types"
]
}
================================================
FILE: eslint-rules/no-fb-only.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.
*
* @format
* @oncall recoil
*/
// Simple eslint rule that warns on usage of `@fb-only` style comments.
// These comments introduce a split point where code behaves differently
// depending on whether it's run at facebook or in OSS and it's very difficult
// to debug, especially if the person working on that code does not have access
// to facebook's internal code. To minimize that complexity all of these split
// points should be defined in one place and dependency injected in Recoil
// at runtime.
const regexps = [
[/^.*(@fb-only).*$/, '@fb-only'],
[/^.*(@oss-only).*$/, '@oss-only'],
];
// If a file paths matches any of provided regular expressions it will be
// excluded from this lint rule.
const excludePaths = [/.*eslint-rules.*/];
module.exports = {
meta: {
docs: {
description: 'disallow @fb-only style comments',
},
},
create(context) {
return {
// Only match the top level `Program` AST node that represents the entire file.
Program(node) {
const lines = context.getSourceCode().text.split('\n');
const filename = context.getFilename();
if (excludePaths.some(r => r.test(filename))) {
return;
}
lines.forEach((line, lineNumber) => {
for (const [regexp, descriptor] of regexps) {
const match = line.match(regexp);
if (match) {
context.report({
message:
`Usage of "${descriptor}". Please consider dependency injecting this condition ` +
`instead. See "${__filename}" for more details`,
loc: {
start: {line: lineNumber + 1, column: 0},
end: {line: lineNumber + 1, column: line.length - 1},
},
});
}
}
});
},
};
},
};
================================================
FILE: flow-typed/jest.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.
*/
type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
*/
mock: {
/**
* An array that represents all calls that have been made into this mock
* function. Each call is represented by an array of arguments that were
* passed during the call.
*/
calls: Array<TArguments>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: Array<TReturn>,
/**
* An array that contains all the object results that have been
* returned by this mock function call
*/
results: Array<{ isThrow: boolean, value: TReturn }>,
},
/**
* Resets all information stored in the mockFn.mock.calls and
* mockFn.mock.instances arrays. Often this is useful when you want to clean
* up a mock's usage data between two assertions.
*/
mockClear(): void,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): void,
/**
* Removes the mock and restores the initial implementation. This is useful
* when you want to mock functions in certain test cases and restore the
* original implementation in others. Beware that mockFn.mockRestore only
* works when mock was created with jest.spyOn. Thus you have to take care of
* restoration yourself when manually assigning jest.fn().
*/
mockRestore(): void,
/**
* Accepts a function that should be used as the implementation of the mock.
* The mock itself will still record all calls that go into and instances
* that come from itself -- the only difference is that the implementation
* will also be executed when the mock is called.
*/
mockImplementation(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a function that will be used as an implementation of the mock for
* one call to the mocked function. Can be chained so that multiple function
* calls produce different results.
*/
mockImplementationOnce(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a string to use in test result output in place of "jest.fn()" to
* indicate which mock function is being referenced.
*/
mockName(name: string): JestMockFn<TArguments, TReturn>,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Accepts a value that will be returned whenever the mock function is called.
*/
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.resolve(value))
*/
mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
*/
mockResolvedValueOnce(
value: TReturn
): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
*/
mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
*/
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean,
};
type JestCallsType = {
allArgs(): mixed,
all(): mixed,
any(): boolean,
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void,
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void,
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean,
};
type JestMatcher = (
actual: any,
expected: any
) => JestMatcherResult | Promise<JestMatcherResult>;
type JestPromiseType = {
/**
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
// eslint-disable-next-line no-use-before-define
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
// eslint-disable-next-line no-use-before-define
resolves: JestExpectType,
};
/**
* Jest allows functions and classes to be used as test names in test() and
* describe()
*/
type JestTestName = string | Function;
/**
* Plugin: jest-styled-components
*/
type JestStyledComponentsMatcherValue =
| string
| JestAsymmetricEqualityType
| RegExp
| typeof undefined;
type JestStyledComponentsMatcherOptions = {
media?: string,
modifier?: string,
supports?: string,
};
type JestStyledComponentsMatchersType = {
toHaveStyleRule(
property: string,
value: JestStyledComponentsMatcherValue,
options?: JestStyledComponentsMatcherOptions
): void,
};
/**
* Plugin: jest-enzyme
*/
type EnzymeMatchersType = {
// 5.x
toBeEmpty(): void,
toBePresent(): void,
// 6.x
toBeChecked(): void,
toBeDisabled(): void,
toBeEmptyRender(): void,
toContainMatchingElement(selector: string): void,
toContainMatchingElements(n: number, selector: string): void,
toContainExactlyOneMatchingElement(selector: string): void,
toContainReact(element: React$Element<any>): void,
toExist(): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp: ((propKey: string, propValue?: any) => void) &
((props: {}) => void),
toHaveRef(refName: string): void,
toHaveState: ((stateKey: string, stateValue?: any) => void) &
((state: {}) => void),
toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
((style: {}) => void),
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toHaveValue(value: any): void,
toIncludeText(text: string): void,
toMatchElement(
element: React$Element<any>,
options?: {| ignoreProps?: boolean, verbose?: boolean |}
): void,
toMatchSelector(selector: string): void,
// 7.x
toHaveDisplayName(name: string): void,
};
// DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers
type DomTestingLibraryType = {
toBeDisabled(): void,
toBeEmpty(): void,
toBeInTheDocument(): void,
toBeVisible(): void,
toContainElement(element: HTMLElement | null): void,
toContainHTML(htmlText: string): void,
toHaveAttribute(name: string, expectedValue?: string): void,
toHaveClass(...classNames: string[]): void,
toHaveFocus(): void,
toHaveFormValues(expectedValues: { [name: string]: any }): void,
toHaveStyle(css: string): void,
toHaveTextContent(
content: string | RegExp,
options?: { normalizeWhitespace: boolean }
): void,
toBeInTheDOM(): void,
};
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
type JestJQueryMatchersType = {
toExist(): void,
toHaveLength(len: number): void,
toHaveId(id: string): void,
toHaveClass(className: string): void,
toHaveTag(tag: string): void,
toHaveAttr(key: string, val?: any): void,
toHaveProp(key: string, val?: any): void,
toHaveText(text: string | RegExp): void,
toHaveData(key: string, val?: any): void,
toHaveValue(val: any): void,
toHaveCss(css: { [key: string]: any }): void,
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBeHidden(): void,
toBeSelected(): void,
toBeVisible(): void,
toBeFocused(): void,
toBeInDom(): void,
toBeMatchedBy(sel: string): void,
toHaveDescendant(sel: string): void,
toHaveDescendantWithText(sel: string, text: string | RegExp): void,
};
// Jest Extended Matchers: https://github.com/jest-community/jest-extended
type JestExtendedMatchersType = {
/**
* Note: Currently unimplemented
* Passing assertion
*
* @param {String} message
*/
// pass(message: string): void;
/**
* Note: Currently unimplemented
* Failing assertion
*
* @param {String} message
*/
// fail(message: string): void;
/**
* Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
*/
toBeEmpty(): void,
/**
* Use .toBeOneOf when checking if a value is a member of a given Array.
* @param {Array.<*>} members
*/
toBeOneOf(members: any[]): void,
/**
* Use `.toBeNil` when checking a value is `null` or `undefined`.
*/
toBeNil(): void,
/**
* Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
* @param {Function} predicate
*/
toSatisfy(predicate: (n: any) => boolean): void,
/**
* Use `.toBeArray` when checking if a value is an `Array`.
*/
toBeArray(): void,
/**
* Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
* @param {Number} x
*/
toBeArrayOfSize(x: number): void,
/**
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
* @param {Array.<*>} members
*/
toIncludeAllMembers(members: any[]): void,
/**
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
* @param {Array.<*>} members
*/
toIncludeAnyMembers(members: any[]): void,
/**
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
* @param {Function} predicate
*/
toSatisfyAll(predicate: (n: any) => boolean): void,
/**
* Use `.toBeBoolean` when checking if a value is a `Boolean`.
*/
toBeBoolean(): void,
/**
* Use `.toBeTrue` when checking a value is equal (===) to `true`.
*/
toBeTrue(): void,
/**
* Use `.toBeFalse` when checking a value is equal (===) to `false`.
*/
toBeFalse(): void,
/**
* Use .toBeDate when checking if a value is a Date.
*/
toBeDate(): void,
/**
* Use `.toBeFunction` when checking if a value is a `Function`.
*/
toBeFunction(): void,
/**
* Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
*
* Note: Required Jest version >22
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same
*
* @param {Mock} mock
*/
toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
/**
* Use `.toBeNumber` when checking if a value is a `Number`.
*/
toBeNumber(): void,
/**
* Use `.toBeNaN` when checking a value is `NaN`.
*/
toBeNaN(): void,
/**
* Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
*/
toBeFinite(): void,
/**
* Use `.toBePositive` when checking if a value is a positive `Number`.
*/
toBePositive(): void,
/**
* Use `.toBeNegative` when checking if a value is a negative `Number`.
*/
toBeNegative(): void,
/**
* Use `.toBeEven` when checking if a value is an even `Number`.
*/
toBeEven(): void,
/**
* Use `.toBeOdd` when checking if a value is an odd `Number`.
*/
toBeOdd(): void,
/**
* Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
*
* @param {Number} start
* @param {Number} end
*/
toBeWithin(start: number, end: number): void,
/**
* Use `.toBeObject` when checking if a value is an `Object`.
*/
toBeObject(): void,
/**
* Use `.toContainKey` when checking if an object contains the provided key.
*
* @param {String} key
*/
toContainKey(key: string): void,
/**
* Use `.toContainKeys` when checking if an object has all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainKeys(keys: string[]): void,
/**
* Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAllKeys(keys: string[]): void,
/**
* Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAnyKeys(keys: string[]): void,
/**
* Use `.toContainValue` when checking if an object contains the provided value.
*
* @param {*} value
*/
toContainValue(value: any): void,
/**
* Use `.toContainValues` when checking if an object contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainValues(values: any[]): void,
/**
* Use `.toContainAllValues` when checking if an object only contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainAllValues(values: any[]): void,
/**
* Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
*
* @param {Array.<*>} values
*/
toContainAnyValues(values: any[]): void,
/**
* Use `.toContainEntry` when checking if an object contains the provided entry.
*
* @param {Array.<String, String>} entry
*/
toContainEntry(entry: [string, string]): void,
/**
* Use `.toContainEntries` when checking if an object contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainEntries(entries: [string, string][]): void,
/**
* Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAllEntries(entries: [string, string][]): void,
/**
* Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAnyEntries(entries: [string, string][]): void,
/**
* Use `.toBeExtensible` when checking if an object is extensible.
*/
toBeExtensible(): void,
/**
* Use `.toBeFrozen` when checking if an object is frozen.
*/
toBeFrozen(): void,
/**
* Use `.toBeSealed` when checking if an object is sealed.
*/
toBeSealed(): void,
/**
* Use `.toBeString` when checking if a value is a `String`.
*/
toBeString(): void,
/**
* Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
*
* @param {String} string
*/
toEqualCaseInsensitive(string: string): void,
/**
* Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
*
* @param {String} prefix
*/
toStartWith(prefix: string): void,
/**
* Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
*
* @param {String} suffix
*/
toEndWith(suffix: string): void,
/**
* Use `.toInclude` when checking if a `String` includes the given `String` substring.
*
* @param {String} substring
*/
toInclude(substring: string): void,
/**
* Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
*
* @param {String} substring
* @param {Number} times
*/
toIncludeRepeated(substring: string, times: number): void,
/**
* Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
*
* @param {Array.<String>} substring
*/
toIncludeMultiple(substring: string[]): void,
};
interface JestExpectType {
not: JestExpectType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType;
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
*/
lastCalledWith(...args: Array<any>): void;
/**
* toBe just checks that a value is what you expect. It uses === to check
* strict equality.
*/
toBe(value: any): void;
/**
* Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toBeCalledWith(...args: Array<any>): void;
/**
* Using exact equality with floating point numbers is a bad idea. Rounding
* means that intuitive things fail.
*/
toBeCloseTo(num: number, delta: any): void;
/**
* Use .toBeDefined to check that a variable is not undefined.
*/
toBeDefined(): void;
/**
* Use .toBeFalsy when you don't care what a value is, you just want to
* ensure a value is false in a boolean context.
*/
toBeFalsy(): void;
/**
* To compare floating point numbers, you can use toBeGreaterThan.
*/
toBeGreaterThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeGreaterThanOrEqual.
*/
toBeGreaterThanOrEqual(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThan.
*/
toBeLessThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThanOrEqual.
*/
toBeLessThanOrEqual(number: number): void;
/**
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
*/
toBeNull(): void;
/**
* Use .toBeTruthy when you don't care what a value is, you just want to
* ensure a value is true in a boolean context.
*/
toBeTruthy(): void;
/**
* Use .toBeUndefined to check that a variable is undefined.
*/
toBeUndefined(): void;
/**
* Use .toContain when you want to check that an item is in a list. For
* testing the items in the list, this uses ===, a strict equality check.
*/
toContain(item: any): void;
/**
* Use .toContainEqual when you want to check that an item is in a list. For
* testing the items in the list, this matcher recursively checks the
* equality of all fields, rather than checking for object identity.
*/
toContainEqual(item: any): void;
/**
* Use .toEqual when you want to check that two objects have the same value.
* This matcher recursively checks the equality of all fields, rather than
* checking for object identity.
*/
toEqual(value: any): void;
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toHaveBeenCalled(): void;
toBeCalled(): void;
/**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times.
*/
toHaveBeenCalledTimes(number: number): void;
toBeCalledTimes(number: number): void;
/**
*
*/
toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void;
nthCalledWith(nthCall: number, ...args: Array<any>): void;
/**
*
*/
toHaveReturned(): void;
toReturn(): void;
/**
*
*/
toHaveReturnedTimes(number: number): void;
toReturnTimes(number: number): void;
/**
*
*/
toHaveReturnedWith(value: any): void;
toReturnWith(value: any): void;
/**
*
*/
toHaveLastReturnedWith(value: any): void;
lastReturnedWith(value: any): void;
/**
*
*/
toHaveNthReturnedWith(nthCall: number, value: any): void;
nthReturnedWith(nthCall: number, value: any): void;
/**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toHaveBeenCalledWith(...args: Array<any>): void;
toBeCalledWith(...args: Array<any>): void;
/**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toHaveBeenLastCalledWith(...args: Array<any>): void;
lastCalledWith(...args: Array<any>): void;
/**
* Check that an object has a .length property and it is set to a certain
* numeric value.
*/
toHaveLength(number: number): void;
/**
*
*/
toHaveProperty(propPath: string, value?: any): void;
/**
* Use .toMatch to check that a string matches a regular expression or string.
*/
toMatch(regexpOrString: RegExp | string): void;
/**
* Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
*/
toMatchObject(object: Object | Array<Object>): void;
/**
* Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object.
*/
toStrictEqual(value: any): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(propertyMatchers?: any, name?: string): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(name: string): void;
toMatchInlineSnapshot(snapshot?: string): void;
toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void;
/**
* Use .toThrow to test that a function throws when it is called.
* If you want to test that a specific error gets thrown, you can provide an
* argument to toThrow. The argument can be a string for the error message,
* a class for the error, or a regex that should match the error.
*
* Alias: .toThrowError
*/
toThrow(message?: string | Error | Class<Error> | RegExp): void;
toThrowError(message?: string | Error | Class<Error> | RegExp): void;
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void;
toThrowErrorMatchingInlineSnapshot(snapshot?: string): void;
}
type JestObjectType = {
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): JestObjectType,
/**
* An un-hoisted version of disableAutomock
*/
autoMockOff(): JestObjectType,
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): JestObjectType,
/**
* An un-hoisted version of enableAutomock
*/
autoMockOn(): JestObjectType,
/**
* Clears the mock.calls and mock.instances properties of all mocks.
* Equivalent to calling .mockClear() on every mocked function.
*/
clearAllMocks(): JestObjectType,
/**
* Resets the state of all mocks. Equivalent to calling .mockReset() on every
* mocked function.
*/
resetAllMocks(): JestObjectType,
/**
* Restores all mocks back to their original value.
*/
restoreAllMocks(): JestObjectType,
/**
* Removes any pending timers from the timer system.
*/
clearAllTimers(): void,
/**
* Returns the number of fake timers still left to run.
*/
getTimerCount(): number,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
*/
doMock(moduleName: string, moduleFactory?: any): JestObjectType,
/**
* The same as `unmock` but not moved to the top of the expectation by
* babel-jest.
*/
dontMock(moduleName: string): JestObjectType,
/**
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
genMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
* The second argument can be used to specify an explicit module factory that
* is being run instead of using Jest's automocking feature.
*
* The third argument can be used to create virtual mocks -- mocks of modules
* that don't exist anywhere in the system.
*/
mock(
moduleName: string,
moduleFactory?: any,
options?: Object
): JestObjectType,
/**
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*/
requireActual(moduleName: string): any,
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
*/
requireMock(moduleName: string): any,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
/**
* Creates a sandbox registry for the modules that are loaded inside the
* callback function. This is useful to isolate specific modules for every
* test so that local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): JestObjectType,
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
*/
runAllTicks(): void,
/**
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
* setInterval(), and setImmediate()).
*/
runAllTimers(): void,
/**
* Exhausts all tasks queued by setImmediate().
*/
runAllImmediates(): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*
* Renamed to `advanceTimersByTime`.
*/
runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
* point)
*/
runOnlyPendingTimers(): void,
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module. Note: It is recommended to use jest.mock()
* instead.
*/
setMock(moduleName: string, moduleExports: any): JestObjectType,
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): JestObjectType,
/**
* Instructs Jest to use fake versions of the standard timer functions
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
useFakeTimers(): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
useRealTimers(): JestObjectType,
/**
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(
object: Object,
methodName: string,
accessType?: 'get' | 'set'
): JestMockFn<any, any>,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType,
};
type JestSpyType = {
calls: JestCallsType,
};
/** Runs this function after every test inside this context */
declare function afterEach(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before every test inside this context */
declare function beforeEach(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** A context for grouping tests together */
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: JestTestName, fn: () => void): void,
/**
* Only run this describe block
*/
only(name: JestTestName, fn: () => void): void,
/**
* Skip running this describe block
*/
skip(name: JestTestName, fn: () => void): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
(
name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Only run this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
only(
name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): {
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
},
/**
* Skip running this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
skip(
name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Highlight planned tests in the summary output
*
* @param {String} Name of Test to do
*/
todo(name: string): void,
/**
* Run the test concurrently
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
concurrent(
name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
};
declare function fit(
name: JestTestName,
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** An individual test unit */
declare var test: typeof it;
/** A disabled group of tests */
declare var xdescribe: typeof describe;
/** A focused group of tests */
declare var fdescribe: typeof describe;
/** A disabled individual test */
declare var xit: typeof it;
/** A disabled individual test */
declare var xtest: typeof it;
type JestPrettyFormatColors = {
comment: { close: string, open: string },
content: { close: string, open: string },
prop: { close: string, open: string },
tag: { close: string, open: string },
value: { close: string, open: string },
};
type JestPrettyFormatIndent = (string) => string;
// eslint-disable-next-line no-unused-vars
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = (any) => string;
// eslint-disable-next-line no-unused-vars
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
callToJSON: boolean,
edgeSpacing: string,
escapeRegex: boolean,
highlight: boolean,
indent: number,
maxDepth: number,
min: boolean,
// eslint-disable-next-line no-use-before-define
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
theme: {|
comment: string,
content: string,
prop: string,
tag: string,
value: string,
|},
|};
type JestPrettyFormatPlugin = {
print: (
val: any,
serialize: JestPrettyFormatPrint,
indent: JestPrettyFormatIndent,
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors
) => string,
test: (any) => boolean,
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
/** The expect function is used every time you want to test a value */
declare var expect: {
/** The object that you want to make assertions against */
(
value: any
): JestExpectType &
JestPromiseType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: { [name: string]: JestMatcher }): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
objectContaining(value: Object): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
not: {
arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
objectContaining: (value: {}) => Object,
stringContaining: (value: string) => string,
stringMatching: (value: string | RegExp) => string,
},
};
// TODO handle return type
// http://jasmine.github.io/2.4/introduction.html#section-Spies
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType;
/**
* The global Jasmine object, this is generally not exposed as the public API,
* using features inside here could break in later versions of Jest.
*/
declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
clock(): JestClockType,
createSpy(name: string): JestSpyType,
createSpyObj(
baseName: string,
methodNames: Array<string>
): { [methodName: string]: JestSpyType },
objectContaining(value: Object): Object,
stringMatching(value: string): string,
};
================================================
FILE: flow-typed/npm/ReactDOM_vx.x.x.js
================================================
// flow-typed signature: 3d9217fcc3103eff665390686051441d
// flow-typed version: <<STUB>>/ReactDOM_v17.0.0/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'ReactDOM'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'ReactDOMLegacy_DEPRECATED' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/ReactTestUtils_vx.x.x.js
================================================
// flow-typed signature: 957098ea98fd4cfa09140997329ef825
// flow-typed version: <<STUB>>/ReactTestUtils_v17.0.0/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'ReactTestUtils'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'ReactTestUtils' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3-array_vx.x.x.js
================================================
// flow-typed signature: 07fe700325d6800ee40ab2fb92dbdb62
// flow-typed version: <<STUB>>/d3-array_v2.7.1/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-array'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-array' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3-collection_vx.x.x.js
================================================
// flow-typed signature: 907d29f8d3e51e4214741d633c400932
// flow-typed version: <<STUB>>/d3-collection_v1.0.7/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-collection'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-collection' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3-interpolate_vx.x.x.js
================================================
// flow-typed signature: 2135ae476a3ade7a473e844376538a26
// flow-typed version: <<STUB>>/d3-interpolate_v2.0.1/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-interpolate'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-interpolate' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3-scale_vx.x.x.js
================================================
// flow-typed signature: c5e0917633fcc4b3962290b8ac57a263
// flow-typed version: <<STUB>>/d3-scale_v3.2.2/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-scale'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-scale' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3-selection_vx.x.x.js
================================================
// flow-typed signature: 6b30cbe8947503cf5b22702a7931f20a
// flow-typed version: <<STUB>>/d3-selection_v2.0.0/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-selection'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-selection' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'd3-selection/dist/d3-selection' {
declare module.exports: any;
}
declare module 'd3-selection/dist/d3-selection.min' {
declare module.exports: any;
}
declare module 'd3-selection/src/array' {
declare module.exports: any;
}
declare module 'd3-selection/src/constant' {
declare module.exports: any;
}
declare module 'd3-selection/src/create' {
declare module.exports: any;
}
declare module 'd3-selection/src/creator' {
declare module.exports: any;
}
declare module 'd3-selection/src/identity' {
declare module.exports: any;
}
declare module 'd3-selection/src' {
declare module.exports: any;
}
declare module 'd3-selection/src/local' {
declare module.exports: any;
}
declare module 'd3-selection/src/matcher' {
declare module.exports: any;
}
declare module 'd3-selection/src/namespace' {
declare module.exports: any;
}
declare module 'd3-selection/src/namespaces' {
declare module.exports: any;
}
declare module 'd3-selection/src/pointer' {
declare module.exports: any;
}
declare module 'd3-selection/src/pointers' {
declare module.exports: any;
}
declare module 'd3-selection/src/select' {
declare module.exports: any;
}
declare module 'd3-selection/src/selectAll' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/append' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/attr' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/call' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/classed' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/clone' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/data' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/datum' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/dispatch' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/each' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/empty' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/enter' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/exit' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/filter' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/html' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/insert' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/iterator' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/join' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/lower' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/merge' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/node' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/nodes' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/on' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/order' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/property' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/raise' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/remove' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/select' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/selectAll' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/selectChild' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/selectChildren' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/size' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/sort' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/sparse' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/style' {
declare module.exports: any;
}
declare module 'd3-selection/src/selection/text' {
declare module.exports: any;
}
declare module 'd3-selection/src/selector' {
declare module.exports: any;
}
declare module 'd3-selection/src/selectorAll' {
declare module.exports: any;
}
declare module 'd3-selection/src/sourceEvent' {
declare module.exports: any;
}
declare module 'd3-selection/src/window' {
declare module.exports: any;
}
// Filename aliases
declare module 'd3-selection/dist/d3-selection.js' {
declare module.exports: $Exports<'d3-selection/dist/d3-selection'>;
}
declare module 'd3-selection/dist/d3-selection.min.js' {
declare module.exports: $Exports<'d3-selection/dist/d3-selection.min'>;
}
declare module 'd3-selection/src/array.js' {
declare module.exports: $Exports<'d3-selection/src/array'>;
}
declare module 'd3-selection/src/constant.js' {
declare module.exports: $Exports<'d3-selection/src/constant'>;
}
declare module 'd3-selection/src/create.js' {
declare module.exports: $Exports<'d3-selection/src/create'>;
}
declare module 'd3-selection/src/creator.js' {
declare module.exports: $Exports<'d3-selection/src/creator'>;
}
declare module 'd3-selection/src/identity.js' {
declare module.exports: $Exports<'d3-selection/src/identity'>;
}
declare module 'd3-selection/src/index' {
declare module.exports: $Exports<'d3-selection/src'>;
}
declare module 'd3-selection/src/index.js' {
declare module.exports: $Exports<'d3-selection/src'>;
}
declare module 'd3-selection/src/local.js' {
declare module.exports: $Exports<'d3-selection/src/local'>;
}
declare module 'd3-selection/src/matcher.js' {
declare module.exports: $Exports<'d3-selection/src/matcher'>;
}
declare module 'd3-selection/src/namespace.js' {
declare module.exports: $Exports<'d3-selection/src/namespace'>;
}
declare module 'd3-selection/src/namespaces.js' {
declare module.exports: $Exports<'d3-selection/src/namespaces'>;
}
declare module 'd3-selection/src/pointer.js' {
declare module.exports: $Exports<'d3-selection/src/pointer'>;
}
declare module 'd3-selection/src/pointers.js' {
declare module.exports: $Exports<'d3-selection/src/pointers'>;
}
declare module 'd3-selection/src/select.js' {
declare module.exports: $Exports<'d3-selection/src/select'>;
}
declare module 'd3-selection/src/selectAll.js' {
declare module.exports: $Exports<'d3-selection/src/selectAll'>;
}
declare module 'd3-selection/src/selection/append.js' {
declare module.exports: $Exports<'d3-selection/src/selection/append'>;
}
declare module 'd3-selection/src/selection/attr.js' {
declare module.exports: $Exports<'d3-selection/src/selection/attr'>;
}
declare module 'd3-selection/src/selection/call.js' {
declare module.exports: $Exports<'d3-selection/src/selection/call'>;
}
declare module 'd3-selection/src/selection/classed.js' {
declare module.exports: $Exports<'d3-selection/src/selection/classed'>;
}
declare module 'd3-selection/src/selection/clone.js' {
declare module.exports: $Exports<'d3-selection/src/selection/clone'>;
}
declare module 'd3-selection/src/selection/data.js' {
declare module.exports: $Exports<'d3-selection/src/selection/data'>;
}
declare module 'd3-selection/src/selection/datum.js' {
declare module.exports: $Exports<'d3-selection/src/selection/datum'>;
}
declare module 'd3-selection/src/selection/dispatch.js' {
declare module.exports: $Exports<'d3-selection/src/selection/dispatch'>;
}
declare module 'd3-selection/src/selection/each.js' {
declare module.exports: $Exports<'d3-selection/src/selection/each'>;
}
declare module 'd3-selection/src/selection/empty.js' {
declare module.exports: $Exports<'d3-selection/src/selection/empty'>;
}
declare module 'd3-selection/src/selection/enter.js' {
declare module.exports: $Exports<'d3-selection/src/selection/enter'>;
}
declare module 'd3-selection/src/selection/exit.js' {
declare module.exports: $Exports<'d3-selection/src/selection/exit'>;
}
declare module 'd3-selection/src/selection/filter.js' {
declare module.exports: $Exports<'d3-selection/src/selection/filter'>;
}
declare module 'd3-selection/src/selection/html.js' {
declare module.exports: $Exports<'d3-selection/src/selection/html'>;
}
declare module 'd3-selection/src/selection/index' {
declare module.exports: $Exports<'d3-selection/src/selection'>;
}
declare module 'd3-selection/src/selection/index.js' {
declare module.exports: $Exports<'d3-selection/src/selection'>;
}
declare module 'd3-selection/src/selection/insert.js' {
declare module.exports: $Exports<'d3-selection/src/selection/insert'>;
}
declare module 'd3-selection/src/selection/iterator.js' {
declare module.exports: $Exports<'d3-selection/src/selection/iterator'>;
}
declare module 'd3-selection/src/selection/join.js' {
declare module.exports: $Exports<'d3-selection/src/selection/join'>;
}
declare module 'd3-selection/src/selection/lower.js' {
declare module.exports: $Exports<'d3-selection/src/selection/lower'>;
}
declare module 'd3-selection/src/selection/merge.js' {
declare module.exports: $Exports<'d3-selection/src/selection/merge'>;
}
declare module 'd3-selection/src/selection/node.js' {
declare module.exports: $Exports<'d3-selection/src/selection/node'>;
}
declare module 'd3-selection/src/selection/nodes.js' {
declare module.exports: $Exports<'d3-selection/src/selection/nodes'>;
}
declare module 'd3-selection/src/selection/on.js' {
declare module.exports: $Exports<'d3-selection/src/selection/on'>;
}
declare module 'd3-selection/src/selection/order.js' {
declare module.exports: $Exports<'d3-selection/src/selection/order'>;
}
declare module 'd3-selection/src/selection/property.js' {
declare module.exports: $Exports<'d3-selection/src/selection/property'>;
}
declare module 'd3-selection/src/selection/raise.js' {
declare module.exports: $Exports<'d3-selection/src/selection/raise'>;
}
declare module 'd3-selection/src/selection/remove.js' {
declare module.exports: $Exports<'d3-selection/src/selection/remove'>;
}
declare module 'd3-selection/src/selection/select.js' {
declare module.exports: $Exports<'d3-selection/src/selection/select'>;
}
declare module 'd3-selection/src/selection/selectAll.js' {
declare module.exports: $Exports<'d3-selection/src/selection/selectAll'>;
}
declare module 'd3-selection/src/selection/selectChild.js' {
declare module.exports: $Exports<'d3-selection/src/selection/selectChild'>;
}
declare module 'd3-selection/src/selection/selectChildren.js' {
declare module.exports: $Exports<'d3-selection/src/selection/selectChildren'>;
}
declare module 'd3-selection/src/selection/size.js' {
declare module.exports: $Exports<'d3-selection/src/selection/size'>;
}
declare module 'd3-selection/src/selection/sort.js' {
declare module.exports: $Exports<'d3-selection/src/selection/sort'>;
}
declare module 'd3-selection/src/selection/sparse.js' {
declare module.exports: $Exports<'d3-selection/src/selection/sparse'>;
}
declare module 'd3-selection/src/selection/style.js' {
declare module.exports: $Exports<'d3-selection/src/selection/style'>;
}
declare module 'd3-selection/src/selection/text.js' {
declare module.exports: $Exports<'d3-selection/src/selection/text'>;
}
declare module 'd3-selection/src/selector.js' {
declare module.exports: $Exports<'d3-selection/src/selector'>;
}
declare module 'd3-selection/src/selectorAll.js' {
declare module.exports: $Exports<'d3-selection/src/selectorAll'>;
}
declare module 'd3-selection/src/sourceEvent.js' {
declare module.exports: $Exports<'d3-selection/src/sourceEvent'>;
}
declare module 'd3-selection/src/window.js' {
declare module.exports: $Exports<'d3-selection/src/window'>;
}
================================================
FILE: flow-typed/npm/d3-transition_vx.x.x.js
================================================
// flow-typed signature: c2d2412c06877d819d3cd4360b374aeb
// flow-typed version: <<STUB>>/d3-transition_v2.0.0/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3-transition'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3-transition' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/d3_vx.x.x.js
================================================
// flow-typed signature: 33ef3a2d3f6bf1c8a39549ccc666bc3d
// flow-typed version: <<STUB>>/d3_v5.16.0/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'd3'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'd3' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/hamt_plus_vx.x.x.js
================================================
// flow-typed signature: b8127b5d14b8b3f8e090da6b48fa7966
// flow-typed version: <<STUB>>/hamt_plus_v1.0.2/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'hamt_plus'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'hamt_plus' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'hamt_plus/hamt' {
declare module.exports: any;
}
// Filename aliases
declare module 'hamt_plus/hamt.js' {
declare module.exports: $Exports<'hamt_plus/hamt'>;
}
================================================
FILE: flow-typed/npm/immutable_vx.x.x.js
================================================
// flow-typed signature: ab2e7a5a8e0e3e4c07cea3c0b0f8b4d6
// flow-typed version: <<STUB>>/immutable_v4.0.0-rc.12/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'immutable'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'immutable' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'immutable/contrib/cursor' {
declare module.exports: any;
}
declare module 'immutable/dist/immutable.es' {
declare module.exports: any;
}
declare module 'immutable/dist/immutable' {
declare module.exports: any;
}
declare module 'immutable/dist/immutable.min' {
declare module.exports: any;
}
// Filename aliases
declare module 'immutable/contrib/cursor/index' {
declare module.exports: $Exports<'immutable/contrib/cursor'>;
}
declare module 'immutable/contrib/cursor/index.js' {
declare module.exports: $Exports<'immutable/contrib/cursor'>;
}
declare module 'immutable/dist/immutable.es.js' {
declare module.exports: $Exports<'immutable/dist/immutable.es'>;
}
declare module 'immutable/dist/immutable.js' {
declare module.exports: $Exports<'immutable/dist/immutable'>;
}
declare module 'immutable/dist/immutable.min.js' {
declare module.exports: $Exports<'immutable/dist/immutable.min'>;
}
================================================
FILE: flow-typed/npm/jest_v26.x.x.js
================================================
// flow-typed signature: 681725d1525989df4ff4c352015f5c2b
// flow-typed version: 9a968c602c/jest_v26.x.x/flow_>=v0.201.x
type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
*/
mock: {
/**
* An array that represents all calls that have been made into this mock
* function. Each call is represented by an array of arguments that were
* passed during the call.
*/
calls: Array<TArguments>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: Array<TReturn>,
/**
* An array that contains all the object results that have been
* returned by this mock function call
*/
results: Array<{
isThrow: boolean,
value: TReturn,
...
}>,
...
},
/**
* Resets all information stored in the mockFn.mock.calls and
* mockFn.mock.instances arrays. Often this is useful when you want to clean
* up a mock's usage data between two assertions.
*/
mockClear(): void,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): void,
/**
* Removes the mock and restores the initial implementation. This is useful
* when you want to mock functions in certain test cases and restore the
* original implementation in others. Beware that mockFn.mockRestore only
* works when mock was created with jest.spyOn. Thus you have to take care of
* restoration yourself when manually assigning jest.fn().
*/
mockRestore(): void,
/**
* Accepts a function that should be used as the implementation of the mock.
* The mock itself will still record all calls that go into and instances
* that come from itself -- the only difference is that the implementation
* will also be executed when the mock is called.
*/
mockImplementation(
fn: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a function that will be used as an implementation of the mock for
* one call to the mocked function. Can be chained so that multiple function
* calls produce different results.
*/
mockImplementationOnce(
fn: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a string to use in test result output in place of "jest.fn()" to
* indicate which mock function is being referenced.
*/
mockName(name: string): JestMockFn<TArguments, TReturn>,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Accepts a value that will be returned whenever the mock function is called.
*/
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.resolve(value))
*/
mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
*/
mockResolvedValueOnce(
value: TReturn,
): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
*/
mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
*/
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
...
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean,
...
};
type JestCallsType = {
allArgs(): mixed,
all(): mixed,
any(): boolean,
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void,
...
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void,
...
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean,
...
};
type JestMatcher = (
received: any,
...actual: Array<any>
) => JestMatcherResult | Promise<JestMatcherResult>;
type JestPromiseType = {
/**
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
resolves: JestExpectType,
...
};
/**
* Jest allows functions and classes to be used as test names in test() and
* describe()
*/
type JestTestName = string | Function;
/**
* Plugin: jest-styled-components
*/
type JestStyledComponentsMatcherValue =
| string
| JestAsymmetricEqualityType
| RegExp
| typeof undefined;
type JestStyledComponentsMatcherOptions = {
media?: string,
modifier?: string,
supports?: string,
...
};
type JestStyledComponentsMatchersType = {
toHaveStyleRule(
property: string,
value: JestStyledComponentsMatcherValue,
options?: JestStyledComponentsMatcherOptions,
): void,
...
};
/**
* Plugin: jest-enzyme
*/
type EnzymeMatchersType = {
// 5.x
toBeEmpty(): void,
toBePresent(): void,
// 6.x
toBeChecked(): void,
toBeDisabled(): void,
toBeEmptyRender(): void,
toContainMatchingElement(selector: string): void,
toContainMatchingElements(n: number, selector: string): void,
toContainExactlyOneMatchingElement(selector: string): void,
toContainReact(element: React$Element<any>): void,
toExist(): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp: ((propKey: string, propValue?: any) => void) &
((props: {...}) => void),
toHaveRef(refName: string): void,
toHaveState: ((stateKey: string, stateValue?: any) => void) &
((state: {...}) => void),
toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
((style: {...}) => void),
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toHaveValue(value: any): void,
toIncludeText(text: string): void,
toMatchElement(
element: React$Element<any>,
options?: {|ignoreProps?: boolean, verbose?: boolean|},
): void,
toMatchSelector(selector: string): void,
// 7.x
toHaveDisplayName(name: string): void,
...
};
// DOM testing library extensions (jest-dom)
// https://github.com/testing-library/jest-dom
type DomTestingLibraryType = {
/**
* @deprecated
*/
toBeInTheDOM(container?: HTMLElement): void,
// 4.x
toBeInTheDocument(): void,
toBeVisible(): void,
toBeEmpty(): void,
toBeDisabled(): void,
toBeEnabled(): void,
toBeInvalid(): void,
toBeRequired(): void,
toBeValid(): void,
toContainElement(element: HTMLElement | null): void,
toContainHTML(htmlText: string): void,
toHaveAttribute(attr: string, value?: any): void,
toHaveClass(...classNames: string[]): void,
toHaveFocus(): void,
toHaveFormValues(expectedValues: {[name: string]: any, ...}): void,
toHaveStyle(css: string | {[name: string]: any, ...}): void,
toHaveTextContent(
text: string | RegExp,
options?: {|normalizeWhitespace: boolean|},
): void,
toHaveValue(value?: string | string[] | number): void,
// 5.x
toHaveDisplayValue(value: string | string[]): void,
toBeChecked(): void,
toBeEmptyDOMElement(): void,
toBePartiallyChecked(): void,
toHaveDescription(text: string | RegExp): void,
...
};
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
type JestJQueryMatchersType = {
toExist(): void,
toHaveLength(len: number): void,
toHaveId(id: string): void,
toHaveClass(className: string): void,
toHaveTag(tag: string): void,
toHaveAttr(key: string, val?: any): void,
toHaveProp(key: string, val?: any): void,
toHaveText(text: string | RegExp): void,
toHaveData(key: string, val?: any): void,
toHaveValue(val: any): void,
toHaveCss(css: {[key: string]: any, ...}): void,
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBeHidden(): void,
toBeSelected(): void,
toBeVisible(): void,
toBeFocused(): void,
toBeInDom(): void,
toBeMatchedBy(sel: string): void,
toHaveDescendant(sel: string): void,
toHaveDescendantWithText(sel: string, text: string | RegExp): void,
...
};
// Jest Extended Matchers: https://github.com/jest-community/jest-extended
type JestExtendedMatchersType = {
/**
* Note: Currently unimplemented
* Passing assertion
*
* @param {String} message
*/
// pass(message: string): void;
/**
* Note: Currently unimplemented
* Failing assertion
*
* @param {String} message
*/
// fail(message: string): void;
/**
* Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
*/
toBeEmpty(): void,
/**
* Use .toBeOneOf when checking if a value is a member of a given Array.
* @param {Array.<*>} members
*/
toBeOneOf(members: any[]): void,
/**
* Use `.toBeNil` when checking a value is `null` or `undefined`.
*/
toBeNil(): void,
/**
* Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
* @param {Function} predicate
*/
toSatisfy(predicate: (n: any) => boolean): void,
/**
* Use `.toBeArray` when checking if a value is an `Array`.
*/
toBeArray(): void,
/**
* Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
* @param {Number} x
*/
toBeArrayOfSize(x: number): void,
/**
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
* @param {Array.<*>} members
*/
toIncludeAllMembers(members: any[]): void,
/**
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
* @param {Array.<*>} members
*/
toIncludeAnyMembers(members: any[]): void,
/**
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
* @param {Function} predicate
*/
toSatisfyAll(predicate: (n: any) => boolean): void,
/**
* Use `.toBeBoolean` when checking if a value is a `Boolean`.
*/
toBeBoolean(): void,
/**
* Use `.toBeTrue` when checking a value is equal (===) to `true`.
*/
toBeTrue(): void,
/**
* Use `.toBeFalse` when checking a value is equal (===) to `false`.
*/
toBeFalse(): void,
/**
* Use .toBeDate when checking if a value is a Date.
*/
toBeDate(): void,
/**
* Use `.toBeFunction` when checking if a value is a `Function`.
*/
toBeFunction(): void,
/**
* Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
*
* Note: Required Jest version >22
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same
*
* @param {Mock} mock
*/
toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
/**
* Use `.toBeNumber` when checking if a value is a `Number`.
*/
toBeNumber(): void,
/**
* Use `.toBeNaN` when checking a value is `NaN`.
*/
toBeNaN(): void,
/**
* Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
*/
toBeFinite(): void,
/**
* Use `.toBePositive` when checking if a value is a positive `Number`.
*/
toBePositive(): void,
/**
* Use `.toBeNegative` when checking if a value is a negative `Number`.
*/
toBeNegative(): void,
/**
* Use `.toBeEven` when checking if a value is an even `Number`.
*/
toBeEven(): void,
/**
* Use `.toBeOdd` when checking if a value is an odd `Number`.
*/
toBeOdd(): void,
/**
* Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
*
* @param {Number} start
* @param {Number} end
*/
toBeWithin(start: number, end: number): void,
/**
* Use `.toBeObject` when checking if a value is an `Object`.
*/
toBeObject(): void,
/**
* Use `.toContainKey` when checking if an object contains the provided key.
*
* @param {String} key
*/
toContainKey(key: string): void,
/**
* Use `.toContainKeys` when checking if an object has all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainKeys(keys: string[]): void,
/**
* Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAllKeys(keys: string[]): void,
/**
* Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAnyKeys(keys: string[]): void,
/**
* Use `.toContainValue` when checking if an object contains the provided value.
*
* @param {*} value
*/
toContainValue(value: any): void,
/**
* Use `.toContainValues` when checking if an object contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainValues(values: any[]): void,
/**
* Use `.toContainAllValues` when checking if an object only contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainAllValues(values: any[]): void,
/**
* Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
*
* @param {Array.<*>} values
*/
toContainAnyValues(values: any[]): void,
/**
* Use `.toContainEntry` when checking if an object contains the provided entry.
*
* @param {Array.<String, String>} entry
*/
toContainEntry(entry: [string, string]): void,
/**
* Use `.toContainEntries` when checking if an object contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainEntries(entries: [string, string][]): void,
/**
* Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAllEntries(entries: [string, string][]): void,
/**
* Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAnyEntries(entries: [string, string][]): void,
/**
* Use `.toBeExtensible` when checking if an object is extensible.
*/
toBeExtensible(): void,
/**
* Use `.toBeFrozen` when checking if an object is frozen.
*/
toBeFrozen(): void,
/**
* Use `.toBeSealed` when checking if an object is sealed.
*/
toBeSealed(): void,
/**
* Use `.toBeString` when checking if a value is a `String`.
*/
toBeString(): void,
/**
* Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
*
* @param {String} string
*/
toEqualCaseInsensitive(string: string): void,
/**
* Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
*
* @param {String} prefix
*/
toStartWith(prefix: string): void,
/**
* Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
*
* @param {String} suffix
*/
toEndWith(suffix: string): void,
/**
* Use `.toInclude` when checking if a `String` includes the given `String` substring.
*
* @param {String} substring
*/
toInclude(substring: string): void,
/**
* Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
*
* @param {String} substring
* @param {Number} times
*/
toIncludeRepeated(substring: string, times: number): void,
/**
* Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
*
* @param {Array.<String>} substring
*/
toIncludeMultiple(substring: string[]): void,
...
};
// Diffing snapshot utility for Jest (snapshot-diff)
// https://github.com/jest-community/snapshot-diff
type SnapshotDiffType = {
/**
* Compare the difference between the actual in the `expect()`
* vs the object inside `valueB` with some extra options.
*/
toMatchDiffSnapshot(
valueB: any,
options?: {|
expand?: boolean,
colors?: boolean,
contextLines?: number,
stablePatchmarks?: boolean,
aAnnotation?: string,
bAnnotation?: string,
|},
testName?: string,
): void,
...
};
interface JestExpectType {
not: JestExpectType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType &
SnapshotDiffType;
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
*/
lastCalledWith(...args: Array<any>): void;
/**
* toBe just checks that a value is what you expect. It uses === to check
* strict equality.
*/
toBe(value: any): void;
/**
* Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toBeCalledWith(...args: Array<any>): void;
/**
* Using exact equality with floating point numbers is a bad idea. Rounding
* means that intuitive things fail.
*/
toBeCloseTo(num: number, delta: any): void;
/**
* Use .toBeDefined to check that a variable is not undefined.
*/
toBeDefined(): void;
/**
* Use .toBeFalsy when you don't care what a value is, you just want to
* ensure a value is false in a boolean context.
*/
toBeFalsy(): void;
/**
* To compare floating point numbers, you can use toBeGreaterThan.
*/
toBeGreaterThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeGreaterThanOrEqual.
*/
toBeGreaterThanOrEqual(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThan.
*/
toBeLessThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThanOrEqual.
*/
toBeLessThanOrEqual(number: number): void;
/**
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
*/
toBeNull(): void;
/**
* Use .toBeTruthy when you don't care what a value is, you just want to
* ensure a value is true in a boolean context.
*/
toBeTruthy(): void;
/**
* Use .toBeUndefined to check that a variable is undefined.
*/
toBeUndefined(): void;
/**
* Use .toContain when you want to check that an item is in a list. For
* testing the items in the list, this uses ===, a strict equality check.
*/
toContain(item: any): void;
/**
* Use .toContainEqual when you want to check that an item is in a list. For
* testing the items in the list, this matcher recursively checks the
* equality of all fields, rather than checking for object identity.
*/
toContainEqual(item: any): void;
/**
* Use .toEqual when you want to check that two objects have the same value.
* This matcher recursively checks the equality of all fields, rather than
* checking for object identity.
*/
toEqual(value: any): void;
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toHaveBeenCalled(): void;
toBeCalled(): void;
/**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times.
*/
toHaveBeenCalledTimes(number: number): void;
toBeCalledTimes(number: number): void;
/**
*
*/
toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void;
nthCalledWith(nthCall: number, ...args: Array<any>): void;
/**
*
*/
toHaveReturned(): void;
toReturn(): void;
/**
*
*/
toHaveReturnedTimes(number: number): void;
toReturnTimes(number: number): void;
/**
*
*/
toHaveReturnedWith(value: any): void;
toReturnWith(value: any): void;
/**
*
*/
toHaveLastReturnedWith(value: any): void;
lastReturnedWith(value: any): void;
/**
*
*/
toHaveNthReturnedWith(nthCall: number, value: any): void;
nthReturnedWith(nthCall: number, value: any): void;
/**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toHaveBeenCalledWith(...args: Array<any>): void;
toBeCalledWith(...args: Array<any>): void;
/**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toHaveBeenLastCalledWith(...args: Array<any>): void;
lastCalledWith(...args: Array<any>): void;
/**
* Check that an object has a .length property and it is set to a certain
* numeric value.
*/
toHaveLength(number: number): void;
/**
*
*/
toHaveProperty(propPath: string | $ReadOnlyArray<string>, value?: any): void;
/**
* Use .toMatch to check that a string matches a regular expression or string.
*/
toMatch(regexpOrString: RegExp | string): void;
/**
* Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
*/
toMatchObject(object: Object | Array<Object>): void;
/**
* Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object.
*/
toStrictEqual(value: any): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(propertyMatchers?: any, name?: string): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(name: string): void;
toMatchInlineSnapshot(snapshot?: string): void;
toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void;
/**
* Use .toThrow to test that a function throws when it is called.
* If you want to test that a specific error gets thrown, you can provide an
* argument to toThrow. The argument can be a string for the error message,
* a class for the error, or a regex that should match the error.
*
* Alias: .toThrowError
*/
toThrow(message?: string | Error | Class<Error> | RegExp): void;
toThrowError(message?: string | Error | Class<Error> | RegExp): void;
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void;
toThrowErrorMatchingInlineSnapshot(snapshot?: string): void;
}
type JestObjectType = {
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): JestObjectType,
/**
* An un-hoisted version of disableAutomock
*/
autoMockOff(): JestObjectType,
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): JestObjectType,
/**
* An un-hoisted version of enableAutomock
*/
autoMockOn(): JestObjectType,
/**
* Clears the mock.calls and mock.instances properties of all mocks.
* Equivalent to calling .mockClear() on every mocked function.
*/
clearAllMocks(): JestObjectType,
/**
* Resets the state of all mocks. Equivalent to calling .mockReset() on every
* mocked function.
*/
resetAllMocks(): JestObjectType,
/**
* Restores all mocks back to their original value.
*/
restoreAllMocks(): JestObjectType,
/**
* Removes any pending timers from the timer system.
*/
clearAllTimers(): void,
/**
* Returns the number of fake timers still left to run.
*/
getTimerCount(): number,
/**
* Set the current system time used by fake timers.
* Simulates a user changing the system clock while your program is running.
* It affects the current time but it does not in itself cause
* e.g. timers to fire; they will fire exactly as they would have done
* without the call to jest.setSystemTime().
*/
setSystemTime(now?: number | Date): void,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
*/
doMock(moduleName: string, moduleFactory?: any): JestObjectType,
/**
* The same as `unmock` but not moved to the top of the expectation by
* babel-jest.
*/
dontMock(moduleName: string): JestObjectType,
/**
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
/**
* Alias of `createMockFromModule`.
*/
genMockFromModule(moduleName: string): any,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
createMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
* The second argument can be used to specify an explicit module factory that
* is being run instead of using Jest's automocking feature.
*
* The third argument can be used to create virtual mocks -- mocks of modules
* that don't exist anywhere in the system.
*/
mock(
moduleName: string,
moduleFactory?: any,
options?: Object,
): JestObjectType,
/**
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*/
requireActual<T>(m: $Flow$ModuleRef<T> | string): T,
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
*/
requireMock(moduleName: string): any,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
/**
* Creates a sandbox registry for the modules that are loaded inside the
* callback function. This is useful to isolate specific modules for every
* test so that local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): JestObjectType,
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
*/
runAllTicks(): void,
/**
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
* setInterval(), and setImmediate()).
*/
runAllTimers(): void,
/**
* Exhausts all tasks queued by setImmediate().
*/
runAllImmediates(): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*
* Renamed to `advanceTimersByTime`.
*/
runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
* point)
*/
runOnlyPendingTimers(): void,
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module. Note: It is recommended to use jest.mock()
* instead.
*/
setMock(moduleName: string, moduleExports: any): JestObjectType,
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): JestObjectType,
/**
* Instructs Jest to use fake versions of the standard timer functions
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
useFakeTimers(mode?: 'modern' | 'legacy'): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
useRealTimers(): JestObjectType,
/**
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(
object: Object,
methodName: string,
accessType?: 'get' | 'set',
): JestMockFn<any, any>,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType,
...
};
type JestSpyType = {calls: JestCallsType, ...};
type JestDoneFn = {|
(error?: Error): void,
fail: (error: Error) => void,
|};
/** Runs this function after every test inside this context */
declare function afterEach(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void;
/** Runs this function before every test inside this context */
declare function beforeEach(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void;
/** A context for grouping tests together */
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: JestTestName, fn: () => void): void,
/**
* Only run this describe block
*/
only(name: JestTestName, fn: () => void): void,
/**
* Skip running this describe block
*/
skip(name: JestTestName, fn: () => void): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number,
) => void,
...
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void,
/**
* Only run this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
only: {|
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void,
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number,
) => void,
|},
/**
* Skip running this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
skip: {|
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void,
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number,
) => void,
|},
/**
* Highlight planned tests in the summary output
*
* @param {String} Name of Test to do
*/
todo(name: string): void,
/**
* Run the test concurrently
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
concurrent(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number,
) => void,
...
};
declare function fit(
name: JestTestName,
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number,
): void;
/** An individual test unit */
declare var test: typeof it;
/** A disabled group of tests */
declare var xdescribe: typeof describe;
/** A focused group of tests */
declare var fdescribe: typeof describe;
/** A disabled individual test */
declare var xit: typeof it;
/** A disabled individual test */
declare var xtest: typeof it;
type JestPrettyFormatColors = {
comment: {
close: string,
open: string,
...
},
content: {
close: string,
open: string,
...
},
prop: {
close: string,
open: string,
...
},
tag: {
close: string,
open: string,
...
},
value: {
close: string,
open: string,
...
},
...
};
type JestPrettyFormatIndent = string => string;
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = any => string;
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
callToJSON: boolean,
edgeSpacing: string,
escapeRegex: boolean,
highlight: boolean,
indent: number,
maxDepth: number,
min: boolean,
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
theme: {|
comment: string,
content: string,
prop: string,
tag: string,
value: string,
|},
|};
type JestPrettyFormatPlugin = {
print: (
val: any,
serialize: JestPrettyFormatPrint,
indent: JestPrettyFormatIndent,
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors,
) => string,
test: any => boolean,
...
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
/** The expect function is used every time you want to test a value */
declare var expect: {
/** The object that you want to make assertions against */
(
value: any,
): JestExpectType &
JestPromiseType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType &
SnapshotDiffType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: {[name: string]: JestMatcher, ...}): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
objectContaining(value: Object): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
not: {
arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
objectContaining: (value: {...}) => Object,
stringContaining: (value: string) => string,
stringMatching: (value: string | RegExp) => string,
...
},
...
};
// TODO handle return type
// http://jasmine.github.io/2.4/introduction.html#section-Spies
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType;
/**
* The global Jasmine object, this is generally not exposed as the public API,
* using features inside here could break in later versions of Jest.
*/
declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
clock(): JestClockType,
createSpy(name: string): JestSpyType,
createSpyObj(
baseName: string,
methodNames: Array<string>,
): {[methodName: string]: JestSpyType, ...},
objectContaining(value: Object): Object,
stringMatching(value: string): string,
...
};
================================================
FILE: flow-typed/npm/jsondiffpatch-for-react_vx.x.x.js
================================================
// flow-typed signature: 01f138bab8c1a273bb901b529eed460c
// flow-typed version: <<STUB>>/jsondiffpatch-for-react_v1.0.4/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'jsondiffpatch-for-react'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'jsondiffpatch-for-react' {
declare module.exports: any;
}
================================================
FILE: flow-typed/npm/nullthrows_vx.x.x.js
================================================
// flow-typed signature: 0b4008173515b0c71528fd8763afbff9
// flow-typed version: <<STUB>>/nullthrows_v1.1.1/flow_v0.129.0
/**
* This is an autogenerated libdef stub for:
*
* 'nullthrows'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'nullthrows' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'nullthrows/nullthrows' {
declare module.exports: any;
}
// Filename aliases
declare module 'nullthrows/nullthrows.js' {
declare module.exports: $Exports<'nullthrows/nullthrows'>;
}
================================================
FILE: flow-typed/npm/react-dom_v18.x.x.js
================================================
/**
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
*
* @oncall recoil
*/
// flow-typed signature: de0a47185086152df6ab4a598943384d
// flow-typed version: cf9120ecbb/react-dom_v18.x.x/flow_>=v0.127.x
declare module 'react-dom_shared-types' {
/**
* Copied from react-reconciler
* https://github.com/facebook/react/blob/168da8d55782f3b34e2a6aa0c4dd0587696afdbd/packages/react-reconciler/src/ReactInternalTypes.js#L271
*/
declare type TransitionTracingCallbacks = {|
onTransitionStart?: (transitionName: string, startTime: number) => void,
onTransitionProgress?: (
transitionName: string,
startTime: number,
currentTime: number,
pending: Array<{|
name: null | string,
|}>,
) => void,
onTransitionIncomplete?: (
transitionName: string,
startTime: number,
deletions: Array<{|
type: string,
name?: string,
newName?: string,
endTime: number,
|}>,
) => void,
onTransitionComplete?: (
transitionName: string,
startTime: number,
endTime: number,
) => void,
onMarkerProgress?: (
transitionName: string,
marker: string,
startTime: number,
currentTime: number,
pending: Array<{|
name: null | string
|}>,
) => void,
onMarkerIncomplete?: (
transitionName: string,
marker: string,
startTime: number,
deletions: Array<{|
type: string,
name?: string,
newName?: string,
endTime: number,
|}>,
) => void,
onMarkerComplete?: (
transitionName: string,
marker: string,
startTime: number,
endTime: number,
) => void,
|};
declare type ReactEmpty = null | void | boolean;
declare type ReactNodeList = ReactEmpty | React$Node;
// Mutable source version can be anything (e.g. number, string, immutable data structure)
// so long as it changes every time any part of the source changes.
declare type MutableSourceVersion = $NonMaybeType<mixed>;
declare type MutableSourceGetVersionFn = (
source: $NonMaybeType<mixed>,
) => MutableSourceVersion;
declare type MutableSource<Source: $NonMaybeType<mixed>> = {|
_source: Source,
_getVersion: MutableSourceGetVersionFn,
// Tracks the version of this source at the time it was most recently read.
// Used to determine if a source is safe to read from before it has been subscribed to.
// Version number is only used during mount,
// since the mechanism for determining safety after subscription is expiration time.
//
// As a workaround to support multiple concurrent renderers,
// we categorize some renderers as primary and others as secondary.
// We only expect there to be two concurrent renderers at most:
// React Native (primary) and Fabric (secondary);
// React DOM (primary) and React ART (secondary).
// Secondary renderers store their context values on separate fields.
// We use the same approach for Context.
_workInProgressVersionPrimary: null | MutableSourceVersion,
_workInProgressVersionSecondary: null | MutableSourceVersion,
// DEV only
// Used to detect multiple renderers using the same mutable source.
_currentPrimaryRenderer?: any,
_currentSecondaryRenderer?: any,
// DEV only
// Used to detect side effects that update a mutable source during render.
// See https://github.com/facebook/react/issues/19948
_currentlyRenderingFiber?: any,
_initialVersionAsOfFirstRender?: MutableSourceVersion | null,
|};
}
declare module 'react-dom' {
declare var version: string;
declare function findDOMNode(
componentOrElement: Element | ?React$Component<any, any>
): null | Element | Text;
declare function render<ElementType: React$ElementType>(
element: React$Element<ElementType>,
container: Element,
callback?: () => void
): React$ElementRef<ElementType>;
declare function hydrate<ElementType: React$ElementType>(
element: React$Element<ElementType>,
container: Element,
callback?: () => void
): React$ElementRef<ElementType>;
declare function createPortal(
node: React$Node,
container: Element
): React$Portal;
declare function unmountComponentAtNode(container: any): boolean;
declare function unstable_batchedUpdates<A, B, C, D, E>(
callback: (a: A, b: B, c: C, d: D, e: E) => mixed,
a: A,
b: B,
c: C,
d: D,
e: E
): void;
declare function unstable_renderSubtreeIntoContainer<
ElementType: React$ElementType
>(
parentComponent: React$Component<any, any>,
nextElement: React$Element<ElementType>,
container: any,
callback?: () => void
): React$ElementRef<ElementType>;
}
declare module 'react-dom/client' {
import type {
TransitionTracingCallbacks,
ReactNodeList,
MutableSource,
} from 'react-dom_shared-types';
declare opaque type FiberRoot;
declare type RootType = {
render(children: ReactNodeList): void,
unmount(): void,
_internalRoot: FiberRoot | null,
...
};
declare type CreateRootOptions = {
unstable_strictMode?: boolean,
unstable_concurrentUpdatesByDefault?: boolean,
identifierPrefix?: string,
onRecoverableError?: (error: mixed) => void,
transitionCallbacks?: TransitionTracingCallbacks,
...
};
declare export function createRoot(
container: Element | DocumentFragment,
options?: CreateRootOptions,
): RootType;
declare type HydrateRootOptions = {
// Hydration options
hydratedSources?: Array<MutableSource<any>>,
onHydrated?: (suspenseNode: Comment) => void,
onDeleted?: (suspenseNode: Comment) => void,
// Options for all roots
unstable_strictMode?: boolean,
unstable_concurrentUpdatesByDefault?: boolean,
identifierPrefix?: string,
onRecoverableError?: (error: mixed) => void,
...
};
declare export function hydrateRoot(
container: Document | Element,
initialChildren: ReactNodeList,
options?: HydrateRootOptions,
): RootType;
}
declare module 'react-dom/server' {
declare var version: string;
declare function renderToString(element: React$Node): string;
declare function renderToStaticMarkup(element: React$Node): string;
declare function renderToNodeStream(element: React$Node): stream$Readable;
declare function renderToStaticNodeStream(
element: React$Node
): stream$Readable;
}
declare module 'react-dom/test-utils' {
declare interface Thenable {
then(resolve: () => mixed, reject?: () => mixed): mixed,
}
declare var Simulate: {
[eventName: string]: (
element: Element,
eventData?: { [key: string]: mixed, ... }
) => void,
...
};
declare function renderIntoDocument(
instance: React$Element<any>
): React$Component<any, any>;
declare function mockComponent(
componentClass: React$ElementType,
mockTagName?: string
): { [key: string]: mixed, ... };
declare function isElement(element: React$Element<any>): boolean;
declare function isElementOfType(
element: React$Element<any>,
componentClass: React$ElementType
): boolean;
declare function isDOMComponent(instance: any): boolean;
declare function isCompositeComponent(
instance: React$Component<any, any>
): boolean;
declare function isCompositeComponentWithType(
instance: React$Component<any, any>,
componentClass: React$ElementType
): boolean;
declare function findAllInRenderedTree(
tree: React$Component<any, any>,
test: (child: React$Component<any, any>) => boolean
): Array<React$Component<any, any>>;
declare function scryRenderedDOMComponentsWithClass(
tree: React$Component<any, any>,
className: string
): Array<Element>;
declare function findRenderedDOMComponentWithClass(
tree: React$Component<any, any>,
className: string
): ?Element;
declare function scryRenderedDOMComponentsWithTag(
tree: React$Component<any, any>,
tagName: string
): Array<Element>;
declare function findRenderedDOMComponentWithTag(
tree: React$Component<any, any>,
tagName: string
): ?Element;
declare function scryRenderedComponentsWithType(
tree: React$Component<any, any>,
componentClass: React$ElementType
): Array<React$Component<any, any>>;
declare function findRenderedComponentWithType(
tree: React$Component<any, any>,
componentClass: React$ElementType
): ?React$Component<any, any>;
declare function act(callback: () => void | Thenable): Thenable;
}
================================================
FILE: flow-typed/package.json.js
================================================
/**
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
*
* @oncall recoil
*/
declare module '../package.json' {
declare var repository: string
}
================================================
FILE: flow-typed/public-stubs.js
================================================
declare var ScopeRules: Object;
declare var ReactElement: any;
declare var __DEV__: boolean;
================================================
FILE: jest.config.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.
*
* @flow strict
* @format
* @oncall recoil
*/
module.exports = {
timers: 'fake',
globals: {
__DEV__: true,
},
moduleNameMapper: {
'^recoil-shared(.*)$': '<rootDir>/packages/shared$1',
'^Recoil$': '<rootDir>/packages/recoil',
'^recoil-sync$': '<rootDir>/packages/recoil-sync',
'^refine$': '<rootDir>/packages/refine',
},
testPathIgnorePatterns: [
'/node_modules/',
'/packages-ext/',
'/__generated__/',
'/mock-graphql/',
],
setupFiles: ['./setupJestMock.js'],
};
================================================
FILE: package.json
================================================
{
"name": "recoil",
"private": true,
"description": "Recoil - A state management library for React",
"main": "cjs/index.js",
"module": "es/index.js",
"react-native": "native/index.js",
"unpkg": "umd/index.js",
"files": [
"umd",
"es",
"cjs",
"native",
"index.d.ts"
],
"repository": "https://github.com/facebookexperimental/Recoil.git",
"license": "MIT",
"scripts": {
"prepare": "install-peers",
"build": "node scripts/build.mjs",
"pack": "node scripts/pack.mjs",
"test": "yarn relay && jest packages/*",
"format": "prettier --write \"./**/*.{js,md,json}\"",
"flow": "flow --show-all-errors",
"flow:restart": "flow stop && npm run flow",
"test:typescript": "dtslint typescript",
"lint": "eslint .",
"relay": "relay-compiler",
"deploy-nightly": "yarn build && node scripts/deploy_nightly_build.js"
},
"dependencies": {
"hamt_plus": "1.0.2",
"transit-js": "^0.8.874"
},
"peerDependencies": {
"react": ">=16.13.1"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
},
"react-native": {
"optional": true
}
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"@babel/plugin-transform-flow-strip-types": "^7.16.0",
"@babel/preset-flow": "^7.16.0",
"@babel/preset-react": "^7.16.0",
"@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-replace": "^2.3.2",
"@types/react": ">=18.0.9",
"@types/react-relay": ">=13.0.2",
"@types/relay-runtime": ">=13.0.3",
"babel-jest": "^26.0.1",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-relay": "^13.2.0",
"babel-preset-fbjs": "^3.3.0",
"dtslint": "^4.2.0",
"eslint": "^8.2.0",
"eslint-plugin-fb-www": "^1.11.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-relay": "^1.8.3",
"eslint-plugin-rulesdir": "^0.2.0",
"eslint-plugin-unused-imports": "^2.0.0",
"flow-bin": "0.207.0",
"flow-copy-source": "^2.0.9",
"flow-interfaces-chrome": "^0.6.0",
"flow-typed": "^3.7.0",
"hermes-eslint": "^0.4.8",
"husky": ">=4",
"immutable": "^4.0.0-rc.12",
"install-peers-cli": "^2.2.0",
"jest-cli": "^26.0.1",
"lint-staged": ">=10",
"prettier": "^2.4.1",
"promise-polyfill": "^8.1.3",
"react": ">=16.13.1",
"react-dom": ">=16.13.1",
"react-relay": "^13.2.0",
"relay-compiler": "^13.2.0",
"relay-runtime": "^13.2.0",
"relay-test-utils": "^13.2.0",
"rollup": "^2.10.0",
"rollup-plugin-includepaths": "^0.2.3",
"rollup-plugin-terser": "^5.3.0",
"typescript": "^3.9.5"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,mjs,md,json}": "prettier --write",
"*.{js,mjs}": "eslint --fix"
}
}
================================================
FILE: packages/recoil/Recoil_index.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.
*
* @flow strict-local
* @format
* @oncall recoil
*/
'use strict';
export type {StoreID} from './core/Recoil_Keys';
export type {PersistenceType} from './core/Recoil_Node';
export type {
RecoilValue,
RecoilState,
RecoilValueReadOnly,
} from './core/Recoil_RecoilValue';
export type {
MutableSnapshot,
Snapshot,
SnapshotID,
} from './core/Recoil_Snapshot';
export type {SetterOrUpdater} from './hooks/Recoil_Hooks';
export type {RecoilCallbackInterface} from './hooks/Recoil_useRecoilCallback';
export type {RecoilBridge} from './hooks/Recoil_useRecoilBridgeAcrossReactRoots';
export type {Loadable} from './adt/Recoil_Loadable';
export type {
AtomEffect,
PersistenceSettings,
} from './recoil_values/Recoil_atom';
export type {TransactionInterface} from './core/Recoil_AtomicUpdates';
export type {
GetRecoilValue,
SetRecoilState,
ResetRecoilState,
} from './recoil_values/Recoil_callbackTypes';
export type {
Parameter,
SelectorFamilyOptions,
} from './recoil_values/Recoil_selectorFamily';
const {RecoilLoadable} = require('./adt/Recoil_Loadable');
const {DefaultValue} = require('./core/Recoil_Node');
const {RecoilRoot, useRecoilStoreID} = require('./core/Recoil_RecoilRoot');
const {isRecoilValue} = require('./core/Recoil_RecoilValue');
const {retentionZone} = require('./core/Recoil_RetentionZone');
const {freshSnapshot} = require('./core/Recoil_Snapshot');
const {
useRecoilState,
useRecoilState_TRANSITION_SUPPORT_UNSTABLE,
useRecoilStateLoadable,
useRecoilValue,
useRecoilValue_TRANSITION_SUPPORT_UNSTABLE,
useRecoilValueLoadable,
useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE,
useResetRecoilState,
useSetRecoilState,
} = require('./hooks/Recoil_Hooks');
const {
useGotoRecoilSnapshot,
useRecoilSnapshot,
useRecoilTransactionObserver,
} = require('./hooks/Recoil_SnapshotHooks');
const useGetRecoilValueInfo = require('./hooks/Recoil_useGetRecoilValueInfo');
const useRecoilBridgeAcrossReactRoots = require('./hooks/Recoil_useRecoilBridgeAcrossReactRoots');
const {useRecoilCallback} = require('./hooks/Recoil_useRecoilCallback');
const useRecoilRefresher = require('./hooks/Recoil_useRecoilRefresher');
const useRecoilTransaction = require('./hooks/Recoil_useRecoilTransaction');
const useRetain = require('./hooks/Recoil_useRetain');
const atom = require('./recoil_values/Recoil_atom');
const atomFamily = require('./recoil_values/Recoil_atomFamily');
const constSelector = require('./recoil_values/Recoil_constSelector');
const errorSelector = require('./recoil_values/Recoil_errorSelector');
const readOnlySelector = require('./recoil_values/Recoil_readOnlySelector');
const selector = require('./recoil_values/Recoil_selector');
const selectorFamily = require('./recoil_values/Recoil_selectorFamily');
const {
noWait,
waitForAll,
waitForAllSettled,
waitForAny,
waitForNone,
} = require('./recoil_values/Recoil_WaitFor');
const RecoilEnv = require('recoil-shared/util/Recoil_RecoilEnv');
module.exports = {
// Types
DefaultValue,
isRecoilValue,
RecoilLoadable,
// Global Recoil environment settings
RecoilEnv,
// Recoil Root
RecoilRoot,
useRecoilStoreID,
useRecoilBridgeAcrossReactRoots_UNSTABLE: useRecoilBridgeAcrossReactRoots,
// Atoms/Selectors
atom,
selector,
// Convenience Atoms/Selectors
atomFamily,
selectorFamily,
constSelector,
errorSelector,
readOnlySelector,
// Concurrency Helpers for Atoms/Selectors
noWait,
waitForNone,
waitForAny,
waitForAll,
waitForAllSettled,
// Hooks for Atoms/Selectors
useRecoilValue,
useRecoilValueLoadable,
useRecoilState,
useRecoilStateLoadable,
useSetRecoilState,
useResetRecoilState,
useGetRecoilValueInfo_UNSTABLE: useGetRecoilValueInfo,
useRecoilRefresher_UNSTABLE: useRecoilRefresher,
useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE,
useRecoilValue_TRANSITION_SUPPORT_UNSTABLE,
useRecoilState_TRANSITION_SUPPORT_UNSTABLE,
// Hooks for complex operations
useRecoilCallback,
useRecoilTransaction_UNSTABLE: useRecoilTransaction,
// Snapshots
useGotoRecoilSnapshot,
useRecoilSnapshot,
useRecoilTransactionObserver_UNSTABLE: useRecoilTransactionObserver,
snapshot_UNSTABLE: freshSnapshot,
// Memory Management
useRetain,
retentionZone,
};
================================================
FILE: packages/recoil/adt/Recoil_ArrayKeyedMap.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.
*
* Implements (a subset of) the interface of built-in Map but supports arrays as
* keys. Two keys are equal if corresponding elements are equal according to the
* equality semantics of built-in Map. Operations are at worst O(n*b) where n is
* the array length and b is the complexity of the built-in operation.
*
* @flow
* @format
* @oncall recoil
*/
'use strict';
const LEAF = {};
const emptyMap = new Map<mixed, mixed>();
class ArrayKeyedMap<V> {
_base: Map<any, any> = new Map();
constructor(
existing?: ArrayKeyedMap<V> | Iterable<[mixed, V]>,
// $FlowFixMe[incompatible-return]
): ArrayKeyedMap<V> {
if (existing instanceof ArrayKeyedMap) {
for (const [k, v] of existing.entries()) {
this.set(k, v);
}
} else if (existing) {
for (const [k, v] of existing) {
this.set(k, v);
}
}
return this;
}
get(key: mixed): V | void {
const ks = Array.isArray(key) ? key : [key];
let map = this._base;
ks.forEach(k => {
map = map.get(k) ?? emptyMap;
});
return map === undefined ? undefined : map.get(LEAF);
}
set(key: mixed, value: V): any {
const ks = Array.isArray(key) ? key : [key];
let map: ?(any | Map<mixed, mixed> | Map<any, any>) = this._base;
let next: ?(any | Map<mixed, mixed> | Map<any, any>) = map;
ks.forEach(k => {
// $FlowFixMe[incompatible-use]
next = map.get(k);
if (!next) {
next = new Map();
// $FlowFixMe[incompatible-use]
map.set(k, next);
}
map = next;
});
// $FlowFixMe[incompatible-use]
next.set(LEAF, value);
return this;
}
delete(key: mixed): any {
const ks = Array.isArray(key) ? key : [key];
let map: ?(any | Map<mixed, mixed> | Map<any, any>) = this._base;
let next: ?(any | Map<mixed, mixed> | Map<any, any>) = map;
ks.forEach(k => {
// $FlowFixMe[incompatible-use]
next = map.get(k);
if (!next) {
next = new Map();
// $FlowFixMe[incompatible-use]
map.set(k, next);
}
map = next;
});
// $FlowFixMe[incompatible-use]
next.delete(LEAF);
// TODO We could cleanup empty maps
return this;
}
entries(): Iterator<[$ReadOnlyArray<mixed>, V]> {
const answer = [];
function recurse(level: any | Map<any, any>, prefix: Array<mixed>) {
level.forEach((v, k) => {
if (k === LEAF) {
answer.push([prefix, v]);
} else {
recurse(v, prefix.concat(k));
}
});
}
recurse(this._base, []);
return answer.values();
}
toBuiltInMap(): Map<$ReadOnlyArray<mixed>, V> {
return new Map(this.entries());
}
}
module.exports = {ArrayKeyedMap};
================================================
FILE: packages/recoil/adt/Recoil_Loadable.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.
*
* A type that represents a value that may or may not be loaded. It differs from
* LoadObject in that the `loading` state has a Promise that is meant to resolve
* when the value is available (but as with LoadObject, an individual Loadable
* is a value type and is not mutated when the status of a request changes).
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
const err = require('recoil-shared/util/Recoil_err');
const isPromise = require('recoil-shared/util/Recoil_isPromise');
const nullthrows = require('recoil-shared/util/Recoil_nullthrows');
class BaseLoadable<T> {
getValue(): T {
throw err('BaseLoadable');
}
toPromise(): Promise<T> {
throw err('BaseLoadable');
}
valueMaybe(): T | void {
throw err('BaseLoadable');
}
valueOrThrow(): T {
// $FlowFixMe[prop-missing]
throw err(`Loadable expected value, but in "${this.state}" state`);
}
promiseMaybe(): Promise<T> | void {
throw err('BaseLoadable');
}
promiseOrThrow(): Promise<T> {
// $FlowFixMe[prop-missing]
throw err(`Loadable expected promise, but in "${this.state}" state`);
}
errorMaybe(): mixed | void {
throw err('BaseLoadable');
}
errorOrThrow(): mixed {
// $FlowFixMe[prop-missing]
throw err(`Loadable expected error, but in "${this.state}" state`);
}
is(other: Loadable<mixed>): boolean {
// $FlowFixMe[prop-missing]
return other.state === this.state && other.contents === this.contents;
}
map<S>(_map: T => Promise<S> | Loadable<S> | S): Loadable<S> {
throw err('BaseLoadable');
}
}
class ValueLoadable<T> extends BaseLoadable<T> {
state: 'hasValue' = 'hasValue';
contents: T;
constructor(value: T) {
super();
this.contents = value;
}
getValue(): T {
return this.contents;
}
toPromise(): Promise<T> {
return Promise.resolve(this.contents);
}
valueMaybe(): T {
return this.contents;
}
valueOrThrow(): T {
return this.contents;
}
promiseMaybe(): void {
return undefined;
}
errorMaybe(): void {
return undefined;
}
map<S>(map: T => Promise<S> | Loadable<S> | S): Loadable<S> {
try {
const next = map(this.contents);
return isPromise(next)
? loadableWithPromise(next)
: isLoadable(next)
? next
: loadableWithValue(next);
} catch (e) {
return isPromise(e)
? // If we "suspended", then try again.
// errors and subsequent retries will be handled in 'loading' case
// $FlowFixMe[prop-missing]
loadableWithPromise(e.next(() => this.map(map)))
: loadableWithError(e);
}
}
}
class ErrorLoadable<T> extends BaseLoadable<T> {
state: 'hasError' = 'hasError';
contents: mixed;
constructor(error: mixed) {
super();
this.contents = error;
}
getValue(): T {
throw this.contents;
}
toPromise(): Promise<T> {
return Promise.reject(this.contents);
}
valueMaybe(): void {
return undefined;
}
promiseMaybe(): void {
return undefined;
}
errorMaybe(): mixed {
return this.contents;
}
errorOrThrow(): mixed {
return this.contents;
}
map<S>(_map: T => Promise<S> | Loadable<S> | S): $ReadOnly<ErrorLoadable<S>> {
// $FlowIssue[incompatible-return]
return this;
}
}
class LoadingLoadable<T> extends BaseLoadable<T> {
state: 'loading' = 'loading';
contents: Promise<T>;
constructor(promise: Promise<T>) {
super();
this.contents = promise;
}
getValue(): T {
throw this.contents;
}
toPromise(): Promise<T> {
return this.contents;
}
valueMaybe(): void {
return undefined;
}
promiseMaybe(): Promise<T> {
return this.contents;
}
promiseOrThrow(): Promise<T> {
return this.contents;
}
errorMaybe(): void {
return undefined;
}
map<S>(
map: T => Promise<S> | Loadable<S> | S,
): $ReadOnly<LoadingLoadable<S>> {
return loadableWithPromise(
this.contents
.then(value => {
const next = map(value);
if (isLoadable(next)) {
const nextLoadable: Loadable<S> = next;
switch (nextLoadable.state) {
case 'hasValue':
return nextLoadable.contents;
case 'hasError':
throw nextLoadable.contents;
case 'loading':
return nextLoadable.contents;
}
}
return next;
})
// $FlowFixMe[incompatible-call]
.catch(e => {
if (isPromise(e)) {
// we were "suspended," try again
return e.then(() => this.map(map).contents);
}
throw e;
}),
);
}
}
export type Loadable<+T> =
| $ReadOnly<ValueLoadable<T>>
| $ReadOnly<ErrorLoadable<T>>
| $ReadOnly<LoadingLoadable<T>>;
export type ValueLoadableType<+T> = $ReadOnly<ValueLoadable<T>>;
export type ErrorLoadableType<+T> = $ReadOnly<ErrorLoadable<T>>;
export type LoadingLoadableType<+T> = $ReadOnly<LoadingLoadable<T>>;
function loadableWithValue<+T>(value: T): $ReadOnly<ValueLoadable<T>> {
return Object.freeze(new ValueLoadable(value));
}
function loadableWithError<+T>(error: mixed): $ReadOnly<ErrorLoadable<T>> {
return Object.freeze(new ErrorLoadable(error));
}
function loadableWithPromise<+T>(
promise: Promise<T>,
): $ReadOnly<LoadingLoadable<T>> {
return Object.freeze(new LoadingLoadable(promise));
}
function loadableLoading<+T>(): $ReadOnly<LoadingLoadable<T>> {
return Object.freeze(new LoadingLoadable(new Promise(() => {})));
}
type UnwrapLoadables<Loadables> = $TupleMap<Loadables, <T>(Loadable<T>) => T>;
type LoadableAllOfTuple = <
Tuple: $ReadOnlyArray<Loadable<mixed> | Promise<mixed> | mixed>,
>(
tuple: Tuple,
) => Loadable<$TupleMap<Tuple, <V>(Loadable<V> | Promise<V> | V) => V>>;
type LoadableAllOfObj = <
Obj: $ReadOnly<{[string]: Loadable<mixed> | Promise<mixed> | mixed, ...}>,
>(
obj: Obj,
) => Loadable<$ObjMap<Obj, <V>(Loadable<V> | Promise<V> | V) => V>>;
type LoadableAll = LoadableAllOfTuple & LoadableAllOfObj;
function loadableAllArray<Inputs: $ReadOnlyArray<Loadable<mixed>>>(
inputs: Inputs,
): Loadable<UnwrapLoadables<Inputs>> {
return inputs.every(i => i.state === 'hasValue')
? // $FlowFixMe[incompatible-return]
loadableWithValue(inputs.map(i => i.contents))
: inputs.some(i => i.state === 'hasError')
? loadableWithError(
nullthrows(
inputs.find(i => i.state === 'hasError'),
'Invalid loadable passed to loadableAll',
).contents,
)
: loadableWithPromise(Promise.all(inputs.map(i => i.contents)));
}
function loadableAll<
Inputs:
| $ReadOnlyArray<Loadable<mixed> | Promise<mixed> | mixed>
| $ReadOnly<{[string]: Loadable<mixed> | Promise<mixed> | mixed, ...}>,
>(
inputs: Inputs,
): Loadable<$ReadOnlyArray<mixed> | $ReadOnly<{[string]: mixed, ...}>> {
const unwrapedInputs = Array.isArray(inputs)
? inputs
: Object.getOwnPropertyNames(inputs).map(key => inputs[key]);
const normalizedInputs = unwrapedInputs.map(x =>
isLoadable(x)
? x
: isPromise(x)
? loadableWithPromise(x)
: loadableWithValue(x),
);
const output = loadableAllArray(normalizedInputs);
return Array.isArray(inputs)
? // $FlowIssue[incompatible-return]
output
: // Object.getOwnPropertyNames() has consistent key ordering with ES6
// $FlowIssue[incompatible-call]
// $FlowFixMe[incompatible-return] Pre-supress errors for Flow 0.207.0
output.map(outputs =>
Object.getOwnPropertyNames(inputs).reduce(
(out, key, idx) => ({...out, [key]: outputs[idx]}),
{},
),
);
}
function isLoadable(x: mixed): boolean %checks {
return x instanceof BaseLoadable;
}
const LoadableStaticInterface = {
of: <T>(value: Promise<T> | Loadable<T> | T): Loadable<T> =>
isPromise(value)
? loadableWithPromise(value)
: isLoadable(value)
? value
: loadableWithValue(value),
error: <T>(error: mixed): $ReadOnly<ErrorLoadable<T>> =>
loadableWithError(error),
// $FlowIssue[incompatible-return]
loading: <T>(): LoadingLoadable<T> => loadableLoading<T>(),
// $FlowIssue[unclear-type]
all: ((loadableAll: any): LoadableAll),
isLoadable,
};
module.exports = {
loadableWithValue,
loadableWithError,
loadableWithPromise,
loadableLoading,
loadableAll,
isLoadable,
RecoilLoadable: LoadableStaticInterface,
};
================================================
FILE: packages/recoil/adt/Recoil_PersistentMap.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
import type {HAMTPlusMap} from 'hamt_plus';
const hamt = require('hamt_plus');
const gkx = require('recoil-shared/util/Recoil_gkx');
export interface PersistentMap<K: string, V> {
keys(): Iterable<K>;
entries(): Iterable<[K, V]>;
get(key: K): V | void;
has(key: K): boolean;
set(key: K, value: V): PersistentMap<K, V>;
delete(key: K): PersistentMap<K, V>;
clone(): PersistentMap<K, V>;
toMap(): Map<K, V>;
}
class BuiltInMap<K: string, V> implements PersistentMap<K, V> {
_map: Map<K, V>;
constructor(existing?: PersistentMap<K, V>) {
this._map = new Map(existing?.entries());
}
keys(): Iterable<K> {
return this._map.keys();
}
entries(): Iterable<[K, V]> {
return this._map.entries();
}
get(k: K): V | void {
return this._map.get(k);
}
has(k: K): boolean {
return this._map.has(k);
}
set(k: K, v: V): PersistentMap<K, V> {
this._map.set(k, v);
return this;
}
delete(k: K): PersistentMap<K, V> {
this._map.delete(k);
return this;
}
clone(): PersistentMap<K, V> {
return persistentMap(this);
}
toMap(): Map<K, V> {
return new Map(this._map);
}
}
class HashArrayMappedTrieMap<K: string, V> implements PersistentMap<K, V> {
// Because hamt.empty is not a function there is no way to introduce type
// parameters on it, so empty is typed as HAMTPlusMap<string, mixed>.
// $FlowIssue
_hamt: HAMTPlusMap<K, V> = ((hamt.empty: any).beginMutation(): HAMTPlusMap<
K,
V,
>);
constructor(existing?: PersistentMap<K, V>) {
if (existing instanceof HashArrayMappedTrieMap) {
const h = existing._hamt.endMutation();
existing._hamt = h.beginMutation();
this._hamt = h.beginMutation();
} else if (existing) {
for (const [k, v] of existing.entries()) {
this._hamt.set(k, v);
}
}
}
keys(): Iterable<K> {
return this._hamt.keys();
}
entries(): Iterable<[K, V]> {
return this._hamt.entries();
}
get(k: K): V | void {
return this._hamt.get(k);
}
has(k: K): boolean {
return this._hamt.has(k);
}
set(k: K, v: V): PersistentMap<K, V> {
this._hamt.set(k, v);
return this;
}
delete(k: K): PersistentMap<K, V> {
this._hamt.delete(k);
return this;
}
clone(): PersistentMap<K, V> {
return persistentMap(this);
}
toMap(): Map<K, V> {
return new Map(this._hamt);
}
}
function persistentMap<K: string, V>(
existing?: PersistentMap<K, V>,
): PersistentMap<K, V> {
if (gkx('recoil_hamt_2020')) {
return new HashArrayMappedTrieMap(existing);
} else {
return new BuiltInMap(existing);
}
}
module.exports = {
persistentMap,
};
================================================
FILE: packages/recoil/adt/Recoil_Queue.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
function enqueueExecution(s: string, f: () => mixed) {
f();
}
module.exports = {
enqueueExecution,
};
================================================
FILE: packages/recoil/adt/Recoil_Wrapper.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.
*
* @flow strict-local
* @format
* @oncall recoil
*/
'use strict';
class WrappedValue<T> {
value: T;
constructor(value: T) {
this.value = value;
}
}
module.exports = {
WrappedValue,
};
================================================
FILE: packages/recoil/adt/__tests__/Recoil_ArrayKeyedMap-test.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.
*
* @flow strict-local
* @format
* @oncall recoil
*/
'use strict';
const {ArrayKeyedMap} = require('../Recoil_ArrayKeyedMap');
test('basic operation', () => {
const m = new ArrayKeyedMap<number>();
m.set([], 0);
m.set(['a'], 1);
m.set(['a', 'b'], 2);
expect(m.get([])).toBe(0);
expect(m.get(['a'])).toBe(1);
expect(m.get(['a', 'b'])).toBe(2);
});
test('enumeration of properties', () => {
const m = new ArrayKeyedMap<number>();
m.set([], 0);
m.set(['a'], 1);
m.set(['a', 'b'], 2);
const entries = Array.from(m.entries());
expect(entries[0][0]).toEqual([]);
expect(entries[0][1]).toBe(0);
expect(entries[1][0]).toEqual(['a']);
expect(entries[1][1]).toBe(1);
expect(entries[2][0]).toEqual(['a', 'b']);
expect(entries[2][1]).toBe(2);
});
test('copying', () => {
const m = new ArrayKeyedMap<number | $FlowFixMe>();
m.set([], 0);
m.set(['a'], 1);
m.set(['a', 'b'], 2);
const mm = new ArrayKeyedMap(m);
expect(mm.get([])).toBe(0);
expect(mm.get(['a'])).toBe(1);
expect(mm.get(['a', 'b'])).toBe(2);
expect(Array.from(m.entries())).toEqual(Array.from(mm.entries()));
});
================================================
FILE: packages/recoil/adt/__tests__/Recoil_Loadable-test.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.
*
* @flow strict-local
* @format
* @oncall recoil
*/
'use strict';
const {
RecoilLoadable,
loadableWithError,
loadableWithPromise,
loadableWithValue,
} = require('../Recoil_Loadable');
const ERROR = new Error('ERROR');
test('Value Loadable', async () => {
const loadable = loadableWithValue('VALUE');
expect(loadable.state).toBe('hasValue');
expect(loadable.contents).toBe('VALUE');
expect(loadable.getValue()).toBe('VALUE');
await expect(loadable.toPromise()).resolves.toBe('VALUE');
expect(loadable.valueMaybe()).toBe('VALUE');
expect(loadable.valueOrThrow()).toBe('VALUE');
expect(loadable.errorMaybe()).toBe(undefined);
expect(() => loadable.errorOrThrow()).toThrow();
expect(loadable.promiseMaybe()).toBe(undefined);
expect(() => loadable.promiseOrThrow()).toThrow();
});
test('Error Loadable', async () => {
const loadable = loadableWithError<$FlowFixMe>(ERROR);
expect(loadable.state).toBe('hasError');
expect(loadable.contents).toBe(ERROR);
expect(() => loadable.getValue()).toThrow(ERROR);
await expect(loadable.toPromise()).rejects.toBe(ERROR);
expect(loadable.valueMaybe()).toBe(undefined);
expect(() => loadable.valueOrThrow()).toThrow();
expect(loadable.errorMaybe()).toBe(ERROR);
expect(loadable.errorOrThrow()).toBe(ERROR);
expect(loadable.promiseMaybe()).toBe(undefined);
expect(() => loadable.promiseOrThrow()).toThrow();
});
test('Pending Value Loadable', async () => {
const promise = Promise.resolve('VALUE');
const loadable = loadableWithPromise(promise);
expect(loadable.state).toBe('loading');
expect(loadable.contents).toBe(promise);
expect(() => loadable.getValue()).toThrow();
await expect(loadable.toPromise()).resolves.toBe('VALUE');
expect(loadable.valueMaybe()).toBe(undefined);
expect(() => loadable.valueOrThrow()).toThrow();
expect(loadable.errorMaybe()).toBe(undefined);
expect(() => loadable.errorOrThrow()).toThrow();
await expect(loadable.promiseMaybe()).resolves.toBe('VALUE');
await expect(loadable.promiseOrThrow()).resolves.toBe('VALUE');
});
describe('Loadable mapping', () => {
test('Loadable mapping value', () => {
const loadable = loadableWithValue('VALUE').map(x => 'MAPPED ' + x);
expect(loadable.state).toBe('hasValue');
expect(loadable.contents).toBe('MAPPED VALUE');
});
test('Loadable mapping value to error', () => {
const loadable = loadableWithValue('VALUE').map<$FlowFixMe>(() => {
throw ERROR;
});
expect(loadable.state).toBe('hasError');
expect(loadable.contents).toBe(ERROR);
});
test('Loadable mapping value to Promise', async () => {
const loadable = loadableWithValue('VALUE').map(value =>
Promise.resolve('MAPPED ' + value),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).resolves.toBe('MAPPED VALUE');
});
test('Loadable mapping value to reject', async () => {
const loadable = loadableWithValue('VALUE').map(() =>
Promise.reject(ERROR),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).rejects.toBe(ERROR);
});
test('Loadable mapping error', () => {
const loadable = loadableWithError<mixed>(ERROR).map(() => 'NOT_USED');
expect(loadable.state).toBe('hasError');
expect(loadable.contents).toBe(ERROR);
});
test('Loadable mapping promise value', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map(
x => 'MAPPED ' + x,
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).resolves.toBe('MAPPED VALUE');
});
test('Loadable mapping promise value to reject', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map(() =>
Promise.reject(ERROR),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).rejects.toBe(ERROR);
});
test('Loadable mapping promise value to error', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map<mixed>(
() => {
throw ERROR;
},
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).rejects.toBe(ERROR);
});
test('Loadable mapping promise error', async () => {
const loadable = loadableWithPromise(Promise.reject(ERROR)).map(
() => 'NOT_USED',
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).rejects.toBe(ERROR);
});
test('Loadable mapping to loadable', () => {
const loadable = loadableWithValue('VALUE').map(value =>
loadableWithValue(value),
);
expect(loadable.state).toBe('hasValue');
expect(loadable.contents).toBe('VALUE');
});
test('Loadable mapping promise to loadable value', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map(value =>
loadableWithValue('MAPPED ' + value),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).resolves.toBe('MAPPED VALUE');
});
test('Loadable mapping promise to loadable error', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map(() =>
// $FlowFixMe[underconstrained-implicit-instantiation]
loadableWithError(ERROR),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).rejects.toBe(ERROR);
});
test('Loadable mapping promise to loadable promise', async () => {
const loadable = loadableWithPromise(Promise.resolve('VALUE')).map(value =>
loadableWithPromise(Promise.resolve('MAPPED ' + value)),
);
expect(loadable.state).toBe('loading');
await expect(loadable.toPromise()).resolves.toBe('MAPPED VALUE');
});
});
test('Loadable Factory Interface', async () => {
const valueLoadable = RecoilLoadable.of('VALUE');
expect(valueLoadable.state).toBe('hasValue');
expect(valueLoadable.contents).toBe('VALUE');
const valueLoadable2 = RecoilLoadable.of(RecoilLoadable.of('VALUE'));
expect(valueLoadable2.state).toBe('hasValue');
expect(valueLoadable2.contents).toBe('VALUE');
const promiseLoadable = RecoilLoadable.of(Promise.resolve('ASYNC'));
expect(promiseLoadable.state).toBe('loading');
await expect(promiseLoadable.contents).resolves.toBe('ASYNC');
const promiseLoadable2 = RecoilLoadable.of(
RecoilLoadable.of(Promise.resolve('ASYNC')),
);
expect(promiseLoadable2.state).toBe('loading');
await expect(promiseLoadable2.contents).resolves.toBe('ASYNC');
const errorLoadable = RecoilLoadable.error<mixed>('ERROR');
expect(errorLoadable.state).toBe('hasError');
expect(errorLoadable.contents).toBe('ERROR');
// $FlowFixMe[underconstrained-implicit-instantiation]
const errorLoadable2 = RecoilLoadable.of(RecoilLoadable.error('ERROR'));
expect(errorLoadable2.state).toBe('hasError');
expect(errorLoadable2.contents).toBe('ERROR');
const loadingLoadable = RecoilLoadable.loading<mixed>();
expect(loadingLoadable.state).toBe('loading');
});
describe('Loadable All', () => {
test('Array', async () => {
expect(
RecoilLoadable.all([RecoilLoadable.of('x'), RecoilLoadable.of(123)])
.contents,
).toEqual(['x', 123]);
await expect(
RecoilLoadable.all([
RecoilLoadable.of(Promise.resolve('x')),
RecoilLoadable.of(123),
]).contents,
).resolves.toEqual(['x', 123]);
expect(
RecoilLoadable.all([
RecoilLoadable.of('x'),
RecoilLoadable.of(123),
// $FlowFixMe[underconstrained-implicit-instantiation]
RecoilLoadable.error('ERROR'),
]).contents,
).toEqual('ERROR');
expect(
RecoilLoadable.all([
RecoilLoadable.of('x'),
RecoilLoadable.all([RecoilLoadable.of(1), RecoilLoadable.of(2)]),
]).contents,
).toEqual(['x', [1, 2]]);
});
test('Object', async () => {
expect(
RecoilLoadable.all({
str: RecoilLoadable.of('x'),
num: RecoilLoadable.of(123),
}).contents,
).toEqual({
str: 'x',
num: 123,
});
await expect(
RecoilLoadable.all({
str: RecoilLoadable.of(Promise.resolve('x')),
num: RecoilLoadable.of(123),
}).contents,
).resolves.toEqual({
str: 'x',
num: 123,
});
expect(
RecoilLoadable.all({
str: RecoilLoadable.of('x'),
num: RecoilLoadable.of(123),
// $FlowFixMe[underconstrained-implicit-instantiation]
err: RecoilLoadable.error('ERROR'),
}).contents,
).toEqual('ERROR');
});
test('mixed values', async () => {
expect(RecoilLoadable.all([RecoilLoadable.of('A'), 'B']).contents).toEqual([
'A',
'B',
]);
await expect(
RecoilLoadable.all([RecoilLoadable.of('A'), Promise.resolve('B')])
.contents,
).resolves.toEqual(['A', 'B']);
await expect(
RecoilLoadable.all([RecoilLoadable.of('A'), Promise.reject('B')])
.contents,
).rejects.toEqual('B');
await expect(
RecoilLoadable.all({
a: 'A',
b: RecoilLoadable.of('B'),
c: Promise.resolve('C'),
}).contents,
).resolves.toEqual({a: 'A', b: 'B', c: 'C'});
});
});
================================================
FILE: packages/recoil/caches/Recoil_CacheImplementationType.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
export interface CacheImplementation<K, V> {
get(K): ?V;
set(K, V): void;
delete(K): void;
clear(): void;
size(): number;
}
================================================
FILE: packages/recoil/caches/Recoil_CachePolicy.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
export type EqualityPolicy = 'reference' | 'value';
export type EvictionPolicy = 'lru' | 'keep-all' | 'most-recent';
export type CachePolicy =
| {eviction: 'lru', maxSize: number, equality?: EqualityPolicy}
| {eviction: 'keep-all', equality?: EqualityPolicy}
| {eviction: 'most-recent', equality?: EqualityPolicy}
| {equality: EqualityPolicy};
export type CachePolicyWithoutEviction = {equality: EqualityPolicy};
================================================
FILE: packages/recoil/caches/Recoil_LRUCache.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
const nullthrows = require('recoil-shared/util/Recoil_nullthrows');
type CacheNode<K, V> = {
key: K,
value: V,
left: ?CacheNode<K, V>,
right: ?CacheNode<K, V>,
};
type Options<K> = {
maxSize: number,
mapKey?: K => mixed,
};
class LRUCache<K = mixed, V = mixed> {
_maxSize: number;
_size: number;
_head: ?CacheNode<K, V>;
_tail: ?CacheNode<K, V>;
_map: Map<mixed, CacheNode<K, V>>;
_keyMapper: K => mixed;
constructor(options: Options<K>) {
this._maxSize = options.maxSize;
this._size = 0;
this._head = null;
this._tail = null;
this._map = new Map<mixed, CacheNode<K, V>>();
this._keyMapper = options.mapKey ?? (v => v);
}
head(): ?CacheNode<K, V> {
return this._head;
}
tail(): ?CacheNode<K, V> {
return this._tail;
}
size(): number {
return this._size;
}
maxSize(): number {
return this._maxSize;
}
has(key: K): boolean {
return this._map.has(this._keyMapper(key));
}
get(key: K): ?V {
const mappedKey = this._keyMapper(key);
const node = this._map.get(mappedKey);
if (!node) {
return undefined;
}
this.set(key, node.value);
return node.value;
}
set(key: K, val: V): void {
const mappedKey = this._keyMapper(key);
const existingNode = this._map.get(mappedKey);
if (existingNode) {
this.delete(key);
}
const head = this.head();
const node = {
key,
right: head,
left: null,
value: val,
};
if (head) {
head.left = node;
} else {
this._tail = node;
}
this._map.set(mappedKey, node);
this._head = node;
this._size++;
this._maybeDeleteLRU();
}
_maybeDeleteLRU() {
if (this.size() > this.maxSize()) {
this.deleteLru();
}
}
deleteLru(): void {
const tail = this.tail();
if (tail) {
this.delete(tail.key);
}
}
delete(key: K): void {
const mappedKey = this._keyMapper(key);
if (!this._size || !this._map.has(mappedKey)) {
return;
}
const node = nullthrows(this._map.get(mappedKey));
const right = node.right;
const left = node.left;
if (right) {
right.left = node.left;
}
if (left) {
left.right = node.right;
}
if (node === this.head()) {
this._head = right;
}
if (node === this.tail()) {
this._tail = left;
}
this._map.delete(mappedKey);
this._size--;
}
clear(): void {
this._size = 0;
this._head = null;
this._tail = null;
this._map = new Map<mixed, CacheNode<K, V>>();
}
}
module.exports = {LRUCache};
================================================
FILE: packages/recoil/caches/Recoil_MapCache.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.
*
* @flow strict
* @format
* @oncall recoil
*/
'use strict';
type Options<K> = {
mapKey: K => mixed,
};
class MapCache<K, V> {
_map: Map<mixed, V>;
_keyMapper: K => mixed;
constructor(options?: Options<K>) {
this._map = new Map<mixed, V>();
this._keyMapper = options?.mapKey ?? (v => v);
}
size(): number {
return this._map.size;
}
has(key: K): boolean {
return this._map.has(this._keyMapper(key));
}
get(key: K): ?V {
return this._map.get(this._keyMapper(key));
}
set(key: K, val: V): void {
this._map.set(this._keyMapper(key), val);
}
delete(key: K): void {
this._map.delete(this._keyMapper(key));
}
clear(): void {
this._map.clear();
}
}
module.exports = {MapCache};
================================================
FILE: packages/recoil/caches/Recoil_TreeCache.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.
*
* @flow strict-local
* @format
* @oncall recoil
*/
'use strict';
import type {
GetHandlers,
NodeCacheRoute,
NodeValueGet,
SetHandlers,
TreeCacheBranch,
TreeCacheLeaf,
TreeCacheNode,
} from './Recoil_TreeCacheImplementationType';
const {isFastRefreshEnabled} = require('../core/Recoil_ReactMode');
const recoverableViolation = require('recoil-shared/util/Recoil_recoverableViolation');
export type Options<T> = {
name?: string,
mapNodeValue?: (value: mixed) => mixed,
onHit?: (node: TreeCacheLeaf<T>) => void,
onSet?: (node: TreeCacheLeaf<T>) => void,
};
class ChangedPathError extends Error {}
class TreeCache<T = mixed> {
_name: ?string;
_numLeafs: number;
// $FlowIssue[unclear-type]
_root: TreeCacheNode<any> | null;
_onHit: $NonMaybeType<Options<T>['onHit']>;
_onSet: $NonMaybeType<Options<T>['onSet']>;
_mapNodeValue: $NonMaybeType<Options<T>['mapNodeValue']>;
constructor(options?: Options<T>) {
this._name = options?.name;
this._numLeafs = 0;
this._root = null;
this._onHit = options?.onHit ?? (() => {});
this._onSet = options?.onSet ?? (() => {});
this._mapNodeValue = options?.mapNodeValue ?? (val => val);
}
size(): number {
return this._numLeafs;
}
// $FlowIssue[unclear-type]
root(): TreeCacheNode<any> | null {
return this._root;
}
get(getNodeValue: NodeValueGet, handlers?: GetHandlers<T>): ?T {
return this.getLeafNode(getNodeValue, handlers)?.value;
}
getLeafNode(
getNodeValue: NodeValueGet,
handlers?: GetHandlers<T>,
): ?TreeCacheLeaf<T> {
if (this._root == null) {
return undefined;
}
// Iterate down the tree based on the current node values until we hit a leaf
// $FlowIssue[unclear-type]
let node: ?TreeCacheNode<any> = this._root;
while (node) {
handlers?.onNodeVisit(node);
if (node.type === 'leaf') {
this._onHit(node);
return node;
}
const nodeValue = this._mapNodeValue(getNodeValue(node.nodeKey));
node = node.branches.get(nodeValue);
}
return undefined;
}
set(route: NodeCacheRoute, value: T, handlers?: SetHandlers<T>): void {
const addLeaf = () => {
// First, setup the branch nodes for the route:
// Iterate down the tree to find or add branch nodes following the route
let node: ?TreeCacheBranch<T>;
let branchKey;
for (const [nodeKey, nodeValue] of route) {
// If the previous root was a leaf, while we not have a get(), it means
// the selector has inconsistent values or implementation changed.
const root = this._root;
if (root?.type === 'leaf') {
throw this.invalidCacheError();
}
// node now refers to the next node down in the tree
const parent = node;
// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-type]
node = parent ? parent.branches.get(branchKey) : root;
// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-type]
node = node ?? {
type: 'branch',
nodeKey,
parent,
branches: new Map(),
branchKey,
};
// If we found an existing node, confirm it has a consistent value
if (node.type !== 'branch' || node.nodeKey !== nodeKey) {
throw this.invalidCacheError();
}
// Add the branch node to the tree
parent?.branches.set(branchKey, node);
handlers?.onNodeVisit?.(node);
// Prepare for next iteration and install root if it is new.
branchKey = this._mapNodeValue(nodeValue);
this._root = this._root ?? node;
}
// Second, setup the leaf node:
// If there is an existing leaf for this route confirm it is consistent
const oldLeaf: ?TreeCacheNode<T> = node
? node?.branches.get(branchKey)
: this._root;
if (
oldLeaf != null &&
(oldLeaf.type !== 'leaf' || oldLeaf.branchKey !== branchKey)
) {
throw this.invalidCacheError();
}
// Create a new or replacement leaf.
const leafNode = {
type: 'leaf',
value,
parent: node,
branchKey,
};
// Install the leaf and call handlers
node?.branches.set(branchKey, leafNode);
this._root = this._root ?? leafNode;
this._numLeafs++;
this._onSet(leafNode);
handlers?.onNodeVisit?.(leafNode);
};
try {
addLeaf();
} catch (error) {
// If the cache was stale or observed inconsistent values, such as with
// Fast Refresh, then clear it and rebuild with the new values.
if (error instanceof ChangedPathError) {
this.clear();
addLeaf();
} else {
throw error;
}
}
}
// Returns true if leaf was actually deleted from the tree
delete(leaf: TreeCacheLeaf<T>): boolean {
const root = this.root();
if (!root) {
return false;
}
if (leaf === root) {
this._root = null;
this._numLeafs = 0;
return true;
}
// Iterate up from the leaf deleteing it from it's parent's branches.
let node = leaf.parent;
let branchKey = leaf.branchKey;
while (node) {
node.branches.delete(branchKey);
// Stop iterating if we hit the root.
if (node === root) {
if (node.branches.size === 0) {
this._root = null;
this._numLeafs = 0;
} else {
this._numLeafs--;
}
return true;
}
// Stop iterating if there are other branches since we don't need to
// remove any more nodes.
if (node.branches.size > 0) {
break;
}
// Iterate up to our parent
branchKey = node?.branchKey;
node = node.parent;
}
// Confirm that the leaf we are deleting is actually attached to our tree
for (; node !== root; node = node.parent) {
if (node == null) {
return false;
}
}
this._numLeafs--;
return true;
}
clear(): void {
this._numLeafs = 0;
this._root = null;
}
invalidCacheError(): ChangedPathError {
const CHANGED_PATH_ERROR_MESSAGE = isFastRefreshEnabled()
? 'Possible Fast Refresh module reload detected. ' +
'This may also be caused by an selector returning inconsistent values. ' +
'Resetting cache.'
: 'Invalid cache values. This happens when selectors do not return ' +
'consistent values for the same input dependency values. That may also ' +
'be caused when using Fast Refresh to change a selector implementation. ' +
'Resetting cache.';
recoverableViolation(
CHANGED_PATH_ERROR_MESSAGE +
(this._name != null ? ` - ${this._name}` : ''),
'recoil',
);
throw new ChangedPathError();
}
}
module.exports = {TreeCache};
================================================
FILE: packages/recoil/caches/Recoil_TreeCacheImplementationType.js
================================================
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under
gitextract_bj3knz1n/
├── .eslintignore
├── .eslintrc.js
├── .flowconfig
├── .github/
│ └── workflows/
│ ├── nightly.yml
│ └── nodejs.yml
├── .gitignore
├── .prettierignore
├── .prettierrc
├── .watchmanconfig
├── CHANGELOG-recoil-relay.md
├── CHANGELOG-recoil-sync.md
├── CHANGELOG-recoil.md
├── CHANGELOG-refine.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README-recoil-relay.md
├── README-recoil-sync.md
├── README-refine.md
├── README.md
├── babel.config.json
├── eslint-rules/
│ └── no-fb-only.js
├── flow-typed/
│ ├── jest.js
│ ├── npm/
│ │ ├── ReactDOM_vx.x.x.js
│ │ ├── ReactTestUtils_vx.x.x.js
│ │ ├── d3-array_vx.x.x.js
│ │ ├── d3-collection_vx.x.x.js
│ │ ├── d3-interpolate_vx.x.x.js
│ │ ├── d3-scale_vx.x.x.js
│ │ ├── d3-selection_vx.x.x.js
│ │ ├── d3-transition_vx.x.x.js
│ │ ├── d3_vx.x.x.js
│ │ ├── hamt_plus_vx.x.x.js
│ │ ├── immutable_vx.x.x.js
│ │ ├── jest_v26.x.x.js
│ │ ├── jsondiffpatch-for-react_vx.x.x.js
│ │ ├── nullthrows_vx.x.x.js
│ │ └── react-dom_v18.x.x.js
│ ├── package.json.js
│ └── public-stubs.js
├── jest.config.js
├── package.json
├── packages/
│ ├── recoil/
│ │ ├── Recoil_index.js
│ │ ├── adt/
│ │ │ ├── Recoil_ArrayKeyedMap.js
│ │ │ ├── Recoil_Loadable.js
│ │ │ ├── Recoil_PersistentMap.js
│ │ │ ├── Recoil_Queue.js
│ │ │ ├── Recoil_Wrapper.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_ArrayKeyedMap-test.js
│ │ │ └── Recoil_Loadable-test.js
│ │ ├── caches/
│ │ │ ├── Recoil_CacheImplementationType.js
│ │ │ ├── Recoil_CachePolicy.js
│ │ │ ├── Recoil_LRUCache.js
│ │ │ ├── Recoil_MapCache.js
│ │ │ ├── Recoil_TreeCache.js
│ │ │ ├── Recoil_TreeCacheImplementationType.js
│ │ │ ├── Recoil_cacheFromPolicy.js
│ │ │ ├── Recoil_treeCacheFromPolicy.js
│ │ │ ├── Recoil_treeCacheLRU.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_LRUCache-test.js
│ │ │ ├── Recoil_MapCache-test.js
│ │ │ ├── Recoil_TreeCache-test.js
│ │ │ ├── Recoil_cacheFromPolicy-test.js
│ │ │ ├── Recoil_treeCacheFromPolicy-test.js
│ │ │ └── Recoil_treeCacheLRU-test.js
│ │ ├── contrib/
│ │ │ ├── devtools_connector/
│ │ │ │ └── RecoilDevTools_Connector.react.js
│ │ │ └── uri_persistence/
│ │ │ ├── Recoil_Link.js
│ │ │ └── __tests__/
│ │ │ └── Recoil_Link-test.js
│ │ ├── core/
│ │ │ ├── Recoil_AtomicUpdates.js
│ │ │ ├── Recoil_Batching.js
│ │ │ ├── Recoil_FunctionalCore.js
│ │ │ ├── Recoil_Graph.js
│ │ │ ├── Recoil_GraphTypes.js
│ │ │ ├── Recoil_Keys.js
│ │ │ ├── Recoil_Node.js
│ │ │ ├── Recoil_ReactMode.js
│ │ │ ├── Recoil_RecoilRoot.js
│ │ │ ├── Recoil_RecoilValue.js
│ │ │ ├── Recoil_RecoilValueInterface.js
│ │ │ ├── Recoil_RetainedBy.js
│ │ │ ├── Recoil_Retention.js
│ │ │ ├── Recoil_RetentionZone.js
│ │ │ ├── Recoil_Snapshot.js
│ │ │ ├── Recoil_SnapshotCache.js
│ │ │ ├── Recoil_State.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_RecoilRoot-test.js
│ │ │ ├── Recoil_RecoilValueInterface-test.js
│ │ │ ├── Recoil_Retention-test.js
│ │ │ ├── Recoil_Snapshot-test.js
│ │ │ ├── Recoil_batcher-test.js
│ │ │ ├── Recoil_core-test.js
│ │ │ ├── Recoil_perf-test.js
│ │ │ └── Recoil_useRecoilStoreID-test.js
│ │ ├── hooks/
│ │ │ ├── Recoil_Hooks.js
│ │ │ ├── Recoil_SnapshotHooks.js
│ │ │ ├── Recoil_useGetRecoilValueInfo.js
│ │ │ ├── Recoil_useRecoilBridgeAcrossReactRoots.js
│ │ │ ├── Recoil_useRecoilCallback.js
│ │ │ ├── Recoil_useRecoilRefresher.js
│ │ │ ├── Recoil_useRecoilTransaction.js
│ │ │ ├── Recoil_useRetain.js
│ │ │ └── __tests__/
│ │ │ ├── Recoil_Hooks_TRANSITION_SUPPORT_UNSTABLE-test.js
│ │ │ ├── Recoil_PublicHooks-test.js
│ │ │ ├── Recoil_React-test.js
│ │ │ ├── Recoil_useGetRecoilValueInfo-test.js
│ │ │ ├── Recoil_useGotoRecoilSnapshot-test.js
│ │ │ ├── Recoil_useRecoilBridgeAcrossReactRoots-test.js
│ │ │ ├── Recoil_useRecoilCallback-test.js
│ │ │ ├── Recoil_useRecoilInterface-test.js
│ │ │ ├── Recoil_useRecoilRefresher-test.js
│ │ │ ├── Recoil_useRecoilSnapshot-test.js
│ │ │ ├── Recoil_useRecoilStateReset-test.js
│ │ │ ├── Recoil_useRecoilTransaction-test.js
│ │ │ ├── Recoil_useRecoilTransactionObserver-test.js
│ │ │ ├── Recoil_useRecoilValueLoadable-test.js
│ │ │ ├── Recoil_useTransactionObservation_DEPRECATED-test.js
│ │ │ └── Recoil_useTransition-test.js
│ │ ├── package-for-release.json
│ │ ├── package.json
│ │ └── recoil_values/
│ │ ├── Recoil_WaitFor.js
│ │ ├── Recoil_WaitFor.js.flow
│ │ ├── Recoil_atom.js
│ │ ├── Recoil_atomFamily.js
│ │ ├── Recoil_callbackTypes.js
│ │ ├── Recoil_constSelector.js
│ │ ├── Recoil_errorSelector.js
│ │ ├── Recoil_readOnlySelector.js
│ │ ├── Recoil_selector.js
│ │ ├── Recoil_selectorFamily.js
│ │ ├── __flowtests__/
│ │ │ └── Recoil_WaitFor-flowtest.js
│ │ └── __tests__/
│ │ ├── Recoil_WaitFor-test.js
│ │ ├── Recoil_atom-test.js
│ │ ├── Recoil_atomFamily-test.js
│ │ ├── Recoil_atomWithFallback-test.js
│ │ ├── Recoil_constSelector-test.js
│ │ ├── Recoil_errorSelector-test.js
│ │ ├── Recoil_selector-test.js
│ │ ├── Recoil_selectorFamily-test.js
│ │ └── Recoil_selectorHooks-test.js
│ ├── recoil-relay/
│ │ ├── RecoilRelay_Environments.js
│ │ ├── RecoilRelay_graphQLMutationEffect.js
│ │ ├── RecoilRelay_graphQLQueryEffect.js
│ │ ├── RecoilRelay_graphQLSelector.js
│ │ ├── RecoilRelay_graphQLSelectorFamily.js
│ │ ├── RecoilRelay_graphQLSubscriptionEffect.js
│ │ ├── RecoilRelay_index.js
│ │ ├── __test_utils__/
│ │ │ └── RecoilRelay_mockRelayEnvironment.js
│ │ ├── __tests__/
│ │ │ ├── RecoilRelay_RecoilRelayEnvironment-test.js
│ │ │ ├── RecoilRelay_graphQLMutationEffect-test.js
│ │ │ ├── RecoilRelay_graphQLQueryEffect-test.js
│ │ │ ├── RecoilRelay_graphQLSelector-test.js
│ │ │ ├── RecoilRelay_graphQLSelectorFamily-test.js
│ │ │ ├── RecoilRelay_graphQLSubscriptionEffect-test.js
│ │ │ └── mock-graphql/
│ │ │ ├── RecoilRelay_MockQueries.js
│ │ │ └── schema.graphql
│ │ ├── package-for-release.json
│ │ └── package.json
│ ├── recoil-sync/
│ │ ├── RecoilSync.js
│ │ ├── RecoilSync_URL.js
│ │ ├── RecoilSync_URLJSON.js
│ │ ├── RecoilSync_URLTransit.js
│ │ ├── RecoilSync_index.js
│ │ ├── __test_utils__/
│ │ │ └── RecoilSync_MockURLSerialization.js
│ │ ├── __tests__/
│ │ │ ├── RecoilSync-test.js
│ │ │ ├── RecoilSync_URL-test.js
│ │ │ ├── RecoilSync_URLCompound-test.js
│ │ │ ├── RecoilSync_URLInterface-test.js
│ │ │ ├── RecoilSync_URLJSON-test.js
│ │ │ ├── RecoilSync_URLListen-test.js
│ │ │ ├── RecoilSync_URLPush-test.js
│ │ │ ├── RecoilSync_URLTransit-test.js
│ │ │ └── RecoilSync_URLTransitJSON-test.js
│ │ ├── package-for-release.json
│ │ └── package.json
│ ├── refine/
│ │ ├── Refine_API.js
│ │ ├── Refine_Checkers.js
│ │ ├── Refine_ContainerCheckers.js
│ │ ├── Refine_JSON.js
│ │ ├── Refine_PrimitiveCheckers.js
│ │ ├── Refine_UtilityCheckers.js
│ │ ├── Refine_index.js
│ │ ├── __tests__/
│ │ │ ├── Refine-test.js
│ │ │ ├── Refine_Containers-test.js
│ │ │ ├── Refine_JSON-test.js
│ │ │ ├── Refine_Primitives-test.js
│ │ │ └── Refine_Utilities-test.js
│ │ ├── package-for-release.json
│ │ └── package.json
│ └── shared/
│ ├── __test_utils__/
│ │ ├── Recoil_ReactRenderModes.js
│ │ └── Recoil_TestingUtils.js
│ ├── package.json
│ ├── polyfill/
│ │ ├── ReactBatchedUpdates.js
│ │ ├── ReactBatchedUpdates.native.js
│ │ ├── err.js
│ │ ├── expectationViolation.js
│ │ ├── invariant.js
│ │ ├── recoverableViolation.js
│ │ └── sprintf.js
│ └── util/
│ ├── Recoil_CopyOnWrite.js
│ ├── Recoil_Environment.js
│ ├── Recoil_Memoize.js
│ ├── Recoil_PerformanceTimings.js
│ ├── Recoil_ReactBatchedUpdates.js
│ ├── Recoil_RecoilEnv.js
│ ├── Recoil_concatIterables.js
│ ├── Recoil_deepFreezeValue.js
│ ├── Recoil_differenceSets.js
│ ├── Recoil_err.js
│ ├── Recoil_expectationViolation.js
│ ├── Recoil_filterIterable.js
│ ├── Recoil_filterMap.js
│ ├── Recoil_filterSet.js
│ ├── Recoil_gkx.js
│ ├── Recoil_invariant.js
│ ├── Recoil_isNode.js
│ ├── Recoil_isPromise.js
│ ├── Recoil_lazyProxy.js
│ ├── Recoil_mapIterable.js
│ ├── Recoil_mapMap.js
│ ├── Recoil_mergeMaps.js
│ ├── Recoil_nullthrows.js
│ ├── Recoil_recoverableViolation.js
│ ├── Recoil_shallowArrayEqual.js
│ ├── Recoil_someSet.js
│ ├── Recoil_stableStringify.js
│ ├── Recoil_unionSets.js
│ ├── Recoil_useComponentName.js
│ ├── Recoil_usePrevious.js
│ ├── Recoil_useRefInitOnce.js
│ └── __tests__/
│ ├── Recoil_Memoize-test.js
│ ├── Recoil_RecoilEnv-test.js
│ ├── Recoil_deepFreezeValue-test.js
│ ├── Recoil_lazyProxy-test.js
│ └── Recoil_stableStringify-test.js
├── packages-ext/
│ ├── recoil-devtools/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── flow.js
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── constants/
│ │ │ │ └── Constants.js
│ │ │ ├── manifest.json
│ │ │ ├── pages/
│ │ │ │ ├── Background/
│ │ │ │ │ ├── Background.js
│ │ │ │ │ ├── __tests__/
│ │ │ │ │ │ └── Background.test.js
│ │ │ │ │ └── index.html
│ │ │ │ ├── Content/
│ │ │ │ │ ├── ContentScript.js
│ │ │ │ │ └── __tests__/
│ │ │ │ │ └── ContentScript.test.js
│ │ │ │ ├── Devtools/
│ │ │ │ │ ├── DevtoolsScript.js
│ │ │ │ │ └── index.html
│ │ │ │ ├── Page/
│ │ │ │ │ └── PageScript.js
│ │ │ │ └── Popup/
│ │ │ │ ├── ConnectionContext.js
│ │ │ │ ├── Devpanel.html
│ │ │ │ ├── Items/
│ │ │ │ │ ├── CollapsibleItem.js
│ │ │ │ │ ├── DiffItem.js
│ │ │ │ │ ├── Item.js
│ │ │ │ │ ├── ItemDependencies.js
│ │ │ │ │ ├── ItemDescription.js
│ │ │ │ │ ├── ItemLabel.js
│ │ │ │ │ ├── ItemMoreItems.js
│ │ │ │ │ ├── ItemValue.js
│ │ │ │ │ ├── NodeName.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── PopupApp.js
│ │ │ │ ├── PopupComponent.js
│ │ │ │ ├── PopupDependencyGraph.js
│ │ │ │ ├── PopupDiff.js
│ │ │ │ ├── PopupHeader.js
│ │ │ │ ├── PopupMainContent.js
│ │ │ │ ├── PopupScript.js
│ │ │ │ ├── PopupSidebar.js
│ │ │ │ ├── PopupSidebarTransaction.js
│ │ │ │ ├── PopupSnapshot.js
│ │ │ │ ├── Snapshot/
│ │ │ │ │ ├── AtomList.js
│ │ │ │ │ ├── SearchContext.js
│ │ │ │ │ ├── SelectorList.js
│ │ │ │ │ ├── SnapshotSearch.js
│ │ │ │ │ └── snapshotHooks.js
│ │ │ │ ├── Tabs.js
│ │ │ │ ├── index.html
│ │ │ │ └── useSelectionHooks.js
│ │ │ ├── types/
│ │ │ │ └── DevtoolsTypes.js
│ │ │ └── utils/
│ │ │ ├── Connection.js
│ │ │ ├── EvictableList.js
│ │ │ ├── GraphUtils.js
│ │ │ ├── Logger.js
│ │ │ ├── ObjectEntries.js
│ │ │ ├── ObjectValues.js
│ │ │ ├── Serialization.js
│ │ │ ├── Store.js
│ │ │ ├── TXHashtable.js
│ │ │ ├── __tests__/
│ │ │ │ ├── EvictableListTest.js
│ │ │ │ ├── Recoil_DevTools_GraphUtils.test.js
│ │ │ │ ├── Recoil_DevTools_TXHashtable.test.js
│ │ │ │ └── SerializationTest.js
│ │ │ ├── debounce.js
│ │ │ ├── getStyle.js
│ │ │ └── sankey/
│ │ │ ├── CV2_D3.js
│ │ │ ├── CV2_memoize.js
│ │ │ ├── Sankey.js
│ │ │ ├── SankeyGraph.js
│ │ │ ├── SankeyGraphLayout.js
│ │ │ ├── compactArray.js
│ │ │ └── isImmutable.js
│ │ ├── utils/
│ │ │ ├── build.js
│ │ │ ├── env.js
│ │ │ └── webserver.js
│ │ └── webpack.config.js
│ └── todo-example/
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src/
│ ├── App.css
│ ├── App.js
│ ├── components/
│ │ └── Todo/
│ │ ├── TodoItem.jsx
│ │ ├── TodoItemCreator.jsx
│ │ ├── TodoList.jsx
│ │ ├── TodoListFilters.jsx
│ │ ├── TodoListStats.jsx
│ │ ├── Todo_state.js
│ │ └── Todo_types.js
│ ├── index.css
│ └── index.js
├── relay.config.js
├── rollup.config.js
├── scripts/
│ ├── build.mjs
│ ├── deploy_nightly_build.js
│ ├── pack.mjs
│ ├── project-root-dir.mjs
│ ├── rollup-configs.mjs
│ └── utils.mjs
├── setupJestMock.js
└── typescript/
├── index.d.ts
├── recoil-relay-test.ts
├── recoil-relay.d.ts
├── recoil-sync-test.ts
├── recoil-sync.d.ts
├── recoil-test.ts
├── recoil.d.ts
├── refine-test.ts
├── refine.d.ts
├── tsconfig.json
└── tslint.json
SYMBOL INDEX (509 symbols across 136 files)
FILE: .eslintrc.js
constant OFF (line 13) | const OFF = 0;
constant WARNING (line 14) | const WARNING = 1;
constant ERROR (line 15) | const ERROR = 2;
FILE: eslint-rules/no-fb-only.js
method create (line 34) | create(context) {
FILE: packages-ext/recoil-devtools/src/pages/Background/Background.js
function onConnect (line 30) | function onConnect(port: chrome$Port): void {
FILE: packages-ext/recoil-devtools/src/pages/Content/ContentScript.js
function initContentScriptListeners (line 24) | function initContentScriptListeners() {
function initPageScript (line 104) | function initPageScript() {
FILE: packages-ext/recoil-devtools/src/pages/Page/PageScript.js
method if (line 34) | if (snapshot == null) {
method initConnection (line 102) | initConnection(props);
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/CollapsibleItem.js
function CollapsibleItem (line 73) | function CollapsibleItem({
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/DiffItem.js
function DiffItem (line 43) | function DiffItem({
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/Item.js
function Item (line 36) | function Item({
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/ItemDependencies.js
function ItemDependencies (line 38) | function ItemDependencies({name}: Props): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/ItemDescription.js
function totalLength (line 36) | function totalLength(content: SerializedValue): number {
function ItemDescription (line 54) | function ItemDescription({content}: KeyProps): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/ItemLabel.js
function ItemLabel (line 35) | function ItemLabel({name, node, isRoot = false}: KeyProps): React$MixedE...
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/ItemMoreItems.js
function ItemMoreItems (line 40) | function ItemMoreItems({content}: KeyProps): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/ItemValue.js
function ItemValue (line 138) | function ItemValue({
FILE: packages-ext/recoil-devtools/src/pages/Popup/Items/NodeName.js
function NodeName (line 39) | function NodeName({name, node}: KeyProps): React$MixedElement {
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupApp.js
function PopupApp (line 25) | function PopupApp({
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupDependencyGraph.js
function ColorReference (line 80) | function ColorReference({color, legend}: ReferenceProps): React.Node {
function PopupDependencyGraph (line 90) | function PopupDependencyGraph(): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupDiff.js
function PopupDiff (line 18) | function PopupDiff(): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupHeader.js
function PopupHeader (line 57) | function PopupHeader({
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupSidebar.js
function Sidebar (line 38) | function Sidebar(): React.MixedElement {
FILE: packages-ext/recoil-devtools/src/pages/Popup/PopupSnapshot.js
function SnapshotRenderer (line 28) | function SnapshotRenderer(): React.Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Snapshot/AtomList.js
function AtomsList (line 19) | function AtomsList(): React$Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Snapshot/SelectorList.js
function SelectorList (line 19) | function SelectorList(): React$Node {
FILE: packages-ext/recoil-devtools/src/pages/Popup/Snapshot/SnapshotSearch.js
function SnapshotSearch (line 15) | function SnapshotSearch(): React$MixedElement {
FILE: packages-ext/recoil-devtools/src/utils/Connection.js
class Connection (line 28) | class Connection {
method constructor (line 39) | constructor(
method initializeValues (line 62) | initializeValues(values: ValuesMessageType) {
method processMessage (line 71) | processMessage(msg: BackgroundPostMessage, _isInit: boolean = false): ...
method persistValues (line 90) | persistValues(values: ?ValuesMessageType, txID: number) {
FILE: packages-ext/recoil-devtools/src/utils/GraphUtils.js
function depsHaveChaged (line 19) | function depsHaveChaged(
function createGraph (line 37) | function createGraph(deps: DependenciesSnapshotType): {
FILE: packages-ext/recoil-devtools/src/utils/Logger.js
method if (line 13) | if (__DEV__) {
method if (line 20) | if (typeof console !== 'undefined') {
FILE: packages-ext/recoil-devtools/src/utils/ObjectEntries.js
method if (line 26) | if (__DEV__) {
FILE: packages-ext/recoil-devtools/src/utils/Serialization.js
function serialize (line 41) | function serialize(
function maybeAddExceeds (line 153) | function maybeAddExceeds(
FILE: packages-ext/recoil-devtools/src/utils/Store.js
class Store (line 21) | class Store {
method constructor (line 27) | constructor() {
method connect (line 33) | connect(
method disconnect (line 56) | disconnect(connectionId: number): void {
method hasConnection (line 61) | hasConnection(id: number): boolean {
method Connection (line 65) | Connection {
method return (line 73) | return Array.from(this.connections.values());
FILE: packages-ext/recoil-devtools/src/utils/sankey/CV2_D3.js
constant OPTION_DEFAULTS (line 43) | const OPTION_DEFAULTS: Options = {
method if (line 159) | if (attrs != null) {
method if (line 178) | if (styles != null) {
method if (line 188) | if (events != null) {
FILE: packages-ext/recoil-devtools/src/utils/sankey/CV2_memoize.js
constant KEY (line 13) | const KEY = Symbol('CV2_cacheKeyFromObject.KEY');
constant TIME_WARNING_THRESHOLD_MS (line 14) | const TIME_WARNING_THRESHOLD_MS = 15;
function cacheKeyFromObject (line 22) | function cacheKeyFromObject(object: mixed): mixed {
FILE: packages-ext/recoil-devtools/src/utils/sankey/SankeyGraph.js
method if (line 95) | if (key != null) {
FILE: packages-ext/recoil-devtools/src/utils/sankey/SankeyGraphLayout.js
method if (line 96) | if (nodeLimit == null || nodeLimit >= graph.nodes.length) {
method if (line 149) | if (!targetLink.fadeTarget && targetLink.target != null) {
method if (line 195) | if (!nodesSet.has(neighbor)) {
function collisionDetection (line 283) | function collisionDetection() {
function layoutLinks (line 322) | function layoutLinks() {
FILE: packages-ext/recoil-devtools/webpack.config.js
method transform (line 139) | transform(content, _path) {
FILE: packages-ext/todo-example/src/App.js
function App (line 17) | function App() {
FILE: packages-ext/todo-example/src/components/Todo/TodoItem.jsx
function replaceItemAtIndex (line 58) | function replaceItemAtIndex(arr, index, newValue) {
function removeItemAtIndex (line 62) | function removeItemAtIndex(arr, index) {
FILE: packages-ext/todo-example/src/components/Todo/TodoItemCreator.jsx
function getId (line 46) | function getId() {
FILE: packages/recoil-relay/RecoilRelay_Environments.js
class EnvironmentKey (line 24) | class EnvironmentKey {
method constructor (line 27) | constructor(name: string) {
method toJSON (line 31) | toJSON(): string {
function registerRelayEnvironment (line 43) | function registerRelayEnvironment(
function RecoilRelayEnvironment (line 91) | function RecoilRelayEnvironment({
function RecoilRelayEnvironmentProvider (line 119) | function RecoilRelayEnvironmentProvider({
function registerRecoilSnapshotRelayEnvironment (line 139) | function registerRecoilSnapshotRelayEnvironment(
method if (line 153) | if (environmentOpt instanceof EnvironmentKey) {
FILE: packages/recoil-relay/__test_utils__/RecoilRelay_mockRelayEnvironment.js
function mockRelayEnvironment (line 31) | function mockRelayEnvironment(): {
FILE: packages/recoil-relay/__tests__/RecoilRelay_RecoilRelayEnvironment-test.js
function AssertEnvironment (line 169) | function AssertEnvironment({
function RegisterRelayEnvironments (line 177) | function RegisterRelayEnvironments({
function Component (line 273) | function Component() {
FILE: packages/recoil-relay/__tests__/RecoilRelay_graphQLQueryEffect-test.js
function Component (line 232) | function Component() {
FILE: packages/recoil-sync/RecoilSync.js
constant DEFAULT_VALUE (line 65) | const DEFAULT_VALUE = new DefaultValue();
method if (line 68) | if (a.size <= b.size) {
method if (line 76) | if (a.has(x)) {
method if (line 122) | if (!this.atomRegistries.has(recoilStoreID)) {
method for (line 289) | for (const [, {options}] of effects) {
method switch (line 564) | switch (loadable.state) {
method catch (line 580) | catch (error) {
FILE: packages/recoil-sync/RecoilSync_URL.js
function URL (line 56) | function parseURL(
function encodeURL (line 94) | function encodeURL(
constant DEFAULT_BROWSER_INTERFACE (line 154) | const DEFAULT_BROWSER_INTERFACE = {
function RecoilURLSync (line 164) | function RecoilURLSync({
FILE: packages/recoil-sync/__tests__/RecoilSync-test.js
function SyncWithProps (line 1026) | function SyncWithProps({
function SyncOrder (line 1282) | function SyncOrder() {
function MyRoot (line 1295) | function MyRoot() {
FILE: packages/recoil-sync/__tests__/RecoilSync_URL-test.js
function testWriteToURL (line 40) | function testWriteToURL(loc: LocationOption, remainder: () => void) {
FILE: packages/recoil-sync/__tests__/RecoilSync_URLJSON-test.js
function testJSON (line 77) | async function testJSON(
FILE: packages/recoil-sync/__tests__/RecoilSync_URLTransit-test.js
class MyClass (line 38) | class MyClass {
method constructor (line 40) | constructor(msg: string) {
constant HANDLERS (line 108) | const HANDLERS = [
function testTransit (line 117) | async function testTransit(
function wasExpectationViolationCalled (line 360) | function wasExpectationViolationCalled(): boolean {
FILE: packages/recoil-sync/__tests__/RecoilSync_URLTransitJSON-test.js
function testURL (line 66) | async function testURL(contents: string, beforeURL: string, afterURL: st...
FILE: packages/recoil/adt/Recoil_ArrayKeyedMap.js
constant LEAF (line 19) | const LEAF = {};
method if (line 30) | if (existing instanceof ArrayKeyedMap) {
FILE: packages/recoil/adt/Recoil_PersistentMap.js
method if (line 84) | if (existing instanceof HashArrayMappedTrieMap) {
method for (line 89) | for (const [k, v] of existing.entries()) {
FILE: packages/recoil/adt/Recoil_Queue.js
function enqueueExecution (line 14) | function enqueueExecution(s: string, f: () => mixed) {
FILE: packages/recoil/adt/__tests__/Recoil_Loadable-test.js
constant ERROR (line 21) | const ERROR = new Error('ERROR');
FILE: packages/recoil/caches/Recoil_LRUCache.js
class LRUCache (line 27) | class LRUCache<K = mixed, V = mixed> {
method constructor (line 35) | constructor(options: Options<K>) {
FILE: packages/recoil/caches/Recoil_MapCache.js
class MapCache (line 17) | class MapCache<K, V> {
method constructor (line 21) | constructor(options?: Options<K>) {
method size (line 26) | size(): number {
method has (line 30) | has(key: K): boolean {
FILE: packages/recoil/caches/Recoil_TreeCache.js
class ChangedPathError (line 34) | class ChangedPathError extends Error {}
method constructor (line 46) | constructor(options?: Options<T>) {
method size (line 55) | size(): number {
method root (line 60) | root(): TreeCacheNode<any> | null {
method if (line 72) | if (this._root == null) {
method if (line 198) | if (node.branches.size === 0) {
method if (line 220) | if (node == null) {
FILE: packages/recoil/caches/Recoil_cacheFromPolicy.js
function cacheFromPolicy (line 36) | function cacheFromPolicy<K, V>({
function getValueMapper (line 48) | function getValueMapper(equality: EqualityPolicy): mixed => mixed {
function getCache (line 59) | function getCache<K, V>(
FILE: packages/recoil/caches/Recoil_treeCacheFromPolicy.js
method switch (line 65) | switch (eviction) {
FILE: packages/recoil/contrib/devtools_connector/RecoilDevTools_Connector.react.js
method if (line 42) | if (typeof window === 'undefined') {
constant CONNECTION_INDEX (line 49) | let CONNECTION_INDEX = 0;
function Connector (line 55) | function Connector({
FILE: packages/recoil/contrib/uri_persistence/Recoil_Link.js
function LinkToRecoilSnapshot (line 54) | function LinkToRecoilSnapshot({
function LinkToRecoilStateChange (line 111) | function LinkToRecoilStateChange({
FILE: packages/recoil/core/Recoil_AtomicUpdates.js
method if (line 103) | if (this._changes.size === 0) {
FILE: packages/recoil/core/Recoil_FunctionalCore.js
method if (line 246) | if (!visitedNodes.has(downstreamNode)) {
FILE: packages/recoil/core/Recoil_Graph.js
function makeGraph (line 23) | function makeGraph(): Graph {
function cloneGraph (line 30) | function cloneGraph(graph: Graph): Graph {
method if (line 64) | if (!nodeToNodeSubscriptions.has(dep)) {
method if (line 75) | if (!nodeToNodeSubscriptions.has(dep)) {
FILE: packages/recoil/core/Recoil_Node.js
class DefaultValue (line 28) | class DefaultValue {}
function recoilValuesForKeys (line 107) | function recoilValuesForKeys(
function checkForDuplicateAtomKey (line 113) | function checkForDuplicateAtomKey(key: string): void {
class NodeMissingError (line 147) | class NodeMissingError extends Error {}
function getNode (line 150) | function getNode(key: NodeKey): Node<any> {
function getNodeMaybe (line 159) | function getNodeMaybe(key: NodeKey): void | Node<any> {
method if (line 166) | if (!gkx('recoil_memory_managament_2020')) {
method if (line 178) | if (!gkx('recoil_memory_managament_2020')) {
method if (line 181) | if (fn === undefined) {
function getConfigDeletionHandler (line 188) | function getConfigDeletionHandler(key: NodeKey): void | (() => void) {
FILE: packages/recoil/core/Recoil_ReactMode.js
function currentRendererSupportsUseSyncExternalStore (line 34) | function currentRendererSupportsUseSyncExternalStore(): boolean {
function reactMode (line 69) | function reactMode(): {mode: ReactMode, early: boolean, concurrent: bool...
function isFastRefreshEnabled (line 86) | function isFastRefreshEnabled(): boolean {
FILE: packages/recoil/core/Recoil_RecoilRoot.js
method if (line 86) | if (stateReplacerIsBeingExecuted) {
method if (line 93) | if (
method useEffect (line 501) | useEffect(() => {
FILE: packages/recoil/core/Recoil_Retention.js
constant SUSPENSE_TIMEOUT_MS (line 28) | const SUSPENSE_TIMEOUT_MS = 120000;
function releaseRetainablesNowOnCurrentTree (line 32) | function releaseRetainablesNowOnCurrentTree(
method if (line 131) | if (!releasableNodes.has(parent)) {
method visit (line 155) | visit(nullthrows(nodes.values().next().value));
method if (line 263) | if (!gkx('recoil_memory_managament_2020')) {
method updateRetainCountToZero (line 269) | updateRetainCountToZero(store, retainable);
method if (line 276) | if (!gkx('recoil_memory_managament_2020')) {
method if (line 285) | if (!gkx('recoil_memory_managament_2020')) {
FILE: packages/recoil/core/Recoil_RetentionZone.js
class RetentionZone (line 14) | class RetentionZone {}
function retentionZone (line 16) | function retentionZone(): RetentionZone {
FILE: packages/recoil/core/Recoil_Snapshot.js
method if (line 118) | if (this._refCount <= 0) {
FILE: packages/recoil/core/Recoil_State.js
function makeEmptyTreeState (line 141) | function makeEmptyTreeState(): TreeState {
function makeEmptyStoreState (line 153) | function makeEmptyStoreState(): StoreState {
FILE: packages/recoil/core/__tests__/Recoil_RecoilRoot-test.js
function initializeState (line 62) | function initializeState({set, getLoadable}: MutableSnapshot) {
function initializeState (line 93) | function initializeState({set, getLoadable}: MutableSnapshot) {
function initializeState (line 130) | function initializeState({set}: MutableSnapshot) {
function MyRoot (line 282) | function MyRoot() {
function Component (line 335) | function Component() {
FILE: packages/recoil/core/__tests__/Recoil_Retention-test.js
function Subscribes (line 173) | function Subscribes() {
function Retains (line 189) | function Retains() {
function RetainsZone (line 206) | function RetainsZone() {
function SubscribesToSelector (line 231) | function SubscribesToSelector() {
function SubscribesToSelector (line 264) | function SubscribesToSelector() {
function SubscribesToSelector (line 305) | function SubscribesToSelector() {
function Setup (line 361) | function Setup() {
function ReadsSelector (line 369) | function ReadsSelector() {
function ReadsDepA (line 375) | function ReadsDepA() {
function ReadsDepB (line 381) | function ReadsDepB() {
function unmountAndRemount (line 388) | function unmountAndRemount() {
function RetainsZone (line 472) | function RetainsZone({zone}: $TEMPORARY$object<{zone: RetentionZone}>) {
function RetainsZone (line 498) | function RetainsZone() {
function RetainsAtom (line 502) | function RetainsAtom() {
FILE: packages/recoil/core/__tests__/Recoil_Snapshot-test.js
function getInfo (line 62) | function getInfo(
function TransactionObserver (line 174) | function TransactionObserver() {
function GotoSnapshot (line 180) | function GotoSnapshot() {
function Component (line 613) | function Component() {
FILE: packages/recoil/core/__tests__/Recoil_perf-test.js
constant ITERATIONS (line 25) | const ITERATIONS = [1];
FILE: packages/recoil/core/__tests__/Recoil_useRecoilStoreID-test.js
function StoreID (line 28) | function StoreID({
function MyApp (line 39) | function MyApp() {
FILE: packages/recoil/hooks/Recoil_Hooks.js
method if (line 265) | if (__DEV__) {
method if (line 268) | if (!recoilValuesUsed.current.has(recoilValue.key)) {
method if (line 670) | if (__DEV__) {
method if (line 707) | if (__DEV__) {
FILE: packages/recoil/hooks/Recoil_SnapshotHooks.js
function useTransactionSubscription (line 37) | function useTransactionSubscription(callback: Store => void) {
function externallyVisibleAtomValuesInState (line 45) | function externallyVisibleAtomValuesInState(
FILE: packages/recoil/hooks/Recoil_useRecoilBridgeAcrossReactRoots.js
function useRecoilBridgeAcrossReactRoots (line 20) | function useRecoilBridgeAcrossReactRoots(): RecoilBridge {
FILE: packages/recoil/hooks/Recoil_useRetain.js
function useRetain (line 34) | function useRetain(toRetain: ToRetain): void {
function useRetain_ACTUAL (line 42) | function useRetain_ACTUAL(toRetain: ToRetain): void {
FILE: packages/recoil/hooks/__tests__/Recoil_Hooks_TRANSITION_SUPPORT_UNSTABLE-test.js
function Component (line 67) | function Component() {
function Component (line 94) | function Component() {
function Component (line 127) | function Component() {
FILE: packages/recoil/hooks/__tests__/Recoil_PublicHooks-test.js
function counterAtom (line 77) | function counterAtom(persistence?: PersistenceSettings<number>) {
function plusOneSelector (line 85) | function plusOneSelector(dep: RecoilValue<number>) {
function componentThatReadsTwoAtoms (line 158) | function componentThatReadsTwoAtoms(
function componentThatReadsAtomWithCommitCount (line 167) | function componentThatReadsAtomWithCommitCount(
function componentThatToggles (line 182) | function componentThatToggles(a: Node, b: null) {
function Component (line 201) | function Component() {
function Component (line 387) | function Component() {
function Parent (line 395) | function Parent() {
function Switch (line 491) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function Switch (line 523) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function Switch (line 689) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function SetsDuringRendering (line 750) | function SetsDuringRendering() {
function Component1 (line 779) | function Component1() {
function Component2 (line 788) | function Component2() {
function Component3 (line 800) | function Component3() {
function SetsDuringEffect (line 834) | function SetsDuringEffect() {
function testWithOrder (line 867) | function testWithOrder(
function Test (line 929) | function Test() {
FILE: packages/recoil/hooks/__tests__/Recoil_React-test.js
function Component (line 44) | function Component() {
function Component (line 73) | function Component() {
FILE: packages/recoil/hooks/__tests__/Recoil_useGetRecoilValueInfo-test.js
function GetRecoilValueInfo (line 61) | function GetRecoilValueInfo() {
FILE: packages/recoil/hooks/__tests__/Recoil_useGotoRecoilSnapshot-test.js
function GotoRecoilSnapshot (line 73) | function GotoRecoilSnapshot() {
function RecoilCallback (line 116) | function RecoilCallback() {
function GotoRecoilSnapshot (line 168) | function GotoRecoilSnapshot() {
function GotoRecoilSnapshot (line 206) | function GotoRecoilSnapshot() {
function ReadAtom (line 248) | function ReadAtom() {
function GotoRecoilSnapshot (line 255) | function GotoRecoilSnapshot() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilBridgeAcrossReactRoots-test.js
function NestedReactRoot (line 50) | function NestedReactRoot({children}: $TEMPORARY$object<{children: Node}>) {
function initializeState (line 72) | function initializeState({set, getLoadable}: MutableSnapshot) {
function RecoilStoreID (line 98) | function RecoilStoreID({storeIDRef}: {storeIDRef: {current: ?StoreID}}) {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilCallback-test.js
function Component (line 73) | function Component() {
function Component (line 96) | function Component() {
function Component (line 121) | function Component() {
function Component (line 147) | function Component() {
function Component (line 180) | function Component() {
function Component (line 217) | function Component() {
function Component (line 258) | function Component() {
function Component (line 304) | function Component() {
function RecoilCallback (line 346) | function RecoilCallback() {
function GetStore (line 390) | function GetStore() {
function Component (line 583) | function Component() {
function Component (line 618) | function Component() {
function Component (line 671) | function Component() {
function Component (line 707) | function Component() {
function Component (line 751) | function Component() {
function Component (line 810) | function Component() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilInterface-test.js
function nonReactCode (line 45) | function nonReactCode(recoilInterface: RecoilInterface) {
function nonReactCode (line 64) | function nonReactCode(recoilInterface: RecoilInterface) {
function nonReactCode (line 88) | function nonReactCode(recoilInterface: RecoilInterface) {
function nonReactCode (line 111) | function nonReactCode(recoilInterface: RecoilInterface) {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilRefresher-test.js
function Component (line 43) | function Component() {
function Component (line 63) | function Component() {
function Component (line 90) | function Component() {
function Component (line 131) | function Component() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilSnapshot-test.js
function RecoilSnapshotAndSubscribe (line 68) | function RecoilSnapshotAndSubscribe() {
function RecoilSnapshotAndSubscribe (line 120) | function RecoilSnapshotAndSubscribe() {
function RecoilSnapshotAndSubscribe (line 163) | function RecoilSnapshotAndSubscribe() {
function RecoilSnapshotAndSubscribe (line 194) | function RecoilSnapshotAndSubscribe() {
function RecoilSnapshot (line 252) | function RecoilSnapshot() {
function UseRecoilSnapshot (line 298) | function UseRecoilSnapshot() {
function Component (line 310) | function Component() {
function UseRecoilSnapshot (line 392) | function UseRecoilSnapshot() {
function Component (line 399) | function Component() {
function RecoilSnapshotAndSubscribe (line 458) | function RecoilSnapshotAndSubscribe() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilTransaction-test.js
function Component (line 58) | function Component() {
function Component (line 78) | function Component() {
function Component (line 124) | function Component() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilTransactionObserver-test.js
function TransactionObserver (line 49) | function TransactionObserver({
function UseRecoilTransactionObserver (line 61) | function UseRecoilTransactionObserver() {
FILE: packages/recoil/hooks/__tests__/Recoil_useRecoilValueLoadable-test.js
function ReadLoadable (line 48) | function ReadLoadable() {
function ReadLoadable (line 71) | function ReadLoadable() {
function ReadLoadable (line 96) | function ReadLoadable() {
function ReadPromise (line 195) | function ReadPromise() {
FILE: packages/recoil/hooks/__tests__/Recoil_useTransactionObservation_DEPRECATED-test.js
function counterAtom (line 66) | function counterAtom(persistence?: PersistenceSettings<number>) {
function plusOneSelector (line 74) | function plusOneSelector(dep: RecoilValue<number>) {
function SetsUnvalidatedAtomValues (line 173) | function SetsUnvalidatedAtomValues() {
function Switch (line 178) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function MyReadsAtom (line 183) | function MyReadsAtom({
function SetsUnvalidatedAtomValues (line 232) | function SetsUnvalidatedAtomValues() {
function Test (line 263) | function Test() {
FILE: packages/recoil/hooks/__tests__/Recoil_useTransition-test.js
function resolveSelectors (line 168) | function resolveSelectors() {
function Component (line 189) | function Component({index}: $TEMPORARY$object<{index: number}>) {
function Main (line 199) | function Main() {
function resolveSelectors (line 291) | function resolveSelectors() {
function Component (line 312) | function Component({index}: $TEMPORARY$object<{index: number}>) {
function Main (line 322) | function Main() {
FILE: packages/recoil/recoil_values/Recoil_WaitFor.js
function concurrentRequests (line 44) | function concurrentRequests(
function isError (line 61) | function isError(exp: $FlowFixMe) {
FILE: packages/recoil/recoil_values/Recoil_atom.js
method if (line 370) | if (isPromise(valueOrUpdater)) {
method if (line 518) | if (cachedAnswerForUnvalidatedValue != null) {
method if (line 612) | if (typeof options.key !== 'string') {
FILE: packages/recoil/recoil_values/Recoil_selector.js
method if (line 248) | if (typeof key !== 'string') {
method if (line 754) | if (result.state === 'hasError') {
method if (line 899) | if (inProgressExecutionInfo.loadingLoadable?.state === 'loading') {
method get (line 1042) | get () => {throw new Error('hi')}
method if (line 1078) | if (dependencyStack.includes(key)) {
method if (line 1165) | if (syncSelectorSetFinished) {
FILE: packages/recoil/recoil_values/Recoil_selectorFamily.js
method catch (line 126) | catch (error) {
method if (line 131) | if (cachedSelector != null) {
FILE: packages/recoil/recoil_values/__tests__/Recoil_WaitFor-test.js
function getLoadable (line 54) | function getLoadable(atom) {
class MyError (line 122) | class MyError extends Error {}
class Error1 (line 220) | class Error1 extends Error {}
class Error2 (line 221) | class Error2 extends Error {}
class Error2 (line 323) | class Error2 extends Error {}
class Error1 (line 429) | class Error1 extends Error {}
FILE: packages/recoil/recoil_values/__tests__/Recoil_atom-test.js
constant DEFAULT_VALUE (line 20) | let React,
class Circular (line 254) | class Circular {
method constructor (line 257) | constructor() {
function TransactionObserver (line 1188) | function TransactionObserver({
function historyEffect (line 1224) | function historyEffect({setSelf, onSet}) {
function App (line 1317) | function App() {
function Component (line 1389) | function Component() {
function NewPage (line 1448) | function NewPage() {
function App (line 1453) | function App() {
FILE: packages/recoil/recoil_values/__tests__/Recoil_atomFamily-test.js
function get (line 99) | function get(recoilValue) {
function getLoadable (line 105) | function getLoadable(recoilValue) {
function SetsUnvalidatedAtomValues (line 398) | function SetsUnvalidatedAtomValues() {
function Switch (line 403) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function MyReadsAtom (line 408) | function MyReadsAtom({
function SetsUnvalidatedAtomValues (line 467) | function SetsUnvalidatedAtomValues() {
function Switch (line 472) | function Switch({children}: $TEMPORARY$object<{children: Node}>) {
function MyReadsAtom (line 479) | function MyReadsAtom({getAtom}) {
constant BASE_CALLS (line 538) | const BASE_CALLS =
function App (line 661) | function App() {
function StoreID (line 714) | function StoreID({
function MyApp (line 726) | function MyApp() {
FILE: packages/recoil/recoil_values/__tests__/Recoil_atomWithFallback-test.js
function get (line 76) | function get(
FILE: packages/recoil/recoil_values/__tests__/Recoil_selectorFamily-test.js
function set (line 54) | function set(recoilValue: RecoilState<number>, value: number) {
FILE: packages/recoil/recoil_values/__tests__/Recoil_selectorHooks-test.js
function counterAtom (line 103) | function counterAtom(persistence?: PersistenceSettings<number>) {
function booleanAtom (line 111) | function booleanAtom(persistence?: PersistenceSettings<boolean>) {
function plusOneSelector (line 119) | function plusOneSelector(dep: RecoilValue<number>) {
function ReadAtom (line 204) | function ReadAtom() {
function componentThatToggles (line 215) | function componentThatToggles(a: Node, b: null) {
function advanceTimersBy (line 226) | function advanceTimersBy(ms: number) {
function Component (line 640) | function Component() {
function Component (line 696) | function Component() {
function Parent (line 796) | function Parent() {
function SelectorUser (line 817) | function SelectorUser() {
function ComponentSetter (line 891) | function ComponentSetter() {
function ReadsAtomWithoutSuspense (line 1324) | function ReadsAtomWithoutSuspense({
function ReadsAtomWithoutSuspense (line 1365) | function ReadsAtomWithoutSuspense({
function TestComponent (line 1651) | function TestComponent() {
function SelectorComponent (line 1815) | function SelectorComponent() {
function TestComponent (line 1853) | function TestComponent({
function Component (line 1888) | function Component() {
function SetAtomB (line 2149) | function SetAtomB() {
function SetAtomA (line 2224) | function SetAtomA() {
function SetAtomB (line 2229) | function SetAtomB() {
function SetAtomA (line 2287) | function SetAtomA() {
function SetAtomB (line 2292) | function SetAtomB() {
function SetAtomA (line 2357) | function SetAtomA() {
function SetAtomB (line 2362) | function SetAtomB() {
function SelectorComponent (line 2506) | function SelectorComponent() {
FILE: packages/refine/Refine_API.js
function raiseError (line 33) | function raiseError(suffix: string, resultFailure: ?CheckFailure): empty {
FILE: packages/refine/Refine_Checkers.js
method return (line 117) | return (value, path = new Path()) => {
FILE: packages/refine/Refine_ContainerCheckers.js
method if (line 211) | if (typeof value !== 'object' || value === null || !isPlainObject(value)) {
FILE: packages/refine/Refine_JSON.js
method if (line 35) | if (text == null) {
FILE: packages/refine/Refine_PrimitiveCheckers.js
function mixed (line 24) | function mixed(): Checker<mixed> {
function number (line 57) | function number(): Checker<number> {
method return (line 70) | return (value, path = new Path()) => {
method return (line 125) | return (value, path = new Path()) => {
FILE: packages/refine/Refine_UtilityCheckers.js
method return (line 55) | return (value, path = new Path()) => {
method return (line 79) | return (value, path = new Path()) => {
method if (line 163) | if (value == null) {
method if (line 232) | if (value === undefined) {
method return (line 360) | return (value, path = new Path()) => {
FILE: packages/refine/__tests__/Refine_Containers-test.js
class MyClass (line 154) | class MyClass {}
class MyClass (line 282) | class MyClass {}
FILE: packages/refine/__tests__/Refine_Utilities-test.js
function userValidator (line 363) | function userValidator() {
FILE: packages/shared/__test_utils__/Recoil_TestingUtils.js
constant QUICK_TEST (line 54) | const QUICK_TEST = false;
constant IS_INTERNAL (line 57) | const IS_INTERNAL = false;
function makeStore (line 60) | function makeStore(): Store {
FILE: packages/shared/polyfill/err.js
function err (line 13) | function err(message: string): Error {
FILE: packages/shared/polyfill/expectationViolation.js
method if (line 16) | if (__DEV__) {
FILE: packages/shared/polyfill/invariant.js
function invariant (line 14) | function invariant(condition: boolean, message: string) {
FILE: packages/shared/polyfill/recoverableViolation.js
function recoverableViolation (line 14) | function recoverableViolation(
FILE: packages/shared/util/Recoil_PerformanceTimings.js
function startPerfBlock (line 14) | function startPerfBlock(_id: mixed): () => null {
FILE: packages/shared/util/Recoil_RecoilEnv.js
function readProcessEnvBooleanFlag (line 33) | function readProcessEnvBooleanFlag(name: string, set: boolean => void) {
FILE: packages/shared/util/Recoil_deepFreezeValue.js
function shouldNotBeFrozen (line 22) | function shouldNotBeFrozen(value: mixed): boolean {
function deepFreezeValue (line 75) | function deepFreezeValue(value: mixed) {
FILE: packages/shared/util/Recoil_filterSet.js
method if (line 24) | if (callback(value)) {
FILE: packages/shared/util/Recoil_gkx.js
function Recoil_gkx_OSS (line 16) | function Recoil_gkx_OSS(gk: string): boolean {
FILE: packages/shared/util/Recoil_isNode.js
function isNode (line 14) | function isNode(object: mixed): boolean {
FILE: packages/shared/util/Recoil_stableStringify.js
constant TIME_WARNING_THRESHOLD_MS (line 17) | const TIME_WARNING_THRESHOLD_MS = 15;
method if (line 24) | if (typeof x === 'string' && !x.includes('"') && !x.includes('\\')) {
FILE: packages/shared/util/Recoil_useComponentName.js
function useComponentName (line 29) | function useComponentName(): string {
FILE: scripts/build.mjs
constant BUILD_TARGET (line 19) | const BUILD_TARGET = 'build';
constant PACKAGES (line 21) | const PACKAGES = {
function buildAll (line 72) | async function buildAll() {
function buildPackage (line 81) | async function buildPackage(target, config) {
function buildRollup (line 147) | async function buildRollup(name, inputOptions, outputOptionsList) {
FILE: scripts/deploy_nightly_build.js
constant DEST_FOLDER (line 15) | const DEST_FOLDER = 'nightly-build-files/';
constant DEST_BRANCH (line 16) | const DEST_BRANCH = 'nightly';
constant COMMIT_MSG (line 18) | const COMMIT_MSG = `Publishing a nightly build`;
FILE: scripts/pack.mjs
constant BUILD_TARGET (line 15) | const BUILD_TARGET = 'build';
FILE: scripts/rollup-configs.mjs
function createInputOption (line 106) | function createInputOption(buildType, folder, inputFile) {
constant BUILD_TARGET (line 137) | const BUILD_TARGET = 'build';
function createOutputOption (line 148) | function createOutputOption(packageType, folder, UMDName) {
FILE: scripts/utils.mjs
function createErrorHandler (line 11) | function createErrorHandler(message) {
FILE: typescript/recoil-relay.d.ts
type Response (line 34) | interface Response { [key: string]: any; }
class EnvironmentKey (line 36) | class EnvironmentKey {
FILE: typescript/recoil-sync-test.ts
constant DEFAULT_VALUE (line 41) | const DEFAULT_VALUE = new DefaultValue();
class MyClass (line 149) | class MyClass {
FILE: typescript/recoil-sync.d.ts
type ItemKey (line 25) | type ItemKey = string;
type StoreKey (line 26) | type StoreKey = string;
type ReadItem (line 29) | type ReadItem = (itemKey: ItemKey) =>
type ItemDiff (line 36) | type ItemDiff = Map<ItemKey, DefaultValue | unknown>;
type ItemSnapshot (line 37) | type ItemSnapshot = Map<ItemKey, DefaultValue | unknown>;
type WriteInterface (line 38) | interface WriteInterface {
type WriteItems (line 42) | type WriteItems = (state: WriteInterface) => void;
type UpdateItem (line 45) | type UpdateItem = (itemKey: ItemKey, newValue: DefaultValue | unknown) =...
type UpdateItems (line 46) | type UpdateItems = (items: ItemSnapshot) => void;
type UpdateAllKnownItems (line 47) | type UpdateAllKnownItems = (items: ItemSnapshot) => void;
type ListenInterface (line 48) | interface ListenInterface {
type ListenToItems (line 53) | type ListenToItems = (callbacks: ListenInterface) => void | (() => void);
type RecoilSyncOptions (line 56) | interface RecoilSyncOptions {
type ReadAtomInterface (line 66) | interface ReadAtomInterface {
type ReadAtom (line 69) | type ReadAtom = (callbacks: ReadAtomInterface) =>
type WriteItem (line 76) | type WriteItem = (itemKey: ItemKey, newValue: DefaultValue | unknown) =>...
type ResetItem (line 77) | type ResetItem = (itemKey: ItemKey) => void;
type WriteAtomInterface (line 78) | interface WriteAtomInterface {
type WriteAtom (line 83) | type WriteAtom<T> = (callbacks: WriteAtomInterface, newValue: DefaultVal...
type SyncEffectOptions (line 86) | interface SyncEffectOptions<T> {
type LocationOption (line 101) | type LocationOption =
type BrowserInterface (line 107) | interface BrowserInterface {
type RecoilURLSyncOptions (line 114) | interface RecoilURLSyncOptions {
type HistoryOption (line 126) | type HistoryOption = 'push' | 'replace';
type URLSyncEffectOptions (line 127) | interface URLSyncEffectOptions<T> extends SyncEffectOptions<T> {
type RecoilURLSyncJSONOptions (line 133) | type RecoilURLSyncJSONOptions = Omit<Omit<RecoilURLSyncOptions, 'seriali...
type TransitHandler (line 137) | interface TransitHandler<T extends new (...args: any) => any, S> {
type RecoilURLSyncTransitOptions (line 143) | interface RecoilURLSyncTransitOptions extends Omit<Omit<RecoilURLSyncOpt...
FILE: typescript/recoil-test.ts
function loadableTest (line 216) | function loadableTest(loadable: Loadable<number>) {
class MySerializableClass (line 544) | class MySerializableClass {
method toJSON (line 545) | toJSON() {
class MyClass (line 621) | class MyClass {}
FILE: typescript/recoil.d.ts
type NodeKey (line 21) | type NodeKey = string;
class DefaultValue (line 24) | class DefaultValue {
type RecoilRootProps (line 29) | type RecoilRootProps =
type RecoilEnv (line 41) | interface RecoilEnv {
type SnapshotID (line 56) | interface SnapshotID {
type ComponentInfo (line 60) | interface ComponentInfo {
type RecoilStateInfo (line 64) | interface RecoilStateInfo<T> {
class Snapshot (line 77) | class Snapshot {
class MutableSnapshot (line 94) | class MutableSnapshot extends Snapshot {
type WrappedValue (line 100) | interface WrappedValue<T> {
type AtomEffect (line 105) | type AtomEffect<T> = (param: {
type AtomOptionsWithoutDefault (line 137) | interface AtomOptionsWithoutDefault<T> {
type AtomOptionsWithDefault (line 143) | interface AtomOptionsWithDefault<T> extends AtomOptionsWithoutDefault<T> {
type AtomOptions (line 146) | type AtomOptions<T> =
type GetRecoilValue (line 158) | type GetRecoilValue = <T>(recoilVal: RecoilValue<T>) => T;
type SetterOrUpdater (line 159) | type SetterOrUpdater<T> = (
type Resetter (line 162) | type Resetter = () => void;
type TransactionInterface_UNSTABLE (line 163) | interface TransactionInterface_UNSTABLE {
type CallbackInterface (line 168) | interface CallbackInterface {
type SelectorCallbackInterface (line 181) | interface SelectorCallbackInterface extends CallbackInterface {
type GetCallback (line 184) | type GetCallback = <Args extends ReadonlyArray<unknown>, Return>(
type SetRecoilState (line 188) | type SetRecoilState = <T>(
type ResetRecoilState (line 193) | type ResetRecoilState = (recoilVal: RecoilState<any>) => void;
type EvictionPolicy (line 197) | type EvictionPolicy = 'lru' | 'keep-all' | 'most-recent';
type CachePolicyWithoutEquality (line 210) | type CachePolicyWithoutEquality =
type ReadOnlySelectorOptions (line 215) | interface ReadOnlySelectorOptions<T> {
type ReadWriteSelectorOptions (line 225) | interface ReadWriteSelectorOptions<T>
type StoreID (line 372) | interface StoreID {
type BaseLoadable (line 381) | interface BaseLoadable<T> {
type ValueLoadable (line 391) | interface ValueLoadable<T> extends BaseLoadable<T> {
type LoadingLoadable (line 399) | interface LoadingLoadable<T> extends BaseLoadable<T> {
type ErrorLoadable (line 407) | interface ErrorLoadable<T> extends BaseLoadable<T> {
type Loadable (line 415) | type Loadable<T> =
class AbstractRecoilValue (line 421) | class AbstractRecoilValue<T> {
class AbstractRecoilValueReadonly (line 430) | class AbstractRecoilValueReadonly<T> {
class RecoilState (line 438) | class RecoilState<T> extends AbstractRecoilValue<T> {}
class RecoilValueReadOnly (line 439) | class RecoilValueReadOnly<T> extends AbstractRecoilValueReadonly<T> {}
type RecoilValue (line 440) | type RecoilValue<T> = RecoilValueReadOnly<T> | RecoilState<T>;
type Primitive (line 450) | type Primitive = undefined | null | boolean | number | symbol | string;
type HasToJSON (line 451) | interface HasToJSON {
type SerializableParam (line 455) | type SerializableParam =
type AtomFamilyOptionsWithoutDefault (line 463) | interface AtomFamilyOptionsWithoutDefault<T, P extends SerializableParam> {
type AtomFamilyOptionsWithDefault (line 474) | interface AtomFamilyOptionsWithDefault<T, P extends SerializableParam>
type AtomFamilyOptions (line 486) | type AtomFamilyOptions<T, P extends SerializableParam> =
type ReadOnlySelectorFamilyOptions (line 497) | interface ReadOnlySelectorFamilyOptions<T, P extends SerializableParam> {
type ReadWriteSelectorFamilyOptions (line 510) | interface ReadWriteSelectorFamilyOptions<
type UnwrapRecoilValue (line 576) | type UnwrapRecoilValue<T> = T extends RecoilValue<infer R> ? R : never;
type UnwrapRecoilValues (line 578) | type UnwrapRecoilValues<
type UnwrapRecoilValueLoadables (line 583) | type UnwrapRecoilValueLoadables<
type UnwrapLoadable (line 633) | type UnwrapLoadable<T> = T extends Loadable<infer R>
type UnwrapLoadables (line 638) | type UnwrapLoadables<T extends any[] | {[key: string]: any}> = {
FILE: typescript/refine-test.ts
type MyType (line 49) | type MyType = CheckerReturnType<typeof checker>;
type ObjectWithOptional (line 142) | type ObjectWithOptional = CheckerReturnType<typeof check>;
class Custom (line 226) | class Custom {}
FILE: typescript/refine.d.ts
type CheckerResult (line 12) | type CheckerResult<V> = V extends Checker<infer Result>
type CheckerReturnType (line 18) | type CheckerReturnType<V> = V extends Checker<infer Result>
class Path (line 26) | class Path {
type CheckFailure (line 35) | type CheckFailure = Readonly<{
type CheckSuccess (line 44) | type CheckSuccess<V> = Readonly<{
type CheckResult (line 55) | type CheckResult<V> = CheckSuccess<V> | CheckFailure;
type Checker (line 61) | type Checker<V> = (value: unknown, path?: Path) => CheckResult<V>;
type AssertionFunction (line 87) | type AssertionFunction<V> = (value: unknown) => V;
type CoercionFunction (line 92) | type CoercionFunction<V> = (value: unknown) => V | null | undefined;
type OptionalPropertyChecker (line 181) | interface OptionalPropertyChecker<T> {
type CheckerObject (line 200) | type CheckerObject = Readonly<{
type CheckersToValues (line 204) | type CheckersToValues<Checkers extends CheckerObject> = {
type WhereValue (line 208) | type WhereValue<Checkers extends CheckerObject, Condition> = Pick<
type RequiredCheckerProperties (line 215) | type RequiredCheckerProperties<Checkers extends CheckerObject> = WhereVa...
type OptionalCheckerProperties (line 220) | type OptionalCheckerProperties<Checkers extends CheckerObject> = Partial<
type ObjectCheckerResult (line 224) | type ObjectCheckerResult<Checkers extends CheckerObject> = CheckersToVal...
type JSONParser (line 295) | type JSONParser<T> = (input: string | null | undefined) => T;
type ElementType (line 387) | type ElementType<T> = T extends unknown[] ? T[number] : T;
Condensed preview — 345 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,696K chars).
[
{
"path": ".eslintignore",
"chars": 72,
"preview": "node_modules\n\nyarn.lock\n\ndocs\n\ncjs/\n\nes/\n\nnative/\n\nrecoil_devtools_ext/\n"
},
{
"path": ".eslintrc.js",
"chars": 961,
"preview": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found i"
},
{
"path": ".flowconfig",
"chars": 1747,
"preview": "[ignore]\n.*/__tests__.*\n.*/node_modules.*\n<PROJECT_ROOT>/build/.*\n<PROJECT_ROOT>/cjs/.*\n# Disable for now as the NPM dep"
},
{
"path": ".github/workflows/nightly.yml",
"chars": 539,
"preview": "name: Nightly Push\n\non:\n schedule:\n - cron: '0 8 * * *' # every day at 8 am UTC / 1 am PDT / 4 am EDT\n\njobs:\n depl"
},
{
"path": ".github/workflows/nodejs.yml",
"chars": 1609,
"preview": "# This workflow will do a clean install of node dependencies, build the source code and run tests across different versi"
},
{
"path": ".gitignore",
"chars": 1502,
"preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs."
},
{
"path": ".prettierignore",
"chars": 112,
"preview": "node_modules/\nbuild/\ncjs/\nes/\numd/\nflow-typed/\nrecoil_devtools_ext/\n\nyarn.lock\nscript/project-root-dir.js\n\n*.md\n"
},
{
"path": ".prettierrc",
"chars": 339,
"preview": "{\n \"arrowParens\": \"avoid\",\n \"singleQuote\": true,\n \"trailingComma\": \"all\",\n \"bracketSpacing\": false,\n \"bracketSameLi"
},
{
"path": ".watchmanconfig",
"chars": 3,
"preview": "{}\n"
},
{
"path": "CHANGELOG-recoil-relay.md",
"chars": 117,
"preview": "# Change Log\n\n## UPCOMING\n**_Add new changes here as they land_**\n\n## 0.1.0 (2022-06-2)\n\nInitial open source release\n"
},
{
"path": "CHANGELOG-recoil-sync.md",
"chars": 741,
"preview": "# Change Log\n\n## UPCOMING\n**_Add new changes here as they land_**\n\n- Migrate from deprecated `substr()` to `substring()`"
},
{
"path": "CHANGELOG-recoil.md",
"chars": 14407,
"preview": "# Change Log\n\n## UPCOMING\n**_Add new changes here as they land_**\n\n## 0.7.7 (2023-03-01)\n\n- Fix potential unhandled prom"
},
{
"path": "CHANGELOG-refine.md",
"chars": 479,
"preview": "# Change Log\n\n## UPCOMING\n**_Add new changes here as they land_**\n\n## 0.1.1 (2022-08-17)\n\n- Rename `boolean()` export to"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3541,
"preview": "# Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and"
},
{
"path": "CONTRIBUTING.md",
"chars": 2259,
"preview": "# Contributing to Recoil\n\nWe want to make contributing to this project as easy and transparent as\npossible.\n\n## Our Deve"
},
{
"path": "LICENSE",
"chars": 1088,
"preview": "MIT License\n\nCopyright (c) Meta Platforms, Inc. and affiliates.\n\nPermission is hereby granted, free of charge, to any pe"
},
{
"path": "README-recoil-relay.md",
"chars": 2670,
"preview": "# Recoil Relay · [](https://www.npmjs.com/package/recoil"
},
{
"path": "README-recoil-sync.md",
"chars": 5053,
"preview": "# Recoil Sync · [](https://www.npmjs.com/package/recoil-s"
},
{
"path": "README-refine.md",
"chars": 4043,
"preview": "# Refine · [](https://www.npmjs.com/package/@recoilj"
},
{
"path": "README.md",
"chars": 1669,
"preview": "# Recoil · [](https://www.npmjs.com/package/recoil) [![Node.js"
},
{
"path": "babel.config.json",
"chars": 588,
"preview": "{\n \"presets\": [\"@babel/react\", \"@babel/flow\"],\n \"plugins\": [\n [\n \"module-resolver\",\n {\n \"root\": [\""
},
{
"path": "eslint-rules/no-fb-only.js",
"chars": 2044,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "flow-typed/jest.js",
"chars": 34793,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "flow-typed/npm/ReactDOM_vx.x.x.js",
"chars": 485,
"preview": "// flow-typed signature: 3d9217fcc3103eff665390686051441d\n// flow-typed version: <<STUB>>/ReactDOM_v17.0.0/flow_v0.129.0"
},
{
"path": "flow-typed/npm/ReactTestUtils_vx.x.x.js",
"chars": 486,
"preview": "// flow-typed signature: 957098ea98fd4cfa09140997329ef825\n// flow-typed version: <<STUB>>/ReactTestUtils_v17.0.0/flow_v0"
},
{
"path": "flow-typed/npm/d3-array_vx.x.x.js",
"chars": 467,
"preview": "// flow-typed signature: 07fe700325d6800ee40ab2fb92dbdb62\n// flow-typed version: <<STUB>>/d3-array_v2.7.1/flow_v0.129.0\n"
},
{
"path": "flow-typed/npm/d3-collection_vx.x.x.js",
"chars": 482,
"preview": "// flow-typed signature: 907d29f8d3e51e4214741d633c400932\n// flow-typed version: <<STUB>>/d3-collection_v1.0.7/flow_v0.1"
},
{
"path": "flow-typed/npm/d3-interpolate_vx.x.x.js",
"chars": 485,
"preview": "// flow-typed signature: 2135ae476a3ade7a473e844376538a26\n// flow-typed version: <<STUB>>/d3-interpolate_v2.0.1/flow_v0."
},
{
"path": "flow-typed/npm/d3-scale_vx.x.x.js",
"chars": 467,
"preview": "// flow-typed signature: c5e0917633fcc4b3962290b8ac57a263\n// flow-typed version: <<STUB>>/d3-scale_v3.2.2/flow_v0.129.0\n"
},
{
"path": "flow-typed/npm/d3-selection_vx.x.x.js",
"chars": 12572,
"preview": "// flow-typed signature: 6b30cbe8947503cf5b22702a7931f20a\n// flow-typed version: <<STUB>>/d3-selection_v2.0.0/flow_v0.12"
},
{
"path": "flow-typed/npm/d3-transition_vx.x.x.js",
"chars": 482,
"preview": "// flow-typed signature: c2d2412c06877d819d3cd4360b374aeb\n// flow-typed version: <<STUB>>/d3-transition_v2.0.0/flow_v0.1"
},
{
"path": "flow-typed/npm/d3_vx.x.x.js",
"chars": 450,
"preview": "// flow-typed signature: 33ef3a2d3f6bf1c8a39549ccc666bc3d\n// flow-typed version: <<STUB>>/d3_v5.16.0/flow_v0.129.0\n\n/**\n"
},
{
"path": "flow-typed/npm/hamt_plus_vx.x.x.js",
"chars": 824,
"preview": "// flow-typed signature: b8127b5d14b8b3f8e090da6b48fa7966\n// flow-typed version: <<STUB>>/hamt_plus_v1.0.2/flow_v0.129.0"
},
{
"path": "flow-typed/npm/immutable_vx.x.x.js",
"chars": 1576,
"preview": "// flow-typed signature: ab2e7a5a8e0e3e4c07cea3c0b0f8b4d6\n// flow-typed version: <<STUB>>/immutable_v4.0.0-rc.12/flow_v0"
},
{
"path": "flow-typed/npm/jest_v26.x.x.js",
"chars": 36603,
"preview": "// flow-typed signature: 681725d1525989df4ff4c352015f5c2b\n// flow-typed version: 9a968c602c/jest_v26.x.x/flow_>=v0.201.x"
},
{
"path": "flow-typed/npm/jsondiffpatch-for-react_vx.x.x.js",
"chars": 512,
"preview": "// flow-typed signature: 01f138bab8c1a273bb901b529eed460c\n// flow-typed version: <<STUB>>/jsondiffpatch-for-react_v1.0.4"
},
{
"path": "flow-typed/npm/nullthrows_vx.x.x.js",
"chars": 848,
"preview": "// flow-typed signature: 0b4008173515b0c71528fd8763afbff9\n// flow-typed version: <<STUB>>/nullthrows_v1.1.1/flow_v0.129."
},
{
"path": "flow-typed/npm/react-dom_v18.x.x.js",
"chars": 8593,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @oncall recoil\n */\n// flow-typed sig"
},
{
"path": "flow-typed/package.json.js",
"chars": 172,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @oncall recoil\n */\ndeclare module '."
},
{
"path": "flow-typed/public-stubs.js",
"chars": 94,
"preview": "declare var ScopeRules: Object;\ndeclare var ReactElement: any;\n\ndeclare var __DEV__: boolean;\n"
},
{
"path": "jest.config.js",
"chars": 707,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "package.json",
"chars": 3278,
"preview": "{\n \"name\": \"recoil\",\n \"private\": true,\n \"description\": \"Recoil - A state management library for React\",\n \"main\": \"cj"
},
{
"path": "packages/recoil/Recoil_index.js",
"chars": 4465,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/Recoil_ArrayKeyedMap.js",
"chars": 2917,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/Recoil_Loadable.js",
"chars": 8650,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/Recoil_PersistentMap.js",
"chars": 2931,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/Recoil_Queue.js",
"chars": 362,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/Recoil_Wrapper.js",
"chars": 391,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/__tests__/Recoil_ArrayKeyedMap-test.js",
"chars": 1314,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/adt/__tests__/Recoil_Loadable-test.js",
"chars": 9373,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_CacheImplementationType.js",
"chars": 388,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_CachePolicy.js",
"chars": 677,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_LRUCache.js",
"chars": 2868,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_MapCache.js",
"chars": 938,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_TreeCache.js",
"chars": 7045,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_TreeCacheImplementationType.js",
"chars": 2165,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_cacheFromPolicy.js",
"chars": 2001,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_treeCacheFromPolicy.js",
"chars": 2134,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/Recoil_treeCacheLRU.js",
"chars": 1101,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_LRUCache-test.js",
"chars": 2792,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_MapCache-test.js",
"chars": 1078,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @flow strict-local\n * @format\n * @on"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_TreeCache-test.js",
"chars": 6047,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_cacheFromPolicy-test.js",
"chars": 5285,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_treeCacheFromPolicy-test.js",
"chars": 7669,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/caches/__tests__/Recoil_treeCacheLRU-test.js",
"chars": 2742,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/contrib/devtools_connector/RecoilDevTools_Connector.react.js",
"chars": 2368,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/contrib/uri_persistence/Recoil_Link.js",
"chars": 3782,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/contrib/uri_persistence/__tests__/Recoil_Link-test.js",
"chars": 3889,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_AtomicUpdates.js",
"chars": 3778,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Batching.js",
"chars": 1515,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_FunctionalCore.js",
"chars": 7737,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Graph.js",
"chars": 3781,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_GraphTypes.js",
"chars": 826,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Keys.js",
"chars": 775,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Node.js",
"chars": 6289,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_ReactMode.js",
"chars": 3564,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_RecoilRoot.js",
"chars": 18932,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_RecoilValue.js",
"chars": 932,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_RecoilValueInterface.js",
"chars": 10789,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_RetainedBy.js",
"chars": 685,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Retention.js",
"chars": 9291,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_RetentionZone.js",
"chars": 410,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_Snapshot.js",
"chars": 14233,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_SnapshotCache.js",
"chars": 601,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/Recoil_State.js",
"chars": 6499,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_RecoilRoot-test.js",
"chars": 13888,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil/core/__tests__/Recoil_RecoilValueInterface-test.js",
"chars": 6444,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_Retention-test.js",
"chars": 14962,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_Snapshot-test.js",
"chars": 21765,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_batcher-test.js",
"chars": 1490,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_core-test.js",
"chars": 1206,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_perf-test.js",
"chars": 5096,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/core/__tests__/Recoil_useRecoilStoreID-test.js",
"chars": 1880,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n'use"
},
{
"path": "packages/recoil/hooks/Recoil_Hooks.js",
"chars": 25038,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_SnapshotHooks.js",
"chars": 9228,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_useGetRecoilValueInfo.js",
"chars": 753,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @flow strict-local\n * @format\n * @on"
},
{
"path": "packages/recoil/hooks/Recoil_useRecoilBridgeAcrossReactRoots.js",
"chars": 912,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_useRecoilCallback.js",
"chars": 4601,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_useRecoilRefresher.js",
"chars": 788,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_useRecoilTransaction.js",
"chars": 1095,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/Recoil_useRetain.js",
"chars": 3446,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_Hooks_TRANSITION_SUPPORT_UNSTABLE-test.js",
"chars": 4504,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_PublicHooks-test.js",
"chars": 26381,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_React-test.js",
"chars": 2747,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useGetRecoilValueInfo-test.js",
"chars": 9128,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useGotoRecoilSnapshot-test.js",
"chars": 7205,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilBridgeAcrossReactRoots-test.js",
"chars": 3176,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilCallback-test.js",
"chars": 23239,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilInterface-test.js",
"chars": 4476,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilRefresher-test.js",
"chars": 3816,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @flow strict-local\n * @format\n * @on"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilSnapshot-test.js",
"chars": 13859,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilStateReset-test.js",
"chars": 6899,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilTransaction-test.js",
"chars": 9961,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilTransactionObserver-test.js",
"chars": 8429,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useRecoilValueLoadable-test.js",
"chars": 7109,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useTransactionObservation_DEPRECATED-test.js",
"chars": 7269,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/hooks/__tests__/Recoil_useTransition-test.js",
"chars": 11998,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/package-for-release.json",
"chars": 637,
"preview": "{\n \"name\": \"recoil\",\n \"version\": \"0.7.7\",\n \"description\": \"Recoil - A state management library for React\",\n \"main\": "
},
{
"path": "packages/recoil/package.json",
"chars": 328,
"preview": "{\n \"name\": \"recoil-oss\",\n \"description\": \"This is the internal package.json enabling CommonJS module\",\n \"main\": \"Reco"
},
{
"path": "packages/recoil/recoil_values/Recoil_WaitFor.js",
"chars": 10747,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_WaitFor.js.flow",
"chars": 2874,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_atom.js",
"chars": 25748,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_atomFamily.js",
"chars": 5732,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_callbackTypes.js",
"chars": 711,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_constSelector.js",
"chars": 1025,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_errorSelector.js",
"chars": 931,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_readOnlySelector.js",
"chars": 591,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_selector.js",
"chars": 46568,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/Recoil_selectorFamily.js",
"chars": 6196,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__flowtests__/Recoil_WaitFor-flowtest.js",
"chars": 3826,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_WaitFor-test.js",
"chars": 22868,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_atom-test.js",
"chars": 56133,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_atomFamily-test.js",
"chars": 24662,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_atomWithFallback-test.js",
"chars": 7192,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_constSelector-test.js",
"chars": 3124,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_errorSelector-test.js",
"chars": 1248,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_selector-test.js",
"chars": 38889,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_selectorFamily-test.js",
"chars": 10150,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil/recoil_values/__tests__/Recoil_selectorHooks-test.js",
"chars": 81385,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_Environments.js",
"chars": 5124,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_graphQLMutationEffect.js",
"chars": 4095,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_graphQLQueryEffect.js",
"chars": 4992,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_graphQLSelector.js",
"chars": 3017,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_graphQLSelectorFamily.js",
"chars": 6868,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_graphQLSubscriptionEffect.js",
"chars": 3120,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/RecoilRelay_index.js",
"chars": 1074,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__test_utils__/RecoilRelay_mockRelayEnvironment.js",
"chars": 1598,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_RecoilRelayEnvironment-test.js",
"chars": 9517,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_graphQLMutationEffect-test.js",
"chars": 5912,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_graphQLQueryEffect-test.js",
"chars": 12953,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_graphQLSelector-test.js",
"chars": 5432,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_graphQLSelectorFamily-test.js",
"chars": 16865,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/RecoilRelay_graphQLSubscriptionEffect-test.js",
"chars": 2807,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/mock-graphql/RecoilRelay_MockQueries.js",
"chars": 1978,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-relay/__tests__/mock-graphql/schema.graphql",
"chars": 820,
"preview": "# GraphQL Schema used for OSS unit tests\n\nschema {\n query: Query\n mutation: Mutation\n subscription: Subscriptio"
},
{
"path": "packages/recoil-relay/package-for-release.json",
"chars": 543,
"preview": "{\n \"name\": \"recoil-relay\",\n \"version\": \"0.1.0\",\n \"description\": \"recoil-relay helps Recoil perform type safe and effi"
},
{
"path": "packages/recoil-relay/package.json",
"chars": 340,
"preview": "{\n \"name\": \"recoil-relay\",\n \"description\": \"This is the internal package.json enabling CommonJS module\",\n \"main\": \"Re"
},
{
"path": "packages/recoil-sync/RecoilSync.js",
"chars": 18912,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-sync/RecoilSync_URL.js",
"chars": 9284,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-sync/RecoilSync_URLJSON.js",
"chars": 1321,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-sync/RecoilSync_URLTransit.js",
"chars": 4113,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/recoil-sync/RecoilSync_index.js",
"chars": 1569,
"preview": "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * This source code is licensed under t"
},
{
"path": "packages/recoil-sync/__test_utils__/RecoilSync_MockURLSerialization.js",
"chars": 3713,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync-test.js",
"chars": 44374,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URL-test.js",
"chars": 12181,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLCompound-test.js",
"chars": 7884,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLInterface-test.js",
"chars": 5413,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLJSON-test.js",
"chars": 6371,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLListen-test.js",
"chars": 6511,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLPush-test.js",
"chars": 4488,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLTransit-test.js",
"chars": 13216,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/__tests__/RecoilSync_URLTransitJSON-test.js",
"chars": 2964,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * @flow strict-local\n * @format\n * @oncall recoil\n */\n\n'us"
},
{
"path": "packages/recoil-sync/package-for-release.json",
"chars": 547,
"preview": "{\n \"name\": \"recoil-sync\",\n \"version\": \"0.2.0\",\n \"description\": \"recoil-sync provides an add-on library to help synchr"
},
{
"path": "packages/recoil-sync/package.json",
"chars": 337,
"preview": "{\n \"name\": \"recoil-sync\",\n \"description\": \"This is the internal package.json enabling CommonJS module\",\n \"main\": \"Rec"
},
{
"path": "packages/refine/Refine_API.js",
"chars": 2742,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_Checkers.js",
"chars": 2946,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_ContainerCheckers.js",
"chars": 9737,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_JSON.js",
"chars": 1881,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_PrimitiveCheckers.js",
"chars": 5941,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_UtilityCheckers.js",
"chars": 10430,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/Refine_index.js",
"chars": 1704,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/__tests__/Refine-test.js",
"chars": 1754,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/__tests__/Refine_Containers-test.js",
"chars": 10953,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/__tests__/Refine_JSON-test.js",
"chars": 1467,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/__tests__/Refine_Primitives-test.js",
"chars": 7345,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/__tests__/Refine_Utilities-test.js",
"chars": 11600,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/refine/package-for-release.json",
"chars": 464,
"preview": "{\n \"name\": \"@recoiljs/refine\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"0.1.1\",\n \"description\": "
},
{
"path": "packages/refine/package.json",
"chars": 324,
"preview": "{\n \"name\": \"refine\",\n \"description\": \"This is the internal package.json enabling CommonJS module\",\n \"main\": \"Refine_i"
},
{
"path": "packages/shared/__test_utils__/Recoil_ReactRenderModes.js",
"chars": 774,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/__test_utils__/Recoil_TestingUtils.js",
"chars": 13977,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/package.json",
"chars": 262,
"preview": "{\n \"name\": \"recoil-shared\",\n \"description\": \"This is the internal package.json enabling CommonJS module\",\n \"haste_com"
},
{
"path": "packages/shared/polyfill/ReactBatchedUpdates.js",
"chars": 439,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/ReactBatchedUpdates.native.js",
"chars": 479,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/err.js",
"chars": 681,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/expectationViolation.js",
"chars": 605,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/invariant.js",
"chars": 404,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/recoverableViolation.js",
"chars": 487,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/polyfill/sprintf.js",
"chars": 434,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/util/Recoil_CopyOnWrite.js",
"chars": 1446,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "packages/shared/util/Recoil_Environment.js",
"chars": 988,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
}
]
// ... and 145 more files (download for full content)
About this extraction
This page contains the full source code of the facebookexperimental/Recoil GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 345 files (1.5 MB), approximately 419.4k tokens, and a symbol index with 509 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.