///
///
import { ProjectMetaBundle } from "../api";
import { PlasmicConfig, PlasmicContext, ProjectConfig } from "./config-utils";
export declare function stripExtension(filename: string, removeComposedPath?: boolean): string;
export declare function writeFileContentRaw(filePath: string, content: string | Buffer, opts?: {
force?: boolean;
yes?: boolean;
}): Promise;
export declare function defaultResourcePath(context: PlasmicContext, project: ProjectConfig | ProjectMetaBundle | string, ...subpaths: string[]): string;
export declare function defaultPublicResourcePath(context: PlasmicContext, project: ProjectConfig, ...subpaths: string[]): string;
export declare function defaultPagePath(context: {
config: Pick;
}, fileName: string): string;
/**
* Returns true iff paths `a` and `b` resolve to the same page URI. For
* example:
*
* - pages/about.tsx and pages/about.js resolve to the same URI (/about).
* - pages/about/index.tsx and pages/about.tsx resolve to the same URI (/about).
* - pages/index.tsx and pages/index/index.tsx do not resolve to the same URI
* (they resolve, respectively, to / and /index).
*/
export declare function eqPagePath(a: string, b: string): boolean;
export declare function writeFileContent(context: PlasmicContext, srcDirFilePath: string, content: string | Buffer, opts?: {
force?: boolean;
}): Promise;
export declare function readFileContent(context: PlasmicContext, srcDirFilePath: string): string;
export declare function deleteFile(context: PlasmicContext, srcDirFilePath: string): void;
export declare function fileExists(context: PlasmicContext, srcDirFilePath: string): boolean;
export declare function makeFilePath(context: PlasmicContext, filePath: string): string;
export declare function renameFile(context: PlasmicContext, oldPath: string, newPath: string): void;
/**
* Returns absolute paths of all Plasmic managed files found, grouped by each basename
* for example:
* {
* "file.txt": [ "/path1/file.txt", "/path2.txt" ]
* ...
* }
* @param {PlasmicContext} context
* @returns {Record}
**/
export declare function buildBaseNameToFiles(context: PlasmicContext): Record;
/**
* Tries to find the file at `srcDir/expectedPath`. If it's not there, tries to detect if it has
* been moved to a different location. Returns the found location relative to the `srcDir`.
*
* If `expectedPath` doesn't exist, but there's more than one file of that name in `baseNameToFiles`, then
* error and quit. If no file of that name can be found, `expectedPath` is returned.
*/
export declare function findSrcDirPath(absoluteSrcDir: string, expectedPath: string, baseNameToFiles: Record): string;
/**
* Finds the full path to the first file satisfying `pred` in `dir`. If
* `opts.traverseParents` is set to true, then will also look in ancestor
* directories until the plasmic.json file is found. If none is found,
* returns undefined.
*/
export declare function findFile(dir: string, pred: (name: string) => boolean, opts: {
traverseParents?: boolean;
}): string | undefined;
/**
* Throws an error if some file in PlasmicConfig is not inside the root
* directory (i.e., the directory containing plasmic.json).
*/
export declare function assertAllPathsInRootDir(context: PlasmicContext): void;
/**
* This turns on buffering of file writes/reads.
*
* This is useful for reducing the extent to which our file updates are scattered over time, which can cause webpack
* dev server to trip up.
*
* This also has the side benefit of making our CLI commands more atomic, in case of failure partway through a sync.
*/
export declare function withBufferedFs(f: () => Promise): Promise;
export declare function writeFileText(path: string, content: string | Buffer): void;
export declare function readFileText(path: string): string;
export declare function renameFileBuffered(oldPath: string, newPath: string): void;
export declare function deleteFileBuffered(path: string): void;
export declare function existsBuffered(path: string): boolean;