import { type BuildOptions } from "@opennextjs/aws/build/helper.js"; import type { ContentUpdater, Plugin } from "@opennextjs/aws/plugins/content-updater.js"; /** * Replaces the dynamic loading of the instrumentation hook, which workerd does not support. * * Next.js loads `.next/server/instrumentation.js` with a `require()` call built from a path * computed at runtime. The loaders are rewritten to either statically `require()` the file that * the Next.js build emitted, or to resolve to `null` when the app has no instrumentation hook. * * @param updater The content updater applying the patches. * @param buildOpts The open-next build options. * @param options.loadInstrumentation When `false`, the instrumentation hook is never registered by this * bundle: the loaders resolve to `null` and the module registering the hook since Next.js 15.4 is * replaced, see {@link noopInstrumentationGlobals}. Defaults to `true`. * @returns An esbuild plugin. */ export declare function patchInstrumentation(updater: ContentUpdater, buildOpts: BuildOptions, { loadInstrumentation }?: { loadInstrumentation?: boolean; }): Plugin; /** * Replaces `next/dist/server/lib/router-utils/instrumentation-globals.external.js` when the * instrumentation hook is not registered. * * The exports of the module load, register or call the hook. They are replaced with no-op async * functions so that the dependencies of the module (the tracer, `@opentelemetry/api`, ...) are not * bundled. A Proxy is used because the exports differ between Next.js versions (i.e. * `ensureInstrumentationRegisteredWithDeferredSpans` was added in 16.4). It relies on Next.js * `require`-ing the module and reading the exports it calls, which goes through the `get` trap. * `then` is not defined so that the module is not taken for a thenable. */ export declare const noopInstrumentationGlobals = "module.exports = new Proxy({}, { get: (_, name) => (name === \"then\" ? undefined : async () => {}) });"; export declare function getNext154Rule(builtInstrumentationPath: string | null): string; export declare function getNext15Rule(builtInstrumentationPath: string | null): string; export declare function getNext14Rule(builtInstrumentationPath: string | null): string;