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/config-vue

v0.0.2

Published

Vue 3 adapter for LDesign configuration

Readme

@composy/config-vue

审计增强摘要

  • 默认每个 Vue App 使用独立的 manager;显式传入 manager 时才共享,且外部 manager 不会由插件销毁。
  • App 卸载时自动恢复插件持有的 $ldesignConfig/$config,并支持 globalPropertyConflict: 'override' 显式覆盖宿主属性。
  • 如果宿主 App 在注入阶段抛错,插件会回滚全局属性并销毁插件拥有的 manager;显式传入的外部 manager 不会被误销毁。
  • composable 订阅绑定 Vue scope 生命周期,避免组件销毁后残留监听器;其余校验、持久化和错误隔离语义与 core 保持一致。

@composy/config-core 的 Vue 3 适配包。它不重复实现配置管理,只把 core 的 ConfigManager 接入 Vue 的 plugin、provide/inject 与 composables。

能力

  • createConfigVuePlugin():安装配置 manager,并注入 $ldesignConfig。
  • useConfig():读取、写入、派生更新单个配置项。
  • useAllConfig():响应式读取完整配置快照。
  • useConfigBatch():复用 core 的 batch()、update() 和合并策略。
  • useConfigHistory()、useConfigStats()、useConfigVersion():读取运行状态。
  • useConfigPersistence()、useConfigValidator():封装持久化和校验场景。
  • 共享 runtime bridge:一个 ConfigManager 在有 Vue 订阅者时才注册一次 core listener,最后一个订阅者释放后自动解绑。

安装

pnpm add @composy/config-vue @composy/config-core vue

Vue Plugin

import { createApp } from 'vue'
import { createConfigVuePlugin } from '@composy/config-vue'

const app = createApp(App)

app.use(createConfigVuePlugin({
  initial: {
    api: { timeout: 5000 },
    ui: { theme: 'light' },
  },
  maxHistorySize: 50,
}))

复用已有 manager:

import { ConfigManager } from '@composy/config-core'
import { createConfigVuePlugin } from '@composy/config-vue'

const manager = new ConfigManager({
  initial: { ui: { theme: 'light' } },
})

app.use(createConfigVuePlugin({ manager }))

Composable

import { useConfig } from '@composy/config-vue'

const theme = useConfig<'light' | 'dark'>('ui.theme', 'light')

theme.set('dark')

theme.update(value => value === 'dark' ? 'light' : 'dark')

批量更新:

import { useConfigBatch } from '@composy/config-vue'

const configBatch = useConfigBatch()

configBatch.batchUpdate({
  'api.retry': value => Number(value ?? 0) + 1,
  'ui.density': () => 'compact',
})

适配边界

  • 新增核心配置能力时,先在 @composy/config-core 实现。
  • Vue 侧只负责响应式值、生命周期、注入和 Engine/Vue plugin 兼容。
  • 不在 composable 中直接复制路径、合并、历史或校验算法。
  • 若新增 composable,需要优先复用 useConfigRuntime(),避免每个 composable 都直接监听 manager。

构建与验证

本包固定使用 @composy/builder 的 rolldown bundler,并将 vue 与 @composy/config-core 作为运行时外部依赖。build 会生成 dist/(UMD 与真实压缩的 index.min.js)、es/(ESM 与声明)、esm/(保留模块结构的 ESM)和 lib/(CommonJS 与声明);随后归一化声明文件和 lib/package.json。

pnpm --dir packages/config/packages/vue run typecheck
pnpm --dir packages/config/packages/vue run lint:check
pnpm --dir packages/config/packages/vue run test:run
pnpm --dir packages/config/packages/vue run build

# 检查 package.json 全部入口是否有对应产物
node --experimental-strip-types scripts/index.ts workspace:check-package-outputs --cwd packages/config --target vue

本包 ESLint 与 TypeScript 的权威配置位于 .ldesign/;包根配置文件仅作为兼容 shim。