vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.17k stars 922 forks source link

feat(client): use visual routes #1433

Closed Mister-Hope closed 7 months ago

Mister-Hope commented 7 months ago

This pr reduce outputsize and improves performance at the same time. by avoiding:

  1. heavy operation with router.resolve

    router.resolve performs RegExp.exec() when mapping the whole routes array to find a matched result.

  2. duplicated route records with redirects and maps holding data, components, now a single map holds all pages info and pageKey is no longer used at client.

Breaking changes

Other notes

To support clean url (e.g.: navigating to /a/b and resolve /a/b.html to /a/b), we improved generation of htmlRelativePath and htmlPath on Page object