//#region src/unplugin/edits.d.ts /** * Edit primitives shared by the transform pipeline stages. * * Every stage (hoist → hoisted-schema compile → rewrites → runtime inject) * describes its changes as non-overlapping `Edit` splices (plus at most one * insertion) against the STAGE INPUT. The same edit list is applied two * ways: `applyEdits()` produces the stage output string, and the pipeline * applies it to a MagicString to produce the stage's sourcemap — deriving * both from one list makes code/map divergence impossible. */ interface Edit { /** Start offset in the stage-input string. */ start: number; /** End offset (exclusive) in the stage-input string. */ end: number; /** Replacement text. */ text: string; } interface Insertion { /** Offset in the stage-input string to insert at. */ offset: number; text: string; } /** * Offset after the shebang and the directive prologue ("use strict", * "use client", "use server", ...) — where module-head insertions must go. * * A directive is only a directive while it is still part of the prologue, so * anything prepended at offset 0 demotes it to a plain string expression. * Bundlers that give directives meaning reject that outright: React Server * Components builds fail with `The "use client" directive must be placed * before other expressions`, which is how the generated runtime prologue used * to break every Next.js file that exported a schema. */ declare function moduleHeadOffset(code: string): number; /** * Apply non-overlapping edits (any order) and an optional insertion to a * string. Mirrors MagicString.overwrite + appendLeft semantics: an insertion * at an edit boundary lands before the edit's replacement. */ declare function applyEdits(code: string, edits: readonly Edit[], insert?: Insertion): string; //#endregion export { Edit, Insertion, applyEdits, moduleHeadOffset }; //# sourceMappingURL=edits.d.ts.map