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

simpler-state

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpler-state - npm Package Compare versions

Comparing version 2.0.0-rc.2 to 2.0.0-rc.3

78

es/core/entity.js

@@ -6,8 +6,10 @@ import { strictEqual } from './equality';

import { getStore, isStoreEnabled } from '../tools/store';
function entity(initialValue, pluginsOrAlias = []) {
function entity(initialValue, pluginsOrAlias) {
if (pluginsOrAlias === void 0) {
pluginsOrAlias = [];
}
if (initialValue === undefined) throw new Error('Entity requires an initial value.');
const plugins = typeof pluginsOrAlias === 'string' ? [alias(pluginsOrAlias)] : pluginsOrAlias;
var plugins = typeof pluginsOrAlias === 'string' ? [alias(pluginsOrAlias)] : pluginsOrAlias;
if (!(plugins instanceof Array)) throw new Error('Invalid plug-ins array.');
const entityBuild = {
var entityBuild = {
_value: undefined,

@@ -21,3 +23,3 @@ _subscribers: new Set()

entityBuild.use = createHook(entityBuild);
const newEntity = entityBuild;
var newEntity = entityBuild;
applyPlugins(newEntity, plugins);

@@ -28,10 +30,7 @@ newEntity.init();

}
export default entity;
function createSubscribe(entity) {
return subscriberFn => {
return function (subscriberFn) {
entity._subscribers.add(subscriberFn);
return () => {
return function () {
entity._subscribers.delete(subscriberFn);

@@ -41,48 +40,57 @@ };

}
function createGet(entity) {
return () => entity._value;
return function () {
return entity._value;
};
}
function createSet(entity) {
return (valueOrUpdaterFn, alias) => {
return function (valueOrUpdaterFn, alias) {
if (typeof valueOrUpdaterFn === 'function') valueOrUpdaterFn = valueOrUpdaterFn(entity._value);
entity._value = valueOrUpdaterFn;
entity._subscribers.forEach(cb => cb(entity._value));
if (alias !== '@@DEVTOOLS') onSet(entity, alias ?? '<anonymous>');
entity._subscribers.forEach(function (cb) {
return cb(entity._value);
});
if (alias !== '@@DEVTOOLS') onSet(entity, alias != null ? alias : '<anonymous>');
};
}
let nextId = 1;
var nextId = 1;
function createInit(entity, initialValue) {
return () => {
if (!entity.name) entity.name = `entity${nextId++}`;
if (initialValue instanceof Promise) initialValue.then(value => setTimeout(() => entity.set(value, '@@ASYNC_INIT')));else entity._value = initialValue;
return function () {
if (!entity.name) entity.name = "entity" + nextId++;
if (initialValue instanceof Promise) initialValue.then(function (value) {
return setTimeout(function () {
return entity.set(value, '@@ASYNC_INIT');
});
});else entity._value = initialValue;
onInit(entity);
};
}
function createHook(entity) {
return (transform = v => v, equality = strictEqual) => useEntity(entity, transform, equality);
return function (transform, equality) {
if (transform === void 0) {
transform = function transform(v) {
return v;
};
}
if (equality === void 0) {
equality = strictEqual;
}
return useEntity(entity, transform, equality);
};
}
function applyPlugins(entity, plugins) {
plugins.forEach(plugin => {
plugins.forEach(function (plugin) {
if (typeof plugin !== 'object') throw new Error('Invalid plug-in');
function overrideMethod(method) {
const createOverride = plugin[method];
var createOverride = plugin[method];
if (typeof createOverride === 'function') {
const override = createOverride(entity[method], entity);
if (typeof override !== 'function') throw new Error(`Invalid override for '${method}' in plug-in.`);
var override = createOverride(entity[method], entity);
if (typeof override !== 'function') throw new Error("Invalid override for '" + method + "' in plug-in.");
entity[method] = override;
}
}
Object.keys(plugin).forEach(method => overrideMethod(method));
Object.keys(plugin).forEach(function (method) {
return overrideMethod(method);
});
});
}

@@ -7,18 +7,14 @@ export function strictEqual(a, b) {

}
function bothObjects(a, b) {
return typeof a === 'object' && a !== null && typeof b === 'object' && b !== null;
}
function equalProps(a, b) {
const keysOfA = Object.keys(a);
const keysOfB = Object.keys(b);
var keysOfA = Object.keys(a);
var keysOfB = Object.keys(b);
if (keysOfA.length !== keysOfB.length) return false;
for (let i = 0; i < keysOfA.length; i++) {
const key = keysOfA[i];
for (var i = 0; i < keysOfA.length; i++) {
var key = keysOfA[i];
if (!b.hasOwnProperty(key) || a[key] !== b[key]) return false;
}
return true;
}
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';
import { strictEqual } from './equality';
export default function useEntity(entity, transform = v => v, equality = strictEqual) {
export default function useEntity(entity, transform, equality) {
if (transform === void 0) {
transform = function transform(v) {
return v;
};
}
if (equality === void 0) {
equality = strictEqual;
}
return useSyncExternalStoreWithSelector(entity.subscribe, entity.get, entity.get, transform, equality);
}
export default function alias(name) {
return {
init(origInit, entity) {
return () => {
init: function init(origInit, entity) {
return function () {
entity.name = name;

@@ -9,4 +9,3 @@ origInit();

}
};
}

@@ -8,3 +8,2 @@ function getLocalStorage() {

}
function getSessionStorage() {

@@ -17,3 +16,2 @@ try {

}
function validateCustomStorage(storage) {

@@ -23,26 +21,27 @@ if (typeof storage.getItem !== 'function' || typeof storage.setItem !== 'function') throw new Error('Persistence: Invalid storage.');

}
function getItem(storage, key, deserialize, callback) {
const res = storage.getItem(key);
var res = storage.getItem(key);
if (res === null) return;
if (typeof res !== 'string' && typeof res.then === 'function') res.then(val => {
if (typeof res !== 'string' && typeof res.then === 'function') res.then(function (val) {
if (val != null) processValue(deserialize, val, callback);
});else processValue(deserialize, res, callback);
}
function setItem(storage, key, value, serialize) {
processValue(serialize, value, res => storage.setItem(key, res));
processValue(serialize, value, function (res) {
return storage.setItem(key, res);
});
}
function processValue(func, value, callback) {
const res = func(value);
var res = func(value);
if (res && typeof res.then === 'function') res.then(callback);else callback(res);
}
export default function persistence(key, options = {}) {
export default function persistence(key, options) {
var _options$storage;
if (options === void 0) {
options = {};
}
if (typeof key !== 'string') throw new Error('Persistence requires a string key.');
let storage;
const storageOption = options.storage ?? 'local';
var storage;
var storageOption = (_options$storage = options.storage) != null ? _options$storage : 'local';
if (storageOption === 'local') storage = getLocalStorage();else if (storageOption === 'session') storage = getSessionStorage();else storage = validateCustomStorage(storageOption);
if (!storage) {

@@ -52,7 +51,6 @@ console.warn('Storage unavailable. Persistence disabled.');

}
return {
init(origInit, entity) {
return () => {
const deserialize = options.deserializeFn || JSON.parse;
init: function init(origInit, entity) {
return function () {
var deserialize = options.deserializeFn || JSON.parse;
origInit();

@@ -62,12 +60,10 @@ getItem(storage, key, deserialize, entity.set);

},
set(origSet, entity) {
return (...args) => {
const serialize = options.serializeFn || JSON.stringify;
origSet(...args);
set: function set(origSet, entity) {
return function () {
var serialize = options.serializeFn || JSON.stringify;
origSet.apply(void 0, arguments);
setItem(storage, key, entity.get(), serialize);
};
}
};
}
import _extends from "@babel/runtime/helpers/esm/extends";
import { getMutableMap, initRegistry, updateRegistry, watchRegistry } from './registry';
let devTools = null;
let isInspectorEnabled = false;
let isInspectorInitialized = false;
let isDevToolsInitialized = false;
let isDevToolsPaused = false;
let initialRegistryValue = null;
export function enableInspector(condition = true) {
var devTools = null;
var isInspectorEnabled = false;
var isInspectorInitialized = false;
var isDevToolsInitialized = false;
var isDevToolsPaused = false;
var initialRegistryValue = null;
export function enableInspector(condition) {
if (condition === void 0) {
condition = true;
}
isInspectorEnabled = condition;
}
export const features = {
export var features = {
pause: true,

@@ -21,9 +24,7 @@ export: true,

export function initInspector() {
var _window$__REDUX_DEVTO;
devTools = ((_window$__REDUX_DEVTO = window.__REDUX_DEVTOOLS_EXTENSION__) == null ? void 0 : _window$__REDUX_DEVTO.connect({
var _ref, _window$__REDUX_DEVTO;
devTools = (_ref = (_window$__REDUX_DEVTO = window.__REDUX_DEVTOOLS_EXTENSION__) == null ? void 0 : _window$__REDUX_DEVTO.connect({
name: document.title,
features
})) ?? null;
features: features
})) != null ? _ref : null;
if (devTools) {

@@ -33,9 +34,6 @@ initRegistry();

}
isInspectorInitialized = true;
}
function handleDevToolsEvent(event) {
if (!isInspectorEnabled || !devTools) return;
if (event.type === 'DISPATCH') {

@@ -47,16 +45,11 @@ switch (event.payload.type) {

break;
case 'COMMIT':
devTools.init(getMutableMap());
break;
case 'ROLLBACK':
const snapshot = applyStateToEntities(event.state);
var snapshot = applyStateToEntities(event.state);
if (snapshot) {
devTools.init(snapshot);
}
break;
case 'RESET':

@@ -67,15 +60,10 @@ if (initialRegistryValue !== null) {

}
break;
case 'IMPORT_STATE':
{
var _imported$computedSta;
const {
nextLiftedState: imported
} = event.payload;
var _imported$currentStat, _imported$computedSta;
var imported = event.payload.nextLiftedState;
if (!imported || !imported.computedStates) return;
const currentIndex = imported.currentStateIndex ?? imported.computedStates.length - 1;
const currentState = (_imported$computedSta = imported.computedStates[currentIndex]) == null ? void 0 : _imported$computedSta.state;
var currentIndex = (_imported$currentStat = imported.currentStateIndex) != null ? _imported$currentStat : imported.computedStates.length - 1;
var currentState = (_imported$computedSta = imported.computedStates[currentIndex]) == null ? void 0 : _imported$computedSta.state;
if (typeof currentState !== 'object') return;

@@ -86,3 +74,2 @@ updateRegistry(currentState);

}
case 'PAUSE_RECORDING':

@@ -94,6 +81,4 @@ isDevToolsPaused = !isDevToolsPaused;

}
function applyStateToEntities(state) {
let parsedState;
var parsedState;
try {

@@ -104,3 +89,2 @@ parsedState = JSON.parse(state);

}
if (typeof parsedState !== 'object') return;

@@ -110,3 +94,2 @@ updateRegistry(parsedState);

}
export function onInit(entity) {

@@ -116,6 +99,5 @@ if (entity.name.charAt(0) === '_') return;

if (!devTools) return;
const mutableMap = getMutableMap();
var mutableMap = getMutableMap();
if (!(entity.name in mutableMap)) {
watchRegistry(value => {
watchRegistry(function (value) {
if (!isInspectorEnabled) return;

@@ -125,8 +107,6 @@ entity.set(value[entity.name], '@@DEVTOOLS');

}
mutableMap[entity.name] = entity.get();
if (isDevToolsInitialized && isInspectorEnabled && !isDevToolsPaused) {
devTools.send({
type: `${entity.name}:@@LAZY_INIT`
type: entity.name + ":@@LAZY_INIT"
}, mutableMap);

@@ -138,6 +118,5 @@ }

if (!devTools) return;
const mutableMap = getMutableMap();
var mutableMap = getMutableMap();
mutableMap[entity.name] = entity.get();
if (!isInspectorEnabled) return;
if (!isDevToolsInitialized) {

@@ -148,8 +127,7 @@ devTools.init(mutableMap);

}
if (!isDevToolsPaused) {
devTools.send({
type: `${entity.name}:${alias}`
type: entity.name + ":" + alias
}, mutableMap);
}
}
import entity from '../core/entity';
let registry;
var registry;
export function initRegistry() {

@@ -4,0 +4,0 @@ registry = entity({}, '__GLOBAL__');

import { getStore, isStoreEnabled } from './store';
export default function resetAll() {
if (!isStoreEnabled()) throw new Error('resetAll() requires the entity store. Call enableStore() at startup.');
getStore().forEach(entity => entity.init());
getStore().forEach(function (entity) {
return entity.init();
});
}

@@ -1,4 +0,7 @@

const store = new Set();
let storeEnabled = false;
export function enableStore(condition = true) {
var store = new Set();
var storeEnabled = false;
export function enableStore(condition) {
if (condition === void 0) {
condition = true;
}
storeEnabled = condition;

@@ -5,0 +8,0 @@ }

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _equality = require("./equality");
var _useEntity = _interopRequireDefault(require("./useEntity"));
var _alias = _interopRequireDefault(require("../plugins/alias"));
var _inspector = require("../tools/inspector");
var _store = require("../tools/store");
function entity(initialValue, pluginsOrAlias) {

@@ -22,3 +15,2 @@ if (pluginsOrAlias === void 0) {

}
if (initialValue === undefined) throw new Error('Entity requires an initial value.');

@@ -42,10 +34,7 @@ var plugins = typeof pluginsOrAlias === 'string' ? [(0, _alias.default)(pluginsOrAlias)] : pluginsOrAlias;

}
var _default = entity;
exports.default = _default;
function createSubscribe(entity) {
return function (subscriberFn) {
entity._subscribers.add(subscriberFn);
return function () {

@@ -56,3 +45,2 @@ entity._subscribers.delete(subscriberFn);

}
function createGet(entity) {

@@ -63,3 +51,2 @@ return function () {

}
function createSet(entity) {

@@ -69,13 +56,9 @@ return function (valueOrUpdaterFn, alias) {

entity._value = valueOrUpdaterFn;
entity._subscribers.forEach(function (cb) {
return cb(entity._value);
});
if (alias !== '@@DEVTOOLS') (0, _inspector.onSet)(entity, alias != null ? alias : '<anonymous>');
};
}
var nextId = 1;
function createInit(entity, initialValue) {

@@ -92,3 +75,2 @@ return function () {

}
function createHook(entity) {

@@ -101,18 +83,13 @@ return function (transform, equality) {

}
if (equality === void 0) {
equality = _equality.strictEqual;
}
return (0, _useEntity.default)(entity, transform, equality);
};
}
function applyPlugins(entity, plugins) {
plugins.forEach(function (plugin) {
if (typeof plugin !== 'object') throw new Error('Invalid plug-in');
function overrideMethod(method) {
var createOverride = plugin[method];
if (typeof createOverride === 'function') {

@@ -124,3 +101,2 @@ var override = createOverride(entity[method], entity);

}
Object.keys(plugin).forEach(function (method) {

@@ -127,0 +103,0 @@ return overrideMethod(method);

"use strict";
exports.__esModule = true;
exports.shallowEqual = shallowEqual;
exports.strictEqual = strictEqual;
exports.shallowEqual = shallowEqual;
function strictEqual(a, b) {
return a === b;
}
function shallowEqual(a, b) {
return strictEqual(a, b) || bothObjects(a, b) && equalProps(a, b);
}
function bothObjects(a, b) {
return typeof a === 'object' && a !== null && typeof b === 'object' && b !== null;
}
function equalProps(a, b) {

@@ -23,3 +19,2 @@ var keysOfA = Object.keys(a);

if (keysOfA.length !== keysOfB.length) return false;
for (var i = 0; i < keysOfA.length; i++) {

@@ -29,4 +24,3 @@ var key = keysOfA[i];

}
return true;
}

@@ -5,7 +5,4 @@ "use strict";

exports.default = useEntity;
var _withSelector = require("use-sync-external-store/shim/with-selector");
var _equality = require("./equality");
function useEntity(entity, transform, equality) {

@@ -17,8 +14,6 @@ if (transform === void 0) {

}
if (equality === void 0) {
equality = _equality.strictEqual;
}
return (0, _withSelector.useSyncExternalStoreWithSelector)(entity.subscribe, entity.get, entity.get, transform, equality);
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.enableStore = exports.enableInspector = exports.shallowEqual = exports.strictEqual = exports.resetAll = exports.persistence = exports.alias = exports.useEntity = exports.entity = void 0;
exports.useEntity = exports.strictEqual = exports.shallowEqual = exports.resetAll = exports.persistence = exports.entity = exports.enableStore = exports.enableInspector = exports.alias = void 0;
var _entity = _interopRequireDefault(require("./core/entity"));
exports.entity = _entity.default;
var _useEntity = _interopRequireDefault(require("./core/useEntity"));
exports.useEntity = _useEntity.default;
var _equality = require("./core/equality");
exports.strictEqual = _equality.strictEqual;
exports.shallowEqual = _equality.shallowEqual;
var _alias = _interopRequireDefault(require("./plugins/alias"));
exports.alias = _alias.default;
var _persistence = _interopRequireDefault(require("./plugins/persistence"));
exports.persistence = _persistence.default;
var _inspector = require("./tools/inspector");
exports.enableInspector = _inspector.enableInspector;
var _store = require("./tools/store");
exports.enableStore = _store.enableStore;
var _resetAll = _interopRequireDefault(require("./tools/resetAll"));
exports.resetAll = _resetAll.default;

@@ -5,3 +5,2 @@ "use strict";

exports.default = alias;
function alias(name) {

@@ -8,0 +7,0 @@ return {

@@ -5,3 +5,2 @@ "use strict";

exports.default = persistence;
function getLocalStorage() {

@@ -14,3 +13,2 @@ try {

}
function getSessionStorage() {

@@ -23,3 +21,2 @@ try {

}
function validateCustomStorage(storage) {

@@ -29,3 +26,2 @@ if (typeof storage.getItem !== 'function' || typeof storage.setItem !== 'function') throw new Error('Persistence: Invalid storage.');

}
function getItem(storage, key, deserialize, callback) {

@@ -38,3 +34,2 @@ var res = storage.getItem(key);

}
function setItem(storage, key, value, serialize) {

@@ -45,3 +40,2 @@ processValue(serialize, value, function (res) {

}
function processValue(func, value, callback) {

@@ -51,10 +45,7 @@ var res = func(value);

}
function persistence(key, options) {
var _options$storage;
if (options === void 0) {
options = {};
}
if (typeof key !== 'string') throw new Error('Persistence requires a string key.');

@@ -64,3 +55,2 @@ var storage;

if (storageOption === 'local') storage = getLocalStorage();else if (storageOption === 'session') storage = getSessionStorage();else storage = validateCustomStorage(storageOption);
if (!storage) {

@@ -70,3 +60,2 @@ console.warn('Storage unavailable. Persistence disabled.');

}
return {

@@ -73,0 +62,0 @@ init: function init(origInit, entity) {

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.enableInspector = enableInspector;
exports.features = void 0;
exports.initInspector = initInspector;
exports.onInit = onInit;
exports.onSet = onSet;
exports.features = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _registry = require("./registry");
var devTools = null;

@@ -22,3 +18,2 @@ var isInspectorEnabled = false;

var initialRegistryValue = null;
function enableInspector(condition) {

@@ -28,6 +23,4 @@ if (condition === void 0) {

}
isInspectorEnabled = condition;
}
var features = {

@@ -42,11 +35,8 @@ pause: true,

exports.features = features;
function initInspector() {
var _window$__REDUX_DEVTO, _window$__REDUX_DEVTO2;
devTools = (_window$__REDUX_DEVTO = (_window$__REDUX_DEVTO2 = window.__REDUX_DEVTOOLS_EXTENSION__) == null ? void 0 : _window$__REDUX_DEVTO2.connect({
var _ref, _window$__REDUX_DEVTO;
devTools = (_ref = (_window$__REDUX_DEVTO = window.__REDUX_DEVTOOLS_EXTENSION__) == null ? void 0 : _window$__REDUX_DEVTO.connect({
name: document.title,
features: features
})) != null ? _window$__REDUX_DEVTO : null;
})) != null ? _ref : null;
if (devTools) {

@@ -56,9 +46,6 @@ (0, _registry.initRegistry)();

}
isInspectorInitialized = true;
}
function handleDevToolsEvent(event) {
if (!isInspectorEnabled || !devTools) return;
if (event.type === 'DISPATCH') {

@@ -70,16 +57,11 @@ switch (event.payload.type) {

break;
case 'COMMIT':
devTools.init((0, _registry.getMutableMap)());
break;
case 'ROLLBACK':
var snapshot = applyStateToEntities(event.state);
if (snapshot) {
devTools.init(snapshot);
}
break;
case 'RESET':

@@ -90,9 +72,6 @@ if (initialRegistryValue !== null) {

}
break;
case 'IMPORT_STATE':
{
var _imported$currentStat, _imported$computedSta;
var imported = event.payload.nextLiftedState;

@@ -107,3 +86,2 @@ if (!imported || !imported.computedStates) return;

}
case 'PAUSE_RECORDING':

@@ -115,6 +93,4 @@ isDevToolsPaused = !isDevToolsPaused;

}
function applyStateToEntities(state) {
var parsedState;
try {

@@ -125,3 +101,2 @@ parsedState = JSON.parse(state);

}
if (typeof parsedState !== 'object') return;

@@ -131,3 +106,2 @@ (0, _registry.updateRegistry)(parsedState);

}
function onInit(entity) {

@@ -138,3 +112,2 @@ if (entity.name.charAt(0) === '_') return;

var mutableMap = (0, _registry.getMutableMap)();
if (!(entity.name in mutableMap)) {

@@ -146,5 +119,3 @@ (0, _registry.watchRegistry)(function (value) {

}
mutableMap[entity.name] = entity.get();
if (isDevToolsInitialized && isInspectorEnabled && !isDevToolsPaused) {

@@ -156,3 +127,2 @@ devTools.send({

}
function onSet(entity, alias) {

@@ -164,3 +134,2 @@ if (entity.name.charAt(0) === '_') return;

if (!isInspectorEnabled) return;
if (!isDevToolsInitialized) {

@@ -171,3 +140,2 @@ devTools.init(mutableMap);

}
if (!isDevToolsPaused) {

@@ -174,0 +142,0 @@ devTools.send({

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.getMutableMap = getMutableMap;
exports.initRegistry = initRegistry;
exports.getMutableMap = getMutableMap;
exports.updateRegistry = updateRegistry;
exports.watchRegistry = watchRegistry;
var _entity = _interopRequireDefault(require("../core/entity"));
var registry;
function initRegistry() {
registry = (0, _entity.default)({}, '__GLOBAL__');
}
function getMutableMap() {
return registry.get();
}
function updateRegistry(newValue) {
registry.set(newValue);
}
function watchRegistry(listener) {
return registry.subscribe(listener);
}

@@ -5,5 +5,3 @@ "use strict";

exports.default = resetAll;
var _store = require("./store");
function resetAll() {

@@ -10,0 +8,0 @@ if (!(0, _store.isStoreEnabled)()) throw new Error('resetAll() requires the entity store. Call enableStore() at startup.');

@@ -5,7 +5,6 @@ "use strict";

exports.enableStore = enableStore;
exports.getStore = getStore;
exports.isStoreEnabled = isStoreEnabled;
exports.getStore = getStore;
var store = new Set();
var storeEnabled = false;
function enableStore(condition) {

@@ -15,12 +14,9 @@ if (condition === void 0) {

}
storeEnabled = condition;
}
function isStoreEnabled() {
return storeEnabled;
}
function getStore() {
return store;
}
{
"name": "simpler-state",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"description": "The simplest app state management for React",

@@ -29,4 +29,4 @@ "keywords": [

"scripts": {
"build:lib": "cross-env BABEL_ENV=commonjs babel build --out-dir lib",
"build:es": "babel build --out-dir es",
"build:lib": "cross-env BUILD_TARGET=commonjs babel src --out-dir lib --extensions .ts,.tsx --ignore **/__tests__/**",
"build:es": "babel src --out-dir es --extensions .ts,.tsx --ignore **/__tests__/**",
"build": "npm run clean && npm run compile && npm run build:lib && npm run build:es",

@@ -45,20 +45,13 @@ "clean": "rimraf build types lib es",

"dependencies": {
"@babel/runtime": "^7.13.10",
"use-sync-external-store": "^1.0.0"
},
"devDependencies": {
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.14",
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.12",
"@babel/preset-react": "^7.13.13",
"@types/jest": "^27.5.0",
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.4",
"@types/jest": "^29.5.1",
"@types/react": "^16.14.25",
"@types/react-dom": "^16.9.15",
"@types/use-sync-external-store": "^0.0.3",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.5.1",
"babel-jest": "^29.5.0",
"babel-preset-react-app": "^10.0.1",
"coveralls": "^3.1.0",

@@ -68,60 +61,15 @@ "cross-env": "^5.2.1",

"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^7.23.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^27.5.1",
"jest-localstorage-mock": "^2.4.8",
"prettier": "^2.6.2",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-react-app": "^7.0.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-localstorage-mock": "^2.4.26",
"prettier": "^2.8.7",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-test-renderer": "^16.13.1",
"rimraf": "^2.7.1",
"sinon": "^7.5.0",
"ts-jest": "^27.1.4",
"typescript": "^4.6.4"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "jsdom",
"resetMocks": false,
"setupFiles": [
"jest-localstorage-mock"
],
"setupFilesAfterEnv": [
"<rootDir>/test-setup.js"
],
"testPathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/build/",
"<rootDir>/es/",
"<rootDir>/lib/",
"<rootDir>/types/"
],
"transformIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/build/",
"<rootDir>/es/",
"<rootDir>/lib/",
"<rootDir>/types/"
],
"modulePathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/build/",
"<rootDir>/es/",
"<rootDir>/lib/",
"<rootDir>/types/"
],
"collectCoverageFrom": [
"src/**/*.ts",
"!src/**/index.ts",
"!src/index.ts"
]
},
"eslintConfig": {
"extends": "react-app"
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
}

@@ -48,3 +48,3 @@ /**

*/
export declare type Plugin = {
export type Plugin = {
[K in keyof Entity as Exclude<K, 'name'>]?: (origMethod: Entity[K], entity: Entity) => Entity[K];

@@ -51,0 +51,0 @@ };

import type { MutableMap } from './registry';
import type { Entity } from '../core/entity';
declare type DevToolsEvent = {
type DevToolsEvent = {
type: 'DISPATCH';

@@ -5,0 +5,0 @@ payload: {

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

export declare type MutableMap = Record<string, any>;
export type MutableMap = Record<string, any>;
export declare function initRegistry(): void;

@@ -3,0 +3,0 @@ export declare function getMutableMap(): MutableMap;

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