From beac8e222bcef19ddfff61616cb1d4b2a27aca7c Mon Sep 17 00:00:00 2001 From: skycurtain Date: Mon, 27 Oct 2025 17:03:08 +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/action-type.ts | 22 ++++++++++++++++++++++ src/tracers.ts/index.ts | 11 +++++++++-- src/tracers.ts/tracer-type.ts | 12 ++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/tracers.ts/action-type.ts create mode 100644 src/tracers.ts/tracer-type.ts diff --git a/src/tracers.ts/action-type.ts b/src/tracers.ts/action-type.ts new file mode 100644 index 0000000..5f1bd5b --- /dev/null +++ b/src/tracers.ts/action-type.ts @@ -0,0 +1,22 @@ +export const ARRAY_TRACER_ACTIONS = [ + 'define', + 'preset', + 'expand', + 'reduce', + 'pick', + 'drop', + 'patch', + 'reset', +] as const; + +export type ArrayTracerAction = (typeof ARRAY_TRACER_ACTIONS)[number]; + +export const STACK_TRACER_ACTIONS = [ + // + 'define', + 'push', +] as const; + +export type StackTracerAction = (typeof STACK_TRACER_ACTIONS)[number]; + +export type TracerAction = ArrayTracerAction | StackTracerAction; diff --git a/src/tracers.ts/index.ts b/src/tracers.ts/index.ts index 7995091..a540340 100644 --- a/src/tracers.ts/index.ts +++ b/src/tracers.ts/index.ts @@ -13,9 +13,8 @@ type TracerTypeKey = keyof typeof TracerType; type TracerTypeVal = (typeof TracerType)[TracerTypeKey]; -const Action = { +const ArrayTracerAction = { Define: 'define', - Preset: 'preset', Expand: 'expand', Reduce: 'reduce', @@ -25,6 +24,14 @@ const Action = { Reset: 'reset', } as const; +type ArrayTracerActionKey = keyof typeof ArrayTracerAction; + +type ArrayTracerActionVal = (typeof ArrayTracerAction)[ArrayTracerActionKey]; + +const Action = { + ...ArrayTracerAction, +} as const; + type ActionKey = keyof typeof Action; type ActionVal = (typeof Action)[ActionKey]; diff --git a/src/tracers.ts/tracer-type.ts b/src/tracers.ts/tracer-type.ts new file mode 100644 index 0000000..b0b9063 --- /dev/null +++ b/src/tracers.ts/tracer-type.ts @@ -0,0 +1,12 @@ +export const TRACER_TYPES = [ + 'ArrayTracer', + 'StackTracer', + 'QueueTracer', + 'MatrixTracer', + 'SortTracer', + 'LinkTracer', + 'TreeTracer', + 'GraphTracer', +] as const; + +export type TracerType = typeof TRACER_TYPES[number];