UNPKG

@-xun/project

Version:

A library to help me wrangle the complex landscape between monorepos and polyrepos

138 lines 4.82 kB
declare const $type: unique symbol; /** * Options available when constructing a new `ProjectError` object. */ export type ProjectErrorOptions = { /** * By default, if an {@link Error} object is passed to `ProjectError`, that * `Error` instance will be passed through as `ProjectError.cause` and that * instance's `Error.message` will be passed through as * `ProjectError.message`. * * Use this option to override this default behavior and instead set * `ProjectError.cause` manually. */ cause?: ErrorOptions['cause']; }; /** * Type guard for {@link ProjectError}. */ export declare function isProjectError(parameter: unknown): parameter is ProjectError; /** * Type guard for {@link NotAGitRepositoryError}. */ export declare function isNotAGitRepositoryError(parameter: unknown): parameter is NotAGitRepositoryError; /** * Type guard for {@link XPackageJsonNotParsableError}. */ export declare function isXPackageJsonNotParsableError(parameter: unknown): parameter is XPackageJsonNotParsableError; /** * Type guard for {@link DuplicatePackageNameError}. */ export declare function isDuplicatePackageNameError(parameter: unknown): parameter is DuplicatePackageNameError; /** * Type guard for {@link DuplicatePackageIdError}. */ export declare function isDuplicatePackageIdError(parameter: unknown): parameter is DuplicatePackageIdError; /** * Represents an exception originating from project meta-analysis tooling (e.g. * `@-xun/project`). */ export declare class ProjectError extends Error implements NonNullable<ProjectErrorOptions> { [$type]: symbol[]; /** * Represents a project-specific error, optionally with suggested exit code * and other context. */ constructor(reason?: Error | string, options?: ProjectErrorOptions); /** * This constructor syntax is used by subclasses when calling this constructor * via `super`. */ constructor(reason: Error | string, options: ProjectErrorOptions, message: string, superOptions: ErrorOptions); } /** * Represents encountering a project that is not a git repository. */ export declare class NotAGitRepositoryError extends ProjectError { [$type]: symbol[]; /** * Represents encountering a project that is not a git repository. */ constructor(); /** * This constructor syntax is used by subclasses when calling this constructor * via `super`. */ constructor(message: string); } /** * Represents encountering an unparsable package.json file in an * symbiote-powered project. */ export declare class XPackageJsonNotParsableError extends ProjectError { readonly packageJsonPath: string; readonly reason: unknown; [$type]: symbol[]; /** * Represents encountering an unparsable package.json file. */ constructor(packageJsonPath: string, reason: unknown); /** * This constructor syntax is used by subclasses when calling this constructor * via `super`. */ constructor(packageJsonPath: string, reason: unknown, message: string); } /** * Represents encountering a workspace package.json file with the same `"name"` * field as another workspace. */ export declare class DuplicatePackageNameError extends ProjectError { readonly packageName: string; readonly firstPath: string; readonly secondPath: string; [$type]: symbol[]; /** * Represents encountering a workspace package.json file with the same * `"name"` field as another workspace. */ constructor(packageName: string, firstPath: string, secondPath: string); /** * This constructor syntax is used by subclasses when calling this constructor * via `super`. */ constructor(packageName: string, firstPath: string, secondPath: string, message: string); } /** * Represents encountering an unnamed workspace with the same package-id as * another workspace. */ export declare class DuplicatePackageIdError extends ProjectError { readonly id: string; readonly firstPath: string; readonly secondPath: string; [$type]: symbol[]; /** * Represents encountering an unnamed workspace with the same package-id as * another workspace. */ constructor(id: string, firstPath: string, secondPath: string); /** * This constructor syntax is used by subclasses when calling this constructor * via `super`. */ constructor(id: string, firstPath: string, secondPath: string, message: string); } /** * A collection of possible error and warning messages. */ export declare const CommonErrorMessage: { Generic(): string; GuruMeditation(): string; NotAGitRepositoryError(): string; PackageJsonNotParsable(packageJsonPath: string, reason: unknown): string; DuplicatePackageName(packageName: string, firstPath: string, secondPath: string): string; DuplicatePackageId(id: string, firstPath: string, secondPath: string): string; }; export {};