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

recoil

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recoil - npm Package Compare versions

Comparing version 0.0.13 to 0.1.1

cjs/caches/Recoil_NodeCache.js.flow

7

CHANGELOG.md
# Change Log
## 0.1.0 (2020-10-29)
- Performance Improvements
- Experimental React Native support
- Experimental Atom Effects
- Experimental Snapshot construction
## 0.0.13 (2020-09-16)

@@ -4,0 +11,0 @@

90

index.d.ts

@@ -7,5 +7,5 @@ // Minimum TypeScript Version: 3.7

export {};
export { };
import * as React from 'react';
import * as React from 'react';

@@ -27,2 +27,23 @@ // state.d.ts

// Effect is called the first time a node is used with a <RecoilRoot>
export type AtomEffect<T> = (param: {
node: RecoilState<T>,
trigger: 'set' | 'get',
// Call synchronously to initialize value or async to change it later
setSelf: (param:
| T
| DefaultValue
| Promise<T | DefaultValue>
| ((param: T | DefaultValue) => T | DefaultValue),
) => void,
resetSelf: () => void,
// Subscribe callbacks to events.
// Atom effect observers are called before global transaction observers
onSet: (
param: (newValue: T | DefaultValue, oldValue: T | DefaultValue) => void,
) => void,
}) => void | (() => void);
// atom.d.ts

@@ -32,4 +53,6 @@ export interface AtomOptions<T> {

default: RecoilValue<T> | Promise<T> | T;
effects_UNSTABLE?: ReadonlyArray<AtomEffect<T>>;
dangerouslyAllowMutability?: boolean;
}
/**

@@ -80,2 +103,14 @@ * Creates an atom, which represents a piece of writeable state

getPromise<T>(recoilValue: RecoilValue<T>): Promise<T>;
getNodes_UNSTABLE(opts?: { isModified?: boolean }): Iterable<RecoilValue<unknown>>;
getInfo_UNSTABLE<T>(recoilValue: RecoilValue<T>): {
loadable?: Loadable<T>,
isActive: boolean,
isSet: boolean,
isModified: boolean, // TODO report modified selectors
type: 'atom' | 'selector' | undefined, // undefined until initialized for now
deps: Iterable<RecoilValue<T>>,
subscribers: {
nodes: Iterable<RecoilValue<T>>,
},
};
map(cb: (mutableSnapshot: MutableSnapshot) => void): Snapshot;

@@ -171,16 +206,34 @@ asyncMap(cb: (mutableSnapshot: MutableSnapshot) => Promise<void>): Promise<Snapshot>;

export type Loadable<T> =
| Readonly<{
state: 'hasValue';
contents: T;
}>
| Readonly<{
state: 'hasError';
contents: Error;
}>
| Readonly<{
state: 'loading';
contents: LoadablePromise<T>;
}>;
interface BaseLoadable<T> {
getValue: () => T;
toPromise: () => Promise<T>;
valueMaybe: () => T | void;
valueOrThrow: () => T;
errorMaybe: () => Error | void;
errorOrThrow: () => Error;
promiseMaybe: () => Promise<T> | void;
promiseOrThrow: () => Promise<T>;
map: <S>(map: (from: T) => Promise<S> | S) => Loadable<S>;
}
interface ValueLoadable<T> extends BaseLoadable<T> {
state: 'hasValue';
contents: T;
}
interface LoadingLoadable<T> extends BaseLoadable<T> {
state: 'loading';
contents: LoadablePromise<T>;
}
interface ErrorLoadable<T> extends BaseLoadable<T> {
state: 'error';
contents: Error;
}
type Loadable<T> =
| ValueLoadable<T>
| LoadingLoadable<T>
| ErrorLoadable<T>;
// recoilValue.d.ts

@@ -219,2 +272,3 @@ declare class AbstractRecoilValue<T> {

default: RecoilValue<T> | Promise<T> | T | ((param: P) => T | RecoilValue<T> | Promise<T>);
effects_UNSTABLE?: | ReadonlyArray<AtomEffect<T>> | ((param: P) => ReadonlyArray<AtomEffect<T>>);
}

@@ -288,7 +342,7 @@

export function waitForAny<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
param: RecoilValues,
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForAny<RecoilValues extends { [key: string]: RecoilValue<any> }>(
param: RecoilValues,
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;

@@ -305,1 +359,3 @@

/* eslint-enable @typescript-eslint/no-explicit-any */
export function snapshot_UNSTABLE(initializeState?: (shapshot: MutableSnapshot) => void): Snapshot;

35

package.json
{
"name": "recoil",
"version": "0.0.13",
"version": "0.1.1",
"description": "Recoil - A state management library for React",
"main": "cjs/recoil.js",
"module": "es/recoil.js",
"react-native": "native/recoil.js",
"unpkg": "umd/recoil.js",

@@ -12,2 +13,3 @@ "files": [

"cjs",
"native",
"index.d.ts"

@@ -25,8 +27,16 @@ ],

"test:typescript": "dtslint typescript",
"lint": "eslint ."
"lint": "eslint .",
"deploy-nightly": "yarn build && node scripts/deploy_nightly_build.js"
},
"peerDependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1"
"react": "^16.13.1"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
},
"react-native": {
"optional": true
}
},
"devDependencies": {

@@ -56,3 +66,3 @@ "@babel/core": "^7.9.6",

"eslint-plugin-react": "^7.20.0",
"flow-bin": "^0.126.1",
"flow-bin": "^0.129.0",
"gen-flow-files": "^0.4.11",

@@ -73,17 +83,2 @@ "husky": ">=4",

},
"jest": {
"timers": "fake",
"globals": {
"__DEV__": true
},
"testPathIgnorePatterns": [
"/node_modules/",
"src/hooks/__tests__/Recoil_PublicHooks-test.js",
"src/hooks/__tests__/Recoil_useRecoilCallback-test.js",
"src/recoil_values/__tests__/Recoil_atomFamily-test.js"
],
"setupFiles": [
"./setupJestMock.js"
]
},
"husky": {

@@ -90,0 +85,0 @@ "hooks": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc