-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathresolve-lib.ts
More file actions
36 lines (33 loc) · 973 Bytes
/
resolve-lib.ts
File metadata and controls
36 lines (33 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Tsdown tool resolver for the vite-plus CLI.
*
* This module exports a function that resolves the Tsdown binary path
* using Node.js module resolution. The resolved path is passed back
* to the Rust core, which then executes Tsdown for running lib.
*
* Used for: `vite-plus lib` command
*/
import { DEFAULT_ENVS, resolve } from './utils.js';
/**
* Resolves the Tsdown binary path and environment variables.
*
* @returns Promise containing:
* - binPath: Absolute path to the Tsdown CLI entry point
* - envs: Environment variables to set when executing Tsdown
*
* Tsdown is a tool that provides a library for building JavaScript/TypeScript libraries.
*/
export async function lib(): Promise<{
binPath: string;
envs: Record<string, string>;
}> {
// Resolve the Tsdown CLI module directly
const binPath = resolve('tsdown/run');
return {
binPath,
// TODO: provide envs inference API
envs: {
...DEFAULT_ENVS,
},
};
}