@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
53 lines • 2.11 kB
text/typescript
//#region src/registry.d.ts
interface NodeOptionsToken {
kind: "option";
index: number;
name: string;
rawName: string;
value: undefined;
inlineValue: undefined;
}
/**
* Tokenizes the arguments string into an array of strings, supporting quoted
* values and escaped characters.
* Converted from: https://github.com/nodejs/node/blob/c29d53c5cfc63c5a876084e788d70c9e87bed880/src/node_options.cc#L1401
*
* @param input - The arguments string to be tokenized.
* @returns An array of strings with the tokenized arguments.
*/
declare const tokenizeArgs: (input: string) => string[];
/**
* Stringify the arguments to be used in a command line. It will ignore any
* argument that has a value of `undefined`.
*
* @param args - The arguments to be stringified.
* @returns A string with the arguments.
*/
declare function formatNodeOptions(args: Record<string, string | boolean | undefined>): string;
/**
* Get the node options from the `NODE_OPTIONS` environment variable and parse
* them into an object without the inspect options.
*
* @returns An object with the parsed node options.
*/
declare function getParsedNodeOptionsWithoutInspect(): {
[longOption: string]: string | boolean | undefined;
};
/**
* Get the node options from the `NODE_OPTIONS` environment variable and format
* them into a string without the inspect options.
*
* @returns A string with the formatted node options.
*/
declare function getFormattedNodeOptionsWithoutInspect(): string;
/**
* Returns the package registry using the user's package manager. The URL will have a trailing slash.
*
* @param baseDir - The base directory to detect the package manager from.
* @returns The package registry URL with a trailing slash.
* @throws Will throw an error if the package manager cannot be detected or if the registry cannot be retrieved.
*/
declare function getRegistry(baseDir?: string): Promise<string>;
//#endregion
export { NodeOptionsToken, formatNodeOptions, getFormattedNodeOptionsWithoutInspect, getParsedNodeOptionsWithoutInspect, getRegistry, tokenizeArgs };
//# sourceMappingURL=registry.d.cts.map