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

inversify

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inversify - npm Package Compare versions

Comparing version 0.0.7 to 1.0.0

.coveralls.yml

2

bower.json
{
"name": "inversify",
"version": "0.0.7",
"version": "1.0.0",
"homepage": "https://github.com/inversify/InversifyJS",

@@ -5,0 +5,0 @@ "authors": [

/**
* inversify v.0.0.6 - A lightweight IoC container written in TypeScript.
* inversify v.0.0.7 - A lightweight IoC container written in TypeScript.
* Copyright (c) 2015 Remo H. Jansen

@@ -7,2 +7,2 @@ * MIT inversify.io/LICENSE

*/
!function n(e,t,i){function r(p,u){if(!t[p]){if(!e[p]){var c="function"==typeof require&&require;if(!u&&c)return c(p,!0);if(o)return o(p,!0);var s=new Error("Cannot find module '"+p+"'");throw s.code="MODULE_NOT_FOUND",s}var f=t[p]={exports:{}};e[p][0].call(f.exports,function(n){var t=e[p][1][n];return r(t?t:n)},f,f.exports,n,e,t,i)}return t[p].exports}for(var o="function"==typeof require&&require,p=0;p<i.length;p++)r(i[p]);return r}({1:[function(n,e,t){var i=n("./kernel"),r=n("./type_binding"),o=n("./type_binding_scope"),p={Kernel:i,TypeBindingScopeEnum:o,TypeBinding:r};e.exports=p},{"./kernel":2,"./type_binding":3,"./type_binding_scope":4}],2:[function(n,e,t){var i=(n("./type_binding_scope"),function(){function n(){this._bindings=new Object}return n.prototype.bind=function(n){this._validateBinding(n)===!0&&(this._bindings[n.runtimeIdentifier]=n)},n.prototype.unbind=function(n){var e=this._bindings[n];if("undefined"==typeof e)throw new Error("Could not resolve service "+n);delete this._bindings[n]},n.prototype.unbindAll=function(){this._bindings=new Object},n.prototype.resolve=function(n){var e=this._bindings[n];if("undefined"==typeof e)throw new Error("Could not resolve service "+n);if(1===e.scope&&null!==e.cache)return e.cache;var t=this._injectDependencies(e.implementationType);return e.cache=t,t},n.prototype._validateBinding=function(n){var e=!0;if("string"!=typeof n.runtimeIdentifier){var t="Expected type of "+n.runtimeIdentifier+" to be string";console.log(t),e=!1}if("undefined"!=typeof this._bindings[n.runtimeIdentifier]){var t="Dublicated binding runtime identifier "+n.runtimeIdentifier;console.log(t),e=!1}if("function"!=typeof n.implementationType){var t="Expected "+n.implementationType+" to be a constructor";console.log(t),e=!1}return e},n.prototype._getConstructorArguments=function(n){var e,t,i,r,o,p;return o=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,p=/([^\s,]+)/g,e=n.toString().replace(o,""),t=e.indexOf("(")+1,i=e.indexOf(")"),r=e.slice(t,i).match(p),null===r&&(r=[]),r},n.prototype._injectDependencies=function(n){var e=this._getConstructorArguments(n);if(0===e.length)return new n;for(var t=[],i=null,r=0;r<e.length;r++){var o=e[r];i=this.resolve(o),t.push(i)}return this._construct(n,t)},n.prototype._construct=function(n,e){function t(){n.apply(this,e)}return t.prototype=n.prototype,new t},n}());e.exports=i},{"./type_binding_scope":4}],3:[function(n,e,t){var i=n("./type_binding_scope"),r=function(){function n(n,e,t){if(this.runtimeIdentifier=n,this.implementationType=e,this.cache=null,"undefined"==typeof t)this.scope=0;else{if(!i[t]){var r="Invalid scope type "+t;throw new Error(r)}this.scope=t}}return n}();e.exports=r},{"./type_binding_scope":4}],4:[function(n,e,t){var i;!function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton"}(i||(i={})),e.exports=i},{}]},{},[1]);
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.inversify=e()}}(function(){return function e(n,t,i){function r(f,p){if(!t[f]){if(!n[f]){var u="function"==typeof require&&require;if(!p&&u)return u(f,!0);if(o)return o(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var c=t[f]={exports:{}};n[f][0].call(c.exports,function(e){var t=n[f][1][e];return r(t?t:e)},c,c.exports,e,n,t,i)}return t[f].exports}for(var o="function"==typeof require&&require,f=0;f<i.length;f++)r(i[f]);return r}({1:[function(e,n,t){var i=e("./kernel"),r=e("./type_binding"),o=e("./type_binding_scope"),f={Kernel:i,TypeBindingScopeEnum:o,TypeBinding:r};n.exports=f},{"./kernel":2,"./type_binding":3,"./type_binding_scope":4}],2:[function(e,n,t){var i=(e("./type_binding_scope"),function(){function e(){this._bindings=new Object}return e.prototype.bind=function(e){this._validateBinding(e)===!0&&(this._bindings[e.runtimeIdentifier]=e)},e.prototype.unbind=function(e){var n=this._bindings[e];if("undefined"==typeof n)throw new Error("Could not resolve service "+e);delete this._bindings[e]},e.prototype.unbindAll=function(){this._bindings=new Object},e.prototype.resolve=function(e){var n=this._bindings[e];if("undefined"==typeof n)throw new Error("Could not resolve service "+e);if(1===n.scope&&null!==n.cache)return n.cache;var t=this._injectDependencies(n.implementationType);return n.cache=t,t},e.prototype._validateBinding=function(e){var n=!0;if("string"!=typeof e.runtimeIdentifier){var t="Expected type of "+e.runtimeIdentifier+" to be string";console.log(t),n=!1}if("undefined"!=typeof this._bindings[e.runtimeIdentifier]){var t="Dublicated binding runtime identifier "+e.runtimeIdentifier;console.log(t),n=!1}if("function"!=typeof e.implementationType){var t="Expected "+e.implementationType+" to be a constructor";console.log(t),n=!1}return n},e.prototype._getConstructorArguments=function(e){var n,t,i,r,o,f;return o=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,f=/([^\s,]+)/g,n=e.toString().replace(o,""),t=n.indexOf("(")+1,i=n.indexOf(")"),r=n.slice(t,i).match(f),null===r&&(r=[]),r},e.prototype._injectDependencies=function(e){var n=this._getConstructorArguments(e);if(0===n.length)return new e;for(var t=[],i=null,r=0;r<n.length;r++){var o=n[r];i=this.resolve(o),t.push(i)}return this._construct(e,t)},e.prototype._construct=function(e,n){function t(){e.apply(this,n)}return t.prototype=e.prototype,new t},e}());n.exports=i},{"./type_binding_scope":4}],3:[function(e,n,t){var i=e("./type_binding_scope"),r=function(){function e(e,n,t){if(this.runtimeIdentifier=e,this.implementationType=n,this.cache=null,"undefined"==typeof t)this.scope=0;else{if(!i[t]){var r="Invalid scope type "+t;throw new Error(r)}this.scope=t}}return e}();n.exports=r},{"./type_binding_scope":4}],4:[function(e,n,t){var i;!function(e){e[e.Transient=0]="Transient",e[e.Singleton=1]="Singleton"}(i||(i={})),n.exports=i},{}]},{},[1])(1)});

@@ -6,15 +6,16 @@ "use strict";

//******************************************************************************
var gulp = require('gulp'),
fs = require("fs"),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
tslint = require('gulp-tslint'),
tsc = require('gulp-typescript'),
karma = require('gulp-karma'),
uglify = require('gulp-uglify'),
var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
run = require("gulp-run"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
karma = require("karma").server,
coveralls = require('gulp-coveralls'),
uglify = require("gulp-uglify"),
docco = require("gulp-docco"),
runSequence = require('run-sequence'),
pkg = require('./package.json'),
header = require('gulp-header');
runSequence = require("run-sequence"),
header = require("gulp-header"),
pkg = require(__dirname + "/package.json");

@@ -24,6 +25,9 @@ //******************************************************************************

//******************************************************************************
gulp.task('lint', function() {
return gulp.src(['./source/**/**.ts', './test/**/**.test.ts'])
gulp.task("lint", function() {
return gulp.src([
__dirname + "/source/**/**.ts",
__dirname + "/test/**/**.test.ts"
])
.pipe(tslint())
.pipe(tslint.report('verbose'));
.pipe(tslint.report("verbose"));
});

@@ -37,21 +41,21 @@

noImplicitAny : false,
target : 'ES3',
module : 'commonjs',
target : "ES3",
module : "commonjs",
declarationFiles : false
});
gulp.task('build-source', function() {
return gulp.src('./source/**/**.ts')
gulp.task("build-source", function() {
return gulp.src(__dirname + "/source/**/**.ts")
.pipe(tsc(tsProject))
.js.pipe(gulp.dest('./build/source/'));
.js.pipe(gulp.dest(__dirname + "/build/source/"));
});
gulp.task('build-test', function() {
return gulp.src('./test/*.test.ts')
gulp.task("build-test", function() {
return gulp.src(__dirname + "/test/*.test.ts")
.pipe(tsc(tsProject))
.js.pipe(gulp.dest('./build/test/'));
.js.pipe(gulp.dest(__dirname + "/build/test/"));
});
gulp.task('build', function(cb) {
runSequence('lint', 'build-source', 'build-test', cb);
gulp.task("build", function(cb) {
runSequence("lint", "build-source", "build-test", cb);
});

@@ -62,6 +66,6 @@

//******************************************************************************
gulp.task('document', function () {
return gulp.src("./build/source/*.js")
gulp.task("document", function () {
return gulp.src(__dirname + "/build/source/*.js")
.pipe(docco())
.pipe(gulp.dest('./documentation'));
.pipe(gulp.dest(__dirname + "/documentation"));
});

@@ -72,5 +76,6 @@

//******************************************************************************
gulp.task('bundle-source', function () {
gulp.task("bundle-source", function () {
var b = browserify({
entries: './build/source/inversify.js',
standalone : 'inversify',
entries: __dirname + "/build/source/inversify.js",
debug: true

@@ -80,34 +85,21 @@ });

return b.bundle()
.pipe(source('inversify.js'))
.pipe(source("inversify.js"))
.pipe(buffer())
.pipe(gulp.dest('./bundled/source/'));
.pipe(gulp.dest(__dirname + "/bundled/source/"));
});
gulp.task('bundle-test', function (cb) {
gulp.task("bundle-test", function () {
var b = browserify({
entries: __dirname + "/build/test/inversify.test.js",
debug: true
});
var path = "./build/test/"
fs.readdir(path, function (err, files) {
if (err) {
throw err;
}
files.forEach(function (file) {
if(file.indexOf(".test.js") != -1) {
var b = browserify({
entries: path + file,
debug: true
});
return b.bundle()
.pipe(source(file))
.pipe(buffer())
.pipe(gulp.dest('./bundled/test/'));
}
});
cb();
});
return b.bundle()
.pipe(source("inversify.test.js"))
.pipe(buffer())
.pipe(gulp.dest(__dirname + "/bundled/test/"));
});
gulp.task('bundle', function(cb) {
runSequence('build', 'bundle-source', 'bundle-test', cb);
gulp.task("bundle", function(cb) {
runSequence("build", "bundle-source", "bundle-test", "document", cb);
});

@@ -118,18 +110,16 @@

//******************************************************************************
//var server = karma.server;
gulp.task("karma", function(cb) {
karma.start({
configFile : __dirname + "/karma.conf.js",
singleRun: true
}, cb);
});
gulp.task('karma', function(cb) {
gulp.src('./bundled/test/*.test.js')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('end', cb)
.on('error', function(err) {
throw err;
});
gulp.task("cover", function() {
return gulp.src(__dirname + '/coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('test', function(cb) {
runSequence('bundle', 'karma', cb);
gulp.task("test", function(cb) {
runSequence("bundle", "karma", "cover", cb);
});

@@ -140,27 +130,27 @@

//******************************************************************************
gulp.task('compress', function() {
return gulp.src('./bundled/source/inversify.js')
gulp.task("compress", function() {
return gulp.src(__dirname + "/bundled/source/inversify.js")
.pipe(uglify({ preserveComments : false }))
.pipe(gulp.dest('./dist/'))
.pipe(gulp.dest(__dirname + "/dist/"))
});
gulp.task('header', function() {
gulp.task("header", function() {
var pkg = require('./package.json');
var pkg = require(__dirname + "/package.json");
var banner = ['/**',
' * <%= pkg.name %> v.<%= pkg.version %> - <%= pkg.description %>',
' * Copyright (c) 2015 <%= pkg.author %>',
' * <%= pkg.license %> inversify.io/LICENSE',
' * <%= pkg.homepage %>',
' */',
''].join('\n');
var banner = ["/**",
" * <%= pkg.name %> v.<%= pkg.version %> - <%= pkg.description %>",
" * Copyright (c) 2015 <%= pkg.author %>",
" * <%= pkg.license %> inversify.io/LICENSE",
" * <%= pkg.homepage %>",
" */",
""].join("\n");
return gulp.src('./dist/inversify.js')
return gulp.src(__dirname + "/dist/inversify.js")
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('./dist/'));
.pipe(gulp.dest(__dirname + "/dist/"));
});
gulp.task('bake', function(cb) {
runSequence('bundle', 'compress', 'header', cb);
gulp.task("bake", function(cb) {
runSequence("bundle", "compress", "header", cb);
});

@@ -171,14 +161,15 @@

//******************************************************************************
gulp.task('default', function (cb) {
gulp.task("default", function (cb) {
runSequence(
'lint',
'build-source',
'build-test',
'document',
'bundle-source',
'bundle-test',
'karma',
'compress',
'header',
"lint",
"build-source",
"build-test",
"bundle-source",
"bundle-test",
"document",
"karma",
"cover",
"compress",
"header",
cb);
});
module.exports = function (config) {
'use strict';
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
browsers: ['PhantomJS'],
reporters: ['progress', 'coverage'],
plugins : [
'karma-coverage',
'karma-mocha',
'karma-chai',
'karma-sinon',
'karma-phantomjs-launcher'
],
preprocessors: {
'./bundled/test/*.test.js' : ['coverage']
},
port: 9876,
colors: true,
autoWatch: false,
singleRun: false,
logLevel: config.LOG_INFO
});
'use strict';
var testFiles = __dirname + '/bundled/test/**/*.test.js',
coverageFolder = __dirname + '/coverage/';
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
browsers: ['PhantomJS'],
reporters: ['progress', 'coverage'],
coverageReporter: {
type : 'lcov',
dir : coverageFolder,
},
plugins : [
'karma-coverage',
'karma-mocha',
'karma-chai',
'karma-sinon',
'karma-phantomjs-launcher'
],
preprocessors: {
'**/bundled/test/**/*.test.js' : 'coverage'
},
files : [
testFiles
],
port: 9876,
colors: true,
autoWatch: false,
logLevel: config.LOG_INFO
});
};
{
"name": "inversify",
"version": "0.0.7",
"version": "1.0.0",
"description": "A lightweight IoC container written in TypeScript.",

@@ -10,3 +10,3 @@ "main": "dist/inversify.js",

"scripts": {
"test": "gulp test"
"test": "gulp"
},

@@ -39,5 +39,6 @@ "repository": {

"gulp": "^3.8.11",
"gulp-coveralls": "^0.1.3",
"gulp-docco": "0.0.4",
"gulp-header": "^1.2.2",
"gulp-karma": "0.0.4",
"gulp-run": "^1.6.7",
"gulp-tslint": "^2.0.0",

@@ -44,0 +45,0 @@ "gulp-typescript": "^2.6.0",

# InversifyJS
[![Join the chat at https://gitter.im/inversify/InversifyJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/inversify/InversifyJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://secure.travis-ci.org/inversify/InversifyJS.png?branch=master)](https://travis-ci.org/inversify/InversifyJS)
[![Coverage Status](https://coveralls.io/repos/inversify/InversifyJS/badge.svg?branch=master)](https://coveralls.io/r/inversify/InversifyJS?branch=master)
[![npm version](https://badge.fury.io/js/inversify.svg)](http://badge.fury.io/js/inversify)
[![Dependencies](https://david-dm.org/inversify/InversifyJS.png)](https://david-dm.org/inversify/InversifyJS#info=dependencies)
[![img](https://david-dm.org/inversify/InversifyJS/dev-status.png)](https://david-dm.org/inversify/InversifyJS/#info=devDependencies)
[![img](https://david-dm.org/inversify/InversifyJS/peer-status.png)](https://david-dm.org/inversify/InversifyJS/#info=peerDependenciess)
A lightweight IoC container written in TypeScript.

@@ -3,0 +11,0 @@ Visit http://inversify.io/ for more information.

@@ -14,14 +14,12 @@ ///<reference path="./interfaces.d.ts" />

// The runtime identifier used because at runtime
// we don't have interfaces
// The runtime identifier used because at runtime we don't have interfaces
public runtimeIdentifier : string;
// Constructor of an implemtation of TServiceType
// The constructor of a class which must implement TServiceType
public implementationType : { new(): TServiceType ;};
// Once a service has been resolved we will cache
// the result to boost performance
// Cache used to allow singleton scope
public cache : TServiceType;
// The scope of the type.
// The scope mode to be used
public scope : TypeBindingScopeEnum;

@@ -31,3 +29,3 @@

runtimeIdentifier : string,
implementationType : { new(): TServiceType ;},
implementationType : { new(...args : any[]): TServiceType ;},
scopeType? : TypeBindingScopeEnum) {

@@ -39,3 +37,3 @@

if(typeof scopeType === "undefined") {
// Default scope is Transient
// The default scope (Transient)
this.scope = TypeBindingScopeEnum.Transient;

@@ -42,0 +40,0 @@ }

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