nolebase / integrations

✍️ A collection of diverse documentation engineering tools. Better reading experience, inline link preview, highlight targeted title, enhanced <mark> element, state-of-the-art SEO and <meta> generation, og image, thumbhash & blurhash images and more!
https://nolebase-integrations.ayaka.io
MIT License
145 stars 26 forks source link

improve(git-changelog): splitting Git data into page-level #279

Open northword opened 3 months ago

northword commented 3 months ago

Splitting the data in Virtual Module down to the page level so that when a user visits the site, they don't need to download a very large Gitlog file (usually theme.hash.js) first, and therefore have higher performance.

Ref: https://github.com/nolebase/integrations/issues/223 , this was discussed in Discord and I am creating a ticket for this issue to track it, this is probably a long term plan and I don't have much ideas on how to implement it at the moment.

(may be?) In the short term, we could probably try to split the git data out of theme.hash.js so that only when the site content is updated (usually only the git data data is changed in theme.hash.js), the user doesn't have to pay for the unchanged parts of theme.hash.js. ref: rollup config: output.manualChunks.

nekomeowww commented 3 months ago

@northword Possibly related:

https://discord.com/channels/1229292283657195520/1229292844838162474/1243464211669979137

https://discord.com/channels/1229292283657195520/1229292844838162474/1245578360655057029

nekomeowww commented 3 months ago

I've been thinking way long and barely giving up.

I believe one possible and easy way to implement this is to generate separate git-changelog-commits.data.json into dist right under each pages' parent directories, then use client side fetch to dynamically fetch through GET for the actual commits logs since commit logs generally wont be needed for SEO and compatible with MPA.

northword commented 2 months ago

For notes only:

ref:https://github.com/vuejs/vitepress/issues/3001#issuecomment-1732237283

Not sure if attaching git logs to pages is possible with transformPageData:

  async transformPageData({ relativePath }) {
    return { contributors: await getContributorsAt(relativePath) }
  }