@raptorjs/di
Advanced tools
Comparing version
@@ -0,3 +1,4 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
class Register { | ||
@@ -71,3 +72,3 @@ | ||
Events.register(event) | ||
}) | ||
@@ -81,2 +82,35 @@ } else { | ||
}) | ||
AnnotationFramework | ||
.build('Import', true) | ||
.on('file', function (meta, reader, file, data) { | ||
if (meta.definition) { | ||
if (Array.isArray(meta.definition.value)) { | ||
meta.definition.value.forEach((item) => { | ||
let filePath = path.join(path.dirname(file), item); | ||
if (filePath.substr(-1) == '*') { | ||
let subDir = filePath.substr(0, filePath.length - 1); | ||
fs.readdirSync(subDir) | ||
.filter((file) => { | ||
return (path.extname(file) == '.js') | ||
}) | ||
.forEach((file) => { | ||
try { | ||
require(path.join(subDir, file)); | ||
} catch (error) { | ||
console.log('Di @Import error: ', error.message) | ||
} | ||
}) | ||
} else { | ||
try { | ||
require(filePath); | ||
} catch (error) { | ||
console.log('Di @Import error: ', error.message) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
return this; | ||
@@ -83,0 +117,0 @@ } |
{ | ||
"state": true, | ||
"name": "di", | ||
"version": "1.0.1" | ||
"version": "1.0.2" | ||
} |
{ | ||
"name": "@raptorjs/di", | ||
"version": "1.0.1", | ||
"_from": "@raptorjs/di@^1.0.1", | ||
"_id": "@raptorjs/di@1.0.1", | ||
"_inBundle": false, | ||
"_integrity": "sha512-1vpLrnz7SaofQvHm7wdY45oEZ0kPS72zjNsLJz9lN6Bh30X2ISYnMOnQSIweP+7Tejq5Gcx+/hY8PS2NWdVG8w==", | ||
"_location": "/@raptorjs/di", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"type": "range", | ||
"registry": true, | ||
"raw": "@raptorjs/di@^1.0.1", | ||
"name": "@raptorjs/di", | ||
"escapedName": "@raptorjs%2fdi", | ||
"scope": "@raptorjs", | ||
"rawSpec": "^1.0.1", | ||
"saveSpec": null, | ||
"fetchSpec": "^1.0.1" | ||
}, | ||
"_requiredBy": [ | ||
"/" | ||
], | ||
"_resolved": "https://registry.npmjs.org/@raptorjs/di/-/di-1.0.1.tgz", | ||
"_shasum": "012c11baa75ee9f44223d23116dd4c567894d97a", | ||
"_spec": "@raptorjs/di@^1.0.1", | ||
"_where": "E:\\Raptor Node\\Proyectos\\serie 2\\app-3", | ||
"author": { | ||
"name": "William Amed - watamayo90@gmail.com" | ||
}, | ||
"bundleDependencies": false, | ||
"deprecated": false, | ||
"description": "", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"name": "@raptorjs/di", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": { | ||
"name": "William Amed - watamayo90@gmail.com" | ||
}, | ||
"license": "MIT" | ||
} | ||
"version": "1.0.2" | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
8243
42.86%191
20.89%4
300%