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

a-di

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-di - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

lib/di.d.ts

1722

lib/di.js

@@ -0,884 +1,976 @@

(function (root, factory) {
'use strict';
// source ./templates/UMD.js
(function(factory){
var _name = 'Di',
_global = typeof window === 'undefined' ? global : window,
_module = {
exports: {}
};
factory(_module, _global);
if (typeof define === 'function' && define.amd) {
define([], function () {
return _module.exports;
});
return;
}
if (typeof module === 'object' && module.exports) {
module.exports = _module.exports;
return;
}
_global[_name] = _module.exports;
}(function(module, global){
// source ./templates/ModuleSimplified.js
var _src_utils_obj;
(function () {
"use strict";
_src_utils_obj = {
extend: function extend(a, b) {
if (b == null) {
return a || {};
}if (a == null) {
return obj_create(b);
}for (var key in b) {
a[key] = b[key];
}
return a;
},
extendDefaults: function extendDefaults(a, b) {
if (b == null) {
return a || {};
}if (a == null) {
return obj_create(b);
}for (var key in b) {
if (a[key] == null) {
a[key] = b[key];
continue;
}
if (key === "toString" && a[key] === Object.prototype.toString) {
a[key] = b[key];
}
}
return a;
}
};
var _name = 'di',
_global = typeof window === 'undefined' ? global : window,
_module = {
exports: {}
};
var obj_create;
(function () {
obj_create = Object.create || function (x) {
var Ctor = function Ctor() {};
Ctor.prototype = x;
return new Ctor();
};
})();
//# sourceMappingURL=obj.js.map;
}());
// end:source ./templates/ModuleSimplified.js
factory(_global, _module, _module.exports);
// source ./templates/ModuleSimplified.js
var _src_utils_arr;
(function () {
"use strict";
if (_global[_name] == null) {
_global[_name] = _module.exports;
}
_src_utils_arr = {
from: function from(arr) {
return Array.prototype.slice.call(arr);
}
};
//# sourceMappingURL=arr.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (typeof module === 'object' && module.exports) {
module.exports = _module.exports;
return;
}
if (typeof define === 'function' && define.amd) {
define([], function () {
return _module.exports;
});
}
// source ./templates/ModuleSimplified.js
var _src_utils_class;
(function () {
"use strict";
}(this, function (global, module, exports) {
'use strict';
var obj = _src_utils_obj;
var Arr = _src_utils_arr;
var _src_Di = {};
var _src_Entries_BaseMethodEntry = {};
var _src_Entries_Entry = {};
var _src_Entries_EntryCollection = {};
var _src_Entries_FnEntry = {};
var _src_Entries_MetaReader = {};
var _src_Entries_ObjectEntry = {};
var _src_Entries_TypeEntry = {};
var _src_Params_BaseParamResolver = {};
var _src_Params_EmptyParamResolver = {};
var _src_Params_ObjectParamResolver = {};
var _src_Params_ParamResolver = {};
var _src_const = {};
var _src_utils_is = {};
_src_utils_class = {
create: createClassFactory(obj.extendDefaults)
// source ./ModuleSimplified.js
var _src_const;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Opts = {
/**
* How to handle the arguments passed to the wrapped function
*/
args: {
OVERRIDE: 'override',
IGNORE: 'ignore',
EXTEND: 'extend'
}
};
;
function createClassFactory(extendDefaultsFn) {
return function () {
var args = Arr.from(arguments),
Proto = args.pop();
if (Proto == null) Proto = {};
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
if (isObject(_src_const) && isObject(module.exports)) {
Object.assign(_src_const, module.exports);
return;
}
_src_const = module.exports;
}());
// end:source ./ModuleSimplified.js
var Ctor;
if (Proto.hasOwnProperty("constructor")) {
Ctor = Proto.constructor;
if (Ctor.prototype === void 0) {
var es6Method = Ctor;
Ctor = function ClassCtor() {
var imax = arguments.length,
i = -1,
args = new Array(imax);
while (++i < imax) args[i] = arguments[i];
return es6Method.apply(this, args);
};
}
} else {
Ctor = function ClassCtor() {};
}
// source ./ModuleSimplified.js
var _src_utils_is;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Is = {
Object: function (mix) {
return mix != null
&& typeof mix === 'object'
&& mix.toString() === '[object Object]';
}
};
;
var i = args.length,
BaseCtor,
x;
while (--i > -1) {
x = args[i];
if (typeof x === "function") {
BaseCtor = wrapFn(x, BaseCtor);
x = x.prototype;
}
extendDefaultsFn(Proto, x);
}
return createClass(wrapFn(BaseCtor, Ctor), Proto);
};
}
function createClass(Ctor, Proto) {
Proto.constructor = Ctor;
Ctor.prototype = Proto;
return Ctor;
}
function wrapFn(fnA, fnB) {
if (fnA == null) {
return fnB;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
if (fnB == null) {
return fnA;
if (isObject(_src_utils_is) && isObject(module.exports)) {
Object.assign(_src_utils_is, module.exports);
return;
}
return function () {
var args = Arr.from(arguments);
var x = fnA.apply(this, args);
if (x !== void 0) return x;
_src_utils_is = module.exports;
}());
// end:source ./ModuleSimplified.js
return fnB.apply(this, args);
};
}
//# sourceMappingURL=class.js.map;
}());
// end:source ./templates/ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Params_BaseParamResolver;
(function () {
"use strict";
// source ./ModuleSimplified.js
var _src_Params_EmptyParamResolver;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EmptyParamResolver = /** @class */ (function () {
function EmptyParamResolver() {
}
EmptyParamResolver.prototype.resolve = function (current) {
return current;
};
return EmptyParamResolver;
}());
exports.EmptyParamResolver = EmptyParamResolver;
;
;
var _require = _src_utils_class;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
if (isObject(_src_Params_EmptyParamResolver) && isObject(module.exports)) {
Object.assign(_src_Params_EmptyParamResolver, module.exports);
return;
}
_src_Params_EmptyParamResolver = module.exports;
}());
// end:source ./ModuleSimplified.js
var class_create = _require.create;
_src_Params_BaseParamResolver = class_create({
// source ./ModuleSimplified.js
var _src_Params_ObjectParamResolver;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_1 = _src_utils_is;
var ObjectParamResolver = /** @class */ (function () {
function ObjectParamResolver(di, object) {
this.object = object;
this.entries = di.entries;
}
ObjectParamResolver.prototype.resolve = function (currentParam) {
if (currentParam !== null && is_1.Is.Object(currentParam) === false) {
throw new Error('Object is expected to extend the resultig one');
}
var out = Object.create(this.object);
for (var key in out) {
out[key] = this.entries.resolve(out[key]);
}
for (var key in currentParam) {
out[key] = currentParam[key];
}
return out;
};
return ObjectParamResolver;
}());
exports.ObjectParamResolver = ObjectParamResolver;
;
constructor: function constructor(di, mix) {
this.entry = di.entries.getFor(mix, true);
},
resolve: function resolve(currentParam) {
if (currentParam != null) {
return currentParam;
}
return this.entry.resolve();
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=BaseParamResolver.js.map;
}());
// end:source ./templates/ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_utils_is;
(function () {
"use strict";
_src_utils_is = {
Object: function Object(mix) {
return mix != null && typeof mix === "object" && mix.toString() === "[object Object]";
if (isObject(_src_Params_ObjectParamResolver) && isObject(module.exports)) {
Object.assign(_src_Params_ObjectParamResolver, module.exports);
return;
}
};
//# sourceMappingURL=is.js.map;
}());
// end:source ./templates/ModuleSimplified.js
_src_Params_ObjectParamResolver = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Params_ObjectParamResolver;
(function () {
"use strict";
var BaseParamResolver = _src_Params_BaseParamResolver;
var is = _src_utils_is;
// source ./ModuleSimplified.js
var _src_Params_BaseParamResolver;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseParamResolver = /** @class */ (function () {
function BaseParamResolver(di, mix) {
this.entry = di.entries.getFor(mix, true);
}
BaseParamResolver.prototype.resolve = function (currentParam) {
if (currentParam != null) {
return currentParam;
}
return this.entry.resolve();
};
return BaseParamResolver;
}());
exports.BaseParamResolver = BaseParamResolver;
;
;
var _require = _src_utils_class;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
if (isObject(_src_Params_BaseParamResolver) && isObject(module.exports)) {
Object.assign(_src_Params_BaseParamResolver, module.exports);
return;
}
_src_Params_BaseParamResolver = module.exports;
}());
// end:source ./ModuleSimplified.js
var class_create = _require.create;
_src_Params_ObjectParamResolver = class_create({
// source ./ModuleSimplified.js
var _src_Params_ParamResolver;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_1 = _src_utils_is;
var EmptyParamResolver_1 = _src_Params_EmptyParamResolver;
var ObjectParamResolver_1 = _src_Params_ObjectParamResolver;
var BaseParamResolver_1 = _src_Params_BaseParamResolver;
exports.ParamResolver = {
create: function (di, mix) {
if (mix == null) {
return new EmptyParamResolver_1.EmptyParamResolver();
}
if (is_1.Is.Object(mix)) {
return new ObjectParamResolver_1.ObjectParamResolver(di, mix);
}
return new BaseParamResolver_1.BaseParamResolver(di, mix);
},
createMany: function (di, arr) {
var out = new Array(arr.length), i = arr.length;
while (--i !== -1) {
out[i] = exports.ParamResolver.create(di, arr[i]);
}
return out;
}
};
;
constructor: function constructor(di, object) {
this.object = object;
this.entries = di.entries;
},
resolve: function resolve(currentParam) {
if (currentParam !== null && is.Object(currentParam) === false) {
throw new Error("Object is expected to extend the resultig one");
}
var out = Object.create(this.object);
for (var key in out) {
out[key] = this.entries.resolve(out[key]);
}
for (var key in currentParam) {
out[key] = currentParam[key];
}
return out;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=ObjectParamResolver.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Params_ParamResolver) && isObject(module.exports)) {
Object.assign(_src_Params_ParamResolver, module.exports);
return;
}
_src_Params_ParamResolver = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Params_EmptyParamResolver;
(function () {
"use strict";
var _require = _src_utils_class;
// source ./ModuleSimplified.js
var _src_Entries_Entry;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var const_1 = _src_const;
var ParamResolver_1 = _src_Params_ParamResolver;
var Entry = /** @class */ (function () {
function Entry(di) {
this.di = di;
this._as = [];
this._using = [];
this._params = [];
this._resolvers = [];
this.cfg_arguments = const_1.Opts.args.OVERRIDE;
this.cfg_singleton = true;
this.onActivatedCb = null;
}
Entry.prototype.config = function (key, value) {
var prop = 'cfg_' + key;
if (this[prop] === void 0) {
throw new Error('Configuration key is not supported: ' + key);
}
this[prop] = value;
return this;
};
Entry.prototype.using = function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
(_a = this._using).push.apply(_a, args);
var resolvers = new Array(args.length), imax = args.length, i = -1;
while (++i < imax) {
resolvers[i] = ParamResolver_1.ParamResolver.create(this.di, args[i]);
}
this._resolvers.push.apply(this._resolvers, resolvers);
return this;
};
Entry.prototype.isSingleton = function (val) {
if (val === void 0) { val = true; }
this.cfg_singleton = val;
return this;
};
Entry.prototype.as = function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
(_a = this._as).push.apply(_a, args);
var i = args.length, entries = this.di.entries;
while (--i > -1) {
entries.registerFor(args[i], this);
}
return this;
};
Entry.prototype.register = function () {
var coll = this.di.entries;
var Entry = this.Entry();
coll.removeFor(Entry);
coll.registerFor(Entry, this);
coll.add(this);
return this;
};
Entry.prototype.asSelf = function () {
this.di.entries.registerFor(this.Entry(), this);
return this;
};
Entry.prototype.resolve = function (mix) {
throw new Error('Not implemented');
};
Entry.prototype.onActivated = function (fn) {
this.onActivatedCb = fn;
};
Entry.prototype.Entry = function () {
throw new Error('Not implemented');
};
return Entry;
}());
exports.Entry = Entry;
;
;
var class_create = _require.create;
_src_Params_EmptyParamResolver = class_create({
resolve: function resolve(current) {
return current;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=EmptyParamResolver.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_Entry) && isObject(module.exports)) {
Object.assign(_src_Entries_Entry, module.exports);
return;
}
_src_Entries_Entry = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Params_ParamResolver;
(function () {
"use strict";
var BaseParamResolver = _src_Params_BaseParamResolver,
ObjectParamResolver = _src_Params_ObjectParamResolver,
EmptyParamResolver = _src_Params_EmptyParamResolver,
is = _src_utils_is;
// source ./ModuleSimplified.js
var _src_Entries_BaseMethodEntry;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Entry_1 = _src_Entries_Entry;
var const_1 = _src_const;
var BaseMethodEntry = /** @class */ (function (_super) {
__extends(BaseMethodEntry, _super);
function BaseMethodEntry(di, Entry) {
var _this = _super.call(this, di) || this;
if (typeof Entry !== 'function') {
throw new Error('Invalid argument. Function expected');
}
var using = di.metaReader.readFromType(Entry);
if (using != null) {
_this.using.apply(_this, using);
}
return _this;
}
BaseMethodEntry.prototype.withParams = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this._params = args;
return this;
};
BaseMethodEntry.prototype.getParams_ = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var resolvers = this._resolvers, params = this._params;
var argsIgnore = this.cfg_arguments === const_1.Opts.args.IGNORE, argsExtend = this.cfg_arguments === const_1.Opts.args.EXTEND, argsOverride = this.cfg_arguments === const_1.Opts.args.OVERRIDE;
var size = resolvers.length;
if (size < params.length)
size = params.length;
if (argsIgnore === false) {
if (argsExtend) {
size += args.length;
}
if (argsOverride && args.length > size) {
size = args.length;
}
}
var ctorParams = new Array(size);
var i = -1;
while (++i < size) {
if (i < params.length && params[i] != null) {
var arg = argsIgnore === false && i < args.length && args[i] != null
? args[i]
: params[i];
ctorParams[i] = arg;
continue;
}
if (i < resolvers.length && resolvers[i] != null) {
var arg = argsIgnore === false && i < args.length
? args[i]
: void 0;
ctorParams[i] = resolvers[i].resolve(arg);
continue;
}
if (argsIgnore) {
continue;
}
if (argsOverride && i < args.length) {
ctorParams[i] = args[i];
continue;
}
if (argsExtend && i >= size - args.length) {
var j = i - size - args.length;
ctorParams[i] = args[j];
continue;
}
}
var Fn = this.Entry();
var expect = Fn.length;
if (expect > size) {
throw new Error("Not enough arguments for Method " + Fn.name + ". Got " + size + ". Expect " + expect);
}
return ctorParams;
};
return BaseMethodEntry;
}(Entry_1.Entry));
exports.BaseMethodEntry = BaseMethodEntry;
;
;
_src_Params_ParamResolver = {
create: function create(di, mix) {
if (mix == null) {
return new EmptyParamResolver();
}
if (is.Object(mix)) {
return new ObjectParamResolver(di, mix);
}
return new BaseParamResolver(di, mix);
},
createMany: function createMany(di, arr) {
var out = new Array(arr.length),
i = arr.length;
while (--i !== -1) {
out[i] = ParamResolver.create(di, arr[i]);
}
return out;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
};
//# sourceMappingURL=ParamResolver.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_BaseMethodEntry) && isObject(module.exports)) {
Object.assign(_src_Entries_BaseMethodEntry, module.exports);
return;
}
_src_Entries_BaseMethodEntry = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_const;
(function () {
"use strict";
_src_const = {
/**
* How to handle the arguments passed to the wrapped function
*/
args: {
OVERRIDE: "override",
IGNORE: "ignore",
EXTEND: "extend"
}
// source ./ModuleSimplified.js
var _src_Entries_TypeEntry;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
//# sourceMappingURL=const.js.map;
}());
// end:source ./templates/ModuleSimplified.js
Object.defineProperty(exports, "__esModule", { value: true });
var BaseMethodEntry_1 = _src_Entries_BaseMethodEntry;
var TypeEntry = /** @class */ (function (_super) {
__extends(TypeEntry, _super);
function TypeEntry(di, Type) {
var _this = _super.call(this, di, Type) || this;
_this._singleton = null;
_this.Type = Type;
return _this;
}
TypeEntry.prototype.Entry = function () {
return this.Type;
};
TypeEntry.prototype.resolve = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (this.cfg_singleton && this._singleton != null) {
return this._singleton;
}
var params = this.getParams_.apply(this, args);
var Ctor = this.Type;
//new (Function.prototype.bind.apply(Ctor, [null].concat(params)))();
var instance = new (Ctor.bind.apply(Ctor, __spreadArrays([void 0], params)))();
if (this.cfg_singleton) {
this._singleton = instance;
}
return instance;
};
TypeEntry.prototype.wrap = function () {
var self = this;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return self.resolve.apply(self, args);
};
};
return TypeEntry;
}(BaseMethodEntry_1.BaseMethodEntry));
exports.TypeEntry = TypeEntry;
;
;
// source ./templates/ModuleSimplified.js
var _src_Entries_Entry;
(function () {
"use strict";
var ParamResolver = _src_Params_ParamResolver;
var opts = _src_const;
var Arr = _src_utils_arr;
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_Entry = class_create({
constructor: function constructor(di) {
this.di = di;
this._as = [];
this._using = [];
this._params = [];
this._resolvers = [];
this.cfg_arguments = opts.args.OVERRIDE;
this.onActivated = null;
},
config: function config(key, value) {
var prop = "cfg_" + key;
if (this[prop] === void 0) {
throw new Error("Configuration key is not supported: " + key);
}
this[prop] = value;
return this;
},
using: function using() {
var args = Arr.from(arguments);
this._using.push.apply(this._using, args);
var resolvers = new Array(args.length),
imax = args.length,
i = -1;
while (++i < imax) {
resolvers[i] = ParamResolver.create(this.di, args[i]);
}
this._resolvers.push.apply(this._resolvers, resolvers);
return this;
},
as: function as() {
var args = Arr.from(arguments);
this._as.push.apply(this._as, args);
var i = args.length,
entries = this.di.entries;
while (--i > -1) {
entries.registerFor(args[i], this);
}
return this;
},
register: function register() {
var coll = this.di.entries;
coll.removeFor(this.Entry());
coll.add(this);
return this;
},
asSelf: function asSelf() {
this.di.entries.registerFor(this.Entry(), this);
return this;
},
resolve: function resolve() {
throw new Error("Not implemented");
},
onActivated: function onActivated(fn) {
this.onActivated = fn;
},
Entry: function Entry() {
throw new Error("Not implemented");
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=Entry.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_TypeEntry) && isObject(module.exports)) {
Object.assign(_src_Entries_TypeEntry, module.exports);
return;
}
_src_Entries_TypeEntry = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_ObjectEntry;
(function () {
"use strict";
var Entry = _src_Entries_Entry;
var ParamResolver = _src_Params_ParamResolver;
// source ./ModuleSimplified.js
var _src_Entries_EntryCollection;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TypeEntry_1 = _src_Entries_TypeEntry;
var EntryCollection = /** @class */ (function () {
function EntryCollection(di) {
this.di = di;
this.arr = [];
this.ids = {};
this.types = {};
}
EntryCollection.prototype.add = function (entry) {
this.arr.push(entry);
};
EntryCollection.prototype.resolve = function (mix) {
if (mix == null) {
throw new Error('Resolve argument is undefined');
}
var entry = null;
if (typeof mix === 'string') {
entry = this.ids[entry];
if (entry == null) {
throw Error("Entry for Type '" + mix + "' not found");
}
}
if (typeof mix === 'function') {
entry = this.getForType(mix);
if (entry == null) {
entry = new TypeEntry_1.TypeEntry(this.di, mix);
this.registerFor(mix, entry);
}
}
return entry.resolve();
};
EntryCollection.prototype.getByType = function (Type) {
var arr = this.arr;
var i = arr.length;
while (--i > -1) {
var x = arr[i];
if (x.Type === Type) {
return x;
}
}
return null;
};
EntryCollection.prototype.getFor = function (mix, required) {
if (required === void 0) { required = false; }
if (typeof mix === 'string') {
var entry = this.ids[mix];
if (required === true && entry == null) {
throw Error("Dependency is not registered \"" + mix + "\"");
}
return entry;
}
if (typeof mix === 'function') {
var entry = this.getForType(mix);
if (required === true && entry == null) {
throw Error("Dependency is not registered \"" + mix.name + "\"");
}
return entry;
}
throw new Error('Collection::getFor. Unsupported value type: ' + (typeof mix));
};
EntryCollection.prototype.getForType = function (Type) {
var _a;
var name = Type.name;
var arr = this.types[name];
if (arr != null) {
var i = arr.length;
while (--i > -1) {
var x = arr[i];
if (x.Type === Type) {
return x.entry;
}
}
}
return (_a = this.di.parent) === null || _a === void 0 ? void 0 : _a.entries.getForType(Type);
};
EntryCollection.prototype.removeForType = function (Type) {
var arr = this.types[Type.name];
if (arr == null) {
return;
}
var imax = arr.length, i = -1;
while (++i < imax) {
var x = arr[i];
if (x.Type === Type) {
arr.splice(i, 1);
return;
}
}
};
EntryCollection.prototype.removeFor = function (mix) {
if (typeof mix === 'string') {
this.ids[mix] = null;
return;
}
if (typeof mix === 'function') {
var name = mix.name;
var arr = this.types[name];
if (arr == null) {
return;
}
var i = arr.length;
while (--i !== -1) {
if (arr[i].Type === mix) {
arr.splice(i, 1);
}
}
return;
}
};
EntryCollection.prototype.registerFor = function (mix, entry) {
if (typeof mix === 'string') {
this.ids[mix] = entry;
return;
}
if (typeof mix === 'function') {
var name = mix.name;
var arr = this.types[name];
if (arr == null) {
arr = this.types[name] = [];
}
arr.push({
Type: mix,
entry: entry
});
return;
}
throw Error('Collection::registerFor. Unsupported value type: ' + (typeof mix));
};
return EntryCollection;
}());
exports.EntryCollection = EntryCollection;
;
;
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_ObjectEntry = class_create(Entry, {
constructor: function constructor(container, object) {
this.Object = object;
},
using: function using(objectDefinitions) {
if (arguments.length !== 1) {
throw new Error("Invalid argument count in using for an ObjectEntry");
}
for (var key in objectDefinitions) {
var paramResolver = ParamResolver.create(container, objectDefinitions[key]);
this.resolvers.push([key, paramResolver]);
}
},
resolve: function resolve(currentObject) {
var object = Object.create(this.Object);
var arr = this.resolvers,
i = arr.length;
while (--i > -1) {
var resolverEntry = this.resolvers[i];
var key = resolverEntry[0],
Resolver = resolverEntry[1];
var arg = currentObject == null ? null : currentObject[key];
var val = Resolver.resolve(arg);
object[key] = val;
}
for (var key in currentObject) {
if (object[key] == null) {
object[key] = currentObject[key];
}
}
return object;
},
wrap: function wrap() {
return this.resolve.bind(this);
},
Entry: function Entry() {
return this.Object;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
if (isObject(_src_Entries_EntryCollection) && isObject(module.exports)) {
Object.assign(_src_Entries_EntryCollection, module.exports);
return;
}
_src_Entries_EntryCollection = module.exports;
}());
// end:source ./ModuleSimplified.js
});
//# sourceMappingURL=ObjectEntry.js.map;
}());
// end:source ./templates/ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_BaseMethodEntry;
(function () {
"use strict";
// source ./ModuleSimplified.js
var _src_Entries_MetaReader;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MetaReader = /** @class */ (function () {
function MetaReader() {
}
MetaReader.prototype.readFromType = function (Type) {
return Type.$constructor;
};
return MetaReader;
}());
exports.MetaReader = MetaReader;
;
;
var Entry = _src_Entries_Entry;
var opts = _src_const;
var Arr = _src_utils_arr;
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_BaseMethodEntry = class_create(Entry, {
constructor: function constructor(di, Entry) {
if (typeof Entry !== "function") {
throw new Error("Invalid argument. Function expected");
}
var using = di.metaReader.readFromType(Entry);
if (using != null) {
this.using.apply(this, using);
}
},
withParams: function withParams() {
this._params = Arr.from(arguments);
return this;
},
getParams_: function getParams_() {
var args = Arr.from(arguments),
resolvers = this._resolvers,
params = this._params;
var argsIgnore = this.cfg_arguments === opts.args.IGNORE,
argsExtend = this.cfg_arguments === opts.args.EXTEND,
argsOverride = this.cfg_arguments === opts.args.OVERRIDE;
var size = resolvers.length;
if (size < params.length) size = params.length;
if (argsIgnore === false) {
if (argsExtend) {
size += args.length;
}
if (argsOverride && args.length > size) {
size = args.length;
}
}
var ctorParams = new Array(size);
var i = -1;
while (++i < size) {
if (i < params.length && params[i] != null) {
var arg = argsIgnore === false && i < args.length && args[i] != null ? args[i] : params[i];
ctorParams[i] = arg;
continue;
}
if (i < resolvers.length && resolvers[i] != null) {
var arg = argsIgnore === false && i < args.length ? args[i] : void 0;
ctorParams[i] = resolvers[i].resolve(arg);
continue;
}
if (argsIgnore) {
continue;
}
if (argsOverride && i < args.length) {
ctorParams[i] = args[i];
continue;
}
if (argsExtend && i >= size - args.length) {
var j = i - size - args.length;
ctorParams[i] = args[j];
continue;
}
}
var Fn = this.Entry(),
expect = Fn.length;
if (expect > size) {
throw new Error("Not enough arguments for Method " + Fn.name + ". Have " + size + ". Expect " + expect);
}
return ctorParams;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=BaseMethodEntry.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_MetaReader) && isObject(module.exports)) {
Object.assign(_src_Entries_MetaReader, module.exports);
return;
}
_src_Entries_MetaReader = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_TypeEntry;
(function () {
"use strict";
var BaseMethodEntry = _src_Entries_BaseMethodEntry;
var opts = _src_const;
var Arr = _src_utils_arr;
// source ./ModuleSimplified.js
var _src_Entries_FnEntry;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var BaseMethodEntry_1 = _src_Entries_BaseMethodEntry;
var FnEntry = /** @class */ (function (_super) {
__extends(FnEntry, _super);
function FnEntry(di, fn) {
var _this = _super.call(this, di, fn) || this;
_this.Fn = fn;
return _this;
}
FnEntry.prototype.Entry = function () {
return this.Fn;
};
FnEntry.prototype.resolve = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var params = this.getParams_.apply(this, args);
return this.Fn.apply(null, params);
};
FnEntry.prototype.wrap = function () {
return this.resolve.bind(this);
};
return FnEntry;
}(BaseMethodEntry_1.BaseMethodEntry));
exports.FnEntry = FnEntry;
;
;
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_TypeEntry = class_create(BaseMethodEntry, {
constructor: function constructor(di, Type) {
this.Type = Type;
},
Entry: function Entry() {
return this.Type;
},
resolve: function resolve() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var args = Arr.from(arguments),
params = this.getParams_.apply(this, args),
Ctor = this.Type;
return new (Function.prototype.bind.apply(Ctor, [null].concat(params)))();
},
wrap: function wrap() {
var self = this;
return function () {
return self.resolve.apply(this, arguments);
};
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=TypeEntry.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_FnEntry) && isObject(module.exports)) {
Object.assign(_src_Entries_FnEntry, module.exports);
return;
}
_src_Entries_FnEntry = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_FnEntry;
(function () {
"use strict";
var BaseMethodEntry = _src_Entries_BaseMethodEntry;
var ParamResolver = _src_Params_ParamResolver;
var Arr = _src_utils_arr;
// source ./ModuleSimplified.js
var _src_Entries_ObjectEntry;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Entry_1 = _src_Entries_Entry;
var ParamResolver_1 = _src_Params_ParamResolver;
var ObjectEntry = /** @class */ (function (_super) {
__extends(ObjectEntry, _super);
function ObjectEntry(container, object) {
var _this = _super.call(this, container) || this;
_this.container = container;
_this.Object = object;
return _this;
}
ObjectEntry.prototype.using = function (objectDefinitions) {
if (arguments.length !== 1) {
throw new Error('Invalid argument count in using for an ObjectEntry');
}
for (var key in objectDefinitions) {
var paramResolver = ParamResolver_1.ParamResolver.create(this.container, objectDefinitions[key]);
this.resolvers.push([key, paramResolver]);
}
return this;
};
ObjectEntry.prototype.resolve = function (currentObject) {
var object = Object.create(this.Object);
var arr = this.resolvers, i = arr.length;
while (--i > -1) {
var resolverEntry = this.resolvers[i];
var key = resolverEntry[0], Resolver = resolverEntry[1];
var arg = currentObject == null ? null : currentObject[key];
var val = Resolver.resolve(arg);
object[key] = val;
}
for (var name in currentObject) {
if (object[name] == null) {
object[name] = currentObject[name];
}
}
return object;
};
ObjectEntry.prototype.wrap = function () {
return this.resolve.bind(this);
};
ObjectEntry.prototype.Entry = function () {
return this.Object;
};
return ObjectEntry;
}(Entry_1.Entry));
exports.ObjectEntry = ObjectEntry;
;
;
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_FnEntry = class_create(BaseMethodEntry, {
constructor: function constructor(container, fn) {
this.Fn = fn;
},
Entry: function Entry() {
return this.Fn;
},
resolve: function resolve() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var args = Arr.from(arguments),
params = this.getParams_.apply(this, args);
return this.Fn.apply(null, params);
},
wrap: function wrap() {
return this.resolve.bind(this);
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=FnEntry.js.map;
}());
// end:source ./templates/ModuleSimplified.js
if (isObject(_src_Entries_ObjectEntry) && isObject(module.exports)) {
Object.assign(_src_Entries_ObjectEntry, module.exports);
return;
}
_src_Entries_ObjectEntry = module.exports;
}());
// end:source ./ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_MetaReader;
(function () {
"use strict";
var _require = _src_utils_class;
// source ./ModuleSimplified.js
var _src_Di;
(function () {
// ensure AMD is not active for the model, so that any UMD exports as commonjs
var define = null;
var exports = {};
var module = { exports: exports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EntryCollection_1 = _src_Entries_EntryCollection;
var MetaReader_1 = _src_Entries_MetaReader;
var TypeEntry_1 = _src_Entries_TypeEntry;
var FnEntry_1 = _src_Entries_FnEntry;
var ObjectEntry_1 = _src_Entries_ObjectEntry;
var Di = /** @class */ (function () {
function Di(parent) {
if (parent === void 0) { parent = null; }
this.parent = parent;
this.di = this;
this.entries = new EntryCollection_1.EntryCollection(this);
this.metaReader = new MetaReader_1.MetaReader();
}
Di.prototype.new = function () {
return new Di(this);
};
Di.prototype.registerType = function (Type) {
return this.Type(Type).register();
};
Di.prototype.registerFactory = function (Fn) {
return this.Function(Fn).register();
};
Di.prototype.Type = function (Type) {
return new TypeEntry_1.TypeEntry(this, Type);
};
Di.prototype.Function = function (fn) {
return new FnEntry_1.FnEntry(this, fn);
};
Di.prototype.Object = function (object) {
return new ObjectEntry_1.ObjectEntry(this, object);
};
Di.prototype.resolve = function (mix) {
return this.entries.resolve(mix);
};
Di.prototype.wrapType = function (Type) {
return this.entries.getFor(Type).wrap();
};
Di.Di = Di;
Di.di = new Di;
return Di;
}());
exports.Di = Di;
;
;
var class_create = _require.create;
_src_Entries_MetaReader = class_create({
readFromType: function readFromType(Type) {
return Type.$constructor;
function isObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
});
//# sourceMappingURL=MetaReader.js.map;
}());
// end:source ./templates/ModuleSimplified.js
// source ./templates/ModuleSimplified.js
var _src_Entries_EntryCollection;
(function () {
"use strict";
var _require = _src_utils_class;
var class_create = _require.create;
_src_Entries_EntryCollection = class_create({
constructor: function constructor() {
this.arr = [];
this.ids = {};
this.types = {};
},
add: function add(entry) {
this.arr.push(entry);
},
resolve: function resolve(mix) {
var entry = null;
if (typeof mix === "string") {
entry = this.ids[entry];
}
if (typeof mix === "function") {
entry = this.getForType(mix);
}
if (entry == null) {
throw Error("Entry for Type '" + mix.name + "' not found");
}
return entry.resolve();
},
getByType: function getByType(Type) {
var arr = this.arr,
imax = arr.length,
i = -1;
while (++i < imax) {
var x = arr[i];
if (x.Type === Type) {
return x;
}
}
return null;
},
getFor: function getFor(mix) {
var required = arguments[1] === undefined ? false : arguments[1];
if (typeof mix === "string") {
var entry = this.ids[mix];
if (required === true && entry == null) {
throw Error("Dependency is not registered \"" + mix + "\"");
}
return entry;
}
if (typeof mix === "function") {
var entry = this.getForType(mix);
if (required === true && entry == null) {
throw Error("Dependency is not registered \"" + mix.name + "\"");
}
return entry;
}
throw new Error("Collection::getFor. Unsupported value type: " + typeof mix);
},
getForType: function getForType(Type) {
var name = Type.name,
arr = this.types[name];
if (arr == null) {
return null;
}
var imax = arr.length,
i = -1;
while (++i < imax) {
var x = arr[i];
if (x.Type === Type) {
return x.entry;
}
}
return null;
},
removeForType: function removeForType(Type) {
var arr = this.types,
imax = arr.length,
i = -1;
while (++i < imax) {
var x = arr[i];
if (x.Type === Type) {
arr.splice(i, 1);
return;
}
}
if (isObject(_src_Di) && isObject(module.exports)) {
Object.assign(_src_Di, module.exports);
return;
},
removeFor: function removeFor(mix) {
if (typeof mix === "string") {
this.ids[mix] = null;
return;
}
if (typeof mix === "function") {
var name = mix.name;
var arr = this.types[name];
if (arr == null) {
return;
}
var i = arr.length;
while (--i !== -1) {
if (arr[i].Type === mix) {
arr.splice(i, 1);
}
}
return;
}
},
registerFor: function registerFor(mix, entry) {
if (typeof mix === "string") {
this.ids[mix] = entry;
return;
}
if (typeof mix === "function") {
var name = mix.name;
var arr = this.types[name];
if (arr == null) {
arr = this.types[name] = [];
}
arr.push({
Type: mix,
entry: entry
});
return;
}
throw Error("Collection::registerFor. Unsupported value type: " + typeof mix);
}
_src_Di = module.exports;
}());
// end:source ./ModuleSimplified.js
});
//# sourceMappingURL=EntryCollection.js.map;
}());
// end:source ./templates/ModuleSimplified.js
"use strict";
var Di_1 = _src_Di;
module.exports = Di_1.Di.di;
var ObjectEntry = _src_Entries_ObjectEntry;
var TypeEntry = _src_Entries_TypeEntry;
var FnEntry = _src_Entries_FnEntry;
var MetaReader = _src_Entries_MetaReader;
var EntryCollection = _src_Entries_EntryCollection;
var _require = _src_utils_class;
var class_create = _require.create;
module.exports = class_create({
constructor: function constructor() {
var container = arguments[0] === undefined ? null : arguments[0];
this.childContainer = container;
this.entries = new EntryCollection();
this.metaReader = new MetaReader();
},
registerType: function registerType(Type) {
return this.Type(Type).register();
},
registerFactory: function registerFactory(Fn) {
return this.Function(Fn).register();
},
Type: (function (_Type) {
var _TypeWrapper = function Type(_x) {
return _Type.apply(this, arguments);
};
_TypeWrapper.toString = function () {
return _Type.toString();
};
return _TypeWrapper;
})(function (Type) {
return new TypeEntry(this, Type);
}),
Function: function Function(fn) {
return new FnEntry(this, fn);
},
Object: function Object(object) {
return new ObjectEntry(this, object);
},
resolve: function resolve(mix) {
return this.entries.resolve(mix);
},
wrapType: function wrapType(Type) {
return this.entries.getFor(Type).wrap();
}
});
//# sourceMappingURL=Di.js.map
}));
// end:source ./templates/UMD.js
}));
{
"name": "a-di",
"version": "1.0.1",
"description": "Dependency injection library for Javascript",
"main": "lib/di.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "atma test",
"build": "app-bundler"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tenbits/di.git"
},
"keywords": [
"di",
"dependency",
"injection",
"IoC"
],
"author": "Alex Kit (alex.kit@atmajs.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/tenbits/di/issues"
},
"homepage": "https://github.com/tenbits/di#readme",
"devDependencies": {
"app-bundler": "0.0.7",
"atma": "^0.10.58",
"atma-io": "^0.2.17",
"atma-loader-babel": "^1.0.26",
"maskjs": "^0.57.2"
},
"app-bundler": {
"file": "src/Di.js",
"outputMain": "lib/di.js",
"package": {
"module": "commonjs",
"moduleWrapper": "umd",
"moduleName": "Di",
"commonjs": {
"output": "simplified"
}
"name": "a-di",
"version": "1.0.2",
"description": "Dependency injection library for Javascript/Typescript",
"main": "lib/di.js",
"directories": {
"test": "test"
},
"middlewares": {
"js": [
"importer:read",
"atma-loader-babel:read"
]
}
},
"atma": {
"plugins": [
"atma-loader-babel"
"scripts": {
"test-server": "atma server --TEST",
"test": "atma test",
"build": "app-bundler && npm run build-dts",
"watch": "app-bundler --watch",
"server": "atma server",
"build-dts": "tsc -p tsconfig-build.json && atma run tools/build-dts",
"release": "echo \"Run atma pub -m \"message\"\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/tenbits/di.git"
},
"keywords": [
"di",
"dependency",
"injection",
"IoC"
],
"settings": {
"atma-loader-babel": {
"extensions": [
"es6",
"test"
]
}
"author": "Alex Kit (alex.kit@atmajs.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/tenbits/di/issues"
},
"homepage": "https://github.com/tenbits/di#readme",
"devDependencies": {
"@types/node": "^13.7.1",
"app-bundler": "0.0.82",
"atma": "^0.12.18",
"atma-io": "^1.2.29",
"atma-loader-ts": "^1.1.12",
"maskjs": "^0.57.2"
},
"app-bundler": {
"file": "src/exports.ts",
"outputMain": "lib/di.js",
"package": {
"module": "commonjs",
"moduleName": "di",
"moduleWrapper": "custom",
"moduleWrapperCustomPath": "./src/umd.js",
"commonjs": {
"output": "simplified"
}
},
"extensions": {
"io": {
"type": "js"
}
},
"defaultExtensions": {
"js": "ts"
},
"middlewares": {
"ts": [
"atma-loader-ts:read"
]
}
},
"atma": {
"plugins": [
"atma-loader-ts"
],
"settings": {
"include": {
"amd": true,
"extentionDefault": {
"js": "ts"
}
},
"atma-utest": {
"include": {
"amd": true
}
},
"atma-loader-ts": {
"extensions": [
"test",
"ts"
],
"typescript": {
"compilerOptions": {
"#if (TEST)": {
"module": "AMD"
}
}
}
}
}
}
}
}

@@ -50,2 +50,4 @@ <p align='center'>

> Though you can use it as a **Service Locator**
When registering the component, we specify identifiers, by which the dependency is resolved. It can be some another `Type`, string identifier, `self-type`. _But we do not encourage you to use string identifiers._

@@ -252,4 +254,5 @@

.methods({
// DummyLogger will be replaced with the registration for ILog
logger: [ILog]
// The method on an instance can be the called without any arguments
// Di will provide required dependencies to the inner function
doSmth: [ILog]
})

@@ -358,2 +361,2 @@ .asSelf();

----
:copyright: MIT - 2016 Atma.js Project
:copyright: MIT - 2017 Atma.js Project
module.exports = {
suites: {
'dom': {
exec: 'dom',
env: [ '/lib/di.js::Di' ],
tests: 'test/bundled/**',
},
'node': {
exec: 'node',
env: [ '/lib/di.js::Di' ],
tests: 'test/bundled/**',
},
'modules': {
exec: 'node',
tests: 'test/*.test',
},
'mask': {
exec: 'dom',
env: [
'/node_modules/maskjs/lib/mask.js::mask',
'/lib/di.js::Di'
],
tests: 'test/mask/**',
}
}
suites: {
'dom': {
exec: 'dom',
tests: 'test/browser/**',
$config: {
includejs: {
amd: true,
extentionDefault: {
"js": "ts"
}
}
}
},
'node': {
exec: 'node',
tests: 'test/node/**',
},
'mask': {
exec: 'dom',
tests: 'test/mask/**',
$config: {
includejs: {
amd: true,
extentionDefault: {
"js": "ts"
}
}
}
}
}
};
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