
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
feat 增加新功能fix 修复问题/BUGstyle 代码风格相关无影响运行结果的perf 优化/性能提升refactor 重构revert 撤销修改test 测试相关docs 文档/注释chore 依赖更新/脚手架配置修改等workflow 工作流改进ci 持续集成types 类型定义文件更改wip 开发中# 显示当前模式并进入交互选择
pnpm switch-mode
# 直接切换到调试模式
pnpm mode:debug
# 直接切换到生产模式
pnpm mode:prod
# 显示帮助信息
pnpm mode:help
组件命名和导出统一前缀为 Hlxb
示例 button 组件:
<script lang="ts" setup>
// 组件命名
defineOptions({ name: 'HlxbButton' });
</script>
// button/index.ts
import hlxbButton from './button.vue';
import { withInstall } from '../utils';
const HlxbButton = withInstall(hlxbButton);
// 组件导出
export default HlxbButton;
// 或
export { HlxbButton };
components/[组件名]/index.less - 单文件样式components/[组件名]/style/index.less - 标准样式目录components/[组件名]/src/index.less - src 目录样式components/[组件名]/src/style/index.less - src 样式目录components/[组件名]/src/[子组件]/style/index.less - 多层嵌套组件样式插件支持多层嵌套的组件结构:
components/
├── button/ # 单层组件
│ └── style/index.less
├── card/ # 单层组件
│ └── style/index.less
└── card-component/ # 多层组件
└── src/
├── basicComponents/ # 子组件层
│ └── style/index.less
└── combinationCards/ # 子组件层
└── style/index.less
import { createApp } from 'vue';
import HlxbUI from 'hlxb-ui';
import 'hlxb-ui/style.css';
import App from './App.vue';
const app = createApp(App);
app.use(HlxbUI);
app.mount('#app');
使用 HlxbUIStyleImport 插件自动导入组件样式,无需手动引入 CSS 文件。
// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { HlxbUIStyleImport } from 'hlxb-ui/resolver';
export default defineConfig({
plugins: [
vue(),
HlxbUIStyleImport({
importStyle: true, // 默认为 true
}),
],
});
interface HlxbUIStyleImportOptions {
/**
* 是否启用样式自动导入
* @default true
*/
importStyle?: boolean;
/**
* 自定义样式路径解析函数
*/
resolveStyle?: (name: string) => string | string[] | undefined;
}
HlxbUIStyleImport({
importStyle: true,
resolveStyle: (name) => {
// 自定义样式路径
if (name === 'HlxbButton') {
return 'path/to/custom/button.css';
}
// 返回 undefined 使用默认路径
return undefined;
},
});
import { HlxbButton, HlxbInput } from 'hlxb-ui';
// 手动引入样式(不推荐,建议使用自动导入插件)
import 'hlxb-ui/es/button/style/index.css';
import 'hlxb-ui/es/input/style/index.css';
以 HlxbTabsTableCard 为例,展示插件如何处理复杂的深层依赖:
<template>
<HlxbTabsTableCard title="数据表格" :dataSource="tableData" :loading="loading" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { HlxbTabsTableCard } from 'hlxb-ui';
/*
* 插件会自动导入所有依赖的样式文件:
* - hlxb-ui/card-component/combinationCards/style/index.css (主组件)
* - hlxb-ui/card/style/index.css (HlxbTabsCard 依赖)
* - hlxb-ui/card-component/basicComponents/style/index.css (HlxbCardLoading 依赖)
* - hlxb-ui/table/style/index.css (HlxbTable 依赖)
* - hlxb-ui/empty/style/index.css (HlxbEmpty 依赖)
* 以及这些组件的递归依赖样式
*/
const tableData = ref([]);
const loading = ref(false);
</script>
插件通过静态分析组件文件中的 import 语句,自动识别依赖关系并导入对应样式。支持相对路径导入、具名导入等多种方式,使用递归算法确保深层依赖样式的完整导入。
当添加新组件时,系统会在 Git 提交时自动检查组件映射。
手动更新命令:
# 检查映射状态
pnpm run check:resolver
# 更新组件映射
pnpm run sync:resolver
FAQs
hlxb-ui组件库
The npm package hlxb-ui receives a total of 34 weekly downloads. As such, hlxb-ui popularity was classified as not popular.
We found that hlxb-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.