mobx-react-lite
Advanced tools
Comparing version 2.0.0-test.0 to 2.0.0-test.1
'use strict' | ||
'use strict' | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./mobxreactlite.cjs.production.js') | ||
} else { | ||
module.exports = require('./mobxreactlite.cjs.development.js') | ||
} | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./mobxreactlite.cjs.production.min.js') | ||
} else { | ||
module.exports = require('./mobxreactlite.cjs.development.js') | ||
} |
@@ -8,3 +8,2 @@ 'use strict'; | ||
var React__default = _interopDefault(React); | ||
var tslib_1 = require('tslib'); | ||
@@ -54,3 +53,3 @@ if (!React.useState) { | ||
var doNothingDisposer = function () {// empty | ||
var doNothingDisposer = function doNothingDisposer() {// empty | ||
}; | ||
@@ -130,2 +129,20 @@ | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function printDebugValue(v) { | ||
@@ -146,4 +163,4 @@ if (!v.current) { | ||
function useForceUpdate() { | ||
var _a = tslib_1.__read(React.useState(0), 2), | ||
setTick = _a[1]; | ||
var _useState = React.useState(0), | ||
setTick = _useState[1]; | ||
@@ -190,3 +207,3 @@ var update = React.useCallback(function () { | ||
var dispose = function () { | ||
var dispose = function dispose() { | ||
if (reaction.current && !reaction.current.isDisposed) { | ||
@@ -228,3 +245,3 @@ reaction.current.dispose(); | ||
var realOptions = tslib_1.__assign({ | ||
var realOptions = _extends({ | ||
forwardRef: false | ||
@@ -235,3 +252,3 @@ }, options); | ||
var wrappedComponent = function (props, ref) { | ||
var wrappedComponent = function wrappedComponent(props, ref) { | ||
return useObserver(function () { | ||
@@ -278,5 +295,5 @@ return baseComponent(props, ref); | ||
function ObserverComponent(_a) { | ||
var children = _a.children, | ||
render = _a.render; | ||
function ObserverComponent(_ref) { | ||
var children = _ref.children, | ||
render = _ref.render; | ||
var component = children || render; | ||
@@ -324,8 +341,8 @@ | ||
var _a = tslib_1.__read(React__default.useState(function () { | ||
var _React$useState = React__default.useState(function () { | ||
return mobx.observable(current, {}, { | ||
deep: false | ||
}); | ||
}), 1), | ||
res = _a[0]; | ||
}), | ||
res = _React$useState[0]; | ||
@@ -336,3 +353,5 @@ if (Object.keys(res).length !== Object.keys(current).length) { | ||
Object.assign(res, current); | ||
mobx.runInAction(function () { | ||
Object.assign(res, current); | ||
}); | ||
return res; | ||
@@ -350,8 +369,10 @@ } | ||
if (isPlainObject(local)) { | ||
Object.keys(local).forEach(function (key) { | ||
var value = local[key]; | ||
mobx.runInAction(function () { | ||
Object.keys(local).forEach(function (key) { | ||
var value = local[key]; | ||
if (typeof value === "function") { | ||
local[key] = wrapInTransaction(value, local); | ||
} | ||
if (typeof value === "function") { | ||
local[key] = wrapInTransaction(value, local); | ||
} | ||
}); | ||
}); | ||
@@ -366,6 +387,4 @@ } | ||
return function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
@@ -372,0 +391,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react'), require('tslib')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react', 'tslib'], factory) : | ||
(global = global || self, factory(global.mobxReactLite = {}, global.mobx, global.React, global.tslib_1)); | ||
}(this, function (exports, mobx, React, tslib_1) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react'], factory) : | ||
(global = global || self, factory(global.mobxReactLite = {}, global.mobx, global.React)); | ||
}(this, function (exports, mobx, React) { 'use strict'; | ||
@@ -52,3 +52,3 @@ var React__default = 'default' in React ? React['default'] : React; | ||
var doNothingDisposer = function () {// empty | ||
var doNothingDisposer = function doNothingDisposer() {// empty | ||
}; | ||
@@ -128,2 +128,20 @@ | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function printDebugValue(v) { | ||
@@ -144,4 +162,4 @@ if (!v.current) { | ||
function useForceUpdate() { | ||
var _a = tslib_1.__read(React.useState(0), 2), | ||
setTick = _a[1]; | ||
var _useState = React.useState(0), | ||
setTick = _useState[1]; | ||
@@ -188,3 +206,3 @@ var update = React.useCallback(function () { | ||
var dispose = function () { | ||
var dispose = function dispose() { | ||
if (reaction.current && !reaction.current.isDisposed) { | ||
@@ -226,3 +244,3 @@ reaction.current.dispose(); | ||
var realOptions = tslib_1.__assign({ | ||
var realOptions = _extends({ | ||
forwardRef: false | ||
@@ -233,3 +251,3 @@ }, options); | ||
var wrappedComponent = function (props, ref) { | ||
var wrappedComponent = function wrappedComponent(props, ref) { | ||
return useObserver(function () { | ||
@@ -276,5 +294,5 @@ return baseComponent(props, ref); | ||
function ObserverComponent(_a) { | ||
var children = _a.children, | ||
render = _a.render; | ||
function ObserverComponent(_ref) { | ||
var children = _ref.children, | ||
render = _ref.render; | ||
var component = children || render; | ||
@@ -322,8 +340,8 @@ | ||
var _a = tslib_1.__read(React__default.useState(function () { | ||
var _React$useState = React__default.useState(function () { | ||
return mobx.observable(current, {}, { | ||
deep: false | ||
}); | ||
}), 1), | ||
res = _a[0]; | ||
}), | ||
res = _React$useState[0]; | ||
@@ -334,3 +352,5 @@ if (Object.keys(res).length !== Object.keys(current).length) { | ||
Object.assign(res, current); | ||
mobx.runInAction(function () { | ||
Object.assign(res, current); | ||
}); | ||
return res; | ||
@@ -348,8 +368,10 @@ } | ||
if (isPlainObject(local)) { | ||
Object.keys(local).forEach(function (key) { | ||
var value = local[key]; | ||
mobx.runInAction(function () { | ||
Object.keys(local).forEach(function (key) { | ||
var value = local[key]; | ||
if (typeof value === "function") { | ||
local[key] = wrapInTransaction(value, local); | ||
} | ||
if (typeof value === "function") { | ||
local[key] = wrapInTransaction(value, local); | ||
} | ||
}); | ||
}); | ||
@@ -364,6 +386,4 @@ } | ||
return function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
@@ -370,0 +390,0 @@ |
{ | ||
"name": "mobx-react-lite", | ||
"version": "2.0.0-test.0", | ||
"version": "2.0.0-test.1", | ||
"description": "Lightweight React bindings for MobX based on React 16.8 and Hooks", | ||
"main": "dist/index.js", | ||
"jsnext:main": "dist/mobxreactlite.es.production.js", | ||
"module": "dist/mobxreactlite.es.production.js", | ||
"typings": "dist/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"jsnext:main": "dist/mobxreactlite.esm.js", | ||
"module": "dist/mobxreactlite.esm.js", | ||
"unpkg": "dist/mobxreactlite.umd.production.min.js", | ||
"repository": { | ||
@@ -22,3 +23,3 @@ "type": "git", | ||
"prebuild": "rimraf dist", | ||
"build": "tsdx build --name mobxReactLite", | ||
"build": "tsdx build --name mobxReactLite --format=cjs,esm,umd", | ||
"prepublishOnly": "yarn build" | ||
@@ -31,3 +32,3 @@ }, | ||
}, | ||
"homepage": "https://mobxjs.github.io/mobx", | ||
"homepage": "https://mobx-react.js.org", | ||
"peerDependencies": { | ||
@@ -38,25 +39,25 @@ "mobx": "^4.0.0 || ^5.0.0", | ||
"devDependencies": { | ||
"@types/jest": "24.0.13", | ||
"@types/node": "12.0.2", | ||
"@types/react": "16.8.18", | ||
"@testing-library/react": "8.0.4", | ||
"@testing-library/react-hooks": "1.0.4", | ||
"@types/jest": "24.0.15", | ||
"@types/node": "12.0.10", | ||
"@types/react": "16.8.22", | ||
"@types/react-dom": "16.8.4", | ||
"coveralls": "3.0.3", | ||
"husky": "2.3.0", | ||
"coveralls": "3.0.4", | ||
"husky": "2.5.0", | ||
"jest": "24.8.0", | ||
"jest-dom": "3.4.0", | ||
"jest-dom": "3.5.0", | ||
"jest-environment-jsdom": "24.8.0", | ||
"jest-mock-console": "1.0.0", | ||
"lint-staged": "8.1.7", | ||
"lint-staged": "8.2.1", | ||
"lodash": "4.17.11", | ||
"mobx": "5.9.4", | ||
"prettier": "1.17.1", | ||
"mobx": "5.10.1", | ||
"prettier": "1.18.2", | ||
"react": "16.8.6", | ||
"react-dom": "16.8.6", | ||
"react-hooks-testing-library": "0.5.0", | ||
"react-test-renderer": "16.8.6", | ||
"react-testing-library": "7.0.1", | ||
"rimraf": "2.6.3", | ||
"ts-jest": "24.0.2", | ||
"tsdx": "^0.5.12", | ||
"tslint": "5.16.0", | ||
"tsdx": "0.7.2", | ||
"tslint": "5.18.0", | ||
"tslint-config-prettier": "1.18.0", | ||
@@ -63,0 +64,0 @@ "typescript": "3.4.5" |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
464364
319
1067
0
7