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

@composy/engine-vue

v0.0.1

Published

Vue 3 adapter for LDesign Engine

Readme

@composy/engine-vue

@composy/engine-vue 是 LDesign Engine 的 Vue 3 适配包。它建立在 @composy/engine-core 之上,只处理 Vue 应用挂载、依赖注入、组合式 API、组件和 Vue 生态可选集成。

适配层边界

  • 复用 core 的插件、生命周期、状态、事件、中间件、配置、错误处理和性能监控。
  • 本包只增加 Vue 相关能力:createApp()mount()unmount()provide/inject、组件、组合式 API 和 Vue DevTools。
  • router/i18n 是可选集成,未安装对应包时不应影响基础引擎能力。

主要能力

  • createVueEngine() / VueEngine:创建并管理 Vue 应用级引擎。
  • EngineProvider:在组件树中提供引擎上下文。
  • ErrorBoundary:Vue 组件错误边界。
  • useEngine()useEngineState()useEngineEvent():访问 core 引擎、状态和事件。
  • useAsyncState()useComputedState()useDebouncedState()usePersistentState():Vue 化状态工具。
  • usePluginApi()useMiddleware()usePerformance()useTimeTravel():复用 core 的运行时能力。
  • createRouterPlugin()createI18nPlugin():可选生态桥接。
  • createVueDevtoolsAdapter():将 core 状态、事件和时间旅行接入 Vue DevTools。

快速开始

import { createVueEngine } from '@composy/engine-vue'
import App from './App.vue'

const engine = createVueEngine({
  name: 'ldesign-vue-app',
  debug: import.meta.env.DEV,
  app: {
    rootComponent: App,
    rootProps: {
      tenant: 'demo',
    },
  },
})

await engine.mount('#app')

组件内使用:

<script setup lang="ts">
import { useEngine, useEngineState } from '@composy/engine-vue'

const engine = useEngine()
const ready = useEngineState<boolean>('ready', false)

function markReady(): void {
  engine.events.emit('app:ready')
  ready.value = true
}
</script>

<template>
  <button type="button" @click="markReady">
    {{ ready ? 'ready' : 'booting' }}
  </button>
</template>

目录结构

src/
  components/    # EngineProvider、ErrorBoundary
  composables/   # useEngine/useAsyncState/usePerformance 等
  config/        # Vue 应用配置类型与 defineConfig
  devtools/      # Vue DevTools 桥接
  engine/        # VueEngine
  plugins/       # router/i18n 等可选插件
  style/         # 组件样式
  index.ts       # 统一公开入口

构建产物

dist/  # UMD/browser 产物、CSS 和 index.min.js
es/    # ESM 主产物、CSS 和 .d.ts
esm/   # 保留模块结构的 ESM/Less 产物
lib/   # CommonJS 产物

样式入口:

  • @composy/engine-vue/index.css
  • @composy/engine-vue/index.min.css

验证命令

pnpm run lint:check
pnpm run type-check
pnpm run test
pnpm run test:performance
pnpm run build

从工作区根目录可运行:

pnpm run build:vue
pnpm run playground:dev:vue
pnpm run playground:build:vue
pnpm run outputs:check

维护规则

  • Vue 层新增能力前,先确认是否能在 @composy/engine-core 中实现为框架无关 API。
  • Vue composable 只负责把 core 状态和生命周期映射成 refcomputedwatch 等 Vue 习惯用法。
  • Vue 插件只负责安装到 Vue App 或向 core 插件上下文补充 Vue 信息,不应改变 core 插件协议。
  • 测试优先覆盖源码入口,不依赖构建产物。