Skip to content

Commit 17eb5b4

Browse files
committed
rename priority to order
1 parent 57e09a6 commit 17eb5b4

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

lib/Chunk.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,20 +361,20 @@ class Chunk {
361361
};
362362
}
363363

364-
getChildIdsByPriorities() {
364+
getChildIdsByOrders() {
365365
const lists = new Map();
366366
for (const group of this.groupsIterable) {
367367
if (group.chunks[group.chunks.length - 1] === this) {
368368
for (const childGroup of group.childrenIterable) {
369369
// TODO webpack 5 remove this check for options
370370
if (typeof childGroup.options === "object") {
371371
for (const key of Object.keys(childGroup.options)) {
372-
if (key.endsWith("Priority")) {
373-
const name = key.substr(0, key.length - "Priority".length);
372+
if (key.endsWith("Order")) {
373+
const name = key.substr(0, key.length - "Order".length);
374374
let list = lists.get(name);
375375
if (list === undefined) lists.set(name, (list = []));
376376
list.push({
377-
priority: childGroup.options[key],
377+
order: childGroup.options[key],
378378
group: childGroup
379379
});
380380
}
@@ -386,7 +386,7 @@ class Chunk {
386386
const result = Object.create(null);
387387
for (const [name, list] of lists) {
388388
list.sort((a, b) => {
389-
const cmp = b.priority - a.priority;
389+
const cmp = b.order - a.order;
390390
if (cmp !== 0) return cmp;
391391
// TOOD webpack 5 remove this check of compareTo
392392
if (a.compareTo) return a.compareTo(b);
@@ -402,11 +402,11 @@ class Chunk {
402402
return result;
403403
}
404404

405-
getChildIdsByPrioritiesMap() {
405+
getChildIdsByOrdersMap() {
406406
const chunkMaps = Object.create(null);
407407

408408
for (const chunk of this.getAllAsyncChunks()) {
409-
const data = chunk.getChildIdsByPriorities();
409+
const data = chunk.getChildIdsByOrders();
410410
for (const key of Object.keys(data)) {
411411
let chunkMap = chunkMaps[key];
412412
if (chunkMap === undefined)

lib/ChunkGroup.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ChunkGroup {
4646
if (this.options[key] === undefined) {
4747
this.options[key] = options[key];
4848
} else if (this.options[key] !== options[key]) {
49-
if (key.endsWith("Priority")) {
49+
if (key.endsWith("Order")) {
5050
this.options[key] = Math.max(this.options[key], options[key]);
5151
} else {
5252
throw new Error(
@@ -325,18 +325,18 @@ class ChunkGroup {
325325
}
326326
}
327327

328-
getChildrenByPriorities() {
328+
getChildrenByOrders() {
329329
const lists = new Map();
330330
for (const childGroup of this._children) {
331331
// TODO webpack 5 remove this check for options
332332
if (typeof childGroup.options === "object") {
333333
for (const key of Object.keys(childGroup.options)) {
334-
if (key.endsWith("Priority")) {
335-
const name = key.substr(0, key.length - "Priority".length);
334+
if (key.endsWith("Order")) {
335+
const name = key.substr(0, key.length - "Order".length);
336336
let list = lists.get(name);
337337
if (list === undefined) lists.set(name, (list = []));
338338
list.push({
339-
priority: childGroup.options[key],
339+
order: childGroup.options[key],
340340
group: childGroup
341341
});
342342
}
@@ -346,7 +346,7 @@ class ChunkGroup {
346346
const result = Object.create(null);
347347
for (const [name, list] of lists) {
348348
list.sort((a, b) => {
349-
const cmp = b.priority - a.priority;
349+
const cmp = b.order - a.order;
350350
if (cmp !== 0) return cmp;
351351
// TOOD webpack 5 remove this check of compareTo
352352
if (a.compareTo) return a.compareTo(b);

lib/Stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class Stats {
401401
for (const keyValuePair of compilation.entrypoints) {
402402
const name = keyValuePair[0];
403403
const ep = keyValuePair[1];
404-
const children = ep.getChildrenByPriorities();
404+
const children = ep.getChildrenByOrders();
405405
obj.entrypoints[name] = {
406406
chunks: ep.chunks.map(c => c.id),
407407
assets: ep.chunks.reduce(

lib/dependencies/ImportParserPlugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class ImportParserPlugin {
6363
}
6464
if (typeof importOptions.webpackPrefetch !== "undefined") {
6565
if (importOptions.webpackPrefetch === true) {
66-
groupOptions.prefetchPriority = 0;
66+
groupOptions.prefetchOrder = 0;
6767
} else if (typeof importOptions.webpackPrefetch === "number") {
68-
groupOptions.prefetchPriority = importOptions.webpackPrefetch;
68+
groupOptions.prefetchOrder = importOptions.webpackPrefetch;
6969
} else {
7070
parser.state.module.warnings.push(
7171
new UnsupportedFeatureWarning(
@@ -79,9 +79,9 @@ class ImportParserPlugin {
7979
}
8080
if (typeof importOptions.webpackPreload !== "undefined") {
8181
if (importOptions.webpackPreload === true) {
82-
groupOptions.preloadPriority = 0;
82+
groupOptions.preloadOrder = 0;
8383
} else if (typeof importOptions.webpackPreload === "number") {
84-
groupOptions.preloadPriority = importOptions.webpackPreload;
84+
groupOptions.preloadOrder = importOptions.webpackPreload;
8585
} else {
8686
parser.state.module.warnings.push(
8787
new UnsupportedFeatureWarning(

lib/web/JsonpMainTemplatePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class JsonpMainTemplatePlugin {
274274
stage: 10
275275
},
276276
(source, chunk, hash) => {
277-
const chunkMap = chunk.getChildIdsByPrioritiesMap().preload;
277+
const chunkMap = chunk.getChildIdsByOrdersMap().preload;
278278
if (!chunkMap || Object.keys(chunkMap).length === 0) return source;
279279
return Template.asString([
280280
source,
@@ -313,7 +313,7 @@ class JsonpMainTemplatePlugin {
313313
stage: 20
314314
},
315315
(source, chunk, hash) => {
316-
const chunkMap = chunk.getChildIdsByPrioritiesMap().prefetch;
316+
const chunkMap = chunk.getChildIdsByOrdersMap().prefetch;
317317
if (!chunkMap || Object.keys(chunkMap).length === 0) return source;
318318
return Template.asString([
319319
source,

0 commit comments

Comments
 (0)