npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@slice_cy/mint-core

v0.0.1

Published

Mint框架运行时

Readme

@slice_cy/mint-core

Mint 框架的运行时核心,基于 Koa 的 BFF (Backend For Frontend) 服务,整合 Vue 3 + Ant Design Vue 前端,提供 Schema 驱动的中后台快速开发能力。

DSL模型配置

module.exports = {
  model: "", // 不同DSL模版标识,用于匹配对应页面渲染模版
  name: "", // 站点标题
  desc: "", // 站点描述
  icon: "", // 站点图标
  homePage: "", // 站点首页
  // 菜单数组,承载分组/功能模块菜单
  menu: [
    {
      key: "", // 菜单唯一标识,全局不可重复
      name: "", // 当前菜单展示名称
      menuType: "", // 菜单类型枚举:group(分组菜单) | module(功能模块菜单)
      moduleType: "", // 模块渲染类型枚举:custom(自定义页面) | schema(标准CRUD页面) | iframe(内嵌页面) | sider(侧边子菜单容器)
      subMenu: [], // 如果menuType === group时必填;分组下嵌套子菜单数组,结构同当前menu
      // menuType === module && moduleType === custom 时必传
      customConfig: {
        path: "", // 自定义页面前端路由地址
      },
      // menuType === module && moduleType === iframe 时必传
      iframeConfig: {
        path: "", // iframe跳转外部页面完整URL地址
      },
      // menuType === module && moduleType === sider 时必传
      siderConfig: {
        menu: [], // 侧边栏子菜单数组,结构同外层menu单项;子菜单禁止再次配置moduleType: sider
      },
      // menuType === module && moduleType === schema 时必传
      schemeConfig: {
        /**
         * 遵循RESTful API规范,接口约定:
         * 【GET】 /xxx/list 列表查询
         * 【GET】 /xxx/:id 单条详情
         * 【POST】 /xxx 新增数据
         * 【PUT】 /xxx/:id 编辑修改
         * 【DELETE】 /xxx/:id 删除数据
         */
        api: "", // CRUD接口基础路由前缀
        // 表单/表格/搜索通用数据字段描述schema
        schema: {
          type: "object",
          properties: {
            ["key"]: {
              type: "", // 字段类型
              label: "", // 字段名称
              // ...标准schema配置

              // 字段在表格中的表现,不配置tableOption代表字段不在表格中渲染
              tableOption: {
                uiTableColumnConfig: {}, // ui组件的表格列props配置
                visible: true, // 字段是否在表格中渲染显示;仅显式配置false时隐藏(定义该开关的意义是考虑到DSL继承覆盖的问题)
                toFixed: 2, // 数字字段小数保留位数,仅数字类型生效
                translate: true, // 字段是否进行翻译
                translateMap: {}, // 翻译的map
                showWay: "image", // 展现形式:image  不设置默认原数据
              },
              // 搜索栏表单配置,缺失该节点则此字段不渲染到搜索区
              searchOption: {
                uiComponentConfig: {}, // 表单控件配置
                comType: "", // 搜索组件类型枚举:input | select | dynamicSelect | dateRangePicker
                enumList: [], // 如果comType === select时,需要传enumList
                visible: true, // 字段是否在表格中渲染显示;仅显式配置false时隐藏(定义该开关的意义是考虑到DSL集成覆盖的问题)
                default: "", // 默认值
                api: "", // comType === dynamicSelect时必填,下拉选项数据请求接口
              },
              "[comName]Option": {
                uiComponentConfig: {}, // 表单控件配置
                comType: "", // 搜索组件类型枚举:input | select | dynamicSelect | dateRangePicker
                enumList: [], // 如果comType === select时,需要传enumList
                visible: true, // 字段是否在表格中渲染显示;仅显式配置false时隐藏(定义该开关的意义是考虑到DSL集成覆盖的问题)
                default: "", // 默认值
                disabled: true, // 是否禁用
                api: "", // comType === dynamicSelect时必填,下拉选项数据请求接口
              },
              ...{}, // schema扩展自定义字段属性,按需拓展
            },
            ...{},
          },
          required: [], // 会注入到多option中: required: true/false
        },
        // 表格区域整体UI渲染配置
        tableConfig: {
          headerButtons: [
            // 表格顶部操作按钮组
            {
              label: "", // 按钮展示文字
              eventKey: "", // 按钮绑定事件唯一标识,前端匹配对应事件逻辑
              eventOption: {
                // 当eventKey === remove时,必传
                params: {
                  paramsKey: "固定值 | schema::[tableKey]", // 参数取值规则,固定格式schema::字段名,代表取当前行schema字段值
                },
                // 当eventKey === showComponent时,需要传
                comName: "",
              },
              uiButtonConfig: {}, // 透传Button组件属性
            },
            ...{},
          ],
          rowButtons: [
            // 表格每行右侧操作按钮组
            {
              label: "", // 按钮展示文字
              eventKey: "", // 按钮绑定事件唯一标识
              eventOption: {}, // 行按钮事件参数配置,格式同headerButtons.eventOption
              uiButtonConfig: {}, // 透传Button组件属性
            },
            ...{},
          ],
        },
        searchConfig: {}, // 搜索栏全局拓展配置,可自定义搜索按钮、布局、默认查询参数等
        componentConfig: {
          ["comName"]: {
            // 组件的配置项,支持用户自定义拓展
          },
          // 内置组件
          createForm: {
            title: "新增",
            showOkButton: true,
            okText: "确定",
            showCancelButton: true,
            cancelText: "取消",
            width: 500,
            eventKey: "loadTableList",
          },
          editForm: {
            title: "编辑",
            showOkButton: true,
            okText: "确定",
            showCancelButton: true,
            cancelText: "取消",
            width: 500,
            eventKey: "loadTableList",
            mainKey: "id",
          },
          detailForm: {
            title: "查看",
            width: 500,
            mainKey: "id",
          },
        }, // 动态组件配置
      },
    },
  ],
};

安装

pnpm add @slice_cy/mint-core

快速开始

const { start } = require("@slice_cy/mint-core");

const app = start({
  name: "my-app",
  homePage: "/view/dashboard",
  noAuthDirectPath: "/view/auth/login",
});

核心能力

BFF Server

  • 静态资源返回 — 内置静态文件服务
  • 页面渲染 — 服务端渲染 + Vue 客户端实例化
  • API 接口 — 可作为中后台 API 或 BFF 转发层
  • 数据隔离 — 通过 project_key 路由参数实现多中台系统数据隔离

加载器系统

框架按以下顺序自动加载模块:

| 加载器 | 职责 | |--------|------| | config | 加载 config/ 下的应用配置 | | extend | 加载 app/extend/ 扩展(数据库、日志、工具函数) | | service | 加载 app/service/ 服务层 | | middleware | 加载 app/middleware/ 中间件 | | router-schema | 加载 app/router-schema/ 路由参数校验 | | controller | 加载 app/controller/ 控制器 | | router | 加载 app/router/ 路由 |

Schema 驱动的 DSL 中后台引擎

模型定义(model/*.js)→ 模型加载器合并 → 项目 API 输出 DSL 配置 → 前端 Schema 解析引擎 → Widget 组件渲染

内置四种菜单类型:

  • schema — Schema 驱动的标准 CRUD 页面(搜索栏、数据表格、动态组件)
  • sider — 左侧子菜单 + 右侧内容区
  • iframe — 嵌入外部页面
  • custom — 完全由业务自定义的 Vue 页面

内建前端

  • Vue 3 + Vue Router + Pinia
  • Ant Design Vue 4.x
  • 通用 Widget 组件(schema-tableschema-search-barschema-form
  • 事件调度系统,保持组件松散耦合

导出 API

const { start, Controller, Service } = require("@slice_cy/mint-core");

start(options)          // 启动应用
Controller.Base         // 基础控制器基类
Service.Base            // 基础服务基类

详情

具体使用请参考 Mint 框架文档