Page MenuHomePhabricator

Enable redirects for Vue components
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):

It should be possible for redirects to exist for "vue" content model.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

I create a Vue component such as "Foo.vue" similar to this (may need some changes to work with MediaWiki):

<script setup>import Component from './Bar.vue';</script><template><Component/></template>

On my local machine, this code effectively "redirects" calls from Foo.vue to Bar.vue. There may be a better way to specify this component without taking up so many characters (or maybe this is the best that is possible).

Benefits (why should this be implemented?):

In case a Vue component moves the old component location should link back.

Event Timeline

In case a Vue component moves the old component location should link back.

Why/when would that happen? What would that mean if a new, different Vue component was created at the old component location?

In case a Vue component moves the old component location should link back.

Why/when would that happen? What would that mean if a new, different Vue component was created at the old component location?

The idea is if the component "Foo.vue" was renamed to "Bar.vue" on wiki, all of the scripts using "Foo.vue" would not have to update to use "Bar.vue" instead, while if someone were to visit "Foo.vue" on wiki they would be redirected to "Bar.vue" in a similar manner for CSS and JS pages.

Vue is not a valid Content model in MediaWiki. Don't you mean the JavaScript content model? I thought they already had redirects??

Vue is not a valid Content model in MediaWiki. Don't you mean the JavaScript content model? I thought they already had redirects??

It is, see T340460.

I create a Vue component such as "Foo.vue" similar to this (may need some changes to work with MediaWiki):

<script setup>import Component from './Bar.vue';</script><template><Component/></template>

There is no way to load a vue page except as part of an RL module, so it doesn't matter what syntax is used to annotate a redirect. We just need to pick some reasonable syntax that *looks* like valid vue. It'll never be executed since ResourceLoader sends the code of the redirect target page to browsers.

I propose using <script>import * from 'MediaWiki:Bar.js';</script>.

I think it should actually be valid Vue, because user script authors might want to design Vue components to use in scripts (see T401975 which I created because there isn't an easy way to load Vue components in user scripts).

I do like the format that is given but I don't know if this is valid. If it indeed is valid then we should use this rather than something else.