/** * Node.js resolve hook used ONLY by scripts/verify_sensitive_paths.mjs when run * with plain `node` (no bundler, no tsx). * * Next ships `next/server.js` but no package.json "exports" map, so bundlers * resolve `next/server` by extension-guessing while plain Node ESM does not. * This hook remaps the bare specifier `next/server` -> `next/server.js` for the * duration of the test process. Not used by the app itself. * * Run: node --import ./scripts/register-next-server-resolve.mjs scripts/verify_sensitive_paths.mjs */ import { registerHooks } from "node:module"; registerHooks({ resolve(specifier, context, nextResolve) { if (specifier === "next/server") { return nextResolve("next/server.js", context); } return nextResolve(specifier, context); }, });