Use this guide when a helper returns an unexpected path or throws an error.
import.meta points to the module that passes it to the helper.
Pass import.meta from the module that calls the helper.
Pass process.cwd() when the process working directory is necessary.
Remember that the package uses every string input as a directory path.
The package uses the string as a directory path. Pass its parent directory as the directory input. Pass the file name as a path segment.
Path helpers use Node.js path rules for the host platform. Windows paths can contain backslashes. POSIX paths can contain forward slashes. Do not compare paths as plain text across platforms.
The .. segment can move above the starting directory.
resolvePath can also accept an absolute segment that replaces the starting directory.
Validate untrusted segments before file access.
Read path safety for a containment check.
Pass import.meta from a native ESM module.
The module must have a usable file: URL.
The helper throws when it cannot convert the module URL to a file path.
Pass a valid file: URL string or a URL object.
Do not pass an http: or https: URL.
Read the API reference for the accepted input types.
Use pathUrl to create the file URL string.
Pass that string to import().
The package creates the URL but does not load the module.
dirnameFn runs only when the input is ImportMeta.
A string input names a directory.
Completed operations use the debug level.
The default logger uses the info level and filters those records.
Set the injected logger level to debug to include them.
Read the usage guide for setup and examples. Read the API reference for each helper's behavior.