VuePress 1.9.0 发布,Vue 轻量级静态网站生成器
VuePress 1.9.0 发布了,此版本为配置文件引入了完整的 TypeScript 支持,还引入了拥有类型推断功能的官方插件,完整更新内容如下:
支持 .vuepress/config.ts
之前,VuePress 只支持这些类型的配置文件
.vuepress/config.js.vuepress/config.yml.vuepress/config.toml
从现在开始,.vuepress/config.ts 获得官方支持。
defineConfig 智能感知配置助手
一个在 vuepress/config 中显示的辅助函数,它可以辅助类型提示符:
import { defineConfig } from "vuepress/config";
export default defineConfig({
title: "VuePress",
description: "Vue-powered Static Site Generator"
// ...
});
Theme 基于主题的类型推断
默认情况下,defineConfig 助手利用默认主题配置的类型作为 themeConfig,也就是说,所有默认主题配置的类型提示现在都可用。
import { defineConfig } from "vuepress/config";
export default defineConfig({
themeConfig: {
repo: "vuejs/vuepress",
editLinks: true,
docsDir: "packages/docs/docs"
// Type is `DefaultThemeConfig`
}
});
如果你使用一个自定义主题,则可以使用 defineConfig4CustomTheme 助手来传递你的主题的泛型类型:
import { defineConfig4CustomTheme } from "vuepress/config";
interface MyThemeConfig {
hello: string;
}
export default defineConfig4CustomTheme<MyThemeConfig>({
themeConfig: {
// Type is `MyThemeConfig`
hello: "vuepress"
}
});
Official Plugins 官方插件类型推断
从 1.9 开始,用户将可以享受官方插件的类型提示:
元组样式(Tuple Style)、对象样式(Object Style)和插件简写(Plugin Shorthand )都支持类型推断。
- 元组样式:
import { defineConfig } from "vuepress/config";
export default defineConfig({
plugins: [
[
"@vuepress/pwa",
{
serviceWorker: true
}
]
]
});
- 对象样式:
import { defineConfig } from "vuepress/config";
export default defineConfig({
plugins: {
"@vuepress/pwa": {
serviceWorker: true
}
}
});
ISO 语言代码
类型推断支持 ISO 语言代码
上下文 API
VuePress 的配置也可以是一个函数,而它的第一个参数是当前的应用上下文:
import { defineConfig } from "vuepress/config";
export default defineConfig(ctx => ({
// do not execute babel compilation under development
evergreen: ctx.isProd
}));
以上为 Vuepress 1.9 的更新内容,更新公告:https://github.com/vuejs/vuepress/releases/tag/v1.9.0
关注公众号
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
支持 tmux,类似 rz / sz 的 trzsz 发布 0.1.4 版本
tmux 不支持 rz / sz ,于是有一个兼容 tmux 的 trz / tsz (trzsz),可以与 iTerm2 一起用,还有一个不错的进度条。 已发布 0.1.4 版本,支持静默模式,以及解决了 tmux 非控制模式下偶尔出错的问题。 trzsz trzsz是一个简单的文件传输工具,和 lrzsz ( rz / sz ) 类似但支持 tmux, 和 iTerm2 一起使用,并且有一个不错的进度条。 GitHub:https://github.com/trzsz/trzsz 为什么开发 trzsz ? 登录远程电脑时用 tmux 保持会话,但 tmux 不支持用 rz / sz 上传和下载文件,这就很不方便了。 重新造一个 rz / sz 比修改 tmux 相对简单很多,并且可以加个进度条,体验上会好很多。 安装指南 远程服务器安装trzsz-svr sudo python3 -m pip install --upgrade trzsz-libs trzsz-svr 同样也支持 Python2: sudo pip install --upgrade trzsz-l...
-
下一篇
Sequelize 已发布 6.12.1 和 6.12.2 维护版本
Sequelize 6.12.1 和 6.12.2 发布了,Sequelize 是一款基于 Nodejs 的异步 ORM 框架,它同时支持 PostgreSQL、MySQL、SQLite 和 MSSQL 多种数据库,很适合作为 Nodejs 后端数据库的存储接口,为快速开发 Node.js 应用奠定扎实、安全的基础。 更新内容: Sequelize 6.12.1 允许深度导入(#13795) 修复 lib/operators的无效 TypeScript 导入样式。(#13797) 更新公告:https://github.com/sequelize/sequelize/releases/tag/v6.12.1 Sequelize 6.12.2 abstract:如果值为 json,则为 pg 修补 jsonb 运算符 (#13780) operators:修复了对operators.ts 的 TypeScript 支持(#13805) postgres:允许 ARRAY(ENUM) 类型名称使用 schema(#13807) query-interface:把 quoteIdentifi...
相关文章
文章评论
共有0条评论来说两句吧...





微信收款码
支付宝收款码