Files
deepseek-harness/packages/sdk/scripts/src/local-plugin-loader-hooks.ts
T
imccyu 42b07a7022 feat(sdk): add developer project tooling
docs(rfc): propose SDK developer project tooling

feat: rename / docs

ci: fix windows gates

docs: revert
2026-07-15 23:17:29 +08:00

28 lines
863 B
TypeScript

/**
* Node module customization hook for project-local plugin package names.
*
* @module @deepseek-ai/dsh-scripts/local-plugin-loader-hooks
*/
import type { ResolveHookContext, ResolveFnOutput } from 'node:module'
interface HookData {
mappings: Readonly<Record<string, string>>
}
let mappings: Readonly<Record<string, string>> = {}
/** Receive the package-name to source-URL map from the launcher thread. */
export function initialize(data: HookData): void {
mappings = { ...data.mappings }
}
/** Resolve exact local workspace package names to their TypeScript entry source. */
export async function resolve(
specifier: string,
context: ResolveHookContext,
nextResolve: (specifier: string, context: ResolveHookContext) => Promise<ResolveFnOutput>,
): Promise<ResolveFnOutput> {
return nextResolve(mappings[specifier] ?? specifier, context)
}