-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
38 lines (34 loc) · 1.44 KB
/
index.d.ts
File metadata and controls
38 lines (34 loc) · 1.44 KB
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
37
38
/**
* Returns the current filename from import.meta, a string (dirname), or __filename.
* @param metaOrDir import.meta (ESM), a string (dirname, e.g. __dirname), or undefined
* @returns Absolute path to the current file or directory.
*/
export function getCurrentFilename(metaOrDir?: ImportMeta | string): string;
/**
* Returns the current dirname from import.meta, a string (dirname), or __dirname.
* @param metaOrDir import.meta (ESM), a string (dirname, e.g. __dirname), or undefined
* @param dirnameFn Optional custom dirname function.
* @returns Absolute path to the current directory.
*/
export function getCurrentDirname(
metaOrDir?: ImportMeta | string,
dirnameFn?: (path: string) => string
): string;
/**
* Joins the current dirname with provided segments to form an absolute path.
* @param metaOrDir import.meta (ESM), a string (dirname, e.g. __dirname), or undefined
* @param segments Path segments to join.
* @returns Absolute path string.
*/
export const path: (
metaOrDir: ImportMeta | string,
...segments: string[]
) => string;
/**
* Converts a resolved path to a file URL href string for dynamic import compatibility.
* @param metaOrDir import.meta (ESM), a string (dirname, e.g. __dirname), or undefined
* @param segments Path segments to join.
* @returns File URL href string.
*/
export function pathUrl(metaOrDir: ImportMeta | string, ...segments: string[]): string;
export default path;