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

reactive-di

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-di - npm Package Compare versions

Comparing version 3.1.6 to 3.1.7

2

dist/annotations.js

@@ -37,2 +37,3 @@ 'use strict';

target._rdiFn = true;
target._rdiId = 0;

@@ -57,2 +58,3 @@ return target;

return function (target) {
target._rdiId = 0;
target._rdiKey = rec.key;

@@ -59,0 +61,0 @@ target._rdiConstr = rec.construct || false;

4

dist/computed/Computed.js

@@ -59,5 +59,5 @@ 'use strict';

var hook = this._hook;
var context = this.context;
if (!this._resolved) {
this._resolved = true;
var context = this.context;
context.binder.begin(this, this._isWrapped);

@@ -83,3 +83,3 @@ if (context.protoFactory) {

if (!this._isWrapped) {
if (!this._isWrapped || context.binder.status) {
var sources = this.sources;

@@ -86,0 +86,0 @@ for (var _i = 0, _l = sources.length; _i < _l; _i++) {

@@ -62,4 +62,4 @@ 'use strict';

this._argVals = new Array(this._args.length);
(0, _resolveArgs2.default)(this._args, this._argVals);
this.cached = this._argVals[0];
// resolveArgs(this._args, this._argVals)
// this.cached = this._argVals[0]
}

@@ -81,3 +81,3 @@ context.binder.end();

} catch (e) {
this._context.notifier.onError(e, this.displayName);
this._context.notifier.onError(e, this.displayName, !!this._meta.errorComponent);
return null;

@@ -119,2 +119,7 @@ }

if (this._refs === 0) {
if (this._args) {
(0, _resolveArgs2.default)(this._args, this._argVals);
}
this.cached = this._argVals[0];
var hooks = this.hooks;

@@ -124,6 +129,2 @@ for (var i = 0, l = hooks.length; i < l; i++) {

}
if (this._args) {
(0, _resolveArgs2.default)(this._args, this._argVals);
}
this.cached = this._argVals[0];
}

@@ -130,0 +131,0 @@

@@ -37,3 +37,3 @@ 'use strict';

hook: key._rdiHook || null,
errorComponent: key === context.defaultErrorComponent ? null : componentMeta.onError || context.defaultErrorComponent,
errorComponent: key === context.defaultErrorComponent ? null : componentMeta.onError || null,
register: componentMeta.register || null

@@ -40,0 +40,0 @@ };

@@ -38,3 +38,3 @@ 'use strict';

this._lastError = e;
this._context.notifier.onError(e, this.displayName);
this._context.notifier.onError(e, this.displayName, !!this._meta.errorComponent);
};

@@ -121,3 +121,3 @@

if (!this._meta.errorComponent) {
console.error('Can\'t render error: error component is not defined'); // eslint-disable-line
// console.error('Can\'t render error: error component is not defined') // eslint-disable-line
return null;

@@ -124,0 +124,0 @@ }

@@ -33,5 +33,5 @@ 'use strict';

Notifier.prototype.onError = function onError(e, name) {
Notifier.prototype.onError = function onError(e, name, isHandled) {
if (this.logger) {
this.logger.get().onError(e, name);
this.logger.get().onError(e, name, isHandled);
}

@@ -61,3 +61,5 @@ };

if (this.logger) {
this.trace = this.logger.displayName + '.onRender';
this.logger.get().onRender(upd);
this.trace = '';
}

@@ -64,0 +66,0 @@

'use strict';
exports.__esModule = true;
exports.AbstractSheetFactory = exports.DiFactory = exports.IndexCollection = exports.RecoverableError = exports.Updater = exports.Thenable = exports.debugName = exports.SourceStatus = exports.ReactComponentFactory = exports.getSrc = exports.copy = undefined;
exports.AbstractSheetFactory = exports.DiFactory = exports.IndexCollection = exports.RecoverableError = exports.Updater = exports.Thenable = exports.debugName = exports.SourceStatus = exports.ReactComponentFactory = exports.getSrc = exports.copy = exports.wrapObject = exports.wrapFunction = undefined;

@@ -45,4 +45,10 @@ var _interfaces = require('./theme/interfaces');

var _wrapObject = require('./computed/wrapObject');
var _wrapObject2 = _interopRequireDefault(_wrapObject);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.wrapFunction = _wrapObject.wrapFunction;
exports.wrapObject = _wrapObject2.default;
exports.copy = _createSetterFn.copy;

@@ -49,0 +55,0 @@ exports.getSrc = _createSetterFn.getSrc;

@@ -86,2 +86,15 @@ 'use strict';

var i = stack.length;
var status = binder.status;
if (status) {
/**
* status(3) - status -> source.computeds (for cache invalidating)
* source -> status.sources (for caching, pass to another computed in future)
*/
source = this.getStatus();
consumers = source.consumers;
computeds = source.computeds;
source.computeds.push(status);
status.sources.push(source);
}
while (--i >= 0) {

@@ -92,46 +105,32 @@ var rec = stack[i];

if (v.t === 3) {
// status
throw new Error('not here');
}
if (i >= level) {
rec.has[source.id] = true;
/**
* status(3) - status -> source.computeds (for cache invalidating)
* source -> status.sources (for caching, pass to another computed in future)
* v is
*
* computed(1) - computed -> source.computeds (for cache invalidating),
* source -> computed.sources (for caching, pass to another computed in future)
*
* consumer(2) - consumer -> source.consumers (for triggering state changes),
* consumer -> source.computeds (for cache invalidating),
* source.hook -> consumer.hooks (for livecycle callbacks)
*
* hook(4) - hook -> source.consumers (for triggering state changes),
* hook -> source.computeds (for cache invalidating)
*/
rec.has[source.id] = true;
source = this.status || this.getStatus();
computeds = source.computeds;
consumers = source.consumers;
computeds.push(v);
v.sources.push(source);
if (source !== this) {
level = 0;
if (v.t === 0) {
// computed
computeds.push(v);
v.sources.push(source);
} else if (v.t === 2) {
// consumer
consumers.push(v);
computeds.push(v);
} else {
// hook
consumers.push(v);
computeds.push(v);
}
} else {
if (i >= level) {
rec.has[source.id] = true;
/**
* v is
*
* computed(1) - computed -> source.computeds (for cache invalidating),
* source -> computed.sources (for caching, pass to another computed in future)
*
* consumer(2) - consumer -> source.consumers (for triggering state changes),
* consumer -> source.computeds (for cache invalidating),
* source.hook -> consumer.hooks (for livecycle callbacks)
*
* hook(4) - hook -> source.consumers (for triggering state changes),
* hook -> source.computeds (for cache invalidating)
*/
if (v.t === 0) {
// computed
computeds.push(v);
v.sources.push(source);
} else if (v.t === 2) {
// consumer
consumers.push(v);
computeds.push(v);
} else {
// hook
consumers.push(v);
computeds.push(v);
}
}
}

@@ -181,3 +180,3 @@ }

var status = new Source(null, this.context, this.id - 1, this.displayName + 'Status', new _SourceStatus2.default());
// status.status = status
status.status = status;
this.status = status;

@@ -184,0 +183,0 @@ }

@@ -38,5 +38,5 @@ 'use strict';

var context = this.context;
context.binder.begin(this, false);
context.binder.status = this;
context.resolveDeps(this._rawStatuses);
context.binder.end();
context.binder.status = null;
return;

@@ -43,0 +43,0 @@ }

@@ -129,3 +129,3 @@ 'use strict';

notifier.opId = this._id;
notifier.onError(error, this._source.displayName);
notifier.onError(error, this._source.displayName, true);
this._status.merge({ error: error, complete: false, pending: false });

@@ -155,5 +155,2 @@ var observer = this._updater;

status.merge(completeObj);
if (v) {
source.merge(v);
}
var observer = this._updater;

@@ -163,2 +160,5 @@ if (observer && observer.complete) {

}
if (v) {
source.merge(v);
}
this._promisable.resolve(v || this._v);

@@ -165,0 +165,0 @@ notifier.opId = oldId;

@@ -35,9 +35,2 @@ 'use strict';

GenericThemeHook.prototype.willUnmount = function willUnmount() {
if (this._sheet) {
this._sheet.detach();
this._sheet = null;
}
};
return GenericThemeHook;

@@ -44,0 +37,0 @@ }(), _class._rdiArg = [_interfaces.AbstractSheetFactory], _temp);

{
"name": "reactive-di",
"version": "3.1.6",
"version": "3.1.7",
"description": "Reactive dependency injection",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -29,2 +29,3 @@ // @flow

target._rdiFn = true
target._rdiId = 0

@@ -49,2 +50,3 @@ return target

return (target: V) => {
target._rdiId = 0
target._rdiKey = rec.key

@@ -51,0 +53,0 @@ target._rdiConstr = rec.construct || false

@@ -28,3 +28,3 @@ // @flow

values: {[id: string]: any};
status: ?IStatus<*>;
debugStr(sub: ?mixed): string;

@@ -31,0 +31,0 @@ begin(dep: IParent, isEnder: boolean): void;

@@ -75,5 +75,5 @@ // @flow

const hook: ?IHook<V> = this._hook
const context = this.context
if (!this._resolved) {
this._resolved = true
const context = this.context
context.binder.begin(this, this._isWrapped)

@@ -99,3 +99,3 @@ if (context.protoFactory) {

if (!this._isWrapped) {
if (!this._isWrapped || context.binder.status) {
const sources = this.sources

@@ -102,0 +102,0 @@ for (let i = 0, l = sources.length; i < l; i++) {

@@ -88,4 +88,4 @@ // @flow

this._argVals = (new Array(this._args.length): any)
resolveArgs(this._args, this._argVals)
this.cached = this._argVals[0]
// resolveArgs(this._args, this._argVals)
// this.cached = this._argVals[0]
}

@@ -116,3 +116,3 @@ context.binder.end()

} catch (e) {
this._context.notifier.onError(e, this.displayName)
this._context.notifier.onError(e, this.displayName, !!this._meta.errorComponent)
return null

@@ -154,2 +154,7 @@ }

if (this._refs === 0) {
if (this._args) {
resolveArgs(this._args, (this._argVals: any))
}
this.cached = this._argVals[0]
const hooks = this.hooks

@@ -159,6 +164,2 @@ for (let i = 0, l = hooks.length; i < l; i++) {

}
if (this._args) {
resolveArgs(this._args, (this._argVals: any))
}
this.cached = this._argVals[0]
}

@@ -165,0 +166,0 @@

@@ -50,3 +50,3 @@ // @flow

? null
: componentMeta.onError || context.defaultErrorComponent,
: componentMeta.onError || null,
register: componentMeta.register || null

@@ -53,0 +53,0 @@ }

@@ -85,3 +85,3 @@ // @flow

this._lastError = e
this._context.notifier.onError(e, this.displayName)
this._context.notifier.onError(e, this.displayName, !!this._meta.errorComponent)
}

@@ -166,3 +166,3 @@

if (!this._meta.errorComponent) {
console.error('Can\'t render error: error component is not defined') // eslint-disable-line
// console.error('Can\'t render error: error component is not defined') // eslint-disable-line
return (null: any)

@@ -169,0 +169,0 @@ }

@@ -52,4 +52,4 @@ // @flow

flush(): void;
onError(e: Error, name: string): void;
onError(e: Error, name: string, isHandled: boolean): void;
notify<V>(c: INotifierItem[], name: string, oldValue: V, newValue: V): void;
}

@@ -36,5 +36,5 @@ // @flow

onError(e: Error, name: string) {
onError(e: Error, name: string, isHandled: boolean) {
if (this.logger) {
this.logger.get().onError(e, name)
this.logger.get().onError(e, name, isHandled)
}

@@ -64,3 +64,5 @@ }

if (this.logger) {
this.trace = `${(this.logger: any).displayName}.onRender`
this.logger.get().onRender(upd)
this.trace = ''
}

@@ -67,0 +69,0 @@

@@ -15,3 +15,7 @@ // @flow

import wrapObject, {wrapFunction} from './computed/wrapObject'
export {
wrapFunction,
wrapObject,
copy,

@@ -33,3 +37,4 @@ getSrc,

IBaseHook,
IHasForceUpdate
IHasForceUpdate,
INotifier
} from './hook/interfaces'

@@ -36,0 +41,0 @@

// @flow
import type {IRelationBinder, IParent, IRelationItem} from './commonInterfaces'
import type {IStatus} from './source/interfaces'
import debugName from './utils/debugName'

@@ -16,3 +16,3 @@

values: {[id: string]: any}
status: ?IStatus<*>
_levels: number[] = []

@@ -19,0 +19,0 @@

@@ -84,3 +84,3 @@ // @flow

const binder = this.context.binder
let level = binder.level
const level = binder.level
const stack = binder.stack

@@ -91,2 +91,15 @@ let source: ISource<any> = (this: ISource<V>)

let i = stack.length
const status = binder.status
if (status) {
/**
* status(3) - status -> source.computeds (for cache invalidating)
* source -> status.sources (for caching, pass to another computed in future)
*/
source = this.getStatus()
consumers = source.consumers
computeds = source.computeds
source.computeds.push(status)
status.sources.push((source: ISource<ISourceStatus>))
}
while (--i >= 0) {

@@ -96,43 +109,30 @@ const rec = stack[i]

const v = rec.v
if (v.t === 3) { // status
if (v.t === 3) {
throw new Error('not here')
}
if (i >= level) {
rec.has[source.id] = true
/**
* status(3) - status -> source.computeds (for cache invalidating)
* source -> status.sources (for caching, pass to another computed in future)
* v is
*
* computed(1) - computed -> source.computeds (for cache invalidating),
* source -> computed.sources (for caching, pass to another computed in future)
*
* consumer(2) - consumer -> source.consumers (for triggering state changes),
* consumer -> source.computeds (for cache invalidating),
* source.hook -> consumer.hooks (for livecycle callbacks)
*
* hook(4) - hook -> source.consumers (for triggering state changes),
* hook -> source.computeds (for cache invalidating)
*/
rec.has[source.id] = true
source = this.status || this.getStatus()
computeds = source.computeds
consumers = source.consumers
computeds.push(v)
v.sources.push((source: ISource<ISourceStatus>))
if (source !== this) {
level = 0
if (v.t === 0) { // computed
computeds.push((v: ICacheable<*> & IDisposable))
v.sources.push((source: ISource<*>))
} else if (v.t === 2) { // consumer
consumers.push((v: INotifierItem))
computeds.push((v: ICacheable<*> & IDisposable))
} else { // hook
consumers.push((v: INotifierItem))
computeds.push((v: ICacheable<*> & IDisposable))
}
} else {
if (i >= level) {
rec.has[source.id] = true
/**
* v is
*
* computed(1) - computed -> source.computeds (for cache invalidating),
* source -> computed.sources (for caching, pass to another computed in future)
*
* consumer(2) - consumer -> source.consumers (for triggering state changes),
* consumer -> source.computeds (for cache invalidating),
* source.hook -> consumer.hooks (for livecycle callbacks)
*
* hook(4) - hook -> source.consumers (for triggering state changes),
* hook -> source.computeds (for cache invalidating)
*/
if (v.t === 0) { // computed
computeds.push((v: ICacheable<*> & IDisposable))
v.sources.push((source: ISource<*>))
} else if (v.t === 2) { // consumer
consumers.push((v: INotifierItem))
computeds.push((v: ICacheable<*> & IDisposable))
} else { // hook
consumers.push((v: INotifierItem))
computeds.push((v: ICacheable<*> & IDisposable))
}
}
}

@@ -192,3 +192,3 @@ }

)
// status.status = status
status.status = status
this.status = status

@@ -195,0 +195,0 @@ }

@@ -48,5 +48,5 @@ // @flow

const context = this.context
context.binder.begin(this, false)
context.binder.status = this
context.resolveDeps(this._rawStatuses)
context.binder.end()
context.binder.status = null
return

@@ -53,0 +53,0 @@ }

@@ -139,3 +139,3 @@ // @flow

notifier.opId = this._id
notifier.onError(error, this._source.displayName)
notifier.onError(error, this._source.displayName, true)
this._status.merge({error, complete: false, pending: false})

@@ -165,5 +165,2 @@ const observer = this._updater

status.merge(completeObj)
if (v) {
source.merge(v)
}
const observer = this._updater

@@ -173,2 +170,5 @@ if (observer && observer.complete) {

}
if (v) {
source.merge(v)
}
this._promisable.resolve(v || this._v)

@@ -175,0 +175,0 @@ notifier.opId = oldId

@@ -31,9 +31,2 @@ // @flow

}
willUnmount(): void {
if (this._sheet) {
this._sheet.detach()
this._sheet = null
}
}
}

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

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