import type { DependencyManifest } from '@pnpm/types'; export interface SyncInjectedDepsOptions { pkgName: string | undefined; pkgRootDir: string; workspaceDir: string | undefined; /** * The package's manifest as it was before the scripts ran. A script that * drops a bin leaves its shim behind, and the copies cannot say which bins * they used to have: their `package.json` is hardlinked to the source, so * an in-place rewrite has already reached them. */ manifestBeforeScripts?: DependencyManifest; /** Selects the source files the install put in the copies, so the sync adds no file the install left out. */ includeOnlyPackageFiles?: boolean; /** * Set when each project has its own lockfile (`sharedWorkspaceLockfile: * false`). Each project's own `.modules.yaml` then lists the copies injected * into it, so every project's is read besides the workspace root's. */ projectLockfiles?: ProjectLockfiles; } /** How to find the workspace projects and the modules directory each one installs into. */ export interface ProjectLockfiles { workspacePackagePatterns?: string[]; modulesDir?: string; modulesDirsByProjectName?: Record; } export interface InjectedEditWatch { stop: () => Promise; } /** * The source directories and injected copies a running script should publish, * the same ones `syncInjectedDeps` patches. Empty when the package has no name, * no workspace, or no injected copies, or when the modules manifest cannot be * read. The sync after the script reports that error, so it does not stop the * script from starting. */ export declare function injectedEditDirs(opts: SyncInjectedDepsOptions): Promise>; /** * Publish injected copies about every 200ms until `stop`. `editedSinceMs` stays * two seconds behind the start of the watch, which covers one-second mtime * resolution. Stop waits for an in-flight publish so the end-of-script hardlink * sync does not run beside it. */ export declare function watchInjectedEdits(sourceDir: string, targetDirs: string[], includeOnlyPackageFiles?: boolean): InjectedEditWatch; export declare function syncInjectedDeps(opts: SyncInjectedDepsOptions): Promise; export interface SyncInjectedDepsOfModulesDirOptions { /** Selects the source files the install put in the copies, so the sync adds no file the install left out. */ includeOnlyPackageFiles?: boolean; /** The directory whose lockfile lists the injected dependencies. */ lockfileDir: string; /** The modules directory that holds the `.modules.yaml` of `lockfileDir`. */ modulesDir: string; /** The sources whose copies are synced. Copies of other sources keep their contents. */ sourceDirs: ReadonlySet; } /** * Brings the injected copies listed in one modules directory back in step * with their sources. A project with its own lockfile injects copies of * workspace projects whose lifecycle scripts run in their own install, so * nothing else syncs those copies after the scripts run. */ export declare function syncInjectedDepsOfModulesDir(opts: SyncInjectedDepsOfModulesDirOptions): Promise;