gulp-angular-esmodules-filesort
Advanced tools
Comparing version 1.2.2 to 1.2.3
30
index.js
@@ -68,17 +68,10 @@ 'use strict'; | ||
if(file.babel && file.babel.modules.imports.length > 0){ | ||
var importedPaths = _.uniq(file.babel.modules.imports | ||
var importPaths = file.babel.modules.imports | ||
.map(function (anImport) { | ||
return path.join(path.dirname(file.path), anImport.source + options.defaultExtension); | ||
})); | ||
}); | ||
importedPaths | ||
.map(function(importedPath){ | ||
return files.find(function(file){ | ||
return file.path === importedPath; | ||
}); | ||
}) | ||
.forEach(function(importedFile){ | ||
if(importedFile){ | ||
esModuleToSort.push([file, importedFile]); | ||
} | ||
_.uniq(importPaths) | ||
.forEach(function(importPath){ | ||
esModuleToSort.push([file, importPath]); | ||
}); | ||
@@ -106,2 +99,15 @@ } | ||
} | ||
// Convert all module names to actual files with declarations: | ||
esModuleToSort = esModuleToSort.map(function (sortItem) { | ||
var importedFile = files.find(function(file){ | ||
return file.path === sortItem[1]; | ||
}); | ||
if (importedFile) { | ||
return [sortItem[0], importedFile]; | ||
} else { | ||
// importing a module outside stream (possibly a 3rd party one), | ||
// don't care when sorting: | ||
return undefined; | ||
} | ||
}).filter(_.identity); | ||
@@ -108,0 +114,0 @@ // Sort files alphabetically first to prevent random reordering. |
{ | ||
"name": "gulp-angular-esmodules-filesort", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Automatically sort AngularJS app files depending on module definitions and usage and also ES6 import/exports", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
42353
124