hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite
MIT License
1.84k stars 127 forks source link

feat: add `resolveRouteBlock` configuration option #364

Closed ckangwen closed 4 months ago

ckangwen commented 1 year ago

test: update snapshots

Description

Add a new configuration option to support custom resolve route block.

Type: (content: string, path: string) => Awaitable<CustomBlock | void>

Additional context

pnpm run test parser is ok, but pnpm run test get error.


What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

FoundTheWOUT commented 1 year ago

what if we have some lib dependency in the meta options, and that option would be called in some where. for example

import { add } from 'lodash'

definePageRoute({
  meta: {
    title: 'CustomRouteBlock',
    load: () => {
        add(1,2)
    }
  },
})