@comfyorg/litegraph

中文文档
0.17.2发布于 2025/08/06MITTypeScriptESM + CJS零依赖近 30 天下载 1.3万

A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录15 节
  1. Features
  2. Installation
  3. How to code a new Node type
  4. Server side
  5. Projects using it
  6. ComfyUI
  7. Projects using the original litegraph.js
  8. webglstudio.org
  9. MOI Elephant
  10. Mynodes
  11. Feedback
  12. Releasing
  13. Pre-release
  14. Contributors
  15. Contributors (pre-fork)

@ComfyOrg/litegraph

This is the litegraph version used in ComfyUI_frontend.

It is a fork of the original litegraph.js. Some APIs may by unchanged, however it is largely incompatible with the original.

Some early highlights:

Install

npm i @comfyorg/litegraph

litegraph.js

A TypeScript library to create graphs in the browser similar to Unreal Blueprints.

Description of the original litegraph.js

A library in Javascript to create graphs in the browser similar to Unreal Blueprints. Nodes can be programmed easily and it includes an editor to construct and tests the graphs.

It can be integrated easily in any existing web applications and graphs can be run without the need of the editor.

Node Graph

Features

  • Renders on Canvas2D (zoom in/out and panning, easy to render complex interfaces, can be used inside a WebGLTexture)
  • Easy to use editor (searchbox, keyboard shortcuts, multiple selection, context menu, ...)
  • Optimized to support hundreds of nodes per graph (on editor but also on execution)
  • Customizable theme (colors, shapes, background)
  • Callbacks to personalize every action/drawing/event of nodes
  • Graphs can be executed in NodeJS
  • Highly customizable nodes (color, shape, widgets, custom rendering)
  • Easy to integrate in any JS application (one single file, no dependencies)
  • Typescript support

Installation

You can install it using npm

npm install @comfyorg/litegraph

How to code a new Node type

Here is an example of how to build a node that sums two inputs:

import { LiteGraph, LGraphNode } from "./litegraph"

class MyAddNode extends LGraphNode {
  // Name to show
  title = "Sum"

  constructor() {
    this.addInput("A", "number")
    this.addInput("B", "number")
    this.addOutput("A+B", "number")
    this.properties.precision = 1
  }

  // Function to call when the node is executed
  onExecute() {
    var A = this.getInputData(0)
    if (A === undefined) A = 0
    var B = this.getInputData(1)
    if (B === undefined) B = 0
    this.setOutputData(0, A + B)
  }
}

// Register the node type
LiteGraph.registerNodeType("basic/sum", MyAddNode)

Server side

It also works server-side using NodeJS although some nodes do not work in server (audio, graphics, input, etc).

import { LiteGraph, LGraph } from "./litegraph.js"

const graph = new LGraph()

const firstNode = LiteGraph.createNode("basic/sum")
graph.add(firstNode)

const secondNode = LiteGraph.createNode("basic/sum")
graph.add(secondNode)

firstNode.connect(0, secondNode, 1)

graph.start()

Projects using it

ComfyUI

ComfyUI default workflow

Projects using the original litegraph.js

Click to expand

webglstudio.org

WebGLStudio

MOI Elephant

MOI Elephant

Mynodes

MyNodes

Feedback

Please open an issue on the GitHub repo.

Development

Litegraph has no runtime dependencies. The build tooling has been tested on Node.JS 20.18.x

Releasing

Use GitHub actions to release normal versions.

  1. Run the Release a New Version action, selecting the version incrment type
  2. Merge the resultion PR
  3. A GitHub release is automatically published on merge

Pre-release

The action directly translates Version increment type to the npm version command. Pre-release ID (suffix) is the option for the --preid argument.

e.g. Use prerelease increment type to automatically bump the patch version and create a pre-release version. Subsequent runs of prerelease will update the prerelease version only. Use patch when ready to remove the pre-release suffix.

Contributors

You can find the current list of contributors on GitHub.

Contributors (pre-fork)

  • atlasan
  • kriffe
  • rappestad
  • InventivetalentDev
  • NateScarlet
  • coderofsalvation
  • ilyabesk
  • gausszhou

版本与发布记录

@comfyorg/litegraph 共发布 290 个版本,首次发布于 2024/07/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.17.2latest2025/08/061.3 年前
0.17.12025/08/051.3 年前
0.17.02025/08/031.3 年前
0.16.202025/07/301.3 年前
0.16.192025/07/291.3 年前
0.16.182025/07/271.3 年前

其他发布通道:sub → 0.16.0-sub.2,subgraph → 0.16.0-sub.19。

关于 @comfyorg/litegraph 的常见问题

@comfyorg/litegraph 是什么?

A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @comfyorg/litegraph?

在项目目录运行 npm install @comfyorg/litegraph,或使用 pnpm add / yarn add / bun add。

@comfyorg/litegraph 支持 TypeScript 吗?

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

@comfyorg/litegraph 支持 ESM 还是 CommonJS?

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

@comfyorg/litegraph 可以商用吗?

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

@comfyorg/litegraph 的下载量有多少?

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

@comfyorg/litegraph 还在维护吗?

最新版本 0.17.2 发布于 2025/08/06(1.3 年前);至今共发布 290 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/07/06。作者已将其标记为弃用,新项目建议寻找替代方案。