@rushstack/package-extractor
Version:
A library for bundling selected files and dependencies into a deployable package.
73 lines • 2.11 kB
TypeScript
import { type FileSystemStats } from '@rushstack/node-core-library';
export interface IPathNodeBase {
kind: 'file' | 'folder' | 'link';
nodePath: string;
linkStats: FileSystemStats;
}
/**
* Represents a file object analyzed by {@link SymlinkAnalyzer}.
*/
export interface IFileNode extends IPathNodeBase {
kind: 'file';
}
/**
* Represents a folder object analyzed by {@link SymlinkAnalyzer}.
*/
export interface IFolderNode extends IPathNodeBase {
kind: 'folder';
}
/**
* Represents a symbolic link analyzed by {@link SymlinkAnalyzer}.
*/
export interface ILinkNode extends IPathNodeBase {
kind: 'link';
/**
* The immediate target that the symlink resolves to.
*/
linkTarget: string;
}
export type PathNode = IFileNode | IFolderNode | ILinkNode;
/**
* Represents a symbolic link.
*
* @public
*/
export interface ILinkInfo {
/**
* The type of link that was encountered.
*/
kind: 'fileLink' | 'folderLink';
/**
* The path to the link, relative to the root of the extractor output folder.
*/
linkPath: string;
/**
* The target that the link points to.
*/
targetPath: string;
}
export interface ISymlinkAnalyzerOptions {
requiredSourceParentPath?: string;
}
export interface IAnalyzePathOptions {
inputPath: string;
preserveLinks?: boolean;
shouldIgnoreExternalLink?: (path: string) => boolean;
}
export declare class SymlinkAnalyzer {
private readonly _requiredSourceParentPath;
private readonly _nodesByPath;
private readonly _linkInfosByPath;
constructor(options?: ISymlinkAnalyzerOptions);
analyzePathAsync(options: IAnalyzePathOptions & {
shouldIgnoreExternalLink: (path: string) => boolean;
}): Promise<PathNode | undefined>;
analyzePathAsync(options: IAnalyzePathOptions & {
shouldIgnoreExternalLink?: never;
}): Promise<PathNode>;
/**
* Returns a summary of all the symbolic links encountered by {@link SymlinkAnalyzer.analyzePathAsync}.
*/
reportSymlinks(): ILinkInfo[];
}
//# sourceMappingURL=SymlinkAnalyzer.d.ts.map