@fluixi/jsx

中文文档
1.0.0-alpha.108发布于 2026/11/07MITTypeScriptESM + CJS零依赖近 30 天下载 6067

JSX runtime types and factory for Fluixi — fine-grained, no virtual DOM.

原始使用文档
文档目录8 节
  1. Installation
  2. Setup
  3. What it exports
  4. Where things actually live
  5. Typing an element
  6. Refs
  7. License
  8. Links

Fluixi

@fluixi/jsx

The JSX runtime and types Fluixi compiles against.

License: MIT TypeScript npm JSX


This is the jsxImportSource for Fluixi: the jsx/jsxs/Fragment factories, the element helpers, and the JSX type definitions that give intrinsic elements and their attributes real types.

It is a small package with a narrow job. Most Fluixi code never imports it: the compiler turns JSX into direct DOM calls, so the factories are a fallback for anything it did not compile. Components, control flow, rendering and reactivity live elsewhere; see Where things actually live.

Installation

pnpm add @fluixi/jsx @fluixi/dom

Setup

Point TypeScript at this package and let the Vite plugin compile:

{
  "compilerOptions": {
    "jsx": "preserve",
    "jsxImportSource": "@fluixi/jsx"
  }
}
// vite.config.ts
import { fluixi } from '@fluixi/vite-plugin';

export default { plugins: [fluixi()] };

npm create fluixi wires both for you.

What it exports

ExportPurpose
jsx, jsxs, FragmentThe automatic-runtime factories
jsxDEVThe development factory
createElement, cloneElement, isValidElementClassic element helpers
createRef, forwardRefRefs
renderToStringString rendering
mergePropsMerge prop objects, keeping getters live
delegateEventsRegister delegated event types
createReactiveJSX, jsxComponent, defineComponent, memo, hydrateLower-level integration seams

Types: JSXElement, JSXComponent, JSXProps, RefCallback, RefObject, plus the global JSX namespace with intrinsic elements.

Where things actually live

This package is a runtime, not a framework façade. Reaching for it directly is usually a sign you want one of these instead:

You wantImport from
Show, For, Index, Switch, Match, Portal, Dynamic, ErrorBoundary@fluixi/core or @fluixi/dom
render, hydrate (app entry)@fluixi/core
signal, memo, effect, store@fluixi/reactive
Server rendering@fluixi/server, or @fluixi/start for the whole thing
The JSX → DOM compile@fluixi/compiler, @fluixi/vite-plugin

Typing an element

The JSX namespace types intrinsic elements and their attributes, so a misspelled attribute or a wrong event handler is an error rather than a silent no-op:

const el = <input type="text" onInput={(e) => console.log(e.currentTarget.value)} />;
//                            ^ typed as InputEvent on HTMLInputElement

Reactive attributes accept an accessor as well as a value, which is what lets the compiler wire a binding without changing your types:

const count = $signal(0);
<div title={() => `count: ${count()}`} data-count={count()} />;

Refs

import { createRef } from '@fluixi/jsx';

function Field() {
  const input = createRef<HTMLInputElement>();
  onMount(() => input.current?.focus());
  return <input ref={input} />;
}

A callback ref works too, ref={(el) => ...}, and both forms are typed bivariantly, so a component that takes HTMLElement accepts a more specific ref.

License

MIT

版本与发布记录

@fluixi/jsx 共发布 56 个版本,首次发布于 2026/07/10;过去 12 个月发布了 56 个版本。

版本发布日期距今
1.0.0-alpha.108latest2026/11/078 天前
1.0.0-alpha.1072026/11/0511 天前
1.0.0-alpha.1062026/11/0213 天前
1.0.0-alpha.1052026/11/0115 天前
1.0.0-alpha.1042026/11/0115 天前
1.0.0-alpha.1032026/10/2620 天前

关于 @fluixi/jsx 的常见问题

@fluixi/jsx 是什么?

JSX runtime types and factory for Fluixi — fine-grained, no virtual DOM.

如何安装 @fluixi/jsx?

在项目目录运行 npm install @fluixi/jsx,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fluixi/dom(^1.0.0-alpha.108)、@fluixi/reactive(^1.0.0-alpha.108)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fluixi/jsx 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fluixi/jsx 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fluixi/jsx 可以商用吗?

@fluixi/jsx 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fluixi/jsx 的下载量有多少?

根据 npm 官方下载统计,@fluixi/jsx 在 2026/10/15 – 2026/11/13 这 30 天内被下载 6,067 次,日均约 202 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fluixi/jsx 还在维护吗?

最新版本 1.0.0-alpha.108 发布于 2026/11/07(8 天前);至今共发布 56 个版本,其中过去 12 个月发布了 56 个;首次发布于 2026/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。