legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
39 lines • 1.27 kB
TypeScript
/**
* @fileoverview ESM utility functions for safe environment detection
*
* This module provides safe utilities for working with ESM modules without
* using eval() or other potentially unsafe patterns.
*/
/**
* Safely get the current directory name in both CommonJS and ESM environments
* @param importMetaUrl - Optional import.meta.url for ESM environments
* @returns Current directory path
*/
export declare function getCurrentDir(importMetaUrl?: string): string;
/**
* Get the directory name from a file path
* @param filePath - The file path to get directory from
* @returns Directory path
*/
export declare function getDirFromPath(filePath: string): string;
/**
* Check if we're running in an ESM environment
* @returns True if ESM, false if CommonJS
*/
export declare function isESM(): boolean;
/**
* Check if we're running in a CommonJS environment
* @returns True if CommonJS, false if ESM
*/
export declare function isCommonJS(): boolean;
/**
* Get module information safely
* @param importMetaUrl - Optional import.meta.url
* @returns Module information object
*/
export declare function getModuleInfo(importMetaUrl?: string): {
dir: string;
isESM: boolean;
isCommonJS: boolean;
};
//# sourceMappingURL=esm-utils.d.ts.map