Skip to content

Commit

Permalink
sort ids in Stats numerical
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 10, 2018
1 parent 9f0056b commit 692faf2
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 55 deletions.
14 changes: 10 additions & 4 deletions lib/Stats.js
Expand Up @@ -15,6 +15,12 @@ const optionsOrFallback = (...args) => {
return optionValues.find(optionValue => typeof optionValue !== "undefined");
};

const compareId = (a, b) => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
};

class Stats {
constructor(compilation) {
this.compilation = compilation;
Expand Down Expand Up @@ -543,7 +549,7 @@ class Stats {
}
return obj;
})
.sort((a, b) => a.moduleId - b.moduleId);
.sort(compareId);
}
if (showUsedExports) {
if (module.used === true) {
Expand Down Expand Up @@ -614,9 +620,9 @@ class Stats {
names: chunk.name ? [chunk.name] : [],
files: chunk.files.slice(),
hash: chunk.renderedHash,
siblings: Array.from(siblings).sort(),
parents: Array.from(parents).sort(),
children: Array.from(children).sort(),
siblings: Array.from(siblings).sort(compareId),
parents: Array.from(parents).sort(compareId),
children: Array.from(children).sort(compareId),
childrenByOrder: childIdByOrder
};
if (showChunkModules) {
Expand Down

0 comments on commit 692faf2

Please sign in to comment.