next 15.6.0-canary.3 → 15.6.0-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/adapter/build-complete.js +1 -1
  3. package/dist/build/adapter/build-complete.js.map +1 -1
  4. package/dist/build/index.js +3 -3
  5. package/dist/build/swc/index.js +1 -1
  6. package/dist/build/webpack-config.js +2 -2
  7. package/dist/client/app-bootstrap.js +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  10. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  11. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  12. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  13. package/dist/compiled/next-server/server.runtime.prod.js +1 -1
  14. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  15. package/dist/esm/build/adapter/build-complete.js +1 -1
  16. package/dist/esm/build/adapter/build-complete.js.map +1 -1
  17. package/dist/esm/build/index.js +3 -3
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/webpack-config.js +2 -2
  20. package/dist/esm/client/app-bootstrap.js +1 -1
  21. package/dist/esm/client/index.js +1 -1
  22. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  23. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  24. package/dist/esm/server/lib/app-info-log.js +1 -1
  25. package/dist/esm/server/lib/start-server.js +1 -1
  26. package/dist/esm/server/node-environment-extensions/unhandled-rejection.js +2 -2
  27. package/dist/esm/server/node-environment-extensions/unhandled-rejection.js.map +1 -1
  28. package/dist/esm/shared/lib/canary-only.js +1 -1
  29. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  30. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  31. package/dist/server/lib/app-info-log.js +1 -1
  32. package/dist/server/lib/start-server.js +1 -1
  33. package/dist/server/node-environment-extensions/unhandled-rejection.js +2 -2
  34. package/dist/server/node-environment-extensions/unhandled-rejection.js.map +1 -1
  35. package/dist/shared/lib/canary-only.js +1 -1
  36. package/dist/telemetry/anonymous-meta.js +1 -1
  37. package/dist/telemetry/events/session-stopped.js +2 -2
  38. package/dist/telemetry/events/version.js +2 -2
  39. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/node-environment-extensions/unhandled-rejection.tsx"],"sourcesContent":["/**\n * Manages unhandled rejection listeners to intelligently filter rejections\n * from aborted prerenders when cache components are enabled.\n *\n * THE PROBLEM:\n * When we abort prerenders we expect to find numerous unhandled promise rejections due to\n * things like awaiting Request data like `headers()`. The rejections are fine and should\n * not be construed as problematic so we need to avoid the appearance of a problem by\n * omitting them from the logged output.\n *\n * THE STRATEGY:\n * 1. Install a filtering unhandled rejection handler\n * 2. Intercept process event methods to capture new handlers in our internal queue\n * 3. For each rejection, check if it comes from an aborted prerender context\n * 4. If yes, suppress it. If no, delegate to all handlers in our queue\n * 5. This provides precise filtering without time-based windows\n *\n * This ensures we suppress noisy prerender-related rejections while preserving\n * normal error logging for genuine unhandled rejections.\n */\n\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\nconst MODE:\n | 'enabled'\n | 'debug'\n | 'true'\n | 'false'\n | '1'\n | '0'\n | ''\n | string\n | undefined = process.env.__NEXT_USE_UNHANDLED_REJECTION_FILTER\n\nlet ENABLE_UHR_FILTER = false\nlet DEBUG_UHR_FILTER = false\n\nswitch (MODE) {\n case 'debug':\n DEBUG_UHR_FILTER = true\n // fallthrough\n case 'enabled':\n case 'true':\n case '1':\n ENABLE_UHR_FILTER = true\n break\n case 'false':\n case 'disabled':\n case '0':\n case '':\n case undefined:\n break\n default:\n if (typeof MODE === 'string') {\n console.error(\n `__NEXT_USE_UNHANDLED_REJECTION_FILTER has an unrecognized value: ${JSON.stringify(MODE)}. Use \"enabled\", \"disabled\", or \"debug\" or omit the environment variable altogether`\n )\n }\n}\n\nconst debug = DEBUG_UHR_FILTER\n ? (...args: any[]) =>\n console.log('[UNHANDLED REJECTION DEBUG]', ...args, new Error().stack)\n : undefined\n\ntype ListenerMetadata = {\n listener: NodeJS.UnhandledRejectionListener\n once: boolean\n}\n\nlet filterInstalled = false\n\n// We store the proxied listeners for unhandled rejections here.\nlet underlyingListeners: Array<NodeJS.UnhandledRejectionListener> = []\n// We store a unique pointer to each event listener registration to track\n// details like whether the listener is a once listener.\nlet listenerMetadata: Array<ListenerMetadata> = []\n\nlet originalProcessOn: typeof process.on\nlet originalProcessAddListener: typeof process.addListener\nlet originalProcessOnce: typeof process.once\nlet originalProcessRemoveListener: typeof process.removeListener\nlet originalProcessRemoveAllListeners: typeof process.removeAllListeners\nlet originalProcessListeners: typeof process.listeners\nlet originalProcessPrependListener: typeof process.prependListener\nlet originalProcessPrependOnceListener: typeof process.prependOnceListener\nlet originalProcessOff: typeof process.off\n\nlet didWarnPrepend = false\nlet didWarnRemoveAll = false\n\n/**\n * Installs a filtering unhandled rejection handler that intelligently suppresses\n * rejections from aborted prerender contexts.\n *\n * This should be called once during server startup to install the global filter.\n */\nfunction installUnhandledRejectionFilter(): void {\n if (filterInstalled) {\n debug?.('unexpected second install')\n return\n }\n\n debug?.(\n 'installUnhandledRejectionFilter',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n\n // Capture existing handlers\n underlyingListeners = Array.from(process.listeners('unhandledRejection'))\n // We assume all existing handlers are not \"once\"\n listenerMetadata = underlyingListeners.map((l) => ({\n listener: l,\n once: false,\n }))\n\n // Store the original process methods\n originalProcessOn = process.on\n originalProcessAddListener = process.addListener\n originalProcessOnce = process.once\n originalProcessOff = process.off\n originalProcessRemoveListener = process.removeListener\n originalProcessRemoveAllListeners = process.removeAllListeners\n originalProcessListeners = process.listeners\n originalProcessPrependListener = process.prependListener\n originalProcessPrependOnceListener = process.prependOnceListener\n\n // Helper function to create a patched method that preserves toString behavior\n function patchMethod<T extends Function>(original: T, patchedImpl: T): T {\n // Preserve the original toString behavior\n Object.defineProperty(patchedImpl, 'toString', {\n value: original.toString.bind(original),\n writable: true,\n configurable: true,\n })\n return patchedImpl\n }\n\n // Intercept process.on to capture new unhandled rejection handlers\n process.on = patchMethod(originalProcessOn, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.on/addListener', listener.toString())\n // Add new handlers to our internal queue instead of the process\n underlyingListeners.push(listener as NodeJS.UnhandledRejectionListener)\n listenerMetadata.push({ listener, once: false })\n return process\n }\n // For other events, use the original method\n return originalProcessOn.call(process, event, listener)\n } as typeof process.on)\n\n // Intercept process.addListener (alias for process.on)\n process.addListener = patchMethod(\n originalProcessAddListener,\n process.on as typeof originalProcessAddListener\n )\n\n // Intercept process.once for one-time handlers\n process.once = patchMethod(originalProcessOnce, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.once', listener.toString())\n underlyingListeners.push(listener)\n listenerMetadata.push({ listener, once: true })\n return process\n }\n // For other events, use the original method\n return originalProcessOnce.call(process, event, listener)\n } as typeof process.once)\n\n // Intercept process.prependListener for handlers that should go first\n process.prependListener = patchMethod(\n originalProcessPrependListener,\n function (event: string | symbol, listener: (...args: any[]) => void) {\n if (event === 'unhandledRejection') {\n debug?.('process.prependListener', listener.toString())\n if (didWarnPrepend === false) {\n didWarnPrepend = true\n console.warn(\n 'Warning: `prependListener(\"unhandledRejection\")` called, but Next.js maintains the first listener ' +\n 'which filters out unnecessary events from aborted prerenders. Your handler will be second.'\n )\n }\n // Add new handlers to the beginning of our internal queue\n underlyingListeners.unshift(\n listener as NodeJS.UnhandledRejectionListener\n )\n listenerMetadata.unshift({ listener, once: false })\n return process\n }\n // For other events, use the original method\n return originalProcessPrependListener.call(\n process,\n event as any,\n listener\n )\n } as typeof process.prependListener\n )\n\n // Intercept process.prependOnceListener for one-time handlers that should go first\n process.prependOnceListener = patchMethod(\n originalProcessPrependOnceListener,\n function (event: string | symbol, listener: (...args: any[]) => void) {\n if (event === 'unhandledRejection') {\n debug?.('process.prependOnceListener', listener.toString())\n if (didWarnPrepend === false) {\n didWarnPrepend = true\n console.warn(\n 'Warning: `prependOnceListener(\"unhandledRejection\")` called, but Next.js maintains the first listener ' +\n 'which filters out unnecessary events from aborted prerenders. Your handler will be second.'\n )\n }\n // Add to the beginning of our internal queue\n underlyingListeners.unshift(listener)\n listenerMetadata.unshift({ listener, once: true })\n return process\n }\n // For other events, use the original method\n return originalProcessPrependOnceListener.call(\n process,\n event as any,\n listener\n )\n } as typeof process.prependOnceListener\n )\n\n // Intercept process.removeListener\n process.removeListener = patchMethod(originalProcessRemoveListener, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.removeListener', listener.toString())\n // Check if they're trying to remove our filtering handler\n if (listener === filteringUnhandledRejectionHandler) {\n uninstallUnhandledRejectionFilter()\n return process\n }\n\n const index = underlyingListeners.lastIndexOf(listener)\n if (index > -1) {\n debug?.('process.removeListener match found', index)\n underlyingListeners.splice(index, 1)\n listenerMetadata.splice(index, 1)\n } else {\n debug?.('process.removeListener match not found', index)\n }\n return process\n }\n // For other events, use the original method\n return originalProcessRemoveListener.call(process, event, listener)\n } as typeof process.removeListener)\n\n // Intercept process.off (alias for process.removeListener)\n process.off = patchMethod(\n originalProcessOff,\n process.removeListener as typeof originalProcessOff\n )\n\n // Intercept process.removeAllListeners\n process.removeAllListeners = patchMethod(\n originalProcessRemoveAllListeners,\n function (event?: string | symbol) {\n if (event === 'unhandledRejection') {\n debug?.(\n 'process.removeAllListeners',\n underlyingListeners.map((l) => l.toString())\n )\n if (didWarnRemoveAll === false) {\n didWarnRemoveAll = true\n console.warn(\n 'Warning: `removeAllListeners(\"unhandledRejection\")` called. Next.js maintains an `unhandledRejection` listener ' +\n 'to filter out unnecessary rejection warnings caused by aborting prerenders early. It is not recommended that you ' +\n 'uninstall this behavior, but if you want to you must call `process.removeListener(\"unhandledRejection\", listener)`. ' +\n 'You can acquire the listener from `process.listeners(\"unhandledRejection\")[0]`.'\n )\n }\n underlyingListeners.length = 0\n listenerMetadata.length = 0\n return process\n }\n\n // For other specific events, use the original method\n if (event !== undefined) {\n return originalProcessRemoveAllListeners.call(process, event)\n }\n\n // If no event specified (removeAllListeners()), uninstall our patch completely\n console.warn(\n 'Warning: `removeAllListeners()` called - uninstalling Next.js unhandled rejection filter. ' +\n 'You will observe `unhandledRejection` logs from prerendering which are not problematic.'\n )\n uninstallUnhandledRejectionFilter()\n return originalProcessRemoveAllListeners.call(process)\n } as typeof process.removeAllListeners\n )\n\n // Intercept process.listeners to return our internal handlers for unhandled rejection\n process.listeners = patchMethod(originalProcessListeners, function (\n event: string | symbol\n ) {\n if (event === 'unhandledRejection') {\n debug?.(\n 'process.listeners',\n [filteringUnhandledRejectionHandler, ...underlyingListeners].map((l) =>\n l.toString()\n )\n )\n return [filteringUnhandledRejectionHandler, ...underlyingListeners]\n }\n return originalProcessListeners.call(process, event as any)\n } as typeof process.listeners)\n\n // Remove all existing handlers\n originalProcessRemoveAllListeners.call(process, 'unhandledRejection')\n\n // Install our filtering handler\n originalProcessOn.call(\n process,\n 'unhandledRejection',\n filteringUnhandledRejectionHandler\n )\n\n originalProcessOn.call(process, 'rejectionHandled', noopRejectionHandled)\n\n filterInstalled = true\n\n debug?.(\n 'after install actual listeners',\n originalProcessListeners\n .call(process, 'unhandledRejection' as any)\n .map((l) => l.toString())\n )\n\n debug?.(\n 'after install listeners',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n}\n\n/**\n * Uninstalls the unhandled rejection filter and restores original process methods.\n * This is called when someone explicitly removes our filtering handler.\n * @internal\n */\nfunction uninstallUnhandledRejectionFilter(): void {\n if (!filterInstalled) {\n debug?.('unexpected second uninstall')\n return\n }\n\n debug?.(\n 'uninstallUnhandledRejectionFilter',\n [filteringUnhandledRejectionHandler, ...underlyingListeners].map((l) =>\n l.toString()\n )\n )\n\n // Restore original process methods\n process.on = originalProcessOn\n process.addListener = originalProcessAddListener\n process.once = originalProcessOnce\n process.prependListener = originalProcessPrependListener\n process.prependOnceListener = originalProcessPrependOnceListener\n process.removeListener = originalProcessRemoveListener\n process.off = originalProcessOff\n process.removeAllListeners = originalProcessRemoveAllListeners\n process.listeners = originalProcessListeners\n\n // Remove our filtering handler\n originalProcessRemoveListener.call(\n process,\n 'unhandledRejection',\n filteringUnhandledRejectionHandler\n )\n\n originalProcessRemoveListener.call(\n process,\n 'rejectionHandled',\n noopRejectionHandled\n )\n\n // Re-register all the handlers that were in our internal queue\n for (const meta of listenerMetadata) {\n if (meta.once) {\n originalProcessOnce.call(process, 'unhandledRejection', meta.listener)\n } else {\n originalProcessOn.call(process, 'unhandledRejection', meta.listener)\n }\n }\n\n // Reset state\n filterInstalled = false\n underlyingListeners.length = 0\n listenerMetadata.length = 0\n\n debug?.(\n 'after uninstall',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n}\n\n/**\n * The filtering handler that decides whether to suppress or delegate unhandled rejections.\n */\nfunction filteringUnhandledRejectionHandler(\n reason: any,\n promise: Promise<any>\n): void {\n const capturedListenerMetadata = Array.from(listenerMetadata)\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime': {\n const signal = workUnitStore.renderSignal\n if (signal.aborted) {\n // This unhandledRejection is from async work spawned in a now\n // aborted prerender. We don't need to report this.\n return\n }\n break\n }\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n // Not from an aborted prerender, delegate to original handlers\n if (capturedListenerMetadata.length === 0) {\n // We need to log something because the default behavior when there is\n // no event handler installed is to trigger an Unhandled Exception.\n // We don't do that here b/c we don't want to rely on this implicit default\n // to kill the process since it can be disabled by installing a userland listener\n // and you may also choose to run Next.js with args such that unhandled rejections\n // do not automatically terminate the process.\n console.error('Unhandled Rejection:', reason)\n } else {\n try {\n for (const meta of capturedListenerMetadata) {\n if (meta.once) {\n // This is a once listener. we remove it from our set before we call it\n const index = listenerMetadata.indexOf(meta)\n if (index !== -1) {\n underlyingListeners.splice(index, 1)\n listenerMetadata.splice(index, 1)\n }\n }\n const listener = meta.listener\n listener(reason, promise)\n }\n } catch (error) {\n // If any handlers error we produce an Uncaught Exception\n setImmediate(() => {\n throw error\n })\n }\n }\n}\n\nfunction noopRejectionHandled() {}\n\n// Install the filter when this module is imported\nif (ENABLE_UHR_FILTER) {\n installUnhandledRejectionFilter()\n}\n"],"names":["MODE","process","env","__NEXT_USE_UNHANDLED_REJECTION_FILTER","ENABLE_UHR_FILTER","DEBUG_UHR_FILTER","undefined","console","error","JSON","stringify","debug","args","log","Error","stack","filterInstalled","underlyingListeners","listenerMetadata","originalProcessOn","originalProcessAddListener","originalProcessOnce","originalProcessRemoveListener","originalProcessRemoveAllListeners","originalProcessListeners","originalProcessPrependListener","originalProcessPrependOnceListener","originalProcessOff","didWarnPrepend","didWarnRemoveAll","installUnhandledRejectionFilter","listeners","map","l","toString","Array","from","listener","once","on","addListener","off","removeListener","removeAllListeners","prependListener","prependOnceListener","patchMethod","original","patchedImpl","Object","defineProperty","value","bind","writable","configurable","event","push","call","warn","unshift","filteringUnhandledRejectionHandler","uninstallUnhandledRejectionFilter","index","lastIndexOf","splice","length","noopRejectionHandled","meta","reason","promise","capturedListenerMetadata","workUnitStore","workUnitAsyncStorage","getStore","type","signal","renderSignal","aborted","indexOf","setImmediate"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;CAmBC;;;;8CAEoC;AAErC,MAAMA,OASUC,QAAQC,GAAG,CAACC,qCAAqC;AAEjE,IAAIC,oBAAoB;AACxB,IAAIC,mBAAmB;AAEvB,OAAQL;IACN,KAAK;QACHK,mBAAmB;IACrB,cAAc;IACd,KAAK;IAC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ources":["../../../src/server/node-environment-extensions/unhandled-rejection.tsx"],"sourcesContent":["/**\n * Manages unhandled rejection listeners to intelligently filter rejections\n * from aborted prerenders when cache components are enabled.\n *\n * THE PROBLEM:\n * When we abort prerenders we expect to find numerous unhandled promise rejections due to\n * things like awaiting Request data like `headers()`. The rejections are fine and should\n * not be construed as problematic so we need to avoid the appearance of a problem by\n * omitting them from the logged output.\n *\n * THE STRATEGY:\n * 1. Install a filtering unhandled rejection handler\n * 2. Intercept process event methods to capture new handlers in our internal queue\n * 3. For each rejection, check if it comes from an aborted prerender context\n * 4. If yes, suppress it. If no, delegate to all handlers in our queue\n * 5. This provides precise filtering without time-based windows\n *\n * This ensures we suppress noisy prerender-related rejections while preserving\n * normal error logging for genuine unhandled rejections.\n */\n\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\nconst MODE:\n | 'enabled'\n | 'debug'\n | 'true'\n | 'false'\n | '1'\n | '0'\n | ''\n | string\n | undefined = process.env.NEXT_USE_UNHANDLED_REJECTION_FILTER\n\nlet ENABLE_UHR_FILTER = false\nlet DEBUG_UHR_FILTER = false\n\nswitch (MODE) {\n case 'debug':\n DEBUG_UHR_FILTER = true\n // fallthrough\n case 'enabled':\n case 'true':\n case '1':\n ENABLE_UHR_FILTER = true\n break\n case 'false':\n case 'disabled':\n case '0':\n case '':\n case undefined:\n break\n default:\n if (typeof MODE === 'string') {\n console.error(\n `NEXT_USE_UNHANDLED_REJECTION_FILTER has an unrecognized value: ${JSON.stringify(MODE)}. Use \"enabled\", \"disabled\", or \"debug\" or omit the environment variable altogether`\n )\n }\n}\n\nconst debug = DEBUG_UHR_FILTER\n ? (...args: any[]) =>\n console.log('[UNHANDLED REJECTION DEBUG]', ...args, new Error().stack)\n : undefined\n\ntype ListenerMetadata = {\n listener: NodeJS.UnhandledRejectionListener\n once: boolean\n}\n\nlet filterInstalled = false\n\n// We store the proxied listeners for unhandled rejections here.\nlet underlyingListeners: Array<NodeJS.UnhandledRejectionListener> = []\n// We store a unique pointer to each event listener registration to track\n// details like whether the listener is a once listener.\nlet listenerMetadata: Array<ListenerMetadata> = []\n\nlet originalProcessOn: typeof process.on\nlet originalProcessAddListener: typeof process.addListener\nlet originalProcessOnce: typeof process.once\nlet originalProcessRemoveListener: typeof process.removeListener\nlet originalProcessRemoveAllListeners: typeof process.removeAllListeners\nlet originalProcessListeners: typeof process.listeners\nlet originalProcessPrependListener: typeof process.prependListener\nlet originalProcessPrependOnceListener: typeof process.prependOnceListener\nlet originalProcessOff: typeof process.off\n\nlet didWarnPrepend = false\nlet didWarnRemoveAll = false\n\n/**\n * Installs a filtering unhandled rejection handler that intelligently suppresses\n * rejections from aborted prerender contexts.\n *\n * This should be called once during server startup to install the global filter.\n */\nfunction installUnhandledRejectionFilter(): void {\n if (filterInstalled) {\n debug?.('unexpected second install')\n return\n }\n\n debug?.(\n 'installUnhandledRejectionFilter',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n\n // Capture existing handlers\n underlyingListeners = Array.from(process.listeners('unhandledRejection'))\n // We assume all existing handlers are not \"once\"\n listenerMetadata = underlyingListeners.map((l) => ({\n listener: l,\n once: false,\n }))\n\n // Store the original process methods\n originalProcessOn = process.on\n originalProcessAddListener = process.addListener\n originalProcessOnce = process.once\n originalProcessOff = process.off\n originalProcessRemoveListener = process.removeListener\n originalProcessRemoveAllListeners = process.removeAllListeners\n originalProcessListeners = process.listeners\n originalProcessPrependListener = process.prependListener\n originalProcessPrependOnceListener = process.prependOnceListener\n\n // Helper function to create a patched method that preserves toString behavior\n function patchMethod<T extends Function>(original: T, patchedImpl: T): T {\n // Preserve the original toString behavior\n Object.defineProperty(patchedImpl, 'toString', {\n value: original.toString.bind(original),\n writable: true,\n configurable: true,\n })\n return patchedImpl\n }\n\n // Intercept process.on to capture new unhandled rejection handlers\n process.on = patchMethod(originalProcessOn, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.on/addListener', listener.toString())\n // Add new handlers to our internal queue instead of the process\n underlyingListeners.push(listener as NodeJS.UnhandledRejectionListener)\n listenerMetadata.push({ listener, once: false })\n return process\n }\n // For other events, use the original method\n return originalProcessOn.call(process, event, listener)\n } as typeof process.on)\n\n // Intercept process.addListener (alias for process.on)\n process.addListener = patchMethod(\n originalProcessAddListener,\n process.on as typeof originalProcessAddListener\n )\n\n // Intercept process.once for one-time handlers\n process.once = patchMethod(originalProcessOnce, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.once', listener.toString())\n underlyingListeners.push(listener)\n listenerMetadata.push({ listener, once: true })\n return process\n }\n // For other events, use the original method\n return originalProcessOnce.call(process, event, listener)\n } as typeof process.once)\n\n // Intercept process.prependListener for handlers that should go first\n process.prependListener = patchMethod(\n originalProcessPrependListener,\n function (event: string | symbol, listener: (...args: any[]) => void) {\n if (event === 'unhandledRejection') {\n debug?.('process.prependListener', listener.toString())\n if (didWarnPrepend === false) {\n didWarnPrepend = true\n console.warn(\n 'Warning: `prependListener(\"unhandledRejection\")` called, but Next.js maintains the first listener ' +\n 'which filters out unnecessary events from aborted prerenders. Your handler will be second.'\n )\n }\n // Add new handlers to the beginning of our internal queue\n underlyingListeners.unshift(\n listener as NodeJS.UnhandledRejectionListener\n )\n listenerMetadata.unshift({ listener, once: false })\n return process\n }\n // For other events, use the original method\n return originalProcessPrependListener.call(\n process,\n event as any,\n listener\n )\n } as typeof process.prependListener\n )\n\n // Intercept process.prependOnceListener for one-time handlers that should go first\n process.prependOnceListener = patchMethod(\n originalProcessPrependOnceListener,\n function (event: string | symbol, listener: (...args: any[]) => void) {\n if (event === 'unhandledRejection') {\n debug?.('process.prependOnceListener', listener.toString())\n if (didWarnPrepend === false) {\n didWarnPrepend = true\n console.warn(\n 'Warning: `prependOnceListener(\"unhandledRejection\")` called, but Next.js maintains the first listener ' +\n 'which filters out unnecessary events from aborted prerenders. Your handler will be second.'\n )\n }\n // Add to the beginning of our internal queue\n underlyingListeners.unshift(listener)\n listenerMetadata.unshift({ listener, once: true })\n return process\n }\n // For other events, use the original method\n return originalProcessPrependOnceListener.call(\n process,\n event as any,\n listener\n )\n } as typeof process.prependOnceListener\n )\n\n // Intercept process.removeListener\n process.removeListener = patchMethod(originalProcessRemoveListener, function (\n event: string | symbol,\n listener: (...args: any[]) => void\n ) {\n if (event === 'unhandledRejection') {\n debug?.('process.removeListener', listener.toString())\n // Check if they're trying to remove our filtering handler\n if (listener === filteringUnhandledRejectionHandler) {\n uninstallUnhandledRejectionFilter()\n return process\n }\n\n const index = underlyingListeners.lastIndexOf(listener)\n if (index > -1) {\n debug?.('process.removeListener match found', index)\n underlyingListeners.splice(index, 1)\n listenerMetadata.splice(index, 1)\n } else {\n debug?.('process.removeListener match not found', index)\n }\n return process\n }\n // For other events, use the original method\n return originalProcessRemoveListener.call(process, event, listener)\n } as typeof process.removeListener)\n\n // Intercept process.off (alias for process.removeListener)\n process.off = patchMethod(\n originalProcessOff,\n process.removeListener as typeof originalProcessOff\n )\n\n // Intercept process.removeAllListeners\n process.removeAllListeners = patchMethod(\n originalProcessRemoveAllListeners,\n function (event?: string | symbol) {\n if (event === 'unhandledRejection') {\n debug?.(\n 'process.removeAllListeners',\n underlyingListeners.map((l) => l.toString())\n )\n if (didWarnRemoveAll === false) {\n didWarnRemoveAll = true\n console.warn(\n 'Warning: `removeAllListeners(\"unhandledRejection\")` called. Next.js maintains an `unhandledRejection` listener ' +\n 'to filter out unnecessary rejection warnings caused by aborting prerenders early. It is not recommended that you ' +\n 'uninstall this behavior, but if you want to you must call `process.removeListener(\"unhandledRejection\", listener)`. ' +\n 'You can acquire the listener from `process.listeners(\"unhandledRejection\")[0]`.'\n )\n }\n underlyingListeners.length = 0\n listenerMetadata.length = 0\n return process\n }\n\n // For other specific events, use the original method\n if (event !== undefined) {\n return originalProcessRemoveAllListeners.call(process, event)\n }\n\n // If no event specified (removeAllListeners()), uninstall our patch completely\n console.warn(\n 'Warning: `removeAllListeners()` called - uninstalling Next.js unhandled rejection filter. ' +\n 'You will observe `unhandledRejection` logs from prerendering which are not problematic.'\n )\n uninstallUnhandledRejectionFilter()\n return originalProcessRemoveAllListeners.call(process)\n } as typeof process.removeAllListeners\n )\n\n // Intercept process.listeners to return our internal handlers for unhandled rejection\n process.listeners = patchMethod(originalProcessListeners, function (\n event: string | symbol\n ) {\n if (event === 'unhandledRejection') {\n debug?.(\n 'process.listeners',\n [filteringUnhandledRejectionHandler, ...underlyingListeners].map((l) =>\n l.toString()\n )\n )\n return [filteringUnhandledRejectionHandler, ...underlyingListeners]\n }\n return originalProcessListeners.call(process, event as any)\n } as typeof process.listeners)\n\n // Remove all existing handlers\n originalProcessRemoveAllListeners.call(process, 'unhandledRejection')\n\n // Install our filtering handler\n originalProcessOn.call(\n process,\n 'unhandledRejection',\n filteringUnhandledRejectionHandler\n )\n\n originalProcessOn.call(process, 'rejectionHandled', noopRejectionHandled)\n\n filterInstalled = true\n\n debug?.(\n 'after install actual listeners',\n originalProcessListeners\n .call(process, 'unhandledRejection' as any)\n .map((l) => l.toString())\n )\n\n debug?.(\n 'after install listeners',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n}\n\n/**\n * Uninstalls the unhandled rejection filter and restores original process methods.\n * This is called when someone explicitly removes our filtering handler.\n * @internal\n */\nfunction uninstallUnhandledRejectionFilter(): void {\n if (!filterInstalled) {\n debug?.('unexpected second uninstall')\n return\n }\n\n debug?.(\n 'uninstallUnhandledRejectionFilter',\n [filteringUnhandledRejectionHandler, ...underlyingListeners].map((l) =>\n l.toString()\n )\n )\n\n // Restore original process methods\n process.on = originalProcessOn\n process.addListener = originalProcessAddListener\n process.once = originalProcessOnce\n process.prependListener = originalProcessPrependListener\n process.prependOnceListener = originalProcessPrependOnceListener\n process.removeListener = originalProcessRemoveListener\n process.off = originalProcessOff\n process.removeAllListeners = originalProcessRemoveAllListeners\n process.listeners = originalProcessListeners\n\n // Remove our filtering handler\n originalProcessRemoveListener.call(\n process,\n 'unhandledRejection',\n filteringUnhandledRejectionHandler\n )\n\n originalProcessRemoveListener.call(\n process,\n 'rejectionHandled',\n noopRejectionHandled\n )\n\n // Re-register all the handlers that were in our internal queue\n for (const meta of listenerMetadata) {\n if (meta.once) {\n originalProcessOnce.call(process, 'unhandledRejection', meta.listener)\n } else {\n originalProcessOn.call(process, 'unhandledRejection', meta.listener)\n }\n }\n\n // Reset state\n filterInstalled = false\n underlyingListeners.length = 0\n listenerMetadata.length = 0\n\n debug?.(\n 'after uninstall',\n process.listeners('unhandledRejection').map((l) => l.toString())\n )\n}\n\n/**\n * The filtering handler that decides whether to suppress or delegate unhandled rejections.\n */\nfunction filteringUnhandledRejectionHandler(\n reason: any,\n promise: Promise<any>\n): void {\n const capturedListenerMetadata = Array.from(listenerMetadata)\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime': {\n const signal = workUnitStore.renderSignal\n if (signal.aborted) {\n // This unhandledRejection is from async work spawned in a now\n // aborted prerender. We don't need to report this.\n return\n }\n break\n }\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n // Not from an aborted prerender, delegate to original handlers\n if (capturedListenerMetadata.length === 0) {\n // We need to log something because the default behavior when there is\n // no event handler installed is to trigger an Unhandled Exception.\n // We don't do that here b/c we don't want to rely on this implicit default\n // to kill the process since it can be disabled by installing a userland listener\n // and you may also choose to run Next.js with args such that unhandled rejections\n // do not automatically terminate the process.\n console.error('Unhandled Rejection:', reason)\n } else {\n try {\n for (const meta of capturedListenerMetadata) {\n if (meta.once) {\n // This is a once listener. we remove it from our set before we call it\n const index = listenerMetadata.indexOf(meta)\n if (index !== -1) {\n underlyingListeners.splice(index, 1)\n listenerMetadata.splice(index, 1)\n }\n }\n const listener = meta.listener\n listener(reason, promise)\n }\n } catch (error) {\n // If any handlers error we produce an Uncaught Exception\n setImmediate(() => {\n throw error\n })\n }\n }\n}\n\nfunction noopRejectionHandled() {}\n\n// Install the filter when this module is imported\nif (ENABLE_UHR_FILTER) {\n installUnhandledRejectionFilter()\n}\n"],"names":["MODE","process","env","NEXT_USE_UNHANDLED_REJECTION_FILTER","ENABLE_UHR_FILTER","DEBUG_UHR_FILTER","undefined","console","error","JSON","stringify","debug","args","log","Error","stack","filterInstalled","underlyingListeners","listenerMetadata","originalProcessOn","originalProcessAddListener","originalProcessOnce","originalProcessRemoveListener","originalProcessRemoveAllListeners","originalProcessListeners","originalProcessPrependListener","originalProcessPrependOnceListener","originalProcessOff","didWarnPrepend","didWarnRemoveAll","installUnhandledRejectionFilter","listeners","map","l","toString","Array","from","listener","once","on","addListener","off","removeListener","removeAllListeners","prependListener","prependOnceListener","patchMethod","original","patchedImpl","Object","defineProperty","value","bind","writable","configurable","event","push","call","warn","unshift","filteringUnhandledRejectionHandler","uninstallUnhandledRejectionFilter","index","lastIndexOf","splice","length","noopRejectionHandled","meta","reason","promise","capturedListenerMetadata","workUnitStore","workUnitAsyncStorage","getStore","type","signal","renderSignal","aborted","indexOf","setImmediate"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;CAmBC;;;;8CAEoC;AAErC,MAAMA,OASUC,QAAQC,GAAG,CAACC,mCAAmC;AAE/D,IAAIC,oBAAoB;AACxB,IAAIC,mBAAmB;AAEvB,OAAQL;IACN,KAAK;QACHK,mBAAmB;IACrB,cAAc;IACd,KAAK;IACL,KAAK;IACL,KAAK;QACHD,oBAAoB;QACpB;IACF,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAKE;QACH;IACF;QACE,IAAI,OAAON,SAAS,UAAU;YAC5BO,QAAQC,KAAK,CACX,CAAC,+DAA+D,EAAEC,KAAKC,SAAS,CAACV,MAAM,mFAAmF,CAAC;QAE/K;AACJ;AAEA,MAAMW,QAAQN,mBACV,CAAC,GAAGO,OAC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L,KAAK;gBAAqB;oBACxB,MAAMC,SAASJ,cAAcK,YAAY;oBACzC,IAAID,OAAOE,OAAO,EAAE;wBAClB,8DAA8D;wBAC9D,mDAAmD;wBACnD;oBACF;oBACA;gBACF;YACA,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBACH;YACF;gBACEN;QACJ;IACF;IAEA,+DAA+D;IAC/D,IAAID,yBAAyBL,MAAM,KAAK,GAAG;QACzC,sEAAsE;QACtE,mEAAmE;QACnE,2EAA2E;QAC3E,iFAAiF;QACjF,kFAAkF;QAClF,8CAA8C;QAC9C1D,QAAQC,KAAK,CAAC,wBAAwB4D;IACxC,OAAO;QACL,IAAI;YACF,KAAK,MAAMD,QAAQG,yBAA0B;gBAC3C,IAAIH,KAAK7B,IAAI,EAAE;oBACb,uEAAuE;oBACvE,MAAMwB,QAAQ5C,iBAAiB4D,OAAO,CAACX;oBACvC,IAAIL,UAAU,CAAC,GAAG;wBAChB7C,oBAAoB+C,MAAM,CAACF,OAAO;wBAClC5C,iBAAiB8C,MAAM,CAACF,OAAO;oBACjC;gBACF;gBACA,MAAMzB,WAAW8B,KAAK9B,QAAQ;gBAC9BA,SAAS+B,QAAQC;YACnB;QACF,EAAE,OAAO7D,OAAO;YACd,yDAAyD;YACzDuE,aAAa;gBACX,MAAMvE;YACR;QACF;IACF;AACF;AAEA,SAAS0D,wBAAwB;AAEjC,kDAAkD;AAClD,IAAI9D,mBAAmB;IACrB0B;AACF","ignoreList":[0]}
@@ -22,7 +22,7 @@ _export(exports, {
22
22
  });
23
23
  function isStableBuild() {
24
24
  var _process_env___NEXT_VERSION;
25
- return !((_process_env___NEXT_VERSION = "15.6.0-canary.3") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
25
+ return !((_process_env___NEXT_VERSION = "15.6.0-canary.4") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
26
26
  }
27
27
  class CanaryOnlyError extends Error {
28
28
  constructor(arg){
@@ -81,7 +81,7 @@ function getAnonymousMeta() {
81
81
  isWsl: _iswsl.default,
82
82
  isCI: _ciinfo.isCI,
83
83
  ciName: _ciinfo.isCI && _ciinfo.name || null,
84
- nextVersion: "15.6.0-canary.3"
84
+ nextVersion: "15.6.0-canary.4"
85
85
  };
86
86
  return traits;
87
87
  }
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
11
11
  const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
12
12
  function eventCliSessionStopped(event) {
13
13
  // This should be an invariant, if it fails our build tooling is broken.
14
- if (typeof "15.6.0-canary.3" !== 'string') {
14
+ if (typeof "15.6.0-canary.4" !== 'string') {
15
15
  return [];
16
16
  }
17
17
  const payload = {
18
- nextVersion: "15.6.0-canary.3",
18
+ nextVersion: "15.6.0-canary.4",
19
19
  nodeVersion: process.version,
20
20
  cliCommand: event.cliCommand,
21
21
  durationMilliseconds: event.durationMilliseconds,
@@ -12,12 +12,12 @@ const EVENT_VERSION = 'NEXT_CLI_SESSION_STARTED';
12
12
  function eventCliSession(nextConfig, event) {
13
13
  var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
14
14
  // This should be an invariant, if it fails our build tooling is broken.
15
- if (typeof "15.6.0-canary.3" !== 'string') {
15
+ if (typeof "15.6.0-canary.4" !== 'string') {
16
16
  return [];
17
17
  }
18
18
  const { images, i18n } = nextConfig || {};
19
19
  const payload = {
20
- nextVersion: "15.6.0-canary.3",
20
+ nextVersion: "15.6.0-canary.4",
21
21
  nodeVersion: process.version,
22
22
  cliCommand: event.cliCommand,
23
23
  isSrcDir: event.isSrcDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next",
3
- "version": "15.6.0-canary.3",
3
+ "version": "15.6.0-canary.4",
4
4
  "description": "The React Framework",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -102,7 +102,7 @@
102
102
  ]
103
103
  },
104
104
  "dependencies": {
105
- "@next/env": "15.6.0-canary.3",
105
+ "@next/env": "15.6.0-canary.4",
106
106
  "@swc/helpers": "0.5.15",
107
107
  "caniuse-lite": "^1.0.30001579",
108
108
  "postcss": "8.4.31",
@@ -132,14 +132,14 @@
132
132
  },
133
133
  "optionalDependencies": {
134
134
  "sharp": "^0.34.3",
135
- "@next/swc-darwin-arm64": "15.6.0-canary.3",
136
- "@next/swc-darwin-x64": "15.6.0-canary.3",
137
- "@next/swc-linux-arm64-gnu": "15.6.0-canary.3",
138
- "@next/swc-linux-arm64-musl": "15.6.0-canary.3",
139
- "@next/swc-linux-x64-gnu": "15.6.0-canary.3",
140
- "@next/swc-linux-x64-musl": "15.6.0-canary.3",
141
- "@next/swc-win32-arm64-msvc": "15.6.0-canary.3",
142
- "@next/swc-win32-x64-msvc": "15.6.0-canary.3"
135
+ "@next/swc-darwin-arm64": "15.6.0-canary.4",
136
+ "@next/swc-darwin-x64": "15.6.0-canary.4",
137
+ "@next/swc-linux-arm64-gnu": "15.6.0-canary.4",
138
+ "@next/swc-linux-arm64-musl": "15.6.0-canary.4",
139
+ "@next/swc-linux-x64-gnu": "15.6.0-canary.4",
140
+ "@next/swc-linux-x64-musl": "15.6.0-canary.4",
141
+ "@next/swc-win32-arm64-msvc": "15.6.0-canary.4",
142
+ "@next/swc-win32-x64-msvc": "15.6.0-canary.4"
143
143
  },
144
144
  "devDependencies": {
145
145
  "@ampproject/toolbox-optimizer": "2.8.3",
@@ -174,11 +174,11 @@
174
174
  "@jest/types": "29.5.0",
175
175
  "@mswjs/interceptors": "0.23.0",
176
176
  "@napi-rs/triples": "1.2.0",
177
- "@next/font": "15.6.0-canary.3",
178
- "@next/polyfill-module": "15.6.0-canary.3",
179
- "@next/polyfill-nomodule": "15.6.0-canary.3",
180
- "@next/react-refresh-utils": "15.6.0-canary.3",
181
- "@next/swc": "15.6.0-canary.3",
177
+ "@next/font": "15.6.0-canary.4",
178
+ "@next/polyfill-module": "15.6.0-canary.4",
179
+ "@next/polyfill-nomodule": "15.6.0-canary.4",
180
+ "@next/react-refresh-utils": "15.6.0-canary.4",
181
+ "@next/swc": "15.6.0-canary.4",
182
182
  "@opentelemetry/api": "1.6.0",
183
183
  "@playwright/test": "1.51.1",
184
184
  "@rspack/core": "1.5.0",