@spinajs/reflection
Advanced tools
Comparing version 1.2.211 to 2.0.12
@@ -166,30 +166,34 @@ "use strict"; | ||
.flatMap((d) => glob.sync(path.join(d, filter))) | ||
.map((f) => { | ||
.flatMap((f) => { | ||
logger.trace(`Loading file ${f}`); | ||
const name = path.parse(f).name; | ||
const nameToResolve = typeMatcher ? typeMatcher(name) : name; | ||
/* eslint-disable */ | ||
const type = require(f)[`${nameToResolve}`]; | ||
if (!type) { | ||
throw new ReflectionException(`cannot find class ${nameToResolve} in file ${f}`); | ||
} | ||
if (resolve) { | ||
if (type.prototype instanceof di_1.AsyncModule) { | ||
promised = true; | ||
return di_1.DI.resolve(type).then((instance) => { | ||
return { | ||
file: f, | ||
instance, | ||
name: nameToResolve, | ||
type, | ||
}; | ||
}); | ||
const fTypes = require(f); | ||
const types = []; | ||
for (const key of Object.keys(fTypes)) { | ||
const nameToResolve = typeMatcher ? typeMatcher(path.parse(f).name, key) : key; | ||
const type = fTypes[`${nameToResolve}`]; | ||
if (resolve) { | ||
if (type.prototype instanceof di_1.AsyncModule) { | ||
promised = true; | ||
return di_1.DI.resolve(type).then((instance) => { | ||
return { | ||
file: f, | ||
instance, | ||
name: nameToResolve, | ||
type, | ||
}; | ||
}); | ||
} | ||
} | ||
types.push({ | ||
file: f, | ||
instance: resolve ? di_1.DI.resolve(type) : null, | ||
name: nameToResolve, | ||
type, | ||
}); | ||
} | ||
return { | ||
file: f, | ||
instance: resolve ? di_1.DI.resolve(type) : null, | ||
name: nameToResolve, | ||
type, | ||
}; | ||
if (types.length === 0) { | ||
throw new ReflectionException(`cannot find any exported class in file ${f}`); | ||
} | ||
return types; | ||
}); | ||
@@ -196,0 +200,0 @@ return promised && resolve ? Promise.all(result) : result; |
{ | ||
"name": "@spinajs/reflection", | ||
"version": "1.2.211", | ||
"version": "2.0.12", | ||
"description": "SpinaJS reflection helpers", | ||
@@ -32,10 +32,14 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@spinajs/configuration": "^1.2.211", | ||
"@spinajs/di": "^1.2.211", | ||
"@spinajs/exceptions": "^1.2.127", | ||
"@spinajs/log": "^1.2.211", | ||
"@spinajs/configuration": "^2.0.12", | ||
"@spinajs/di": "^2.0.12", | ||
"@spinajs/exceptions": "^2.0.12", | ||
"@spinajs/log": "^2.0.12", | ||
"lodash": "^4.17.21", | ||
"typescript": "^4.7.4", | ||
"typescript-mix": "^3.1.3" | ||
}, | ||
"gitHead": "70d07e9437552855ac6c986465929a31ee49f5c3" | ||
"devDependencies": { | ||
"@types/node": "^18.0.4" | ||
}, | ||
"gitHead": "d7910d799995df6fa9eb8174d4a9b65c81db8352" | ||
} |
Sorry, the diff of this file is not supported yet
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
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
16324
266
7
1
+ Addedtypescript@^4.7.4
+ Added@spinajs/configuration@2.0.313(transitive)
+ Added@spinajs/configuration-common@2.0.313(transitive)
+ Added@spinajs/di@2.0.313(transitive)
+ Added@spinajs/exceptions@2.0.313(transitive)
+ Added@spinajs/internal-logger@2.0.313(transitive)
+ Added@spinajs/log@2.0.313(transitive)
+ Added@spinajs/log-common@2.0.313(transitive)
+ Added@spinajs/util@2.0.313(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedchalk@5.2.0(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedtypescript@4.9.5(transitive)
- Removed@spinajs/configuration@1.2.211(transitive)
- Removed@spinajs/configuration-common@1.2.211(transitive)
- Removed@spinajs/di@1.2.211(transitive)
- Removed@spinajs/exceptions@1.2.127(transitive)
- Removed@spinajs/internal-logger@1.2.211(transitive)
- Removed@spinajs/log@1.2.211(transitive)
- Removed@spinajs/log-common@1.2.211(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedglob@7.2.3(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedluxon@2.5.2(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedsupports-color@7.2.0(transitive)
Updated@spinajs/di@^2.0.12
Updated@spinajs/exceptions@^2.0.12
Updated@spinajs/log@^2.0.12