From 9c99af47811b0070814996860b29c3ae9244b0a0 Mon Sep 17 00:00:00 2001 From: skycurtain Date: Mon, 10 Nov 2025 02:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1tracer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tracers.ts/commander/index.ts | 6 +++--- src/tracers.ts/tracers/array-tracer.ts | 4 ++-- src/tracers.ts/tracers/index.ts | 2 +- .../types/command/array-tracer-command.ts | 18 +++++++++--------- src/tracers.ts/types/command/index.ts | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/tracers.ts/commander/index.ts b/src/tracers.ts/commander/index.ts index de1b538..365fbc1 100644 --- a/src/tracers.ts/commander/index.ts +++ b/src/tracers.ts/commander/index.ts @@ -1,10 +1,10 @@ import type { TracerCommand } from "../types/command"; export class Commander { - private commands: TracerCommand[]; + private commands: TracerCommand[]; private constructor() { - this.commands = []; + this.commands = []; } private static instance: Commander | null = null; @@ -16,7 +16,7 @@ export class Commander { return this.instance; } - public command(command: TracerCommand) { + public command(command: TracerCommand) { this.commands.push(command); } diff --git a/src/tracers.ts/tracers/array-tracer.ts b/src/tracers.ts/tracers/array-tracer.ts index 30c6dc0..9e02749 100644 --- a/src/tracers.ts/tracers/array-tracer.ts +++ b/src/tracers.ts/tracers/array-tracer.ts @@ -41,9 +41,9 @@ export class ArrayTracer { }); } - public expand(size: number) {} + public extend(size: number) {} - public reduce(size: number) {} + public shrink(size: number) {} public pick(index: number) {} diff --git a/src/tracers.ts/tracers/index.ts b/src/tracers.ts/tracers/index.ts index c9bf137..f99b6e5 100644 --- a/src/tracers.ts/tracers/index.ts +++ b/src/tracers.ts/tracers/index.ts @@ -1 +1 @@ -export * from "./array-tracer"; \ No newline at end of file +export * from "./array-tracer"; diff --git a/src/tracers.ts/types/command/array-tracer-command.ts b/src/tracers.ts/types/command/array-tracer-command.ts index 2b066f1..fb91097 100644 --- a/src/tracers.ts/types/command/array-tracer-command.ts +++ b/src/tracers.ts/types/command/array-tracer-command.ts @@ -1,52 +1,52 @@ export type ArrayTracerDefineCommand = { - tracer: null; action: "define"; + tracer: null; params: { type: "ArrayTracer"; id: string; desc?: string }; }; export type ArrayTracerPresetCommand = { - tracer: string; action: "preset"; + tracer: string; params: T[]; }; export type ArrayTracerExtendCommand = { - tracer: string; action: "extend"; + tracer: string; params: { size: number }; }; export type ArrayTracerShrinkCommand = { - tracer: string; action: "shrink"; + tracer: string; params: { size: number }; }; export type ArrayTracerPickCommand = { - tracer: string; action: "pick"; + tracer: string; params: { index: number }; }; export type ArrayTracerDropCommand = { - tracer: string; action: "drop"; + tracer: string; params: { index: number }; }; export type ArrayTracerPatchCommand = { - tracer: string; action: "patch"; + tracer: string; params: { index: number; value: T }; }; export type ArrayTracerResetCommand = { - tracer: string; action: "reset"; + tracer: string; params: null; }; -export type ArrayTracerCommand = +export type ArrayTracerCommand = | ArrayTracerDefineCommand | ArrayTracerPresetCommand | ArrayTracerExtendCommand diff --git a/src/tracers.ts/types/command/index.ts b/src/tracers.ts/types/command/index.ts index d852989..69bb9df 100644 --- a/src/tracers.ts/types/command/index.ts +++ b/src/tracers.ts/types/command/index.ts @@ -2,4 +2,4 @@ import type { ArrayTracerCommand } from "./array-tracer-command"; export * from "./array-tracer-command"; -export type TracerCommand = ArrayTracerCommand +export type TracerCommand = ArrayTracerCommand;