Compare commits

...

1 Commits

Author SHA1 Message Date
Connor Byrne
19ca845e5b docs(litegraph): mark subgraph building blocks as @internal
Per AUDIT-LG.9 §subgraph correction, these subgraph cluster exports
are internal building blocks with no production importers — they leak
into the published @comfyorg/extension-api ABI but should not be part
of the public surface:

- EmptySubgraphInput, EmptySubgraphOutput
- SubgraphSlot (SubgraphSlotBase.ts), SubgraphIONodeBase
- PromotedWidgetViewManager
- subgraphDeduplication (deduplicateSubgraphNodeIds, topologicalSortSubgraphs)
- subgraphUtils (splitPositionables, getBoundaryLinks, multiClone,
  groupResolvedByOutput, mapSubgraphInputsAndLinks,
  mapSubgraphOutputsAndLinks, getDirectSubgraphIds, findUsedSubgraphIds,
  isSubgraphInput, isSubgraphOutput, isNodeSlot)
- SubgraphOutput

Add @internal JSDoc tags so TypeDoc (with excludeInternal: true)
strips them from the published ABI. Preserves SubgraphNode, Subgraph,
SubgraphInput, ExecutableNodeDTO, and subgraphTest/createTestSubgraph
test fixtures — those are external-facing.
2026-05-13 16:22:34 -07:00
8 changed files with 36 additions and 1 deletions

View File

@@ -10,6 +10,8 @@ import type { SubgraphInputNode } from './SubgraphInputNode'
/**
* A virtual slot that simply creates a new input slot when connected to.
*
* @internal
*/
export class EmptySubgraphInput extends SubgraphInput {
declare parent: SubgraphInputNode

View File

@@ -10,6 +10,8 @@ import type { SubgraphOutputNode } from './SubgraphOutputNode'
/**
* A virtual slot that simply creates a new output slot when connected to.
*
* @internal
*/
export class EmptySubgraphOutput extends SubgraphOutput {
declare parent: SubgraphOutputNode

View File

@@ -9,6 +9,8 @@ type ViewManagerEntry = PromotedWidgetSource & {
*
* Keeps object identity stable by key while preserving the current
* promotion order and deduplicating duplicate entries by first occurrence.
*
* @internal
*/
export class PromotedWidgetViewManager<TView> {
private viewCache = new Map<string, TView>()

View File

@@ -29,6 +29,7 @@ import type { Subgraph } from './Subgraph'
import type { SubgraphInput } from './SubgraphInput'
import type { SubgraphOutput } from './SubgraphOutput'
/** @internal */
export abstract class SubgraphIONodeBase<
TSlot extends SubgraphInput | SubgraphOutput
>

View File

@@ -27,6 +27,8 @@ import { isNodeSlot, isSubgraphInput } from './subgraphUtils'
* You have "Subgraph Outputs", because they go from inside the subgraph and out, but links to them come from "node outputs".
*
* Functionally, however, when editing a subgraph, that "subgraph output" is the "target" or "input side" of a link.
*
* @internal
*/
export class SubgraphOutput extends SubgraphSlot {
declare parent: SubgraphOutputNode

View File

@@ -37,7 +37,11 @@ interface SubgraphSlotDrawOptions {
editorAlpha?: number
}
/** Shared base class for the slots used on Subgraph . */
/**
* Shared base class for the slots used on Subgraph .
*
* @internal
*/
export abstract class SubgraphSlot
extends SlotBase
implements SubgraphIO, Hoverable, Serialisable<SubgraphIO>

View File

@@ -28,6 +28,8 @@ interface DeduplicationResult {
* @param reservedNodeIds - Node IDs already in use by root-level nodes
* @param state - Graph state containing the `lastNodeId` counter (mutated)
* @param rootNodes - Optional root-level nodes with proxyWidgets to patch
*
* @internal
*/
export function deduplicateSubgraphNodeIds(
subgraphs: ExportedSubgraph[],
@@ -148,6 +150,8 @@ function patchPromotedWidgets(
*
* Falls back to the original order if no reordering is needed or if the
* dependency graph contains cycles.
*
* @internal
*/
export function topologicalSortSubgraphs(
subgraphs: ExportedSubgraph[]

View File

@@ -37,6 +37,7 @@ interface FilteredItems {
unknown: Set<Positionable>
}
/** @internal */
export function splitPositionables(
items: Iterable<Positionable>
): FilteredItems {
@@ -89,6 +90,7 @@ interface BoundaryLinks {
boundaryOutputLinks: LLink[]
}
/** @internal */
export function getBoundaryLinks(
graph: LGraph,
items: Set<Positionable>
@@ -213,6 +215,7 @@ export function getBoundaryLinks(
}
}
/** @internal */
export function multiClone(nodes: Iterable<LGraphNode>): ISerialisedNode[] {
const clonedNodes: ISerialisedNode[] = []
@@ -240,6 +243,8 @@ export function multiClone(nodes: Iterable<LGraphNode>): ISerialisedNode[] {
* Groups resolved connections by output object. If the output is nullish, the connection will be in its own group.
* @param resolvedConnections The resolved connections to group
* @returns A map of grouped connections.
*
* @internal
*/
export function groupResolvedByOutput(
resolvedConnections: ResolvedConnection[]
@@ -278,6 +283,7 @@ function mapReroutes(
return lastId
}
/** @internal */
export function mapSubgraphInputsAndLinks(
resolvedInputLinks: ResolvedConnection[],
links: SerialisableLLink[],
@@ -358,6 +364,8 @@ export function mapSubgraphInputsAndLinks(
* @param resolvedOutputLinks The resolved output links.
* @param links The links to add to the subgraph.
* @returns The subgraph output slots.
*
* @internal
*/
export function mapSubgraphOutputsAndLinks(
resolvedOutputLinks: ResolvedConnection[],
@@ -436,6 +444,8 @@ export function mapSubgraphOutputsAndLinks(
* Collects all subgraph IDs used directly in a single graph (non-recursive).
* @param graph The graph to check for subgraph nodes
* @returns Set of subgraph IDs used in this graph
*
* @internal
*/
export function getDirectSubgraphIds(graph: GraphOrSubgraph): Set<SubgraphId> {
const subgraphIds = new Set<SubgraphId>()
@@ -454,6 +464,8 @@ export function getDirectSubgraphIds(graph: GraphOrSubgraph): Set<SubgraphId> {
* @param rootGraph The graph to start from
* @param subgraphRegistry Map of all available subgraphs
* @returns Set of all subgraph IDs found
*
* @internal
*/
export function findUsedSubgraphIds(
rootGraph: GraphOrSubgraph,
@@ -484,6 +496,8 @@ export function findUsedSubgraphIds(
* Type guard to check if a slot is a SubgraphInput.
* @param slot The slot to check
* @returns true if the slot is a SubgraphInput
*
* @internal
*/
export function isSubgraphInput(slot: unknown): slot is SubgraphInput {
return (
@@ -498,6 +512,8 @@ export function isSubgraphInput(slot: unknown): slot is SubgraphInput {
* Type guard to check if a slot is a SubgraphOutput.
* @param slot The slot to check
* @returns true if the slot is a SubgraphOutput
*
* @internal
*/
export function isSubgraphOutput(slot: unknown): slot is SubgraphOutput {
return (
@@ -512,6 +528,8 @@ export function isSubgraphOutput(slot: unknown): slot is SubgraphOutput {
* Type guard to check if a slot is a regular node slot (INodeInputSlot or INodeOutputSlot).
* @param slot The slot to check
* @returns true if the slot is a regular node slot
*
* @internal
*/
export function isNodeSlot(
slot: unknown