Skip to content

Commit 9a4203e

Browse files
chore: drop the commented-out held-back code for short notes
Commented-out blocks broke the repository's limit of two short lines per comment in lib/ and test/. Keep one note where the absence needs explaining — the missing environment default, and the entry that is no longer awaited — and leave the implementation to the commit history: reverting this pull request restores it.
1 parent 01481c1 commit 9a4203e

6 files changed

Lines changed: 6 additions & 97 deletions

File tree

‎lib/RuntimeTemplate.js‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,6 @@ class RuntimeTemplate {
569569
return this.outputOptions.environment.generator;
570570
}
571571

572-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
573-
// supportsTopLevelAwait() {
574-
// return this.outputOptions.environment.topLevelAwait;
575-
// }
576-
577572
supportsOptionalChaining() {
578573
return this.outputOptions.environment.optionalChaining;
579574
}

‎lib/config/browserslistTargetHandler.js‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -428,26 +428,6 @@ const resolve = (browsers) => {
428428
// kaios: Not supported
429429
node: [16, 9]
430430
}),
431-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
432-
// topLevelAwait: rawChecker({
433-
// chrome: 89,
434-
// and_chr: 89,
435-
// edge: 89,
436-
// firefox: 89,
437-
// and_ff: 89,
438-
// // ie: Not supported,
439-
// opera: 75,
440-
// op_mob: 63,
441-
// safari: 15,
442-
// ios_saf: 15,
443-
// samsung: 15,
444-
// android: 89,
445-
// // and_qq: Not supported
446-
// // baidu: Not supported
447-
// // and_uc: Not supported
448-
// // kaios: Not supported
449-
// node: [14, 8]
450-
// }),
451431
spread: rawChecker({
452432
chrome: 60,
453433
and_chr: 60,

‎lib/config/defaults.js‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,8 @@ const applyOutputDefaults = (
17471747
"generator",
17481748
() => tp && optimistic(/** @type {boolean | undefined} */ (tp.generator))
17491749
);
1750-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
1751-
// F(
1752-
// environment,
1753-
// "topLevelAwait",
1754-
// () =>
1755-
// tp && optimistic(/** @type {boolean | undefined} */ (tp.topLevelAwait))
1756-
// );
1750+
// No `topLevelAwait` here: the option is held back from the patch release,
1751+
// so nothing derives it from `tp` yet. Reapply by reverting #21881.
17571752
F(
17581753
environment,
17591754
"forOf",

‎lib/config/target.js‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
269269
arrowFunction: v(6),
270270
asyncFunction: v(7, 6),
271271
generator: v(4),
272-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
273-
// v14.8.0
274-
// topLevelAwait: v(14, 8),
275272
forOf: v(5),
276273
destructuring: v(6),
277274
bigIntLiteral: v(10, 4),
@@ -332,8 +329,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
332329
templateLiteral: true,
333330
asyncFunction: true,
334331
generator: true,
335-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
336-
// topLevelAwait: true,
337332
// import defer - v2.8.0
338333
deferImport: v(2, 8),
339334
// import source - v2.6.0
@@ -385,8 +380,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
385380
arrowFunction: true,
386381
asyncFunction: true,
387382
generator: true,
388-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
389-
// topLevelAwait: true,
390383
forOf: true,
391384
destructuring: true,
392385
bigIntLiteral: true,
@@ -444,9 +437,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
444437
arrowFunction: v(1, 1),
445438
asyncFunction: v(1, 7),
446439
generator: v(1, 1),
447-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
448-
// 12.0.0 - Chromium 89
449-
// topLevelAwait: v(12),
450440
forOf: v(0, 36),
451441
destructuring: v(1, 1),
452442
bigIntLiteral: v(4),
@@ -496,9 +486,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
496486
arrowFunction: v(0, 15),
497487
asyncFunction: v(0, 21),
498488
generator: v(0, 15),
499-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
500-
// 0.52.0 - Chromium 89
501-
// topLevelAwait: v(0, 52),
502489
forOf: v(0, 13),
503490
destructuring: v(0, 15),
504491
bigIntLiteral: v(0, 32),
@@ -528,8 +515,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
528515
destructuring: v >= 2015,
529516
module: v >= 2015,
530517
asyncFunction: v >= 2017,
531-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
532-
// topLevelAwait: v >= 2022,
533518
generator: v >= 2015,
534519
globalThis: v >= 2020,
535520
symbol: v >= 2015,

‎lib/javascript/JavascriptModulesPlugin.js‎

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,29 +1680,8 @@ class JavascriptModulesPlugin {
16801680
continue;
16811681
}
16821682
}
1683-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`.
1684-
// const entryOptions = chunk.getEntryOptions();
1685-
// const library =
1686-
// entryOptions && entryOptions.library !== undefined
1687-
// ? entryOptions.library
1688-
// : runtimeTemplate.outputOptions.library;
1689-
// // A module library awaits the entry itself, in `ModuleLibraryPlugin`.
1690-
// const awaitedByLibrary =
1691-
// library !== undefined && library.type === "module";
1692-
// // `await` is only legal at the top level of an ESM chunk, never in
1693-
// // the startup function rendered below, and only where the target
1694-
// // can parse it (`target: "node14"` reads ESM but not top-level await).
1695-
// const canAwaitEntry =
1696-
// runtimeTemplate.isModule() &&
1697-
// runtimeTemplate.supportsTopLevelAwait() &&
1698-
// !awaitedByLibrary &&
1699-
// !runtimeRequirements.has(RuntimeGlobals.startup) &&
1700-
// !(
1701-
// runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) &&
1702-
// runtimeRequirements.has(RuntimeGlobals.startupOnlyAfter)
1703-
// );
1704-
// /** @type {string[]} */
1705-
// const awaitedEntries = [];
1683+
// An async entry is not awaited here: that needs top-level `await`,
1684+
// gated on an option held back from the patch release (revert #21881).
17061685
let i = jsEntries.length;
17071686
for (const [entryModule, entrypoint] of jsEntries) {
17081687
const chunks =
@@ -1829,20 +1808,6 @@ class JavascriptModulesPlugin {
18291808
)})`
18301809
);
18311810
} else if (useRequire) {
1832-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`:
1833-
// an async entry nobody awaits settles after the bundle did, which
1834-
// orphans its rejection.
1835-
// const awaitEntry =
1836-
// canAwaitEntry && moduleGraph.isAsync(entryModule);
1837-
// const target =
1838-
// i === 0
1839-
// ? RuntimeGlobals.exports
1840-
// : `${RuntimeGlobals.exports}_${i}`;
1841-
// const needsDecl = i === 0 || awaitEntry;
1842-
// buf2.push(
1843-
// `${needsDecl ? `${exportsDecl} ${target} = ` : ""}${RuntimeGlobals.require}(${moduleIdExpr});`
1844-
// );
1845-
// if (awaitEntry) awaitedEntries.push(target);
18461811
buf2.push(
18471812
`${i === 0 ? `${exportsDecl} ${RuntimeGlobals.exports} = ` : ""}${
18481813
RuntimeGlobals.require
@@ -1890,15 +1855,6 @@ class JavascriptModulesPlugin {
18901855
`${RuntimeGlobals.exports} = ${RuntimeGlobals.onChunksLoaded}(${RuntimeGlobals.exports});`
18911856
);
18921857
}
1893-
// Held back for the patch release, reapply with `output.environment.topLevelAwait`:
1894-
// several need one `Promise.all`, so an entry rejecting first still
1895-
// leaves the others observed. A single one has nothing to orphan.
1896-
// if (awaitedEntries.length === 1) {
1897-
// buf2.push(`${awaitedEntries[0]} = await ${awaitedEntries[0]};`);
1898-
// } else if (awaitedEntries.length > 1) {
1899-
// const list = awaitedEntries.join(", ");
1900-
// buf2.push(`[${list}] = await Promise.all([${list}]);`);
1901-
// }
19021858
if (
19031859
runtimeRequirements.has(RuntimeGlobals.startup) ||
19041860
(runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore) &&

‎test/test262.spectest.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,8 @@ const knownBugs = [
10251025
"expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js",
10261026
"expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js",
10271027

1028-
// A rejecting top-level-await entry can only reject the ESM bundle module
1029-
// via top-level `await`, which the startup does not emit while
1030-
// `output.environment.topLevelAwait` is held back for the patch release, so
1031-
// the rejection is orphaned instead of failing the module.
1028+
// Rejecting these needs the startup's top-level `await`, held back from the
1029+
// patch release, so the rejection is orphaned instead of failing the module.
10321030
"module-code/top-level-await/module-import-rejection.js",
10331031
"module-code/top-level-await/module-import-rejection-body.js",
10341032
"module-code/top-level-await/module-import-rejection-tick.js",

0 commit comments

Comments
 (0)