es-guard
Version:
A tool to check JavaScript compatibility with target environments
66 lines • 1.62 kB
TypeScript
/**
* Helper to read and parse JSON file safely.
* Supports JSON with comments (e.g. tsconfig.json).
*/
export declare const readJsonFile: (filePath: string) => unknown;
/**
* Helper to read text file safely
*/
export declare const readTextFile: (filePath: string) => string;
/**
* Helper to safely evaluate JavaScript files (for config files)
*/
export declare const evaluateJsFile: (filePath: string) => unknown;
/**
* Type guard for package.json structure
*/
export declare const isPackageJson: (obj: unknown) => obj is {
browserslist?: string | string[];
main?: string;
dist?: string;
build?: string;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
};
/**
* Type guard for tsconfig.json structure
*/
export declare const isTsConfig: (obj: unknown) => obj is {
compilerOptions?: {
target?: string;
outDir?: string;
};
};
/**
* Type guard for .babelrc structure
*/
export declare const isBabelRc: (obj: unknown) => obj is {
presets?: Array<[string, {
targets?: {
browsers?: string[];
};
}]>;
};
/**
* Type guard for vite config structure
*/
export declare const isViteConfig: (obj: unknown) => obj is {
build?: {
outDir?: string;
};
};
/**
* Type guard for webpack config structure
*/
export declare const isWebpackConfig: (obj: unknown) => obj is {
output?: {
path?: string;
};
};
/**
* Type guard for next.js config structure
*/
export declare const isNextConfig: (obj: unknown) => obj is {
distDir?: string;
};
//# sourceMappingURL=utils.d.ts.map