Page MenuHomePhabricator

Add native support for ES2016-ES2017 to the minifier
Closed, ResolvedPublic

Description

Now that we have done T272104: Allow modules to opt-in to ES6 syntax support, we should consider doing the same thing for ES2016 and ES2017.

We will have to consider the benefits of new language features in a given ES version versus the costs of dropping browsers that don't support it, and the complexity of feature detection.

Notable syntax features in later versions:

Later: T386530: Add native support for ES2018-ES2020 to the minifier

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change #1048590 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/libs/Minify@master] JavaScriptMinifier: Add support for `**=` operator (ECMAScript 2016)

https://gerrit.wikimedia.org/r/1048590

Change #1048590 merged by jenkins-bot:

[mediawiki/libs/Minify@master] JavaScriptMinifier: Add support for `**=` operator (ECMAScript 2016)

https://gerrit.wikimedia.org/r/1048590

Krinkle updated the task description. (Show Details)

Some things related to async functions that don't work yet:

  • Async function as the first alternative in a ternary: foo = bar ? async function x() {} : 42
  • Async function as an object property value: foo = { bar: async function x() {} }

In both of these cases, if you minify them with maxLineLength=1, the output puts async and function on separate lines, which is a syntax error.

T371938 (gerrit 1060177), that you created at the same time, adds (in addition to the previously existing PAREN_EXPRESSION_OP_NO_NL state) EXPRESSION_TERNARY_NO_NL, PAREN_EXPRESSION_NO_NL and PROPERTY_EXPRESSION_NO_NL states. These might help to add support for the remaining async functions.

I feel we are soooo close to have full ES8 support, thus async/await!

After T368204: Consider removing new-line insertion from JavaScriptMinifier Minifier adds no new lines. So this one T277675#10046960 should no longer causes problems. We should focus on when new lines are required but ignored by Minifier.

Novem_Linguae renamed this task from Add native support for ES2016-ES2020 or higher versions to Add native support for ES2016-ES2020 or higher versions to the minifier.Dec 11 2024, 3:57 AM
Krinkle renamed this task from Add native support for ES2016-ES2020 or higher versions to the minifier to Add native support for ES2016-ES2017 to the minifier.Feb 14 2025, 11:37 PM
Krinkle updated the task description. (Show Details)
Krinkle raised the priority of this task from Low to Medium.

With T386139 resolved, we're ready for a Minify release to roll out the ES2017 tokens to MediaWiki.

As part of that, we do need to update the JavaScriptMinified class doc as there's still various references to ECMAScript 7.0 (ES2016) that should now point to ECMAScript 8.0. When doing we also need to check the specification linked from the class against those references, to verify that we haven't forgotten to add/change/remove/reorder anything. The order and grouping of class constants does not change the library behaviour but helps future updates and verification.

Change #1130172 had a related patch set uploaded (by Krinkle; author: Hokwelum):

[mediawiki/libs/Minify@master] JavaScriptMinifier: Update class documentation for ES2017 support

https://gerrit.wikimedia.org/r/1130172

Change #1130172 merged by jenkins-bot:

[mediawiki/libs/Minify@master] JavaScriptMinifier: Update class documentation for ES2017 support

https://gerrit.wikimedia.org/r/1130172

Change #1131296 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/libs/Minify@master] Tag 2.9.0

https://gerrit.wikimedia.org/r/1131296

Change #1131296 merged by jenkins-bot:

[mediawiki/libs/Minify@master] Tag 2.9.0

https://gerrit.wikimedia.org/r/1131296

Change #1131406 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/vendor@master] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131406

Change #1131409 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/core@master] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131409

Change #1131406 merged by jenkins-bot:

[mediawiki/vendor@master] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131406

Change #1131409 merged by jenkins-bot:

[mediawiki/core@master] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131409

Change #1131426 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/vendor@REL1_43] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131426

Change #1131427 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/vendor@REL1_42] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131427

Change #1131428 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/vendor@REL1_39] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131428

Change #1131429 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/core@REL1_43] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131429

Change #1131430 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/core@REL1_42] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131430

Change #1131431 had a related patch set uploaded (by Reedy; author: Hokwelum):

[mediawiki/core@REL1_39] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131431

Change #1131428 merged by Reedy:

[mediawiki/vendor@REL1_39] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131428

Change #1131427 merged by Reedy:

[mediawiki/vendor@REL1_42] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131427

Change #1131426 merged by Reedy:

[mediawiki/vendor@REL1_43] update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131426

Change #1131431 merged by jenkins-bot:

[mediawiki/core@REL1_39] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131431

Change #1131430 merged by jenkins-bot:

[mediawiki/core@REL1_42] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131430

Change #1131429 merged by jenkins-bot:

[mediawiki/core@REL1_43] ResourceLoader: update wikimedia/minify to 2.9.0

https://gerrit.wikimedia.org/r/1131429

@Quiddity Are you really sure this is ready to be announced? I think actually T381537 should be the User-notice task instead of this one, and that one still lists a couple of steps to be done.

You're exactly right. The relevant tech news will be: mediawiki generally changing browser support, and gadgets can use new syntax. Neither is the case (yet) and is better captured in the parent task.

Okay, I see it did make it in, but what made it in is completely accurate, well-phrased, and minimal in scope. This is harmless and shouldn't cause confusion I think.

https://meta.wikimedia.org/wiki/Tech/News/2025/14

The MediaWiki minifier now supports ES2016 and ES2017.

It is perhaps a useful FYI to report progress in the general area, but it is not actionable for readers, so I wouldn't mind removing it to reduce noise.

Haha! Edits crossing in the night, I removed the entry as you were typing the above. I had meant to ask you if it should be clarified, but i didn't notice it till late yesterday (yesterday was very busy....) so I just left it in.
We can go either way - Up to you.
I'd hesitantly suggest leaving it out if there's nothing actionable.
If you want it back in, and if I/we replace it within the next hour, then that should be fine, but if you don't notice this response for longer, then let's keep it out.

[…] what made it in is completely accurate, well-phrased, and minimal in scope. This is harmless and shouldn't cause confusion I think.

When I was reading the Tech News draft, my first thought was “cool, we can finally use async/await”, and even reading it twice, I was still not entirely sure this isn’t the case. I’m pretty sure others would have similar thoughts – probably because we expect Tech News entries to be actionable, and if they aren’t, we unconsciously make up something. So I appreciate the unactionable entry being removed.

Makes sense. +1. Thanks again, Tacsipacsi (and Krinkle!). Sorry for the confusion & noise.