Comparing version 0.5.8 to 0.5.9
@@ -1,2 +0,3 @@ | ||
declare module pang { | ||
/// <reference path="../src/references/node.d.ts" /> | ||
declare module pang { | ||
class Dependency { | ||
@@ -13,4 +14,7 @@ public domain: Domain; | ||
class Domain { | ||
private fs; | ||
private path; | ||
private dependencies; | ||
constructor(); | ||
public config(name: string, filename: string): Domain; | ||
public factory(name: string, initializer: (...args: any[]) => any): Domain; | ||
@@ -26,2 +30,1 @@ public singleton(name: string): any; | ||
} | ||
declare var module: any; |
21
index.js
@@ -21,2 +21,3 @@ /*-------------------------------------------------------------------------- | ||
---------------------------------------------------------------------------*/ | ||
/// <reference path="references/node.d.ts" /> | ||
var pang; | ||
@@ -59,5 +60,21 @@ (function (pang) { | ||
function Domain() { | ||
this.fs = require('fs'); | ||
this.path = require('path'); | ||
this.dependencies = []; | ||
} | ||
//---------------------------------------------- | ||
// create config dependency | ||
//---------------------------------------------- | ||
Domain.prototype.config = function (name, filename) { | ||
var _this = this; | ||
this.dependencies.push(new Dependency(this, name, [], function () { | ||
var directory = _this.path.dirname(filename); | ||
return JSON.parse(_this.fs.readFileSync(filename, 'utf8').replace(new RegExp('~', 'g'), directory).replace(new RegExp('/\\/', 'g'), '/')); | ||
}, false, null)); | ||
return this; | ||
}; | ||
//---------------------------------------------- | ||
// create a new dependency | ||
@@ -181,3 +198,5 @@ //---------------------------------------------- | ||
//----------------------------- | ||
// export | ||
//----------------------------- | ||
module.exports = pang; |
{ | ||
"name": "pang", | ||
"version": "0.5.8", | ||
"version": "0.5.9", | ||
"description": "A simple dependency injection library for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11172
191
1