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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cfp-studio/core

v1.0.3

Published

CFP Studio 的核心运行时与服务编排包,负责组件/Story 静态分析、预览服务、插件架构、Vite 集成、API 路由、依赖管理等。是整个 monorepo 的中枢和 glue 层。

Readme

@cfp-studio/core

CFP Studio 的核心运行时与服务编排包,负责组件/Story 静态分析、预览服务、插件架构、Vite 集成、API 路由、依赖管理等。是整个 monorepo 的中枢和 glue 层。


架构与工作原理

1. 预览服务与中间件

  • 启动 Express/Vite 组合服务,自动托管前端产物与 API。
  • 支持自定义中间件(如 inspector、静态资源、CORS、API 路由等)。
  • 通过 Previewer 类统一管理服务生命周期、端口、热重载、缓存等。

2. 插件化框架支持

  • 通过 FrameworkPluginFactory/FrameworkPlugin 接口,支持多框架(React/Vue/Svelte/Solid/Preact 等)插件热插拔。
  • 插件可自定义类型分析、依赖检测、Vite 配置、特殊文件处理等。
  • 自动检测项目依赖,动态选择兼容插件。

3. 组件/Story 静态分析

  • 集成 @cfp-studio/analyzer-api,支持 TS/JSX 组件、Story、属性、类型、propTypes 等静态分析。
  • 支持批量文件爬取、缓存、依赖追踪、增量分析。
  • 统一可预览 ID 生成与解析,便于前后端通信。

4. Vite 深度集成与虚拟文件

  • 内置多种 Vite 插件(如虚拟文件、CSS modules、inspector、public asset import、local eval 等)。
  • 支持虚拟文件系统(VFS),可动态生成/注入模块。
  • 自动处理 alias、tsconfig 路径、全局样式、热重载等。

5. API 路由与远程调用

  • 内置 ApiRouter,支持类型安全的 RPC 路由与分发。
  • 支持插件/服务注册自定义 RPC 端点。
  • 统一错误处理与日志。

6. 缓存与依赖管理

  • 自动管理缓存目录,支持多版本隔离。
  • 支持依赖包版本检测、动态加载、兼容性校验。

主要 API/模块

  • Previewer:预览服务主类
  • FrameworkPluginFactory/FrameworkPlugin:插件接口
  • crawlFiles/findFiles:批量文件爬取与查找
  • ApiRouter:RPC 路由
  • ViteManager:Vite 服务与插件集成
  • getCacheDir:缓存目录管理
  • extractPackageDependencies:依赖检测
  • toVitePath:路径工具

用法示例

import { Previewer, findCompatiblePlugin } from '@cfp-studio/core';
const plugin = await findCompatiblePlugin({ rootDir: '/project' });
const previewer = new Previewer({
  rootDir: '/project',
  frameworkPlugin: plugin,
  // ...其他参数
});
await previewer.start();

依赖

  • @cfp-studio/analyzer-api@cfp-studio/api@cfp-studio/config@cfp-studio/iframe@cfp-studio/middleware@cfp-studio/serializable-values@cfp-studio/type-analyzer@cfp-studio/vfs
  • expressvitepinofs-extraaxioszod

构建

pnpm build

许可证

MIT