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

@viewfly/core

v3.0.6

Published

Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.

Readme

@viewfly/core

Languages: English

Viewfly 的内核包:函数组件、JSX、响应式与 signalwatch、生命周期、inject 与 IoC 相关 API、以及 withMark 等与 UI 逻辑直接相关的入口均由此包提供。

在浏览器里挂载应用请使用 @viewfly/platform-browsercreateApp(其内部使用本包提供的应用模型)。


安装

npm install @viewfly/core

本包依赖 reflect-metadata。正常从 @viewfly/core 的主入口导入时,会随模块加载一并初始化;若你的打包拆包方式导致依赖注入相关运行时异常,可在应用入口最先增加显式导入:

import 'reflect-metadata'

更稳妥的做法以当前安装版本随附的类型定义与官方文档(https://viewfly.org)为准。


JSX / TSX 配置

tsconfig.json 中启用 automatic JSX runtime,并把来源指向本包:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@viewfly/core"
  }
}

使用 Babel 时,将 @babel/preset-reactruntime: "automatic"importSource: "@viewfly/core" 对齐上述行为。


能力速览(面向使用者)

以下为日常开发中最常见的方向,具体类型与参数以类型定义和官网为准

| 方向 | 公开 API 与用法提示 | |------|---------------------| | 组件 | 函数组件:在 JSX 中当标签使用;配合生命周期钩子使用。 | | 生命周期 | onMountedonUpdatedonUnmounted 等(须在组件 setup 阶段调用)。 | | 响应式 | reactiveshallowReactivewatch 等(reactive 模块)。 | | signal / 派生 | createSignalcomputed 等(见 reactive 导出;具体符号以类型为准)。 | | 依赖注入 | 在组件内用 inject 解析 token;用 Injectable() 声明可注入类;用 withAnnotationcreateContext / createContextProvider 挂载 Provider;根应用上通过 createApp(...).provide(...)(由 @viewfly/platform-browser 提供)注册全局提供者。 | | 自定义 DOM 属性标记 | withMark(marks, setup):为组件渲染出的元素附加与 marks 同名的属性(常用于 scoped CSS 的 scopeId 等场景)。 |

说明:源码中可能存在标有 @internal 或未在官网文档化的符号,它们仅供框架内部或实验用途,不建议业务代码依赖;升级版本时也可能在无 semver 预告的情况下变更。


文档与示例

  • 官方文档https://viewfly.org(重点见安装、组件、响应式、依赖注入)。
  • 类型与注释:发布包中的 .d.ts 与源码注释可用于补充 API 细节。
  • 本仓库试跑:克隆仓库后使用 pnpm 安装依赖,在仓库根目录执行 pnpm dev 打开 playground。

License

MIT