mirror of https://github.com/webpack/webpack.git
fix byId sorting
This commit is contained in:
parent
c04747f17d
commit
5e4a6a4f5d
|
|
@ -108,10 +108,11 @@ const compareLocations = require("./compareLocations");
|
||||||
* @returns {-1|0|1} sort value
|
* @returns {-1|0|1} sort value
|
||||||
*/
|
*/
|
||||||
const byId = (a, b) => {
|
const byId = (a, b) => {
|
||||||
if (a.id !== null && b.id !== null) {
|
if (typeof a.id !== typeof b.id) {
|
||||||
if (a.id < b.id) return -1;
|
return typeof a.id < typeof b.id ? -1 : 1;
|
||||||
if (a.id > b.id) return 1;
|
|
||||||
}
|
}
|
||||||
|
if (a.id < b.id) return -1;
|
||||||
|
if (a.id > b.id) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -121,6 +122,9 @@ const byId = (a, b) => {
|
||||||
* @returns {-1|0|1} sort value
|
* @returns {-1|0|1} sort value
|
||||||
*/
|
*/
|
||||||
const byIdOrIdentifier = (a, b) => {
|
const byIdOrIdentifier = (a, b) => {
|
||||||
|
if (typeof a.id !== typeof b.id) {
|
||||||
|
return typeof a.id < typeof b.id ? -1 : 1;
|
||||||
|
}
|
||||||
if (a.id < b.id) return -1;
|
if (a.id < b.id) return -1;
|
||||||
if (a.id > b.id) return 1;
|
if (a.id > b.id) return 1;
|
||||||
const identA = a.identifier();
|
const identA = a.identifier();
|
||||||
|
|
|
||||||
|
|
@ -539,6 +539,15 @@ Built at: Thu Jan 01 1970 00:00:00 GMT
|
||||||
2.bundle.js 433 bytes 2 [emitted]
|
2.bundle.js 433 bytes 2 [emitted]
|
||||||
bundle.js 8.67 KiB main [emitted] main
|
bundle.js 8.67 KiB main [emitted] main
|
||||||
Entrypoint main = bundle.js
|
Entrypoint main = bundle.js
|
||||||
|
chunk {main} bundle.js (main) 73 bytes >{1}< >{2}< [entry] [rendered]
|
||||||
|
> ./index main
|
||||||
|
[./a.js] 22 bytes {main} [built]
|
||||||
|
cjs require ./a [./e.js] 1:0-14
|
||||||
|
cjs require ./a [./index.js] 1:0-14
|
||||||
|
[./index.js] Xms -> factory:Xms building:Xms = Xms
|
||||||
|
[./index.js] 51 bytes {main} [built]
|
||||||
|
single entry ./index main
|
||||||
|
factory:Xms building:Xms = Xms
|
||||||
chunk {0} 0.bundle.js 60 bytes <{2}> [rendered]
|
chunk {0} 0.bundle.js 60 bytes <{2}> [rendered]
|
||||||
> [./c.js] ./c.js 1:0-52
|
> [./c.js] ./c.js 1:0-52
|
||||||
[./d.js] 22 bytes {0} [built]
|
[./d.js] 22 bytes {0} [built]
|
||||||
|
|
@ -556,16 +565,7 @@ chunk {2} 2.bundle.js 54 bytes <{main}> >{0}< [rendered]
|
||||||
> ./c [./index.js] ./index.js 3:0-16
|
> ./c [./index.js] ./index.js 3:0-16
|
||||||
[./c.js] 54 bytes {2} [built]
|
[./c.js] 54 bytes {2} [built]
|
||||||
amd require ./c [./index.js] 3:0-16
|
amd require ./c [./index.js] 3:0-16
|
||||||
[./index.js] Xms -> factory:Xms building:Xms = Xms
|
[./index.js] Xms -> factory:Xms building:Xms = Xms"
|
||||||
chunk {main} bundle.js (main) 73 bytes >{1}< >{2}< [entry] [rendered]
|
|
||||||
> ./index main
|
|
||||||
[./a.js] 22 bytes {main} [built]
|
|
||||||
cjs require ./a [./e.js] 1:0-14
|
|
||||||
cjs require ./a [./index.js] 1:0-14
|
|
||||||
[./index.js] Xms -> factory:Xms building:Xms = Xms
|
|
||||||
[./index.js] 51 bytes {main} [built]
|
|
||||||
single entry ./index main
|
|
||||||
factory:Xms building:Xms = Xms"
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`StatsTestCases should print correct stats for circular-correctness 1`] = `
|
exports[`StatsTestCases should print correct stats for circular-correctness 1`] = `
|
||||||
|
|
@ -1124,7 +1124,7 @@ Compilation error while processing magic comment(-s): /* webpackPrefetch: true,
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`StatsTestCases should print correct stats for issue-7577 1`] = `
|
exports[`StatsTestCases should print correct stats for issue-7577 1`] = `
|
||||||
"Hash: 3a382f7c6759b0401b6ff9bcd7c310309db5b68c1266869869f7e09577eb
|
"Hash: 3a382f7c6759b0401b6ff9bcd7c310309db5b68ca77f24f3c38b481493dd
|
||||||
Child
|
Child
|
||||||
Hash: 3a382f7c6759b0401b6f
|
Hash: 3a382f7c6759b0401b6f
|
||||||
Time: Xms
|
Time: Xms
|
||||||
|
|
@ -1148,7 +1148,7 @@ Child
|
||||||
[0] ./node_modules/vendor.js 23 bytes {vendors~main} [built]
|
[0] ./node_modules/vendor.js 23 bytes {vendors~main} [built]
|
||||||
[1] ./b.js 17 bytes {all~main} [built]
|
[1] ./b.js 17 bytes {all~main} [built]
|
||||||
Child
|
Child
|
||||||
Hash: 1266869869f7e09577eb
|
Hash: a77f24f3c38b481493dd
|
||||||
Time: Xms
|
Time: Xms
|
||||||
Built at: Thu Jan 01 1970 00:00:00 GMT
|
Built at: Thu Jan 01 1970 00:00:00 GMT
|
||||||
Asset Size Chunks Chunk Names
|
Asset Size Chunks Chunk Names
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue