refactor(broccoli-check-imports): allow imports from self by default
Closes #5573
This commit is contained in:
parent
7a1fbf1c3a
commit
688469c221
@ -13,13 +13,10 @@ class CheckImports implements DiffingBroccoliPlugin {
|
|||||||
static IMPORT_PATH_REGEXP = new RegExp(`['"]([^'"]+)+['"]`, "m");
|
static IMPORT_PATH_REGEXP = new RegExp(`['"]([^'"]+)+['"]`, "m");
|
||||||
|
|
||||||
static ALLOWED_IMPORTS = {
|
static ALLOWED_IMPORTS = {
|
||||||
"angular2/src/core": [
|
"angular2/src/core": ["angular2/src/facade"],
|
||||||
"angular2/src/core",
|
"angular2/src/facade": ["rxjs"],
|
||||||
"angular2/src/facade",
|
"angular2/src/common": ["angular2/core", "angular2/src/facade"],
|
||||||
],
|
"angular2/src/http": ["angular2/core", "angular2/src/facade", "rxjs"]
|
||||||
"angular2/src/facade": ["angular2/src/facade", "rxjs"],
|
|
||||||
"angular2/src/common": ["angular2/core", "angular2/src/facade", "angular2/src/common"],
|
|
||||||
"angular2/src/http": ["angular2/core", "angular2/src/facade", "angular2/src/http", "rxjs"]
|
|
||||||
//"angular2/src/render": [
|
//"angular2/src/render": [
|
||||||
// "angular2/animate",
|
// "angular2/animate",
|
||||||
// "angular2/core",
|
// "angular2/core",
|
||||||
@ -80,7 +77,8 @@ class CheckImports implements DiffingBroccoliPlugin {
|
|||||||
for (var prop in c) {
|
for (var prop in c) {
|
||||||
if (c.hasOwnProperty(prop) && startsWith(sourceFile, prop)) {
|
if (c.hasOwnProperty(prop) && startsWith(sourceFile, prop)) {
|
||||||
const allowedPaths = c[prop];
|
const allowedPaths = c[prop];
|
||||||
return allowedPaths.filter(p => startsWith(importPath, p)).length > 0;
|
return startsWith(importPath, prop) ||
|
||||||
|
allowedPaths.filter(p => startsWith(importPath, p)).length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user