@vrx/cp
@vrx/cp
为 使用.tsx,.ts,.vue 方案的 vue3 组件库进行打包
该包处于实验阶段,API 不稳定
特性
- 生成.d.ts 文件
- 生成 components.d.ts
- 生成 web-types.json
简单使用
pnpm exec vrx-cp build
组件信息配置文件
用于覆盖自动组件信息解析时遗漏或解析错误的配置
- gendoc.{ts,js,mts,mjs}
- gendoc.{toml,yaml,yml,jsonc,json5,json}
例:
gendoc.ts
import { defineGenDoc } from '@vrx/cp'
export default defineGenDoc([
{
name: 'Progress',
props: {
percent: {
type: 'number',
desc: '百分比 0.1 形式',
},
title: {
type: 'string',
desc: '标题',
},
},
events: {
click: {
desc: '点击事件',
},
},
slots: {
label: {
name: 'label',
desc: '标题',
},
},
}
])
gendoc.toml
[[docs]]
name = 'Progress'
[docs.props.percent]
type = 'number'
desc = '百分比 0.1 形式'
[docs.props.title]
type = 'string'
desc = '标题'
[docs.events.click]
desc = '点击事件'
[docs.slots.label]
name = 'label'
desc = '标题'
配置文件
- vrx-cp.config.{ts,js,mts,mjs}
- vrx-cp.{toml,yaml,yml,jsonc,json5,json}
- package.json#vrx-cp
⚠️ 由于vite5.0废弃了cjs module的原因,配置文件在使用 js/ts编写时只能使用esm格式
import { defineConfig } from '@vrx/cp'
export default defineConfig({
// 入口文件 默认 src/index.ts
entry: 'src/index.ts',
})
autoprefixer 样式
可以 根据 .browserslistrc 文件自动添加浏览器前缀
# Browsers that we support
last 1 version
> 1%
not dead # no browsers without security updates
试验性功能
watch mode
监听 源码目录,当文件发生改变时,重新执行打包操作
pnpm exec vrx-cp build --watch
# or
pnpm exec vrx-cp watch
vue-macros + volar
配置文件参考
vrx-cp.config.ts
import { defineConfig } from '@vrx/cp'
import VueMacros from 'vue-macros/vite'
export default defineConfig({
type: ({ vue, vueJsx }) =>
VueMacros({
plugins: {
vue: vue(),
vueJsx: vueJsx(),
},
}),
})
tsconfig.json
{
"compilerOptions": {
"types": ["vue-macros/macros-global"]
},
"vueCompilerOptions": {
"plugins": ["vue-macros/volar"]
}
}
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 0.9.1 | MIT | |
| 0.9.0 | MIT | |
| 0.8.0 | MIT | |
| 0.7.2 | MIT | |
| 0.7.1 | MIT | |
| 0.7.0 | MIT | |
| 0.6.2 | MIT | |
| 0.6.1 | MIT | |
| 0.6.0 | MIT | |
| 0.5.0 | MIT | |
| 0.4.3 | MIT | |
| 0.4.2 | MIT | |
| 0.4.0 | MIT | |
| 0.3.3 | MIT | |
| 0.3.2 | MIT | |
| 0.3.1 | MIT | |
| 0.3.0 | MIT | |
| 0.2.4 | MIT | |
| 0.2.3 | MIT | |
| 0.2.2 | MIT | |
| 0.2.1 | MIT | |
| 0.1.9 | MIT | |
| 0.1.8 | MIT | |
| 0.1.7 | MIT | |
| 0.1.6 | MIT | |
| 0.1.5 | MIT | |
| 0.1.4 | MIT | |
| 0.1.3 | MIT | |
| 0.1.2 | MIT | |
| 0.1.1 | MIT |
Showing the latest 30 of 33. See every release on npm
Pre-releases (98)
| Version | Released | License |
|---|---|---|
| 0.0.1-beta.99 | MIT | |
| 0.0.1-beta.98 | MIT | |
| 0.0.1-beta.97 | MIT | |
| 0.0.1-beta.96 | MIT | |
| 0.0.1-beta.95 | MIT | |
| 0.0.1-beta.94 | MIT | |
| 0.0.1-beta.92 | MIT | |
| 0.0.1-beta.91 | MIT | |
| 0.0.1-beta.90 | MIT | |
| 0.0.1-beta.89 | MIT | |
| 0.0.1-beta.88 | MIT | |
| 0.0.1-beta.87 | MIT | |
| 0.0.1-beta.86 | MIT | |
| 0.0.1-beta.85 | MIT | |
| 0.0.1-beta.84 | MIT | |
| 0.0.1-beta.83 | MIT | |
| 0.0.1-beta.82 | MIT | |
| 0.0.1-beta.81 | MIT | |
| 0.0.1-beta.80 | MIT | |
| 0.0.1-beta.79 | MIT | |
| 0.0.1-beta.78 | MIT | |
| 0.0.1-beta.77 | MIT | |
| 0.0.1-beta.76 | MIT | |
| 0.0.1-beta.75 | MIT | |
| 0.0.1-beta.74 | MIT | |
| 0.0.1-beta.73 | MIT | |
| 0.0.1-beta.72 | MIT | |
| 0.0.1-beta.71 | MIT | |
| 0.0.1-beta.70 | MIT | |
| 0.0.1-beta.69 | MIT |
Showing the latest 30 of 98. See every release on npm