import { IntlayerConfig } from "@intlayer/types/config"; //#region src/utils/contentWatcherLock.d.ts /** * What kind of process is watching the content declarations. * * - `cli` — the `intlayer watch` / `intlayer build --watch` command. * - `bundler` — an Intlayer bundler plugin (e.g. `withIntlayer` on Next.js). */ export type ContentWatcherSource = 'cli' | 'bundler'; export type ContentWatcherOwner = { /** PID of the process holding the watcher. */ pid: number; source: ContentWatcherSource; /** * How the owner should be named in a message, e.g. `intlayer watch` or * `next-intlayer`. */ label: string; }; /** * Set on every process spawned by `intlayer watch --with` (and * `intlayer build --watch --with`), so a bundler plugin running as that child * knows a CLI watcher is already covering the project — without having to * depend on the two processes reaching the lock file in a given order. * * Holds the label of the command that set it. */ export declare const CLI_CONTENT_WATCHER_ENV_VAR = "INTLAYER_CLI_CONTENT_WATCHER"; /** * Path of the lock coordinating every content watcher of one project. * * Deliberately at the root of `.intlayer` rather than in its `cache` * subdirectory: `cleanOutputDir` wipes every subdirectory of `.intlayer`, so a * lock kept in `cache` would be erased by any `prepareIntlayer` that cleans — * after which a bundler plugin would see no owner and start a second watcher * next to the `intlayer watch` still running. The root itself is never removed. * * @param configuration - The resolved Intlayer configuration. */ export declare const getContentWatcherLockFilePath: (configuration: IntlayerConfig) => string; /** * Reads the lock, removing it when it describes a process that has since died. * * An unreadable or malformed lock is treated as abandoned: a corrupted file * must never block the watcher for a whole dev session. * * @returns The live owner, or `null` when nothing is watching. */ export declare const getContentWatcherOwner: (configuration: IntlayerConfig) => Promise; /** * Tries to become the process that watches this project's content * declarations. * * Creating the file with `wx` is atomic, so exactly one process wins even when * several try at the same moment — which is the normal case on Next.js, where * `next.config.*` is evaluated in more than one process. * * @param configuration - The resolved Intlayer configuration. * @param owner - How this process should describe itself to the others. * @returns `true` when this process now owns the watcher. */ export declare const acquireContentWatcherLock: (configuration: IntlayerConfig, owner: Omit) => Promise; /** * The CLI watcher command this process was spawned by, or `null` when it was * not started through `intlayer watch --with`. */ export declare const getCliContentWatcherLabel: () => string | null; /** * Registers a CLI command as the content watcher of this project. * * Call it *before* spawning a `--with` child: taking the lock first means the * bundler plugin inside that child never races the command for it, and the * environment marker makes the child's decision independent of the filesystem * altogether. * * @param configuration - The resolved Intlayer configuration. * @param label - How the command should be named in a message. * @returns The bundler already watching this project, or `null` when the * command took the watcher for itself. A CLI watcher never stands down on that * answer — watching is what it was asked to do — but reporting it lets the user * know the parallel command has become redundant. */ export declare const claimCliContentWatcher: (configuration: IntlayerConfig, label: string) => Promise; type RedundantWatcherReport = { /** Name of the CLI command watching, e.g. `intlayer watch`. */ cliLabel: string; /** Name of the bundler integration watching, e.g. `next-intlayer`. */ bundlerLabel: string; }; /** * Reports a CLI watcher running alongside a bundler integration that watches * on its own, and points at the parallel command as the part to drop. * * Emitted at most once per process: a bundler config is evaluated several times * per command, and callers may re-enter this on a retry loop. * * @param configuration - The resolved Intlayer configuration. * @param report - Who is watching in parallel with whom. */ export declare const reportRedundantContentWatcher: (configuration: IntlayerConfig, { cliLabel, bundlerLabel }: RedundantWatcherReport) => void; //#endregion //# sourceMappingURL=contentWatcherLock.d.ts.map