Knip: More Pruning (#5374)

* knip: Don't ignore exports that are only used within a given file

* knip: More pruning after rebase

* knip: Vite plugin config fix

* knip: vitest plugin config

* knip: Playwright config, remove unnecessary ignores.

* knip: Simplify project file enumeration.

* knip: simplify the config file patterns ?(.optional_segment)

* knip: tailwind v4 fix

* knip: A little more, explain some of the deps.
Should be good for this PR.

* knip: remove unused disabling of classMembers.
It's opt-in, which we should probably do.

* knip: floating comments
We should probably delete _one_ of these parallell trees, right?

* knip: Add additional entrypoints

* knip: Restore UserData that's exposed via the types for now.

* knip: Add as an entry file even though knip says it's not necessary.

* knip: re-export functions used by nodes (h/t @christian-byrne)
This commit is contained in:
Alexander Brown
2025-09-07 01:10:32 -07:00
committed by GitHub
parent 5fa3b83918
commit f6405e9125
88 changed files with 210 additions and 284 deletions

View File

@@ -318,7 +318,7 @@ const zDeviceStats = z.object({
torch_vram_free: z.number()
})
export const zSystemStats = z.object({
const zSystemStats = z.object({
system: z.object({
os: z.string(),
python_version: z.string(),

View File

@@ -100,7 +100,7 @@ export const paletteSchema = z
})
.passthrough()
export const completedPaletteSchema = z
const completedPaletteSchema = z
.object({
id: z.string(),
name: z.string(),

View File

@@ -5,9 +5,9 @@ import { fromZodError } from 'zod-validation-error'
// innerNode.id = `${this.node.id}:${i}`
// Remove it after GroupNode is redesigned.
export const zNodeId = z.union([z.number().int(), z.string()])
export const zNodeInputName = z.string()
const zNodeInputName = z.string()
export type NodeId = z.infer<typeof zNodeId>
export const zSlotIndex = z.union([
const zSlotIndex = z.union([
z.number().int(),
z
.string()
@@ -20,7 +20,7 @@ export const zSlotIndex = z.union([
// TODO: Investigate usage of array and number as data type usage in custom nodes.
// Known usage:
// - https://github.com/rgthree/rgthree-comfy Context Big node is using array as type.
export const zDataType = z.union([z.string(), z.array(z.string()), z.number()])
const zDataType = z.union([z.string(), z.array(z.string()), z.number()])
const zVector2 = z.union([
z
@@ -214,7 +214,7 @@ const zComfyNode = z
})
.passthrough()
export const zSubgraphIO = zNodeInput.extend({
const zSubgraphIO = zNodeInput.extend({
/** Slot ID (internal; never changes once instantiated). */
id: z.string().uuid(),
/** The data type this slot uses. Unlike nodes, this does not support legacy numeric types. */
@@ -274,11 +274,11 @@ const zExtra = z
})
.passthrough()
export const zGraphDefinitions = z.object({
const zGraphDefinitions = z.object({
subgraphs: z.lazy(() => z.array(zSubgraphDefinition))
})
export const zBaseExportableGraph = z.object({
const zBaseExportableGraph = z.object({
/** Unique graph ID. Automatically generated if not provided. */
id: z.string().uuid().optional(),
revision: z.number().optional(),
@@ -371,13 +371,13 @@ export const zComfyWorkflow1 = zBaseExportableGraph
})
.passthrough()
export const zExportedSubgraphIONode = z.object({
const zExportedSubgraphIONode = z.object({
id: zNodeId,
bounding: z.tuple([z.number(), z.number(), z.number(), z.number()]),
pinned: z.boolean().optional()
})
export const zExposedWidget = z.object({
const zExposedWidget = z.object({
id: z.string(),
name: z.string()
})
@@ -414,7 +414,7 @@ interface SubgraphDefinitionBase<
}
/** A subgraph definition `worfklow.definitions.subgraphs` */
export const zSubgraphDefinition = zComfyWorkflow1
const zSubgraphDefinition = zComfyWorkflow1
.extend({
/** Unique graph ID. Automatically generated if not provided. */
id: z.string().uuid(),
@@ -455,7 +455,7 @@ export type WorkflowJSON04 = z.infer<typeof zComfyWorkflow>
export type ComfyWorkflowJSON = z.infer<
typeof zComfyWorkflow | typeof zComfyWorkflow1
>
export type SubgraphDefinition = z.infer<typeof zSubgraphDefinition>
type SubgraphDefinition = z.infer<typeof zSubgraphDefinition>
/**
* Type guard to check if an object is a SubgraphDefinition.
@@ -522,5 +522,5 @@ const zNodeData = z.object({
})
})
export const zComfyApiWorkflow = z.record(zNodeId, zNodeData)
const zComfyApiWorkflow = z.record(zNodeId, zNodeData)
export type ComfyApiWorkflow = z.infer<typeof zComfyApiWorkflow>

View File

@@ -1,7 +1,7 @@
import { z } from 'zod'
// KeyCombo schema
export const zKeyCombo = z.object({
const zKeyCombo = z.object({
key: z.string(),
ctrl: z.boolean().optional(),
alt: z.boolean().optional(),

View File

@@ -207,10 +207,10 @@ export const zComfyNodeDef = z.object({
})
// Export types
export type IntInputSpec = z.infer<typeof zIntInputSpec>
export type FloatInputSpec = z.infer<typeof zFloatInputSpec>
export type BooleanInputSpec = z.infer<typeof zBooleanInputSpec>
export type StringInputSpec = z.infer<typeof zStringInputSpec>
type IntInputSpec = z.infer<typeof zIntInputSpec>
type FloatInputSpec = z.infer<typeof zFloatInputSpec>
type BooleanInputSpec = z.infer<typeof zBooleanInputSpec>
type StringInputSpec = z.infer<typeof zStringInputSpec>
export type ComboInputSpec = z.infer<typeof zComboInputSpec>
export type ColorInputSpec = z.infer<typeof zColorInputSpec>
export type FileUploadInputSpec = z.infer<typeof zFileUploadInputSpec>

View File

@@ -34,7 +34,7 @@ export const zBaseInputOptions = z
})
.passthrough()
export const zNumericInputOptions = zBaseInputOptions.extend({
const zNumericInputOptions = zBaseInputOptions.extend({
min: z.number().optional(),
max: z.number().optional(),
step: z.number().optional(),