Page MenuHomePhabricator

Allow .vue files to be used in Gadgets
Open, Needs TriagePublicFeature

Description

ResourceLoader currently does not allow .vue files to be used in on-wiki modules (only .js, .css and .json) files. We want to allow .vue files, but we don't want to allow Less (via <style lang="less">) in these, only CSS. This is because we decided not to make Less available in user-authored modules in T56864#6153179, for fear that arbitrary user-authored Less code could take arbitrarily long to execute.

Because all the code for .vue file handling is currently in FileModule, some of it will need to be moved to Module, while preserving the ability of FileModule to allow Less to be used and the ability of WikiModule to forbid it.

  • Add a content model for .vue pages, with the same special treatment as .js pages
  • Move (most) .vue handling code from FileModule to Module
  • Allow .vue pages to be used in WikiModule
  • Do not allow Less to be used in WikiModule (but continue to allow it in FileModule)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 907557 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/extensions/Gadgets@master] [WIP] Support .vue files in packaged gadgets

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

Change 907556 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/core@master] [WIP] Support loading .vue pages in the MediaWiki namespace

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

This is because we decided not to make Less available in user-authored modules in T56864#6153179, for fear that arbitrary user-authored Less code could take arbitrarily long to execute.

Is this not also a concern for Vue, which must be transpiled to Javascript?

Izno changed the subtype of this task from "Task" to "Feature Request".Jul 24 2023, 3:15 PM

Upstream, Ace just last month added support for syntax highlighting vue (https://github.com/ajaxorg/ace/pull/5483).

For syntax highlighting in action=view mode though, Pygments doesn't yet support it. But they appear to be open to contribution - https://github.com/pygments/pygments/issues/2111

Upstream, Ace just last month added support for syntax highlighting vue (https://github.com/ajaxorg/ace/pull/5483).

Brilliant; I just made an Ace update last week for T342387 that includes this feature; it will go out this week, but isn't wired up (compare https://en.wikipedia.beta.wmflabs.org/wiki/User:Foo/Bar.js?action=edit which loads CodeEditor vs. https://en.wikipedia.beta.wmflabs.org/wiki/User:Foo/Bar.vue?action=edit which loads your wikitext editor, so there's a little more work needed to support nice editing of .vue on-wiki pages (the first checklist point in this task's list).