PluginPagesContext #
pages() 的生成函数收到的东西。
字段 #
command'dev' | 'build'
开发服务器运行时是 dev,执行 kawapress build 时是 build。
read(path: string): Promise<string>
读取一个 UTF-8 文本文件,并把它记为这组页面的依赖。相对路径从站点根目录算起。
glob(pattern: string | readonly string[]): Promise<string[]>
查找文件,返回排好序的绝对路径。这个模式会被记为这组页面的依赖。相对模式从站点根目录算起。
完整类型签名
TypeScript
interface PluginPagesContext {
command: 'dev' | 'build'
read: (path: string) => Promise<string>
glob: (pattern: string | readonly string[]) => Promise<string[]>
}

评论