You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When used to sort bower components, the non-reversed order is needed, hence reverse should be an option. Perhaps something like (index.js):
vares=require('event-stream');varngDep=require('ng-dependencies');vartoposort=require('toposort');vargutil=require('gulp-util');varPluginError=gutil.PluginError;varPLUGIN_NAME='gulp-angular-filesort';varANGULAR_MODULE='ng';module.exports=functionangularFilesort(opts){varfiles=[];varangmods={};vartoSort=[];vardbgTitle='angularFilesort: ';varlOpts=opts||{debug: false,reverse: true};returnes.through(functioncollectFilesToSort(file){if(!file.contents){returnthis.emit('error',newPluginError(PLUGIN_NAME,'File: "'+file.relative+'" without content. You have to read it with gulp.src(..)'));}vardeps;try{deps=ngDep(file.contents);}catch(err){returnthis.emit('error',newPluginError(PLUGIN_NAME,'Error in parsing: "'+file.relative+'", '+err.message));}if(lOpts.debug){gutil.log(dbgTitle+file.path+' Modules={'+Object.keys(deps.modules)+'}, dependencies={'+deps.dependencies+'}');}if(deps.modules){// Store references to each file with a declaration:Object.keys(deps.modules).forEach(function(name){angmods[name]=file;});}if(deps.dependencies){// Add each file with dependencies to the array to sort:deps.dependencies.forEach(function(dep){if(isDependecyUsedInAnyDeclaration(dep,deps)){return;}if(dep===ANGULAR_MODULE){return;}toSort.push([file,dep]);});}// Collect all files:files.push(file);},functionafterFileCollection(){// Convert all module names to actual files with declarations:for(vari=0;i<toSort.length;i++){varmoduleName=toSort[i][1];vardeclarationFile=angmods[moduleName];if(declarationFile){toSort[i][1]=declarationFile;}else{// Depending on module outside stream (possibly a 3rd party one),// don't care when sorting:toSort.splice(i--,1);}}// Sort `files` with `toSort` as dependency tree:varsorted=toposort.array(files,toSort);if(lOpts.reverse){sorted=sorted.reverse();}sorted.forEach(function(file){this.emit('data',file);}.bind(this));this.emit('end');});};functionisDependecyUsedInAnyDeclaration(dependency,ngDeps){if(!ngDeps.modules){returnfalse;}if(dependencyinngDeps.modules){returntrue;}returnObject.keys(ngDeps.modules).some(function(module){returnngDeps.modules[module].indexOf(dependency)>-1;});}
Hi,
When used to sort bower components, the non-reversed order is needed, hence reverse should be an option. Perhaps something like (index.js):
and then use
to sort correctly (and prefer jquery)
The text was updated successfully, but these errors were encountered: