refactor: 重构项目结构,将 tracer 模块提取为独立子包
- 将 tracer 相关代码移动到 tracers.ts 子目录中 - 新增类型定义文件,统一管理命令类型 - 实现上下文管理机制,集中处理 tracer 命令 - 更新构建配置和依赖管理 - 移除旧的根目录文件,保持代码结构清晰
This commit is contained in:
1
tracers.ts/src/context/index.ts
Normal file
1
tracers.ts/src/context/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './tracer-context';
|
||||
22
tracers.ts/src/context/tracer-context.ts
Normal file
22
tracers.ts/src/context/tracer-context.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { TracerCommand } from '../types';
|
||||
|
||||
const createTracerContext = () => {
|
||||
const commands: TracerCommand[] = [];
|
||||
|
||||
const getTracerContext = () => {
|
||||
const command = (command: TracerCommand) => {
|
||||
commands.push(command);
|
||||
};
|
||||
|
||||
return {
|
||||
commands,
|
||||
command,
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
getTracerContext,
|
||||
};
|
||||
};
|
||||
|
||||
export const { getTracerContext } = createTracerContext();
|
||||
Reference in New Issue
Block a user