@wessberg/di-compiler
Advanced tools
Comparing version 1.0.46 to 1.0.47
@@ -0,1 +1,10 @@ | ||
<a name="1.0.47"></a> | ||
## 1.0.47 (2017-08-28) | ||
* 1.0.47 ([f270ef3](https://github.com/wessberg/di-compiler/commit/f270ef3)) | ||
* Bumped deps. Performance improvements ([9ae775c](https://github.com/wessberg/di-compiler/commit/9ae775c)) | ||
* Bumped version ([1871097](https://github.com/wessberg/di-compiler/commit/1871097)) | ||
<a name="1.0.46"></a> | ||
@@ -2,0 +11,0 @@ ## 1.0.46 (2017-08-28) |
@@ -58,8 +58,2 @@ import { ICompiler, ICompilerResult } from "./Interface/ICompiler"; | ||
/** | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
private isExcluded(filepath); | ||
/** | ||
* The consumable method that upgrades the code as per the class description. | ||
@@ -72,6 +66,7 @@ * @param {string} filepath | ||
/** | ||
* Resolves all dependencies for the provided filepath | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
private resolveDependencies(filepath); | ||
private isExcluded(filepath); | ||
/** | ||
@@ -78,0 +73,0 @@ * Returns a new class indexer will all classes that doesn't have a @noInject decorator. |
@@ -51,10 +51,2 @@ import { PathValidator } from "@wessberg/compiler-common"; | ||
/** | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
isExcluded(filepath) { | ||
return this.pathValidator.isBlacklisted(filepath) || [...this.excludedFiles].some(regex => regex.test(filepath)); | ||
} | ||
/** | ||
* The consumable method that upgrades the code as per the class description. | ||
@@ -69,3 +61,5 @@ * @param {string} filepath | ||
const { host } = this; | ||
this.resolveDependencies(filepath); | ||
// Add the path (and the class declarations it contains) to the compiler | ||
Compiler.resolvedPaths.add(filepath); | ||
Compiler.classes.push(...this.filterOutNoInjectClasses(this.host.getClassesForFile(filepath))); | ||
// Finds all references to the DIContainer instance. | ||
@@ -80,18 +74,8 @@ const identifiers = new Set([diConfig.exportName]); | ||
/** | ||
* Resolves all dependencies for the provided filepath | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
resolveDependencies(filepath) { | ||
Compiler.resolvedPaths.add(filepath); | ||
const imports = this.host.getImportedFilesForFile(filepath); | ||
// Dedupe and add with existing filepath. | ||
const paths = new Set([filepath, ...imports].filter(path => !this.isExcluded(path))); | ||
// Tracks class declarations so we can extract their constructor arguments and decide if we should dependency inject them. | ||
paths.forEach(path => { | ||
const classes = this.filterOutNoInjectClasses(this.host.getClassesForFile(path)); | ||
Compiler.classes.push(...classes); | ||
// Recurse all through the tree of dependencies. | ||
if (!Compiler.resolvedPaths.has(path)) | ||
this.resolveDependencies(path); | ||
}); | ||
isExcluded(filepath) { | ||
return this.pathValidator.isBlacklisted(filepath) || [...this.excludedFiles].some(regex => regex.test(filepath)); | ||
} | ||
@@ -98,0 +82,0 @@ /** |
@@ -58,8 +58,2 @@ import { ICompiler, ICompilerResult } from "./Interface/ICompiler"; | ||
/** | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
private isExcluded(filepath); | ||
/** | ||
* The consumable method that upgrades the code as per the class description. | ||
@@ -72,6 +66,7 @@ * @param {string} filepath | ||
/** | ||
* Resolves all dependencies for the provided filepath | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
private resolveDependencies(filepath); | ||
private isExcluded(filepath); | ||
/** | ||
@@ -78,0 +73,0 @@ * Returns a new class indexer will all classes that doesn't have a @noInject decorator. |
@@ -62,10 +62,2 @@ (function (factory) { | ||
/** | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
isExcluded(filepath) { | ||
return this.pathValidator.isBlacklisted(filepath) || [...this.excludedFiles].some(regex => regex.test(filepath)); | ||
} | ||
/** | ||
* The consumable method that upgrades the code as per the class description. | ||
@@ -80,3 +72,5 @@ * @param {string} filepath | ||
const { host } = this; | ||
this.resolveDependencies(filepath); | ||
// Add the path (and the class declarations it contains) to the compiler | ||
Compiler.resolvedPaths.add(filepath); | ||
Compiler.classes.push(...this.filterOutNoInjectClasses(this.host.getClassesForFile(filepath))); | ||
// Finds all references to the DIContainer instance. | ||
@@ -91,18 +85,8 @@ const identifiers = new Set([DIConfig_1.diConfig.exportName]); | ||
/** | ||
* Resolves all dependencies for the provided filepath | ||
* Returns true if the given filepath should be excluded | ||
* @param {string} filepath | ||
* @returns {boolean} | ||
*/ | ||
resolveDependencies(filepath) { | ||
Compiler.resolvedPaths.add(filepath); | ||
const imports = this.host.getImportedFilesForFile(filepath); | ||
// Dedupe and add with existing filepath. | ||
const paths = new Set([filepath, ...imports].filter(path => !this.isExcluded(path))); | ||
// Tracks class declarations so we can extract their constructor arguments and decide if we should dependency inject them. | ||
paths.forEach(path => { | ||
const classes = this.filterOutNoInjectClasses(this.host.getClassesForFile(path)); | ||
Compiler.classes.push(...classes); | ||
// Recurse all through the tree of dependencies. | ||
if (!Compiler.resolvedPaths.has(path)) | ||
this.resolveDependencies(path); | ||
}); | ||
isExcluded(filepath) { | ||
return this.pathValidator.isBlacklisted(filepath) || [...this.excludedFiles].some(regex => regex.test(filepath)); | ||
} | ||
@@ -109,0 +93,0 @@ /** |
{ | ||
"name": "@wessberg/di-compiler", | ||
"version": "1.0.46", | ||
"version": "1.0.47", | ||
"description": "The compiler for https://www.npmjs.com/package/@wessberg/di", | ||
@@ -56,6 +56,6 @@ "scripts": { | ||
"dependencies": { | ||
"@wessberg/codeanalyzer": "^1.0.57", | ||
"@wessberg/codeanalyzer": "^1.0.61", | ||
"@wessberg/compiler-common": "^1.0.0", | ||
"@wessberg/globalobject": "^1.0.7", | ||
"@wessberg/type": "^0.0.80", | ||
"@wessberg/type": "^0.0.81", | ||
"@wessberg/typedetector": "^1.0.6", | ||
@@ -62,0 +62,0 @@ "magic-string": "^0.22.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
114247
1465
+ Added@wessberg/type@0.0.81(transitive)
- Removed@wessberg/type@0.0.80(transitive)
Updated@wessberg/type@^0.0.81