next 15.5.1-canary.26 → 15.5.1-canary.27
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.
- package/dist/bin/next +3 -3
- package/dist/build/index.js +4 -3
- package/dist/build/index.js.map +1 -1
- package/dist/build/load-jsconfig.js +4 -3
- package/dist/build/load-jsconfig.js.map +1 -1
- package/dist/build/swc/generated-native.d.ts +0 -4
- package/dist/build/swc/index.js +1 -3
- package/dist/build/swc/index.js.map +1 -1
- package/dist/build/swc/types.d.ts +0 -10
- package/dist/build/turbopack-build/impl.js +0 -1
- package/dist/build/turbopack-build/impl.js.map +1 -1
- package/dist/build/type-check.js.map +1 -1
- package/dist/build/webpack/loaders/next-app-loader/index.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +4 -3
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/load-jsconfig.js +4 -3
- package/dist/esm/build/load-jsconfig.js.map +1 -1
- package/dist/esm/build/swc/generated-native.d.ts +0 -4
- package/dist/esm/build/swc/index.js +1 -3
- package/dist/esm/build/swc/index.js.map +1 -1
- package/dist/esm/build/swc/types.js.map +1 -1
- package/dist/esm/build/turbopack-build/impl.js +1 -2
- package/dist/esm/build/turbopack-build/impl.js.map +1 -1
- package/dist/esm/build/type-check.js.map +1 -1
- package/dist/esm/build/webpack/loaders/next-app-loader/index.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/find-pages-dir.js +11 -0
- package/dist/esm/lib/find-pages-dir.js.map +1 -1
- package/dist/esm/lib/verify-root-layout.js +2 -1
- package/dist/esm/lib/verify-root-layout.js.map +1 -1
- package/dist/esm/lib/verify-typescript-setup.js +3 -2
- package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
- package/dist/esm/server/config-shared.js +1 -1
- package/dist/esm/server/config-shared.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +2 -3
- package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +11 -9
- package/dist/esm/server/lib/app-info-log.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +3 -2
- package/dist/esm/server/lib/start-server.js.map +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/esm/shared/lib/turbopack/utils.js +0 -7
- package/dist/esm/shared/lib/turbopack/utils.js.map +1 -1
- package/dist/lib/find-pages-dir.js +11 -0
- package/dist/lib/find-pages-dir.js.map +1 -1
- package/dist/lib/verify-root-layout.d.ts +1 -1
- package/dist/lib/verify-root-layout.js +2 -1
- package/dist/lib/verify-root-layout.js.map +1 -1
- package/dist/lib/verify-typescript-setup.d.ts +1 -1
- package/dist/lib/verify-typescript-setup.js +3 -2
- package/dist/lib/verify-typescript-setup.js.map +1 -1
- package/dist/server/config-shared.d.ts +2 -2
- package/dist/server/config-shared.js +1 -1
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -2
- package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.d.ts +2 -1
- package/dist/server/lib/app-info-log.js +11 -9
- package/dist/server/lib/app-info-log.js.map +1 -1
- package/dist/server/lib/start-server.js +3 -2
- package/dist/server/lib/start-server.js.map +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/shared/lib/turbopack/utils.d.ts +0 -3
- package/dist/shared/lib/turbopack/utils.js +0 -11
- package/dist/shared/lib/turbopack/utils.js.map +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +16 -16
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/server/dev/hot-reloader-turbopack.ts"],"sourcesContent":["import type { Socket } from 'net'\nimport { mkdir, writeFile } from 'fs/promises'\nimport { join, extname, relative } from 'path'\nimport { pathToFileURL } from 'url'\n\nimport ws from 'next/dist/compiled/ws'\n\nimport type { OutputState } from '../../build/output/store'\nimport { store as consoleStore } from '../../build/output/store'\nimport type {\n CompilationError,\n HmrMessageSentToBrowser,\n NextJsHotReloaderInterface,\n ReloadPageMessage,\n SyncMessage,\n TurbopackConnectedMessage,\n} from './hot-reloader-types'\nimport { HMR_MESSAGE_SENT_TO_BROWSER } from './hot-reloader-types'\nimport type {\n Update as TurbopackUpdate,\n Endpoint,\n WrittenEndpoint,\n TurbopackResult,\n Project,\n Entrypoints,\n} from '../../build/swc/types'\nimport { createDefineEnv } from '../../build/swc'\nimport * as Log from '../../build/output/log'\nimport {\n getVersionInfo,\n matchNextPageBundleRequest,\n} from './hot-reloader-webpack'\nimport { BLOCKED_PAGES } from '../../shared/lib/constants'\nimport {\n getOverlayMiddleware,\n getSourceMapMiddleware,\n} from './middleware-turbopack'\nimport { PageNotFoundError } from '../../shared/lib/utils'\nimport { debounce } from '../utils'\nimport { deleteCache } from './require-cache'\nimport {\n clearAllModuleContexts,\n clearModuleContext,\n} from '../lib/render-server'\nimport { denormalizePagePath } from '../../shared/lib/page-path/denormalize-page-path'\nimport { trace } from '../../trace'\nimport {\n AssetMapper,\n type ChangeSubscriptions,\n type ClientState,\n handleEntrypoints,\n handlePagesErrorRoute,\n handleRouteType,\n hasEntrypointForKey,\n msToNs,\n type ReadyIds,\n type SendHmr,\n type StartBuilding,\n processTopLevelIssues,\n printNonFatalIssue,\n normalizedPageToTurbopackStructureRoute,\n} from './turbopack-utils'\nimport {\n propagateServerField,\n type ServerFields,\n type SetupOpts,\n} from '../lib/router-utils/setup-dev-bundler'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { findPagePathData } from './on-demand-entry-handler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport {\n type EntryKey,\n getEntryKey,\n splitEntryKey,\n} from '../../shared/lib/turbopack/entry-key'\nimport { FAST_REFRESH_RUNTIME_RELOAD } from './messages'\nimport { generateEncryptionKeyBase64 } from '../app-render/encryption-utils-server'\nimport { isAppPageRouteDefinition } from '../route-definitions/app-page-route-definition'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport type { ModernSourceMapPayload } from '../lib/source-maps'\nimport { getNodeDebugType } from '../lib/utils'\nimport { isMetadataRouteFile } from '../../lib/metadata/is-metadata-route'\nimport { setBundlerFindSourceMapImplementation } from '../patch-error-inspect'\nimport { getNextErrorFeedbackMiddleware } from '../../next-devtools/server/get-next-error-feedback-middleware'\nimport {\n formatIssue,\n getTurbopackJsConfig,\n isPersistentCachingEnabled,\n isWellKnownError,\n processIssues,\n renderStyledStringToErrorAnsi,\n type EntryIssuesMap,\n type TopLevelIssuesMap,\n} from '../../shared/lib/turbopack/utils'\nimport { getDevOverlayFontMiddleware } from '../../next-devtools/server/font/get-dev-overlay-font-middleware'\nimport { devIndicatorServerState } from './dev-indicator-server-state'\nimport { getDisableDevIndicatorMiddleware } from '../../next-devtools/server/dev-indicator-middleware'\nimport { getRestartDevServerMiddleware } from '../../next-devtools/server/restart-dev-server-middleware'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../../build/utils'\nimport { receiveBrowserLogsTurbopack } from './browser-logs/receive-logs'\nimport { normalizePath } from '../../lib/normalize-path'\nimport {\n devToolsConfigMiddleware,\n getDevToolsConfig,\n} from '../../next-devtools/server/devtools-config-middleware'\n\nconst wsServer = new ws.Server({ noServer: true })\nconst isTestMode = !!(\n process.env.NEXT_TEST_MODE ||\n process.env.__NEXT_TEST_MODE ||\n process.env.DEBUG\n)\n\nconst sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random())\n\ndeclare const __next__clear_chunk_cache__: (() => void) | null | undefined\n\n/**\n * Replaces turbopack:///[project] with the specified project in the `source` field.\n */\nfunction rewriteTurbopackSources(\n projectRoot: string,\n sourceMap: ModernSourceMapPayload\n): void {\n if ('sections' in sourceMap) {\n for (const section of sourceMap.sections) {\n rewriteTurbopackSources(projectRoot, section.map)\n }\n } else {\n for (let i = 0; i < sourceMap.sources.length; i++) {\n sourceMap.sources[i] = pathToFileURL(\n join(\n projectRoot,\n sourceMap.sources[i].replace(/turbopack:\\/\\/\\/\\[project\\]/, '')\n )\n ).toString()\n }\n }\n}\n\nfunction getSourceMapFromTurbopack(\n project: Project,\n projectRoot: string,\n sourceURL: string\n): ModernSourceMapPayload | undefined {\n let sourceMapJson: string | null = null\n\n try {\n sourceMapJson = project.getSourceMapSync(sourceURL)\n } catch (err) {}\n\n if (sourceMapJson === null) {\n return undefined\n } else {\n const payload: ModernSourceMapPayload = JSON.parse(sourceMapJson)\n // The sourcemap from Turbopack is not yet written to disk so its `sources`\n // are not absolute paths yet. We need to rewrite them to be absolute paths.\n rewriteTurbopackSources(projectRoot, payload)\n return payload\n }\n}\n\nexport async function createHotReloaderTurbopack(\n opts: SetupOpts & { isSrcDir: boolean },\n serverFields: ServerFields,\n distDir: string,\n resetFetch: () => void\n): Promise<NextJsHotReloaderInterface> {\n const dev = true\n const buildId = 'development'\n const { nextConfig, dir: projectPath } = opts\n\n const { loadBindings } =\n require('../../build/swc') as typeof import('../../build/swc')\n\n let bindings = await loadBindings()\n\n // For the debugging purpose, check if createNext or equivalent next instance setup in test cases\n // works correctly. Normally `run-test` hides output so only will be visible when `--debug` flag is used.\n if (isTestMode) {\n ;(require('console') as typeof import('console')).log(\n 'Creating turbopack project',\n {\n dir: projectPath,\n testMode: isTestMode,\n }\n )\n }\n\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n const hotReloaderSpan = trace('hot-reloader', undefined, {\n version: process.env.__NEXT_VERSION as string,\n })\n // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing\n // of the current `next dev` invocation.\n hotReloaderSpan.stop()\n\n const encryptionKey = await generateEncryptionKeyBase64({\n isBuild: false,\n distDir,\n })\n\n // TODO: Implement\n let clientRouterFilters: any\n if (nextConfig.experimental.clientRouterFilter) {\n // TODO this need to be set correctly for persistent caching to work\n }\n\n const supportedBrowsers = getSupportedBrowsers(projectPath, dev)\n const currentNodeJsVersion = process.versions.node\n\n const rootPath =\n opts.nextConfig.turbopack?.root ||\n opts.nextConfig.outputFileTracingRoot ||\n projectPath\n const project = await bindings.turbo.createProject(\n {\n rootPath,\n projectPath: normalizePath(relative(rootPath, projectPath) || '.'),\n distDir,\n nextConfig: opts.nextConfig,\n jsConfig: await getTurbopackJsConfig(projectPath, nextConfig),\n watch: {\n enable: dev,\n pollIntervalMs: nextConfig.watchOptions?.pollIntervalMs,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters,\n config: nextConfig,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix: opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // TODO: Implement\n middlewareMatchers: undefined,\n rewrites: opts.fsChecker.rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps: opts.fsChecker.prerenderManifest.preview,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling: false,\n currentNodeJsVersion,\n },\n {\n persistentCaching: isPersistentCachingEnabled(opts.nextConfig),\n memoryLimit: opts.nextConfig.experimental?.turbopackMemoryLimit,\n isShortSession: false,\n }\n )\n backgroundLogCompilationEvents(project, {\n eventTypes: ['StartupCacheInvalidationEvent', 'TimingEvent'],\n })\n setBundlerFindSourceMapImplementation(\n getSourceMapFromTurbopack.bind(null, project, projectPath)\n )\n opts.onDevServerCleanup?.(async () => {\n setBundlerFindSourceMapImplementation(() => undefined)\n await project.onExit()\n })\n const entrypointsSubscription = project.entrypointsSubscribe()\n\n const currentWrittenEntrypoints: Map<EntryKey, WrittenEndpoint> = new Map()\n const currentEntrypoints: Entrypoints = {\n global: {\n app: undefined,\n document: undefined,\n error: undefined,\n\n middleware: undefined,\n instrumentation: undefined,\n },\n\n page: new Map(),\n app: new Map(),\n }\n\n const currentTopLevelIssues: TopLevelIssuesMap = new Map()\n const currentEntryIssues: EntryIssuesMap = new Map()\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n // Dev specific\n const changeSubscriptions: ChangeSubscriptions = new Map()\n const serverPathState = new Map<string, string>()\n const readyIds: ReadyIds = new Set()\n let currentEntriesHandlingResolve: ((value?: unknown) => void) | undefined\n let currentEntriesHandling = new Promise(\n (resolve) => (currentEntriesHandlingResolve = resolve)\n )\n\n const assetMapper = new AssetMapper()\n\n function clearRequireCache(\n key: EntryKey,\n writtenEndpoint: WrittenEndpoint,\n {\n force,\n }: {\n // Always clear the cache, don't check if files have changed\n force?: boolean\n } = {}\n ): boolean {\n if (force) {\n for (const { path, contentHash } of writtenEndpoint.serverPaths) {\n // We ignore source maps\n if (path.endsWith('.map')) continue\n const localKey = `${key}:${path}`\n serverPathState.set(localKey, contentHash)\n serverPathState.set(path, contentHash)\n }\n } else {\n // Figure out if the server files have changed\n let hasChange = false\n for (const { path, contentHash } of writtenEndpoint.serverPaths) {\n // We ignore source maps\n if (path.endsWith('.map')) continue\n const localKey = `${key}:${path}`\n const localHash = serverPathState.get(localKey)\n const globalHash = serverPathState.get(path)\n if (\n (localHash && localHash !== contentHash) ||\n (globalHash && globalHash !== contentHash)\n ) {\n hasChange = true\n serverPathState.set(localKey, contentHash)\n serverPathState.set(path, contentHash)\n } else {\n if (!localHash) {\n serverPathState.set(localKey, contentHash)\n }\n if (!globalHash) {\n serverPathState.set(path, contentHash)\n }\n }\n }\n\n if (!hasChange) {\n return false\n }\n }\n\n resetFetch()\n\n // Not available in:\n // - Pages Router (no server-side HMR)\n // - Edge Runtime (uses browser runtime which already disposes chunks individually)\n if (typeof __next__clear_chunk_cache__ === 'function') {\n __next__clear_chunk_cache__()\n }\n\n const serverPaths = writtenEndpoint.serverPaths.map(({ path: p }) =>\n join(distDir, p)\n )\n\n for (const file of serverPaths) {\n clearModuleContext(file)\n deleteCache(file)\n }\n\n return true\n }\n\n const buildingIds = new Set()\n\n const startBuilding: StartBuilding = (id, requestUrl, forceRebuild) => {\n if (!forceRebuild && readyIds.has(id)) {\n return () => {}\n }\n if (buildingIds.size === 0) {\n consoleStore.setState(\n {\n loading: true,\n trigger: id,\n url: requestUrl,\n } as OutputState,\n true\n )\n }\n buildingIds.add(id)\n return function finishBuilding() {\n if (buildingIds.size === 0) {\n return\n }\n readyIds.add(id)\n buildingIds.delete(id)\n if (buildingIds.size === 0) {\n hmrEventHappened = false\n consoleStore.setState(\n {\n loading: false,\n } as OutputState,\n true\n )\n }\n }\n }\n\n let hmrEventHappened = false\n let hmrHash = 0\n\n const clients = new Set<ws>()\n const clientStates = new WeakMap<ws, ClientState>()\n\n function sendToClient(client: ws, message: HmrMessageSentToBrowser) {\n client.send(JSON.stringify(message))\n }\n\n function sendEnqueuedMessages() {\n for (const [, issueMap] of currentEntryIssues) {\n if (\n [...issueMap.values()].filter((i) => i.severity !== 'warning').length >\n 0\n ) {\n // During compilation errors we want to delay the HMR events until errors are fixed\n return\n }\n }\n\n for (const client of clients) {\n const state = clientStates.get(client)\n if (!state) {\n continue\n }\n\n for (const [, issueMap] of state.clientIssues) {\n if (\n [...issueMap.values()].filter((i) => i.severity !== 'warning')\n .length > 0\n ) {\n // During compilation errors we want to delay the HMR events until errors are fixed\n return\n }\n }\n\n for (const message of state.messages.values()) {\n sendToClient(client, message)\n }\n state.messages.clear()\n\n if (state.turbopackUpdates.length > 0) {\n sendToClient(client, {\n type: HMR_MESSAGE_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: state.turbopackUpdates,\n })\n state.turbopackUpdates.length = 0\n }\n }\n }\n const sendEnqueuedMessagesDebounce = debounce(sendEnqueuedMessages, 2)\n\n const sendHmr: SendHmr = (id: string, message: HmrMessageSentToBrowser) => {\n for (const client of clients) {\n clientStates.get(client)?.messages.set(id, message)\n }\n\n hmrEventHappened = true\n sendEnqueuedMessagesDebounce()\n }\n\n function sendTurbopackMessage(payload: TurbopackUpdate) {\n // TODO(PACK-2049): For some reason we end up emitting hundreds of issues messages on bigger apps,\n // a lot of which are duplicates.\n // They are currently not handled on the client at all, so might as well not send them for now.\n payload.diagnostics = []\n payload.issues = []\n\n for (const client of clients) {\n clientStates.get(client)?.turbopackUpdates.push(payload)\n }\n\n hmrEventHappened = true\n sendEnqueuedMessagesDebounce()\n }\n\n async function subscribeToChanges(\n key: EntryKey,\n includeIssues: boolean,\n endpoint: Endpoint,\n createMessage: (\n change: TurbopackResult,\n hash: string\n ) => Promise<HmrMessageSentToBrowser> | HmrMessageSentToBrowser | void,\n onError?: (\n error: Error\n ) => Promise<HmrMessageSentToBrowser> | HmrMessageSentToBrowser | void\n ) {\n if (changeSubscriptions.has(key)) {\n return\n }\n\n const { side } = splitEntryKey(key)\n\n const changedPromise = endpoint[`${side}Changed`](includeIssues)\n changeSubscriptions.set(key, changedPromise)\n try {\n const changed = await changedPromise\n\n for await (const change of changed) {\n processIssues(currentEntryIssues, key, change, false, true)\n // TODO: Get an actual content hash from Turbopack.\n const message = await createMessage(change, String(++hmrHash))\n if (message) {\n sendHmr(key, message)\n }\n }\n } catch (e) {\n changeSubscriptions.delete(key)\n const payload = await onError?.(e as Error)\n if (payload) {\n sendHmr(key, payload)\n }\n return\n }\n changeSubscriptions.delete(key)\n }\n\n async function unsubscribeFromChanges(key: EntryKey) {\n const subscription = await changeSubscriptions.get(key)\n if (subscription) {\n await subscription.return?.()\n changeSubscriptions.delete(key)\n }\n currentEntryIssues.delete(key)\n }\n\n async function subscribeToHmrEvents(client: ws, id: string) {\n const key = getEntryKey('assets', 'client', id)\n if (!hasEntrypointForKey(currentEntrypoints, key, assetMapper)) {\n // maybe throw an error / force the client to reload?\n return\n }\n\n const state = clientStates.get(client)\n if (!state || state.subscriptions.has(id)) {\n return\n }\n\n const subscription = project!.hmrEvents(id)\n state.subscriptions.set(id, subscription)\n\n // The subscription will always emit once, which is the initial\n // computation. This is not a change, so swallow it.\n try {\n await subscription.next()\n\n for await (const data of subscription) {\n processIssues(state.clientIssues, key, data, false, true)\n if (data.type !== 'issues') {\n sendTurbopackMessage(data)\n }\n }\n } catch (e) {\n // The client might be using an HMR session from a previous server, tell them\n // to fully reload the page to resolve the issue. We can't use\n // `hotReloader.send` since that would force every connected client to\n // reload, only this client is out of date.\n const reloadMessage: ReloadPageMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.RELOAD_PAGE,\n data: `error in HMR event subscription for ${id}: ${e}`,\n }\n sendToClient(client, reloadMessage)\n client.close()\n return\n }\n }\n\n function unsubscribeFromHmrEvents(client: ws, id: string) {\n const state = clientStates.get(client)\n if (!state) {\n return\n }\n\n const subscription = state.subscriptions.get(id)\n subscription?.return!()\n\n const key = getEntryKey('assets', 'client', id)\n state.clientIssues.delete(key)\n }\n\n async function handleEntrypointsSubscription() {\n for await (const entrypoints of entrypointsSubscription) {\n if (!currentEntriesHandlingResolve) {\n currentEntriesHandling = new Promise(\n // eslint-disable-next-line no-loop-func\n (resolve) => (currentEntriesHandlingResolve = resolve)\n )\n }\n\n processTopLevelIssues(currentTopLevelIssues, entrypoints)\n\n await handleEntrypoints({\n entrypoints,\n\n currentEntrypoints,\n\n currentEntryIssues,\n manifestLoader,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n\n dev: {\n assetMapper,\n changeSubscriptions,\n clients,\n clientStates,\n serverFields,\n\n hooks: {\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n return clearRequireCache(id, result, { force: forceDeleteCache })\n },\n propagateServerField: propagateServerField.bind(null, opts),\n sendHmr,\n startBuilding,\n subscribeToChanges,\n unsubscribeFromChanges,\n unsubscribeFromHmrEvents,\n },\n },\n })\n\n currentEntriesHandlingResolve!()\n currentEntriesHandlingResolve = undefined\n }\n }\n\n await mkdir(join(distDir, 'server'), { recursive: true })\n await mkdir(join(distDir, 'static', buildId), { recursive: true })\n await writeFile(\n join(distDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n },\n null,\n 2\n )\n )\n\n const middlewares = [\n getOverlayMiddleware({\n project,\n projectPath,\n isSrcDir: opts.isSrcDir,\n }),\n getSourceMapMiddleware(project),\n getNextErrorFeedbackMiddleware(opts.telemetry),\n getDevOverlayFontMiddleware(),\n getDisableDevIndicatorMiddleware(),\n getRestartDevServerMiddleware({\n telemetry: opts.telemetry,\n turbopackProject: project,\n }),\n devToolsConfigMiddleware({\n distDir,\n sendUpdateSignal: (data) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.DEVTOOLS_CONFIG,\n data,\n })\n },\n }),\n ]\n\n const versionInfoPromise = getVersionInfo()\n\n let devtoolsFrontendUrl: string | undefined\n const nodeDebugType = getNodeDebugType()\n if (nodeDebugType) {\n const debugPort = process.debugPort\n let debugInfo\n try {\n // It requires to use 127.0.0.1 instead of localhost for server-side fetching.\n const debugInfoList = await fetch(\n `http://127.0.0.1:${debugPort}/json/list`\n ).then((res) => res.json())\n debugInfo = debugInfoList[0]\n } catch {}\n if (debugInfo) {\n devtoolsFrontendUrl = debugInfo.devtoolsFrontendUrl\n }\n }\n\n const hotReloader: NextJsHotReloaderInterface = {\n turbopackProject: project,\n activeWebpackConfigs: undefined,\n serverStats: null,\n edgeServerStats: null,\n async run(req, res, _parsedUrl) {\n // intercept page chunks request and ensure them with turbopack\n if (req.url?.startsWith('/_next/static/chunks/pages/')) {\n const params = matchNextPageBundleRequest(req.url)\n\n if (params) {\n const decodedPagePath = `/${params.path\n .map((param: string) => decodeURIComponent(param))\n .join('/')}`\n\n const denormalizedPagePath = denormalizePagePath(decodedPagePath)\n\n await hotReloader\n .ensurePage({\n page: denormalizedPagePath,\n clientOnly: false,\n definition: undefined,\n url: req.url,\n })\n .catch(console.error)\n }\n }\n\n for (const middleware of middlewares) {\n let calledNext = false\n\n await middleware(req, res, () => {\n calledNext = true\n })\n\n if (!calledNext) {\n return { finished: true }\n }\n }\n\n // Request was not finished.\n return { finished: undefined }\n },\n\n // TODO: Figure out if socket type can match the NextJsHotReloaderInterface\n onHMR(req, socket: Socket, head, onUpgrade) {\n wsServer.handleUpgrade(req, socket, head, (client) => {\n onUpgrade(client)\n const clientIssues: EntryIssuesMap = new Map()\n const subscriptions: Map<string, AsyncIterator<any>> = new Map()\n\n clients.add(client)\n clientStates.set(client, {\n clientIssues,\n messages: new Map(),\n turbopackUpdates: [],\n subscriptions,\n })\n\n client.on('close', () => {\n // Remove active subscriptions\n for (const subscription of subscriptions.values()) {\n subscription.return?.()\n }\n clientStates.delete(client)\n clients.delete(client)\n })\n\n client.addEventListener('message', async ({ data }) => {\n const parsedData = JSON.parse(\n typeof data !== 'string' ? data.toString() : data\n )\n\n // Next.js messages\n switch (parsedData.event) {\n case 'span-end': {\n hotReloaderSpan.manualTraceChild(\n parsedData.spanName,\n msToNs(parsedData.startTime),\n msToNs(parsedData.endTime),\n parsedData.attributes\n )\n break\n }\n case 'client-hmr-latency': // { id, startTime, endTime, page, updatedModules, isPageHidden }\n hotReloaderSpan.manualTraceChild(\n parsedData.event,\n msToNs(parsedData.startTime),\n msToNs(parsedData.endTime),\n {\n updatedModules: parsedData.updatedModules,\n page: parsedData.page,\n isPageHidden: parsedData.isPageHidden,\n }\n )\n break\n\n case 'client-error': // { errorCount, clientId }\n case 'client-warning': // { warningCount, clientId }\n case 'client-success': // { clientId }\n case 'server-component-reload-page': // { clientId }\n case 'client-reload-page': // { clientId }\n case 'client-removed-page': // { page }\n case 'client-full-reload': // { stackTrace, hadRuntimeError }\n const { hadRuntimeError, dependencyChain } = parsedData\n if (hadRuntimeError) {\n Log.warn(FAST_REFRESH_RUNTIME_RELOAD)\n }\n if (\n Array.isArray(dependencyChain) &&\n typeof dependencyChain[0] === 'string'\n ) {\n const cleanedModulePath = dependencyChain[0]\n .replace(/^\\[project\\]/, '.')\n .replace(/ \\[.*\\] \\(.*\\)$/, '')\n Log.warn(\n `Fast Refresh had to perform a full reload when ${cleanedModulePath} changed. Read more: https://nextjs.org/docs/messages/fast-refresh-reload`\n )\n }\n break\n case 'client-added-page':\n // TODO\n break\n case 'browser-logs': {\n if (nextConfig.experimental.browserDebugInfoInTerminal) {\n await receiveBrowserLogsTurbopack({\n entries: parsedData.entries,\n router: parsedData.router,\n sourceType: parsedData.sourceType,\n project,\n projectPath,\n distDir,\n config: nextConfig.experimental.browserDebugInfoInTerminal,\n })\n }\n break\n }\n\n default:\n // Might be a Turbopack message...\n if (!parsedData.type) {\n throw new Error(`unrecognized HMR message \"${data}\"`)\n }\n }\n\n // Turbopack messages\n switch (parsedData.type) {\n case 'turbopack-subscribe':\n subscribeToHmrEvents(client, parsedData.path)\n break\n\n case 'turbopack-unsubscribe':\n unsubscribeFromHmrEvents(client, parsedData.path)\n break\n\n default:\n if (!parsedData.event) {\n throw new Error(`unrecognized Turbopack HMR message \"${data}\"`)\n }\n }\n })\n\n const turbopackConnectedMessage: TurbopackConnectedMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: { sessionId },\n }\n sendToClient(client, turbopackConnectedMessage)\n\n const errors: CompilationError[] = []\n\n for (const entryIssues of currentEntryIssues.values()) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n errors.push({\n message: formatIssue(issue),\n })\n } else {\n printNonFatalIssue(issue)\n }\n }\n }\n\n if (devIndicatorServerState.disabledUntil < Date.now()) {\n devIndicatorServerState.disabledUntil = 0\n }\n\n ;(async function () {\n const versionInfo = await versionInfoPromise\n const devToolsConfig = await getDevToolsConfig(distDir)\n\n const syncMessage: SyncMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.SYNC,\n errors,\n warnings: [],\n hash: '',\n versionInfo,\n debug: {\n devtoolsFrontendUrl,\n },\n devIndicator: devIndicatorServerState,\n devToolsConfig,\n }\n\n sendToClient(client, syncMessage)\n })()\n })\n },\n\n send(action) {\n const payload = JSON.stringify(action)\n for (const client of clients) {\n client.send(payload)\n }\n },\n\n setHmrServerError(_error) {\n // Not implemented yet.\n },\n clearHmrServerError() {\n // Not implemented yet.\n },\n async start() {},\n async getCompilationErrors(page) {\n const appEntryKey = getEntryKey('app', 'server', page)\n const pagesEntryKey = getEntryKey('pages', 'server', page)\n\n const topLevelIssues = currentTopLevelIssues.values()\n\n const thisEntryIssues =\n currentEntryIssues.get(appEntryKey) ??\n currentEntryIssues.get(pagesEntryKey)\n\n if (thisEntryIssues !== undefined && thisEntryIssues.size > 0) {\n // If there is an error related to the requesting page we display it instead of the first error\n return [...topLevelIssues, ...thisEntryIssues.values()]\n .map((issue) => {\n const formattedIssue = formatIssue(issue)\n if (issue.severity === 'warning') {\n printNonFatalIssue(issue)\n return null\n } else if (isWellKnownError(issue)) {\n Log.error(formattedIssue)\n }\n\n return new Error(formattedIssue)\n })\n .filter((error) => error !== null)\n }\n\n // Otherwise, return all errors across pages\n const errors = []\n for (const issue of topLevelIssues) {\n if (issue.severity !== 'warning') {\n errors.push(new Error(formatIssue(issue)))\n }\n }\n for (const entryIssues of currentEntryIssues.values()) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n const message = formatIssue(issue)\n errors.push(new Error(message))\n } else {\n printNonFatalIssue(issue)\n }\n }\n }\n return errors\n },\n async invalidate({\n // .env files or tsconfig/jsconfig change\n reloadAfterInvalidation,\n }) {\n if (reloadAfterInvalidation) {\n for (const [key, entrypoint] of currentWrittenEntrypoints) {\n clearRequireCache(key, entrypoint, { force: true })\n }\n\n await clearAllModuleContexts()\n this.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES,\n hash: String(++hmrHash),\n })\n }\n },\n async buildFallbackError() {\n // Not implemented yet.\n },\n async ensurePage({\n page: inputPage,\n // Unused parameters\n // clientOnly,\n appPaths,\n definition,\n isApp,\n url: requestUrl,\n }) {\n // When there is no route definition this is an internal file not a route the user added.\n // Middleware and instrumentation are handled in turbpack-utils.ts handleEntrypoints instead.\n if (!definition) {\n if (inputPage === '/middleware') return\n if (inputPage === '/src/middleware') return\n if (inputPage === '/instrumentation') return\n if (inputPage === '/src/instrumentation') return\n }\n\n return hotReloaderSpan\n .traceChild('ensure-page', {\n inputPage,\n })\n .traceAsyncFn(async () => {\n if (BLOCKED_PAGES.includes(inputPage) && inputPage !== '/_error') {\n return\n }\n\n await currentEntriesHandling\n\n // TODO We shouldn't look into the filesystem again. This should use the information from entrypoints\n let routeDef: Pick<\n RouteDefinition,\n 'filename' | 'bundlePath' | 'page'\n > =\n definition ??\n (await findPagePathData(\n projectPath,\n inputPage,\n nextConfig.pageExtensions,\n opts.pagesDir,\n opts.appDir,\n !!nextConfig.experimental.globalNotFound\n ))\n\n // If the route is actually an app page route, then we should have access\n // to the app route definition, and therefore, the appPaths from it.\n if (!appPaths && definition && isAppPageRouteDefinition(definition)) {\n appPaths = definition.appPaths\n }\n\n let page = routeDef.page\n if (appPaths) {\n const normalizedPage = normalizeAppPath(page)\n\n // filter out paths that are not exact matches (e.g. catchall)\n const matchingAppPaths = appPaths.filter(\n (path) => normalizeAppPath(path) === normalizedPage\n )\n\n // the last item in the array is the root page, if there are parallel routes\n page = matchingAppPaths[matchingAppPaths.length - 1]\n }\n\n const pathname = definition?.pathname ?? inputPage\n\n if (page === '/_error') {\n let finishBuilding = startBuilding(pathname, requestUrl, false)\n try {\n await handlePagesErrorRoute({\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n hooks: {\n subscribeToChanges,\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n assetMapper.setPathsForKey(id, result.clientPaths)\n return clearRequireCache(id, result, {\n force: forceDeleteCache,\n })\n },\n },\n })\n } finally {\n finishBuilding()\n }\n return\n }\n\n const isInsideAppDir = routeDef.bundlePath.startsWith('app/')\n const isEntryMetadataRouteFile = isMetadataRouteFile(\n routeDef.filename.replace(opts.appDir || '', ''),\n nextConfig.pageExtensions,\n true\n )\n const normalizedAppPage = isEntryMetadataRouteFile\n ? normalizedPageToTurbopackStructureRoute(\n page,\n extname(routeDef.filename)\n )\n : page\n\n const route = isInsideAppDir\n ? currentEntrypoints.app.get(normalizedAppPage)\n : currentEntrypoints.page.get(page)\n\n if (!route) {\n // TODO: why is this entry missing in turbopack?\n if (page === '/middleware') return\n if (page === '/src/middleware') return\n if (page === '/instrumentation') return\n if (page === '/src/instrumentation') return\n\n throw new PageNotFoundError(`route not found ${page}`)\n }\n\n // We don't throw on ensureOpts.isApp === true for page-api\n // since this can happen when app pages make\n // api requests to page API routes.\n if (isApp && route.type === 'page') {\n throw new Error(`mis-matched route type: isApp && page for ${page}`)\n }\n\n const finishBuilding = startBuilding(pathname, requestUrl, false)\n try {\n await handleRouteType({\n dev,\n page,\n pathname,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n readyIds,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n\n hooks: {\n subscribeToChanges,\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n assetMapper.setPathsForKey(id, result.clientPaths)\n return clearRequireCache(id, result, {\n force: forceDeleteCache,\n })\n },\n },\n })\n } finally {\n finishBuilding()\n }\n })\n },\n close() {\n for (const wsClient of clients) {\n // it's okay to not cleanly close these websocket connections, this is dev\n wsClient.terminate()\n }\n clients.clear()\n },\n }\n\n handleEntrypointsSubscription().catch((err) => {\n console.error(err)\n process.exit(1)\n })\n\n // Write empty manifests\n await currentEntriesHandling\n await manifestLoader.writeManifests({\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n entrypoints: currentEntrypoints,\n })\n\n async function handleProjectUpdates() {\n for await (const updateMessage of project.updateInfoSubscribe(30)) {\n switch (updateMessage.updateType) {\n case 'start': {\n hotReloader.send({ type: HMR_MESSAGE_SENT_TO_BROWSER.BUILDING })\n break\n }\n case 'end': {\n sendEnqueuedMessages()\n\n function addErrors(\n errorsMap: Map<string, CompilationError>,\n issues: EntryIssuesMap\n ) {\n for (const issueMap of issues.values()) {\n for (const [key, issue] of issueMap) {\n if (issue.severity === 'warning') continue\n if (errorsMap.has(key)) continue\n\n const message = formatIssue(issue)\n\n errorsMap.set(key, {\n message,\n details: issue.detail\n ? renderStyledStringToErrorAnsi(issue.detail)\n : undefined,\n })\n }\n }\n }\n\n const errors = new Map<string, CompilationError>()\n addErrors(errors, currentEntryIssues)\n\n for (const client of clients) {\n const state = clientStates.get(client)\n if (!state) {\n continue\n }\n\n const clientErrors = new Map(errors)\n addErrors(clientErrors, state.clientIssues)\n\n sendToClient(client, {\n type: HMR_MESSAGE_SENT_TO_BROWSER.BUILT,\n hash: String(++hmrHash),\n errors: [...clientErrors.values()],\n warnings: [],\n })\n }\n\n if (hmrEventHappened) {\n const time = updateMessage.value.duration\n const timeMessage =\n time > 2000 ? `${Math.round(time / 100) / 10}s` : `${time}ms`\n Log.event(`Compiled in ${timeMessage}`)\n hmrEventHappened = false\n }\n break\n }\n default:\n }\n }\n }\n\n handleProjectUpdates().catch((err) => {\n console.error(err)\n process.exit(1)\n })\n\n return hotReloader\n}\n"],"names":["createHotReloaderTurbopack","wsServer","ws","Server","noServer","isTestMode","process","env","NEXT_TEST_MODE","__NEXT_TEST_MODE","DEBUG","sessionId","Math","floor","Number","MAX_SAFE_INTEGER","random","rewriteTurbopackSources","projectRoot","sourceMap","section","sections","map","i","sources","length","pathToFileURL","join","replace","toString","getSourceMapFromTurbopack","project","sourceURL","sourceMapJson","getSourceMapSync","err","undefined","payload","JSON","parse","opts","serverFields","distDir","resetFetch","nextConfig","dev","buildId","dir","projectPath","loadBindings","require","bindings","log","testMode","hasRewrites","fsChecker","rewrites","afterFiles","beforeFiles","fallback","hotReloaderSpan","trace","version","__NEXT_VERSION","stop","encryptionKey","generateEncryptionKeyBase64","isBuild","clientRouterFilters","experimental","clientRouterFilter","supportedBrowsers","getSupportedBrowsers","currentNodeJsVersion","versions","node","rootPath","turbopack","root","outputFileTracingRoot","turbo","createProject","normalizePath","relative","jsConfig","getTurbopackJsConfig","watch","enable","pollIntervalMs","watchOptions","defineEnv","createDefineEnv","isTurbopack","config","fetchCacheKeyPrefix","middlewareMatchers","previewProps","prerenderManifest","preview","browserslistQuery","noMangling","persistentCaching","isPersistentCachingEnabled","memoryLimit","turbopackMemoryLimit","isShortSession","backgroundLogCompilationEvents","eventTypes","setBundlerFindSourceMapImplementation","bind","onDevServerCleanup","onExit","entrypointsSubscription","entrypointsSubscribe","currentWrittenEntrypoints","Map","currentEntrypoints","global","app","document","error","middleware","instrumentation","page","currentTopLevelIssues","currentEntryIssues","manifestLoader","TurbopackManifestLoader","changeSubscriptions","serverPathState","readyIds","Set","currentEntriesHandlingResolve","currentEntriesHandling","Promise","resolve","assetMapper","AssetMapper","clearRequireCache","key","writtenEndpoint","force","path","contentHash","serverPaths","endsWith","localKey","set","hasChange","localHash","get","globalHash","__next__clear_chunk_cache__","p","file","clearModuleContext","deleteCache","buildingIds","startBuilding","id","requestUrl","forceRebuild","has","size","consoleStore","setState","loading","trigger","url","add","finishBuilding","delete","hmrEventHappened","hmrHash","clients","clientStates","WeakMap","sendToClient","client","message","send","stringify","sendEnqueuedMessages","issueMap","values","filter","severity","state","clientIssues","messages","clear","turbopackUpdates","type","HMR_MESSAGE_SENT_TO_BROWSER","TURBOPACK_MESSAGE","data","sendEnqueuedMessagesDebounce","debounce","sendHmr","sendTurbopackMessage","diagnostics","issues","push","subscribeToChanges","includeIssues","endpoint","createMessage","onError","side","splitEntryKey","changedPromise","changed","change","processIssues","String","e","unsubscribeFromChanges","subscription","return","subscribeToHmrEvents","getEntryKey","hasEntrypointForKey","subscriptions","hmrEvents","next","reloadMessage","RELOAD_PAGE","close","unsubscribeFromHmrEvents","handleEntrypointsSubscription","entrypoints","processTopLevelIssues","handleEntrypoints","devRewrites","productionRewrites","logErrors","hooks","handleWrittenEndpoint","result","forceDeleteCache","propagateServerField","mkdir","recursive","writeFile","middlewares","getOverlayMiddleware","isSrcDir","getSourceMapMiddleware","getNextErrorFeedbackMiddleware","telemetry","getDevOverlayFontMiddleware","getDisableDevIndicatorMiddleware","getRestartDevServerMiddleware","turbopackProject","devToolsConfigMiddleware","sendUpdateSignal","hotReloader","DEVTOOLS_CONFIG","versionInfoPromise","getVersionInfo","devtoolsFrontendUrl","nodeDebugType","getNodeDebugType","debugPort","debugInfo","debugInfoList","fetch","then","res","json","activeWebpackConfigs","serverStats","edgeServerStats","run","req","_parsedUrl","startsWith","params","matchNextPageBundleRequest","decodedPagePath","param","decodeURIComponent","denormalizedPagePath","denormalizePagePath","ensurePage","clientOnly","definition","catch","console","calledNext","finished","onHMR","socket","head","onUpgrade","handleUpgrade","on","addEventListener","parsedData","event","manualTraceChild","spanName","msToNs","startTime","endTime","attributes","updatedModules","isPageHidden","hadRuntimeError","dependencyChain","Log","warn","FAST_REFRESH_RUNTIME_RELOAD","Array","isArray","cleanedModulePath","browserDebugInfoInTerminal","receiveBrowserLogsTurbopack","entries","router","sourceType","Error","turbopackConnectedMessage","TURBOPACK_CONNECTED","errors","entryIssues","issue","formatIssue","printNonFatalIssue","devIndicatorServerState","disabledUntil","Date","now","versionInfo","devToolsConfig","getDevToolsConfig","syncMessage","SYNC","warnings","hash","debug","devIndicator","action","setHmrServerError","_error","clearHmrServerError","start","getCompilationErrors","appEntryKey","pagesEntryKey","topLevelIssues","thisEntryIssues","formattedIssue","isWellKnownError","invalidate","reloadAfterInvalidation","entrypoint","clearAllModuleContexts","SERVER_COMPONENT_CHANGES","buildFallbackError","inputPage","appPaths","isApp","traceChild","traceAsyncFn","BLOCKED_PAGES","includes","routeDef","findPagePathData","pageExtensions","pagesDir","appDir","globalNotFound","isAppPageRouteDefinition","normalizedPage","normalizeAppPath","matchingAppPaths","pathname","handlePagesErrorRoute","setPathsForKey","clientPaths","isInsideAppDir","bundlePath","isEntryMetadataRouteFile","isMetadataRouteFile","filename","normalizedAppPage","normalizedPageToTurbopackStructureRoute","extname","route","PageNotFoundError","handleRouteType","wsClient","terminate","exit","writeManifests","handleProjectUpdates","updateMessage","updateInfoSubscribe","updateType","BUILDING","addErrors","errorsMap","details","detail","renderStyledStringToErrorAnsi","clientErrors","BUILT","time","value","duration","timeMessage","round"],"mappings":";;;;+BAmKsBA;;;eAAAA;;;0BAlKW;sBACO;qBACV;2DAEf;uBAGuB;kCASM;qBASZ;6DACX;oCAId;2BACuB;qCAIvB;uBAC2B;wBACT;8BACG;8BAIrB;qCAC6B;uBACd;gCAgBf;iCAKA;gCACiC;sCACP;0BAM1B;0BACqC;uCACA;wCACH;0BACR;wBAEA;iCACG;mCACkB;gDACP;wBAUxC;6CACqC;yCACJ;wCACS;4CACH;mCACC;wBACV;6BACO;+BACd;0CAI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ack.ts"],"sourcesContent":["import type { Socket } from 'net'\nimport { mkdir, writeFile } from 'fs/promises'\nimport { join, extname, relative } from 'path'\nimport { pathToFileURL } from 'url'\n\nimport ws from 'next/dist/compiled/ws'\n\nimport type { OutputState } from '../../build/output/store'\nimport { store as consoleStore } from '../../build/output/store'\nimport type {\n CompilationError,\n HmrMessageSentToBrowser,\n NextJsHotReloaderInterface,\n ReloadPageMessage,\n SyncMessage,\n TurbopackConnectedMessage,\n} from './hot-reloader-types'\nimport { HMR_MESSAGE_SENT_TO_BROWSER } from './hot-reloader-types'\nimport type {\n Update as TurbopackUpdate,\n Endpoint,\n WrittenEndpoint,\n TurbopackResult,\n Project,\n Entrypoints,\n} from '../../build/swc/types'\nimport { createDefineEnv } from '../../build/swc'\nimport * as Log from '../../build/output/log'\nimport {\n getVersionInfo,\n matchNextPageBundleRequest,\n} from './hot-reloader-webpack'\nimport { BLOCKED_PAGES } from '../../shared/lib/constants'\nimport {\n getOverlayMiddleware,\n getSourceMapMiddleware,\n} from './middleware-turbopack'\nimport { PageNotFoundError } from '../../shared/lib/utils'\nimport { debounce } from '../utils'\nimport { deleteCache } from './require-cache'\nimport {\n clearAllModuleContexts,\n clearModuleContext,\n} from '../lib/render-server'\nimport { denormalizePagePath } from '../../shared/lib/page-path/denormalize-page-path'\nimport { trace } from '../../trace'\nimport {\n AssetMapper,\n type ChangeSubscriptions,\n type ClientState,\n handleEntrypoints,\n handlePagesErrorRoute,\n handleRouteType,\n hasEntrypointForKey,\n msToNs,\n type ReadyIds,\n type SendHmr,\n type StartBuilding,\n processTopLevelIssues,\n printNonFatalIssue,\n normalizedPageToTurbopackStructureRoute,\n} from './turbopack-utils'\nimport {\n propagateServerField,\n type ServerFields,\n type SetupOpts,\n} from '../lib/router-utils/setup-dev-bundler'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { findPagePathData } from './on-demand-entry-handler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport {\n type EntryKey,\n getEntryKey,\n splitEntryKey,\n} from '../../shared/lib/turbopack/entry-key'\nimport { FAST_REFRESH_RUNTIME_RELOAD } from './messages'\nimport { generateEncryptionKeyBase64 } from '../app-render/encryption-utils-server'\nimport { isAppPageRouteDefinition } from '../route-definitions/app-page-route-definition'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport type { ModernSourceMapPayload } from '../lib/source-maps'\nimport { getNodeDebugType } from '../lib/utils'\nimport { isMetadataRouteFile } from '../../lib/metadata/is-metadata-route'\nimport { setBundlerFindSourceMapImplementation } from '../patch-error-inspect'\nimport { getNextErrorFeedbackMiddleware } from '../../next-devtools/server/get-next-error-feedback-middleware'\nimport {\n formatIssue,\n isPersistentCachingEnabled,\n isWellKnownError,\n processIssues,\n renderStyledStringToErrorAnsi,\n type EntryIssuesMap,\n type TopLevelIssuesMap,\n} from '../../shared/lib/turbopack/utils'\nimport { getDevOverlayFontMiddleware } from '../../next-devtools/server/font/get-dev-overlay-font-middleware'\nimport { devIndicatorServerState } from './dev-indicator-server-state'\nimport { getDisableDevIndicatorMiddleware } from '../../next-devtools/server/dev-indicator-middleware'\nimport { getRestartDevServerMiddleware } from '../../next-devtools/server/restart-dev-server-middleware'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../../build/utils'\nimport { receiveBrowserLogsTurbopack } from './browser-logs/receive-logs'\nimport { normalizePath } from '../../lib/normalize-path'\nimport {\n devToolsConfigMiddleware,\n getDevToolsConfig,\n} from '../../next-devtools/server/devtools-config-middleware'\n\nconst wsServer = new ws.Server({ noServer: true })\nconst isTestMode = !!(\n process.env.NEXT_TEST_MODE ||\n process.env.__NEXT_TEST_MODE ||\n process.env.DEBUG\n)\n\nconst sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random())\n\ndeclare const __next__clear_chunk_cache__: (() => void) | null | undefined\n\n/**\n * Replaces turbopack:///[project] with the specified project in the `source` field.\n */\nfunction rewriteTurbopackSources(\n projectRoot: string,\n sourceMap: ModernSourceMapPayload\n): void {\n if ('sections' in sourceMap) {\n for (const section of sourceMap.sections) {\n rewriteTurbopackSources(projectRoot, section.map)\n }\n } else {\n for (let i = 0; i < sourceMap.sources.length; i++) {\n sourceMap.sources[i] = pathToFileURL(\n join(\n projectRoot,\n sourceMap.sources[i].replace(/turbopack:\\/\\/\\/\\[project\\]/, '')\n )\n ).toString()\n }\n }\n}\n\nfunction getSourceMapFromTurbopack(\n project: Project,\n projectRoot: string,\n sourceURL: string\n): ModernSourceMapPayload | undefined {\n let sourceMapJson: string | null = null\n\n try {\n sourceMapJson = project.getSourceMapSync(sourceURL)\n } catch (err) {}\n\n if (sourceMapJson === null) {\n return undefined\n } else {\n const payload: ModernSourceMapPayload = JSON.parse(sourceMapJson)\n // The sourcemap from Turbopack is not yet written to disk so its `sources`\n // are not absolute paths yet. We need to rewrite them to be absolute paths.\n rewriteTurbopackSources(projectRoot, payload)\n return payload\n }\n}\n\nexport async function createHotReloaderTurbopack(\n opts: SetupOpts & { isSrcDir: boolean },\n serverFields: ServerFields,\n distDir: string,\n resetFetch: () => void\n): Promise<NextJsHotReloaderInterface> {\n const dev = true\n const buildId = 'development'\n const { nextConfig, dir: projectPath } = opts\n\n const { loadBindings } =\n require('../../build/swc') as typeof import('../../build/swc')\n\n let bindings = await loadBindings()\n\n // For the debugging purpose, check if createNext or equivalent next instance setup in test cases\n // works correctly. Normally `run-test` hides output so only will be visible when `--debug` flag is used.\n if (isTestMode) {\n ;(require('console') as typeof import('console')).log(\n 'Creating turbopack project',\n {\n dir: projectPath,\n testMode: isTestMode,\n }\n )\n }\n\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n const hotReloaderSpan = trace('hot-reloader', undefined, {\n version: process.env.__NEXT_VERSION as string,\n })\n // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing\n // of the current `next dev` invocation.\n hotReloaderSpan.stop()\n\n const encryptionKey = await generateEncryptionKeyBase64({\n isBuild: false,\n distDir,\n })\n\n // TODO: Implement\n let clientRouterFilters: any\n if (nextConfig.experimental.clientRouterFilter) {\n // TODO this need to be set correctly for persistent caching to work\n }\n\n const supportedBrowsers = getSupportedBrowsers(projectPath, dev)\n const currentNodeJsVersion = process.versions.node\n\n const rootPath =\n opts.nextConfig.turbopack?.root ||\n opts.nextConfig.outputFileTracingRoot ||\n projectPath\n const project = await bindings.turbo.createProject(\n {\n rootPath,\n projectPath: normalizePath(relative(rootPath, projectPath) || '.'),\n distDir,\n nextConfig: opts.nextConfig,\n watch: {\n enable: dev,\n pollIntervalMs: nextConfig.watchOptions?.pollIntervalMs,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters,\n config: nextConfig,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix: opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // TODO: Implement\n middlewareMatchers: undefined,\n rewrites: opts.fsChecker.rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps: opts.fsChecker.prerenderManifest.preview,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling: false,\n currentNodeJsVersion,\n },\n {\n persistentCaching: isPersistentCachingEnabled(opts.nextConfig),\n memoryLimit: opts.nextConfig.experimental?.turbopackMemoryLimit,\n isShortSession: false,\n }\n )\n backgroundLogCompilationEvents(project, {\n eventTypes: ['StartupCacheInvalidationEvent', 'TimingEvent'],\n })\n setBundlerFindSourceMapImplementation(\n getSourceMapFromTurbopack.bind(null, project, projectPath)\n )\n opts.onDevServerCleanup?.(async () => {\n setBundlerFindSourceMapImplementation(() => undefined)\n await project.onExit()\n })\n const entrypointsSubscription = project.entrypointsSubscribe()\n\n const currentWrittenEntrypoints: Map<EntryKey, WrittenEndpoint> = new Map()\n const currentEntrypoints: Entrypoints = {\n global: {\n app: undefined,\n document: undefined,\n error: undefined,\n\n middleware: undefined,\n instrumentation: undefined,\n },\n\n page: new Map(),\n app: new Map(),\n }\n\n const currentTopLevelIssues: TopLevelIssuesMap = new Map()\n const currentEntryIssues: EntryIssuesMap = new Map()\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n // Dev specific\n const changeSubscriptions: ChangeSubscriptions = new Map()\n const serverPathState = new Map<string, string>()\n const readyIds: ReadyIds = new Set()\n let currentEntriesHandlingResolve: ((value?: unknown) => void) | undefined\n let currentEntriesHandling = new Promise(\n (resolve) => (currentEntriesHandlingResolve = resolve)\n )\n\n const assetMapper = new AssetMapper()\n\n function clearRequireCache(\n key: EntryKey,\n writtenEndpoint: WrittenEndpoint,\n {\n force,\n }: {\n // Always clear the cache, don't check if files have changed\n force?: boolean\n } = {}\n ): boolean {\n if (force) {\n for (const { path, contentHash } of writtenEndpoint.serverPaths) {\n // We ignore source maps\n if (path.endsWith('.map')) continue\n const localKey = `${key}:${path}`\n serverPathState.set(localKey, contentHash)\n serverPathState.set(path, contentHash)\n }\n } else {\n // Figure out if the server files have changed\n let hasChange = false\n for (const { path, contentHash } of writtenEndpoint.serverPaths) {\n // We ignore source maps\n if (path.endsWith('.map')) continue\n const localKey = `${key}:${path}`\n const localHash = serverPathState.get(localKey)\n const globalHash = serverPathState.get(path)\n if (\n (localHash && localHash !== contentHash) ||\n (globalHash && globalHash !== contentHash)\n ) {\n hasChange = true\n serverPathState.set(localKey, contentHash)\n serverPathState.set(path, contentHash)\n } else {\n if (!localHash) {\n serverPathState.set(localKey, contentHash)\n }\n if (!globalHash) {\n serverPathState.set(path, contentHash)\n }\n }\n }\n\n if (!hasChange) {\n return false\n }\n }\n\n resetFetch()\n\n // Not available in:\n // - Pages Router (no server-side HMR)\n // - Edge Runtime (uses browser runtime which already disposes chunks individually)\n if (typeof __next__clear_chunk_cache__ === 'function') {\n __next__clear_chunk_cache__()\n }\n\n const serverPaths = writtenEndpoint.serverPaths.map(({ path: p }) =>\n join(distDir, p)\n )\n\n for (const file of serverPaths) {\n clearModuleContext(file)\n deleteCache(file)\n }\n\n return true\n }\n\n const buildingIds = new Set()\n\n const startBuilding: StartBuilding = (id, requestUrl, forceRebuild) => {\n if (!forceRebuild && readyIds.has(id)) {\n return () => {}\n }\n if (buildingIds.size === 0) {\n consoleStore.setState(\n {\n loading: true,\n trigger: id,\n url: requestUrl,\n } as OutputState,\n true\n )\n }\n buildingIds.add(id)\n return function finishBuilding() {\n if (buildingIds.size === 0) {\n return\n }\n readyIds.add(id)\n buildingIds.delete(id)\n if (buildingIds.size === 0) {\n hmrEventHappened = false\n consoleStore.setState(\n {\n loading: false,\n } as OutputState,\n true\n )\n }\n }\n }\n\n let hmrEventHappened = false\n let hmrHash = 0\n\n const clients = new Set<ws>()\n const clientStates = new WeakMap<ws, ClientState>()\n\n function sendToClient(client: ws, message: HmrMessageSentToBrowser) {\n client.send(JSON.stringify(message))\n }\n\n function sendEnqueuedMessages() {\n for (const [, issueMap] of currentEntryIssues) {\n if (\n [...issueMap.values()].filter((i) => i.severity !== 'warning').length >\n 0\n ) {\n // During compilation errors we want to delay the HMR events until errors are fixed\n return\n }\n }\n\n for (const client of clients) {\n const state = clientStates.get(client)\n if (!state) {\n continue\n }\n\n for (const [, issueMap] of state.clientIssues) {\n if (\n [...issueMap.values()].filter((i) => i.severity !== 'warning')\n .length > 0\n ) {\n // During compilation errors we want to delay the HMR events until errors are fixed\n return\n }\n }\n\n for (const message of state.messages.values()) {\n sendToClient(client, message)\n }\n state.messages.clear()\n\n if (state.turbopackUpdates.length > 0) {\n sendToClient(client, {\n type: HMR_MESSAGE_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: state.turbopackUpdates,\n })\n state.turbopackUpdates.length = 0\n }\n }\n }\n const sendEnqueuedMessagesDebounce = debounce(sendEnqueuedMessages, 2)\n\n const sendHmr: SendHmr = (id: string, message: HmrMessageSentToBrowser) => {\n for (const client of clients) {\n clientStates.get(client)?.messages.set(id, message)\n }\n\n hmrEventHappened = true\n sendEnqueuedMessagesDebounce()\n }\n\n function sendTurbopackMessage(payload: TurbopackUpdate) {\n // TODO(PACK-2049): For some reason we end up emitting hundreds of issues messages on bigger apps,\n // a lot of which are duplicates.\n // They are currently not handled on the client at all, so might as well not send them for now.\n payload.diagnostics = []\n payload.issues = []\n\n for (const client of clients) {\n clientStates.get(client)?.turbopackUpdates.push(payload)\n }\n\n hmrEventHappened = true\n sendEnqueuedMessagesDebounce()\n }\n\n async function subscribeToChanges(\n key: EntryKey,\n includeIssues: boolean,\n endpoint: Endpoint,\n createMessage: (\n change: TurbopackResult,\n hash: string\n ) => Promise<HmrMessageSentToBrowser> | HmrMessageSentToBrowser | void,\n onError?: (\n error: Error\n ) => Promise<HmrMessageSentToBrowser> | HmrMessageSentToBrowser | void\n ) {\n if (changeSubscriptions.has(key)) {\n return\n }\n\n const { side } = splitEntryKey(key)\n\n const changedPromise = endpoint[`${side}Changed`](includeIssues)\n changeSubscriptions.set(key, changedPromise)\n try {\n const changed = await changedPromise\n\n for await (const change of changed) {\n processIssues(currentEntryIssues, key, change, false, true)\n // TODO: Get an actual content hash from Turbopack.\n const message = await createMessage(change, String(++hmrHash))\n if (message) {\n sendHmr(key, message)\n }\n }\n } catch (e) {\n changeSubscriptions.delete(key)\n const payload = await onError?.(e as Error)\n if (payload) {\n sendHmr(key, payload)\n }\n return\n }\n changeSubscriptions.delete(key)\n }\n\n async function unsubscribeFromChanges(key: EntryKey) {\n const subscription = await changeSubscriptions.get(key)\n if (subscription) {\n await subscription.return?.()\n changeSubscriptions.delete(key)\n }\n currentEntryIssues.delete(key)\n }\n\n async function subscribeToHmrEvents(client: ws, id: string) {\n const key = getEntryKey('assets', 'client', id)\n if (!hasEntrypointForKey(currentEntrypoints, key, assetMapper)) {\n // maybe throw an error / force the client to reload?\n return\n }\n\n const state = clientStates.get(client)\n if (!state || state.subscriptions.has(id)) {\n return\n }\n\n const subscription = project!.hmrEvents(id)\n state.subscriptions.set(id, subscription)\n\n // The subscription will always emit once, which is the initial\n // computation. This is not a change, so swallow it.\n try {\n await subscription.next()\n\n for await (const data of subscription) {\n processIssues(state.clientIssues, key, data, false, true)\n if (data.type !== 'issues') {\n sendTurbopackMessage(data)\n }\n }\n } catch (e) {\n // The client might be using an HMR session from a previous server, tell them\n // to fully reload the page to resolve the issue. We can't use\n // `hotReloader.send` since that would force every connected client to\n // reload, only this client is out of date.\n const reloadMessage: ReloadPageMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.RELOAD_PAGE,\n data: `error in HMR event subscription for ${id}: ${e}`,\n }\n sendToClient(client, reloadMessage)\n client.close()\n return\n }\n }\n\n function unsubscribeFromHmrEvents(client: ws, id: string) {\n const state = clientStates.get(client)\n if (!state) {\n return\n }\n\n const subscription = state.subscriptions.get(id)\n subscription?.return!()\n\n const key = getEntryKey('assets', 'client', id)\n state.clientIssues.delete(key)\n }\n\n async function handleEntrypointsSubscription() {\n for await (const entrypoints of entrypointsSubscription) {\n if (!currentEntriesHandlingResolve) {\n currentEntriesHandling = new Promise(\n // eslint-disable-next-line no-loop-func\n (resolve) => (currentEntriesHandlingResolve = resolve)\n )\n }\n\n processTopLevelIssues(currentTopLevelIssues, entrypoints)\n\n await handleEntrypoints({\n entrypoints,\n\n currentEntrypoints,\n\n currentEntryIssues,\n manifestLoader,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n\n dev: {\n assetMapper,\n changeSubscriptions,\n clients,\n clientStates,\n serverFields,\n\n hooks: {\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n return clearRequireCache(id, result, { force: forceDeleteCache })\n },\n propagateServerField: propagateServerField.bind(null, opts),\n sendHmr,\n startBuilding,\n subscribeToChanges,\n unsubscribeFromChanges,\n unsubscribeFromHmrEvents,\n },\n },\n })\n\n currentEntriesHandlingResolve!()\n currentEntriesHandlingResolve = undefined\n }\n }\n\n await mkdir(join(distDir, 'server'), { recursive: true })\n await mkdir(join(distDir, 'static', buildId), { recursive: true })\n await writeFile(\n join(distDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n },\n null,\n 2\n )\n )\n\n const middlewares = [\n getOverlayMiddleware({\n project,\n projectPath,\n isSrcDir: opts.isSrcDir,\n }),\n getSourceMapMiddleware(project),\n getNextErrorFeedbackMiddleware(opts.telemetry),\n getDevOverlayFontMiddleware(),\n getDisableDevIndicatorMiddleware(),\n getRestartDevServerMiddleware({\n telemetry: opts.telemetry,\n turbopackProject: project,\n }),\n devToolsConfigMiddleware({\n distDir,\n sendUpdateSignal: (data) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.DEVTOOLS_CONFIG,\n data,\n })\n },\n }),\n ]\n\n const versionInfoPromise = getVersionInfo()\n\n let devtoolsFrontendUrl: string | undefined\n const nodeDebugType = getNodeDebugType()\n if (nodeDebugType) {\n const debugPort = process.debugPort\n let debugInfo\n try {\n // It requires to use 127.0.0.1 instead of localhost for server-side fetching.\n const debugInfoList = await fetch(\n `http://127.0.0.1:${debugPort}/json/list`\n ).then((res) => res.json())\n debugInfo = debugInfoList[0]\n } catch {}\n if (debugInfo) {\n devtoolsFrontendUrl = debugInfo.devtoolsFrontendUrl\n }\n }\n\n const hotReloader: NextJsHotReloaderInterface = {\n turbopackProject: project,\n activeWebpackConfigs: undefined,\n serverStats: null,\n edgeServerStats: null,\n async run(req, res, _parsedUrl) {\n // intercept page chunks request and ensure them with turbopack\n if (req.url?.startsWith('/_next/static/chunks/pages/')) {\n const params = matchNextPageBundleRequest(req.url)\n\n if (params) {\n const decodedPagePath = `/${params.path\n .map((param: string) => decodeURIComponent(param))\n .join('/')}`\n\n const denormalizedPagePath = denormalizePagePath(decodedPagePath)\n\n await hotReloader\n .ensurePage({\n page: denormalizedPagePath,\n clientOnly: false,\n definition: undefined,\n url: req.url,\n })\n .catch(console.error)\n }\n }\n\n for (const middleware of middlewares) {\n let calledNext = false\n\n await middleware(req, res, () => {\n calledNext = true\n })\n\n if (!calledNext) {\n return { finished: true }\n }\n }\n\n // Request was not finished.\n return { finished: undefined }\n },\n\n // TODO: Figure out if socket type can match the NextJsHotReloaderInterface\n onHMR(req, socket: Socket, head, onUpgrade) {\n wsServer.handleUpgrade(req, socket, head, (client) => {\n onUpgrade(client)\n const clientIssues: EntryIssuesMap = new Map()\n const subscriptions: Map<string, AsyncIterator<any>> = new Map()\n\n clients.add(client)\n clientStates.set(client, {\n clientIssues,\n messages: new Map(),\n turbopackUpdates: [],\n subscriptions,\n })\n\n client.on('close', () => {\n // Remove active subscriptions\n for (const subscription of subscriptions.values()) {\n subscription.return?.()\n }\n clientStates.delete(client)\n clients.delete(client)\n })\n\n client.addEventListener('message', async ({ data }) => {\n const parsedData = JSON.parse(\n typeof data !== 'string' ? data.toString() : data\n )\n\n // Next.js messages\n switch (parsedData.event) {\n case 'span-end': {\n hotReloaderSpan.manualTraceChild(\n parsedData.spanName,\n msToNs(parsedData.startTime),\n msToNs(parsedData.endTime),\n parsedData.attributes\n )\n break\n }\n case 'client-hmr-latency': // { id, startTime, endTime, page, updatedModules, isPageHidden }\n hotReloaderSpan.manualTraceChild(\n parsedData.event,\n msToNs(parsedData.startTime),\n msToNs(parsedData.endTime),\n {\n updatedModules: parsedData.updatedModules,\n page: parsedData.page,\n isPageHidden: parsedData.isPageHidden,\n }\n )\n break\n\n case 'client-error': // { errorCount, clientId }\n case 'client-warning': // { warningCount, clientId }\n case 'client-success': // { clientId }\n case 'server-component-reload-page': // { clientId }\n case 'client-reload-page': // { clientId }\n case 'client-removed-page': // { page }\n case 'client-full-reload': // { stackTrace, hadRuntimeError }\n const { hadRuntimeError, dependencyChain } = parsedData\n if (hadRuntimeError) {\n Log.warn(FAST_REFRESH_RUNTIME_RELOAD)\n }\n if (\n Array.isArray(dependencyChain) &&\n typeof dependencyChain[0] === 'string'\n ) {\n const cleanedModulePath = dependencyChain[0]\n .replace(/^\\[project\\]/, '.')\n .replace(/ \\[.*\\] \\(.*\\)$/, '')\n Log.warn(\n `Fast Refresh had to perform a full reload when ${cleanedModulePath} changed. Read more: https://nextjs.org/docs/messages/fast-refresh-reload`\n )\n }\n break\n case 'client-added-page':\n // TODO\n break\n case 'browser-logs': {\n if (nextConfig.experimental.browserDebugInfoInTerminal) {\n await receiveBrowserLogsTurbopack({\n entries: parsedData.entries,\n router: parsedData.router,\n sourceType: parsedData.sourceType,\n project,\n projectPath,\n distDir,\n config: nextConfig.experimental.browserDebugInfoInTerminal,\n })\n }\n break\n }\n\n default:\n // Might be a Turbopack message...\n if (!parsedData.type) {\n throw new Error(`unrecognized HMR message \"${data}\"`)\n }\n }\n\n // Turbopack messages\n switch (parsedData.type) {\n case 'turbopack-subscribe':\n subscribeToHmrEvents(client, parsedData.path)\n break\n\n case 'turbopack-unsubscribe':\n unsubscribeFromHmrEvents(client, parsedData.path)\n break\n\n default:\n if (!parsedData.event) {\n throw new Error(`unrecognized Turbopack HMR message \"${data}\"`)\n }\n }\n })\n\n const turbopackConnectedMessage: TurbopackConnectedMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: { sessionId },\n }\n sendToClient(client, turbopackConnectedMessage)\n\n const errors: CompilationError[] = []\n\n for (const entryIssues of currentEntryIssues.values()) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n errors.push({\n message: formatIssue(issue),\n })\n } else {\n printNonFatalIssue(issue)\n }\n }\n }\n\n if (devIndicatorServerState.disabledUntil < Date.now()) {\n devIndicatorServerState.disabledUntil = 0\n }\n\n ;(async function () {\n const versionInfo = await versionInfoPromise\n const devToolsConfig = await getDevToolsConfig(distDir)\n\n const syncMessage: SyncMessage = {\n type: HMR_MESSAGE_SENT_TO_BROWSER.SYNC,\n errors,\n warnings: [],\n hash: '',\n versionInfo,\n debug: {\n devtoolsFrontendUrl,\n },\n devIndicator: devIndicatorServerState,\n devToolsConfig,\n }\n\n sendToClient(client, syncMessage)\n })()\n })\n },\n\n send(action) {\n const payload = JSON.stringify(action)\n for (const client of clients) {\n client.send(payload)\n }\n },\n\n setHmrServerError(_error) {\n // Not implemented yet.\n },\n clearHmrServerError() {\n // Not implemented yet.\n },\n async start() {},\n async getCompilationErrors(page) {\n const appEntryKey = getEntryKey('app', 'server', page)\n const pagesEntryKey = getEntryKey('pages', 'server', page)\n\n const topLevelIssues = currentTopLevelIssues.values()\n\n const thisEntryIssues =\n currentEntryIssues.get(appEntryKey) ??\n currentEntryIssues.get(pagesEntryKey)\n\n if (thisEntryIssues !== undefined && thisEntryIssues.size > 0) {\n // If there is an error related to the requesting page we display it instead of the first error\n return [...topLevelIssues, ...thisEntryIssues.values()]\n .map((issue) => {\n const formattedIssue = formatIssue(issue)\n if (issue.severity === 'warning') {\n printNonFatalIssue(issue)\n return null\n } else if (isWellKnownError(issue)) {\n Log.error(formattedIssue)\n }\n\n return new Error(formattedIssue)\n })\n .filter((error) => error !== null)\n }\n\n // Otherwise, return all errors across pages\n const errors = []\n for (const issue of topLevelIssues) {\n if (issue.severity !== 'warning') {\n errors.push(new Error(formatIssue(issue)))\n }\n }\n for (const entryIssues of currentEntryIssues.values()) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n const message = formatIssue(issue)\n errors.push(new Error(message))\n } else {\n printNonFatalIssue(issue)\n }\n }\n }\n return errors\n },\n async invalidate({\n // .env files or tsconfig/jsconfig change\n reloadAfterInvalidation,\n }) {\n if (reloadAfterInvalidation) {\n for (const [key, entrypoint] of currentWrittenEntrypoints) {\n clearRequireCache(key, entrypoint, { force: true })\n }\n\n await clearAllModuleContexts()\n this.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES,\n hash: String(++hmrHash),\n })\n }\n },\n async buildFallbackError() {\n // Not implemented yet.\n },\n async ensurePage({\n page: inputPage,\n // Unused parameters\n // clientOnly,\n appPaths,\n definition,\n isApp,\n url: requestUrl,\n }) {\n // When there is no route definition this is an internal file not a route the user added.\n // Middleware and instrumentation are handled in turbpack-utils.ts handleEntrypoints instead.\n if (!definition) {\n if (inputPage === '/middleware') return\n if (inputPage === '/src/middleware') return\n if (inputPage === '/instrumentation') return\n if (inputPage === '/src/instrumentation') return\n }\n\n return hotReloaderSpan\n .traceChild('ensure-page', {\n inputPage,\n })\n .traceAsyncFn(async () => {\n if (BLOCKED_PAGES.includes(inputPage) && inputPage !== '/_error') {\n return\n }\n\n await currentEntriesHandling\n\n // TODO We shouldn't look into the filesystem again. This should use the information from entrypoints\n let routeDef: Pick<\n RouteDefinition,\n 'filename' | 'bundlePath' | 'page'\n > =\n definition ??\n (await findPagePathData(\n projectPath,\n inputPage,\n nextConfig.pageExtensions,\n opts.pagesDir,\n opts.appDir,\n !!nextConfig.experimental.globalNotFound\n ))\n\n // If the route is actually an app page route, then we should have access\n // to the app route definition, and therefore, the appPaths from it.\n if (!appPaths && definition && isAppPageRouteDefinition(definition)) {\n appPaths = definition.appPaths\n }\n\n let page = routeDef.page\n if (appPaths) {\n const normalizedPage = normalizeAppPath(page)\n\n // filter out paths that are not exact matches (e.g. catchall)\n const matchingAppPaths = appPaths.filter(\n (path) => normalizeAppPath(path) === normalizedPage\n )\n\n // the last item in the array is the root page, if there are parallel routes\n page = matchingAppPaths[matchingAppPaths.length - 1]\n }\n\n const pathname = definition?.pathname ?? inputPage\n\n if (page === '/_error') {\n let finishBuilding = startBuilding(pathname, requestUrl, false)\n try {\n await handlePagesErrorRoute({\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n hooks: {\n subscribeToChanges,\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n assetMapper.setPathsForKey(id, result.clientPaths)\n return clearRequireCache(id, result, {\n force: forceDeleteCache,\n })\n },\n },\n })\n } finally {\n finishBuilding()\n }\n return\n }\n\n const isInsideAppDir = routeDef.bundlePath.startsWith('app/')\n const isEntryMetadataRouteFile = isMetadataRouteFile(\n routeDef.filename.replace(opts.appDir || '', ''),\n nextConfig.pageExtensions,\n true\n )\n const normalizedAppPage = isEntryMetadataRouteFile\n ? normalizedPageToTurbopackStructureRoute(\n page,\n extname(routeDef.filename)\n )\n : page\n\n const route = isInsideAppDir\n ? currentEntrypoints.app.get(normalizedAppPage)\n : currentEntrypoints.page.get(page)\n\n if (!route) {\n // TODO: why is this entry missing in turbopack?\n if (page === '/middleware') return\n if (page === '/src/middleware') return\n if (page === '/instrumentation') return\n if (page === '/src/instrumentation') return\n\n throw new PageNotFoundError(`route not found ${page}`)\n }\n\n // We don't throw on ensureOpts.isApp === true for page-api\n // since this can happen when app pages make\n // api requests to page API routes.\n if (isApp && route.type === 'page') {\n throw new Error(`mis-matched route type: isApp && page for ${page}`)\n }\n\n const finishBuilding = startBuilding(pathname, requestUrl, false)\n try {\n await handleRouteType({\n dev,\n page,\n pathname,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n readyIds,\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n logErrors: true,\n\n hooks: {\n subscribeToChanges,\n handleWrittenEndpoint: (id, result, forceDeleteCache) => {\n currentWrittenEntrypoints.set(id, result)\n assetMapper.setPathsForKey(id, result.clientPaths)\n return clearRequireCache(id, result, {\n force: forceDeleteCache,\n })\n },\n },\n })\n } finally {\n finishBuilding()\n }\n })\n },\n close() {\n for (const wsClient of clients) {\n // it's okay to not cleanly close these websocket connections, this is dev\n wsClient.terminate()\n }\n clients.clear()\n },\n }\n\n handleEntrypointsSubscription().catch((err) => {\n console.error(err)\n process.exit(1)\n })\n\n // Write empty manifests\n await currentEntriesHandling\n await manifestLoader.writeManifests({\n devRewrites: opts.fsChecker.rewrites,\n productionRewrites: undefined,\n entrypoints: currentEntrypoints,\n })\n\n async function handleProjectUpdates() {\n for await (const updateMessage of project.updateInfoSubscribe(30)) {\n switch (updateMessage.updateType) {\n case 'start': {\n hotReloader.send({ type: HMR_MESSAGE_SENT_TO_BROWSER.BUILDING })\n break\n }\n case 'end': {\n sendEnqueuedMessages()\n\n function addErrors(\n errorsMap: Map<string, CompilationError>,\n issues: EntryIssuesMap\n ) {\n for (const issueMap of issues.values()) {\n for (const [key, issue] of issueMap) {\n if (issue.severity === 'warning') continue\n if (errorsMap.has(key)) continue\n\n const message = formatIssue(issue)\n\n errorsMap.set(key, {\n message,\n details: issue.detail\n ? renderStyledStringToErrorAnsi(issue.detail)\n : undefined,\n })\n }\n }\n }\n\n const errors = new Map<string, CompilationError>()\n addErrors(errors, currentEntryIssues)\n\n for (const client of clients) {\n const state = clientStates.get(client)\n if (!state) {\n continue\n }\n\n const clientErrors = new Map(errors)\n addErrors(clientErrors, state.clientIssues)\n\n sendToClient(client, {\n type: HMR_MESSAGE_SENT_TO_BROWSER.BUILT,\n hash: String(++hmrHash),\n errors: [...clientErrors.values()],\n warnings: [],\n })\n }\n\n if (hmrEventHappened) {\n const time = updateMessage.value.duration\n const timeMessage =\n time > 2000 ? `${Math.round(time / 100) / 10}s` : `${time}ms`\n Log.event(`Compiled in ${timeMessage}`)\n hmrEventHappened = false\n }\n break\n }\n default:\n }\n }\n }\n\n handleProjectUpdates().catch((err) => {\n console.error(err)\n process.exit(1)\n })\n\n return hotReloader\n}\n"],"names":["createHotReloaderTurbopack","wsServer","ws","Server","noServer","isTestMode","process","env","NEXT_TEST_MODE","__NEXT_TEST_MODE","DEBUG","sessionId","Math","floor","Number","MAX_SAFE_INTEGER","random","rewriteTurbopackSources","projectRoot","sourceMap","section","sections","map","i","sources","length","pathToFileURL","join","replace","toString","getSourceMapFromTurbopack","project","sourceURL","sourceMapJson","getSourceMapSync","err","undefined","payload","JSON","parse","opts","serverFields","distDir","resetFetch","nextConfig","dev","buildId","dir","projectPath","loadBindings","require","bindings","log","testMode","hasRewrites","fsChecker","rewrites","afterFiles","beforeFiles","fallback","hotReloaderSpan","trace","version","__NEXT_VERSION","stop","encryptionKey","generateEncryptionKeyBase64","isBuild","clientRouterFilters","experimental","clientRouterFilter","supportedBrowsers","getSupportedBrowsers","currentNodeJsVersion","versions","node","rootPath","turbopack","root","outputFileTracingRoot","turbo","createProject","normalizePath","relative","watch","enable","pollIntervalMs","watchOptions","defineEnv","createDefineEnv","isTurbopack","config","fetchCacheKeyPrefix","middlewareMatchers","previewProps","prerenderManifest","preview","browserslistQuery","noMangling","persistentCaching","isPersistentCachingEnabled","memoryLimit","turbopackMemoryLimit","isShortSession","backgroundLogCompilationEvents","eventTypes","setBundlerFindSourceMapImplementation","bind","onDevServerCleanup","onExit","entrypointsSubscription","entrypointsSubscribe","currentWrittenEntrypoints","Map","currentEntrypoints","global","app","document","error","middleware","instrumentation","page","currentTopLevelIssues","currentEntryIssues","manifestLoader","TurbopackManifestLoader","changeSubscriptions","serverPathState","readyIds","Set","currentEntriesHandlingResolve","currentEntriesHandling","Promise","resolve","assetMapper","AssetMapper","clearRequireCache","key","writtenEndpoint","force","path","contentHash","serverPaths","endsWith","localKey","set","hasChange","localHash","get","globalHash","__next__clear_chunk_cache__","p","file","clearModuleContext","deleteCache","buildingIds","startBuilding","id","requestUrl","forceRebuild","has","size","consoleStore","setState","loading","trigger","url","add","finishBuilding","delete","hmrEventHappened","hmrHash","clients","clientStates","WeakMap","sendToClient","client","message","send","stringify","sendEnqueuedMessages","issueMap","values","filter","severity","state","clientIssues","messages","clear","turbopackUpdates","type","HMR_MESSAGE_SENT_TO_BROWSER","TURBOPACK_MESSAGE","data","sendEnqueuedMessagesDebounce","debounce","sendHmr","sendTurbopackMessage","diagnostics","issues","push","subscribeToChanges","includeIssues","endpoint","createMessage","onError","side","splitEntryKey","changedPromise","changed","change","processIssues","String","e","unsubscribeFromChanges","subscription","return","subscribeToHmrEvents","getEntryKey","hasEntrypointForKey","subscriptions","hmrEvents","next","reloadMessage","RELOAD_PAGE","close","unsubscribeFromHmrEvents","handleEntrypointsSubscription","entrypoints","processTopLevelIssues","handleEntrypoints","devRewrites","productionRewrites","logErrors","hooks","handleWrittenEndpoint","result","forceDeleteCache","propagateServerField","mkdir","recursive","writeFile","middlewares","getOverlayMiddleware","isSrcDir","getSourceMapMiddleware","getNextErrorFeedbackMiddleware","telemetry","getDevOverlayFontMiddleware","getDisableDevIndicatorMiddleware","getRestartDevServerMiddleware","turbopackProject","devToolsConfigMiddleware","sendUpdateSignal","hotReloader","DEVTOOLS_CONFIG","versionInfoPromise","getVersionInfo","devtoolsFrontendUrl","nodeDebugType","getNodeDebugType","debugPort","debugInfo","debugInfoList","fetch","then","res","json","activeWebpackConfigs","serverStats","edgeServerStats","run","req","_parsedUrl","startsWith","params","matchNextPageBundleRequest","decodedPagePath","param","decodeURIComponent","denormalizedPagePath","denormalizePagePath","ensurePage","clientOnly","definition","catch","console","calledNext","finished","onHMR","socket","head","onUpgrade","handleUpgrade","on","addEventListener","parsedData","event","manualTraceChild","spanName","msToNs","startTime","endTime","attributes","updatedModules","isPageHidden","hadRuntimeError","dependencyChain","Log","warn","FAST_REFRESH_RUNTIME_RELOAD","Array","isArray","cleanedModulePath","browserDebugInfoInTerminal","receiveBrowserLogsTurbopack","entries","router","sourceType","Error","turbopackConnectedMessage","TURBOPACK_CONNECTED","errors","entryIssues","issue","formatIssue","printNonFatalIssue","devIndicatorServerState","disabledUntil","Date","now","versionInfo","devToolsConfig","getDevToolsConfig","syncMessage","SYNC","warnings","hash","debug","devIndicator","action","setHmrServerError","_error","clearHmrServerError","start","getCompilationErrors","appEntryKey","pagesEntryKey","topLevelIssues","thisEntryIssues","formattedIssue","isWellKnownError","invalidate","reloadAfterInvalidation","entrypoint","clearAllModuleContexts","SERVER_COMPONENT_CHANGES","buildFallbackError","inputPage","appPaths","isApp","traceChild","traceAsyncFn","BLOCKED_PAGES","includes","routeDef","findPagePathData","pageExtensions","pagesDir","appDir","globalNotFound","isAppPageRouteDefinition","normalizedPage","normalizeAppPath","matchingAppPaths","pathname","handlePagesErrorRoute","setPathsForKey","clientPaths","isInsideAppDir","bundlePath","isEntryMetadataRouteFile","isMetadataRouteFile","filename","normalizedAppPage","normalizedPageToTurbopackStructureRoute","extname","route","PageNotFoundError","handleRouteType","wsClient","terminate","exit","writeManifests","handleProjectUpdates","updateMessage","updateInfoSubscribe","updateType","BUILDING","addErrors","errorsMap","details","detail","renderStyledStringToErrorAnsi","clientErrors","BUILT","time","value","duration","timeMessage","round"],"mappings":";;;;+BAkKsBA;;;eAAAA;;;0BAjKW;sBACO;qBACV;2DAEf;uBAGuB;kCASM;qBASZ;6DACX;oCAId;2BACuB;qCAIvB;uBAC2B;wBACT;8BACG;8BAIrB;qCAC6B;uBACd;gCAgBf;iCAKA;gCACiC;sCACP;0BAM1B;0BACqC;uCACA;wCACH;0BACR;wBAEA;iCACG;mCACkB;gDACP;wBASxC;6CACqC;yCACJ;wCACS;4CACH;mCACC;wBACV;6BACO;+BACd;0CAIvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,MAAMC,WAAW,IAAIC,WAAE,CAACC,MAAM,CAAC;IAAEC,UAAU;AAAK;AAChD,MAAMC,aAAa,CAAC,CAClBC,CAAAA,QAAQC,GAAG,CAACC,cAAc,IAC1BF,QAAQC,GAAG,CAACE,gBAAgB,IAC5BH,QAAQC,GAAG,CAACG,KAAK,AAAD;AAGlB,MAAMC,YAAYC,KAAKC,KAAK,CAACC,OAAOC,gBAAgB,GAAGH,KAAKI,MAAM;AAIlE;;CAEC,GACD,SAASC,wBACPC,WAAmB,EACnBC,SAAiC;IAEjC,IAAI,cAAcA,WAAW;QAC3B,KAAK,MAAMC,WAAWD,UAAUE,QAAQ,CAAE;YACxCJ,wBAAwBC,aAAaE,QAAQE,GAAG;QAClD;IACF,OAAO;QACL,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,UAAUK,OAAO,CAACC,MAAM,EAAEF,IAAK;YACjDJ,UAAUK,OAAO,CAACD,EAAE,GAAGG,IAAAA,kBAAa,EAClCC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AAE;4BACd;wBACF;wBAEA,IAAItK,kBAAkB;4BACpB,MAAM4O,OAAOX,cAAcY,KAAK,CAACC,QAAQ;4BACzC,MAAMC,cACJH,OAAO,OAAO,GAAG1Y,KAAK8Y,KAAK,CAACJ,OAAO,OAAO,GAAG,CAAC,CAAC,GAAG,GAAGA,KAAK,EAAE,CAAC;4BAC/DlG,KAAIX,KAAK,CAAC,CAAC,YAAY,EAAEgH,aAAa;4BACtC/O,mBAAmB;wBACrB;wBACA;oBACF;gBACA;YACF;QACF;IACF;IAEAgO,uBAAuB7G,KAAK,CAAC,CAAC1P;QAC5B2P,QAAQxK,KAAK,CAACnF;QACd7B,QAAQkY,IAAI,CAAC;IACf;IAEA,OAAO1I;AACT","ignoreList":[0]}
|
@@ -262,7 +262,7 @@ class HotReloaderWebpack {
|
|
262
262
|
this.previewProps = previewProps;
|
263
263
|
this.rewrites = rewrites;
|
264
264
|
this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
|
265
|
-
version: "15.5.1-canary.
|
265
|
+
version: "15.5.1-canary.27"
|
266
266
|
});
|
267
267
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
268
268
|
// of the current `next dev` invocation.
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { type ConfiguredExperimentalFeature } from '../config';
|
2
|
-
export declare function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, }: {
|
2
|
+
export declare function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, logBundler, }: {
|
3
3
|
networkUrl: string | null;
|
4
4
|
appUrl: string | null;
|
5
5
|
envInfo?: string[];
|
6
6
|
experimentalFeatures?: ConfiguredExperimentalFeature[];
|
7
|
+
logBundler: boolean;
|
7
8
|
}): void;
|
8
9
|
export declare function getStartServerInfo({ dir, dev, debugPrerender, }: {
|
9
10
|
dir: string;
|
@@ -71,16 +71,18 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
71
71
|
}
|
72
72
|
return newObj;
|
73
73
|
}
|
74
|
-
function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures }) {
|
75
|
-
let bundlerSuffix;
|
76
|
-
if (
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, logBundler }) {
|
75
|
+
let bundlerSuffix = '';
|
76
|
+
if (logBundler) {
|
77
|
+
if (process.env.TURBOPACK) {
|
78
|
+
bundlerSuffix = ' (Turbopack)';
|
79
|
+
} else if (process.env.NEXT_RSPACK) {
|
80
|
+
bundlerSuffix = ' (Rspack)';
|
81
|
+
} else {
|
82
|
+
bundlerSuffix = ' (webpack)';
|
83
|
+
}
|
82
84
|
}
|
83
|
-
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.1-canary.
|
85
|
+
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.1-canary.27"}`))}${bundlerSuffix}`);
|
84
86
|
if (appUrl) {
|
85
87
|
_log.bootstrap(`- Local: ${appUrl}`);
|
86
88
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/server/lib/app-info-log.ts"],"sourcesContent":["import { loadEnvConfig } from '@next/env'\nimport * as Log from '../../build/output/log'\nimport { bold, purple } from '../../lib/picocolors'\nimport {\n PHASE_DEVELOPMENT_SERVER,\n PHASE_PRODUCTION_BUILD,\n} from '../../shared/lib/constants'\nimport loadConfig, { type ConfiguredExperimentalFeature } from '../config'\n\nexport function logStartInfo({\n networkUrl,\n appUrl,\n envInfo,\n experimentalFeatures,\n}: {\n networkUrl: string | null\n appUrl: string | null\n envInfo?: string[]\n experimentalFeatures?: ConfiguredExperimentalFeature[]\n}) {\n let bundlerSuffix\n if (process.env.TURBOPACK) {\n
|
1
|
+
{"version":3,"sources":["../../../src/server/lib/app-info-log.ts"],"sourcesContent":["import { loadEnvConfig } from '@next/env'\nimport * as Log from '../../build/output/log'\nimport { bold, purple } from '../../lib/picocolors'\nimport {\n PHASE_DEVELOPMENT_SERVER,\n PHASE_PRODUCTION_BUILD,\n} from '../../shared/lib/constants'\nimport loadConfig, { type ConfiguredExperimentalFeature } from '../config'\n\nexport function logStartInfo({\n networkUrl,\n appUrl,\n envInfo,\n experimentalFeatures,\n logBundler,\n}: {\n networkUrl: string | null\n appUrl: string | null\n envInfo?: string[]\n experimentalFeatures?: ConfiguredExperimentalFeature[]\n logBundler: boolean\n}) {\n let bundlerSuffix = ''\n if (logBundler) {\n if (process.env.TURBOPACK) {\n bundlerSuffix = ' (Turbopack)'\n } else if (process.env.NEXT_RSPACK) {\n bundlerSuffix = ' (Rspack)'\n } else {\n bundlerSuffix = ' (webpack)'\n }\n }\n\n Log.bootstrap(\n `${bold(\n purple(`${Log.prefixes.ready} Next.js ${process.env.__NEXT_VERSION}`)\n )}${bundlerSuffix}`\n )\n if (appUrl) {\n Log.bootstrap(`- Local: ${appUrl}`)\n }\n if (networkUrl) {\n Log.bootstrap(`- Network: ${networkUrl}`)\n }\n if (envInfo?.length) Log.bootstrap(`- Environments: ${envInfo.join(', ')}`)\n\n if (experimentalFeatures?.length) {\n Log.bootstrap(`- Experiments (use with caution):`)\n for (const exp of experimentalFeatures) {\n const symbol =\n typeof exp.value === 'boolean'\n ? exp.value === true\n ? bold('✓')\n : bold('⨯')\n : '·'\n\n const suffix =\n typeof exp.value === 'number' || typeof exp.value === 'string'\n ? `: ${JSON.stringify(exp.value)}`\n : ''\n\n const reason = exp.reason ? ` (${exp.reason})` : ''\n\n Log.bootstrap(` ${symbol} ${exp.key}${suffix}${reason}`)\n }\n }\n\n // New line after the bootstrap info\n Log.info('')\n}\n\nexport async function getStartServerInfo({\n dir,\n dev,\n debugPrerender,\n}: {\n dir: string\n dev: boolean\n debugPrerender?: boolean\n}): Promise<{\n envInfo?: string[]\n experimentalFeatures?: ConfiguredExperimentalFeature[]\n}> {\n let experimentalFeatures: ConfiguredExperimentalFeature[] = []\n await loadConfig(\n dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_BUILD,\n dir,\n {\n reportExperimentalFeatures(features) {\n experimentalFeatures = features.sort(({ key: a }, { key: b }) =>\n a.localeCompare(b)\n )\n },\n debugPrerender,\n silent: false,\n }\n )\n\n // we need to reset env if we are going to create\n // the worker process with the esm loader so that the\n // initial env state is correct\n let envInfo: string[] = []\n const { loadedEnvFiles } = loadEnvConfig(dir, true, console, false)\n if (loadedEnvFiles.length > 0) {\n envInfo = loadedEnvFiles.map((f) => f.path)\n }\n\n return {\n envInfo,\n experimentalFeatures,\n }\n}\n"],"names":["getStartServerInfo","logStartInfo","networkUrl","appUrl","envInfo","experimentalFeatures","logBundler","bundlerSuffix","process","env","TURBOPACK","NEXT_RSPACK","Log","bootstrap","bold","purple","prefixes","ready","__NEXT_VERSION","length","join","exp","symbol","value","suffix","JSON","stringify","reason","key","info","dir","dev","debugPrerender","loadConfig","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","reportExperimentalFeatures","features","sort","a","b","localeCompare","silent","loadedEnvFiles","loadEnvConfig","console","map","f","path"],"mappings":";;;;;;;;;;;;;;;IAuEsBA,kBAAkB;eAAlBA;;IA9DNC,YAAY;eAAZA;;;qBATc;6DACT;4BACQ;2BAItB;+DACwD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExD,SAASA,aAAa,EAC3BC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,oBAAoB,EACpBC,UAAU,EAOX;IACC,IAAIC,gBAAgB;IACpB,IAAID,YAAY;QACd,IAAIE,QAAQC,GAAG,CAACC,SAAS,EAAE;YACzBH,gBAAgB;QAClB,OAAO,IAAIC,QAAQC,GAAG,CAACE,WAAW,EAAE;YAClCJ,gBAAgB;QAClB,OAAO;YACLA,gBAAgB;QAClB;IACF;IAEAK,KAAIC,SAAS,CACX,GAAGC,IAAAA,gB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,4BAA2BC,QAAQ;YACjChC,uBAAuBgC,SAASC,IAAI,CAAC,CAAC,EAAEV,KAAKW,CAAC,EAAE,EAAE,EAAEX,KAAKY,CAAC,EAAE,GAC1DD,EAAEE,aAAa,CAACD;QAEpB;QACAR;QACAU,QAAQ;IACV;IAGF,iDAAiD;IACjD,qDAAqD;IACrD,+BAA+B;IAC/B,IAAItC,UAAoB,EAAE;IAC1B,MAAM,EAAEuC,cAAc,EAAE,GAAGC,IAAAA,kBAAa,EAACd,KAAK,MAAMe,SAAS;IAC7D,IAAIF,eAAexB,MAAM,GAAG,GAAG;QAC7Bf,UAAUuC,eAAeG,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;IAC5C;IAEA,OAAO;QACL5C;QACAC;IACF;AACF","ignoreList":[0]}
|
@@ -179,7 +179,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
|
|
179
179
|
async function startServer(serverOptions) {
|
180
180
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
181
181
|
let { port } = serverOptions;
|
182
|
-
process.title = `next-server (v${"15.5.1-canary.
|
182
|
+
process.title = `next-server (v${"15.5.1-canary.27"})`;
|
183
183
|
let handlersReady = ()=>{};
|
184
184
|
let handlersError = ()=>{};
|
185
185
|
let handlersPromise = new Promise((resolve, reject)=>{
|
@@ -320,7 +320,8 @@ async function startServer(serverOptions) {
|
|
320
320
|
networkUrl,
|
321
321
|
appUrl,
|
322
322
|
envInfo,
|
323
|
-
experimentalFeatures
|
323
|
+
experimentalFeatures,
|
324
|
+
logBundler: isDev
|
324
325
|
});
|
325
326
|
_log.event(`Starting...`);
|
326
327
|
try {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/server/lib/start-server.ts"],"sourcesContent":["// Start CPU profile if it wasn't already started.\nimport './cpu-profile'\nimport { getNetworkHost } from '../../lib/get-network-host'\n\nif (performance.getEntriesByName('next-start').length === 0) {\n performance.mark('next-start')\n}\nimport '../next'\nimport '../require-hook'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { SelfSignedCertificate } from '../../lib/mkcert'\nimport type { WorkerRequestHandler, WorkerUpgradeHandler } from './types'\n\nimport fs from 'fs'\nimport v8 from 'v8'\nimport path from 'path'\nimport http from 'http'\nimport https from 'https'\nimport os from 'os'\nimport { exec } from 'child_process'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport * as Log from '../../build/output/log'\nimport setupDebug from 'next/dist/compiled/debug'\nimport {\n RESTART_EXIT_CODE,\n getFormattedDebugAddress,\n getNodeDebugType,\n} from './utils'\nimport { formatHostname } from './format-hostname'\nimport { initialize } from './router-server'\nimport { CONFIG_FILES } from '../../shared/lib/constants'\nimport { getStartServerInfo, logStartInfo } from './app-info-log'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { type Span, trace, flushAllTraces } from '../../trace'\nimport { isIPv6 } from './is-ipv6'\nimport { AsyncCallbackSet } from './async-callback-set'\nimport type { NextServer } from '../next'\nimport type { ConfiguredExperimentalFeature } from '../config'\n\nconst debug = setupDebug('next:start-server')\nlet startServerSpan: Span | undefined\n\n/**\n * Get the process ID (PID) of the process using the specified port\n */\nasync function getProcessIdUsingPort(port: number): Promise<string | null> {\n const timeoutMs = 250\n const processLookupController = new AbortController()\n\n const pidPromise = new Promise<string | null>((resolve) => {\n const handleError = (error: Error) => {\n debug('Failed to get process ID for port', port, error)\n resolve(null)\n }\n\n try {\n // Use lsof on Unix-like systems (macOS, Linux)\n if (process.platform !== 'win32') {\n exec(\n `lsof -ti:${port} -sTCP:LISTEN`,\n { signal: processLookupController.signal },\n (error, stdout) => {\n if (error) {\n handleError(error)\n return\n }\n // `-sTCP` will ensure there's only one port, clean up output\n const pid = stdout.trim()\n resolve(pid || null)\n }\n )\n } else {\n // Use netstat on Windows\n exec(\n `netstat -ano | findstr /C:\":${port} \" | findstr LISTENING`,\n { signal: processLookupController.signal },\n (error, stdout) => {\n if (error) {\n handleError(error)\n return\n }\n // Clean up output and extract PID\n const cleanOutput = stdout.replace(/\\s+/g, ' ').trim()\n if (cleanOutput) {\n const lines = cleanOutput.split('\\n')\n const firstLine = lines[0].trim()\n if (firstLine) {\n const parts = firstLine.split(' ')\n const pid = parts[parts.length - 1]\n resolve(pid || null)\n } else {\n resolve(null)\n }\n } else {\n resolve(null)\n }\n }\n )\n }\n } catch (cause) {\n handleError(\n new Error('Unexpected error during process lookup', { cause })\n )\n }\n })\n\n const timeoutId = setTimeout(() => {\n processLookupController.abort(\n `PID detection timed out after ${timeoutMs}ms for port ${port}.`\n )\n }, timeoutMs)\n\n pidPromise.finally(() => clearTimeout(timeoutId))\n\n return pidPromise\n}\n\nexport interface StartServerOptions {\n dir: string\n port: number\n isDev: boolean\n hostname?: string\n allowRetry?: boolean\n customServer?: boolean\n minimalMode?: boolean\n keepAliveTimeout?: number\n // this is dev-server only\n selfSignedCertificate?: SelfSignedCertificate\n}\n\nexport async function getRequestHandlers({\n dir,\n port,\n isDev,\n onDevServerCleanup,\n server,\n hostname,\n minimalMode,\n keepAliveTimeout,\n experimentalHttpsServer,\n quiet,\n}: {\n dir: string\n port: number\n isDev: boolean\n onDevServerCleanup: ((listener: () => Promise<void>) => void) | undefined\n server?: import('http').Server\n hostname?: string\n minimalMode?: boolean\n keepAliveTimeout?: number\n experimentalHttpsServer?: boolean\n quiet?: boolean\n}): ReturnType<typeof initialize> {\n return initialize({\n dir,\n port,\n hostname,\n onDevServerCleanup,\n dev: isDev,\n minimalMode,\n server,\n keepAliveTimeout,\n experimentalHttpsServer,\n startServerSpan,\n quiet,\n })\n}\n\nexport async function startServer(\n serverOptions: StartServerOptions\n): Promise<void> {\n const {\n dir,\n isDev,\n hostname,\n minimalMode,\n allowRetry,\n keepAliveTimeout,\n selfSignedCertificate,\n } = serverOptions\n let { port } = serverOptions\n\n process.title = `next-server (v${process.env.__NEXT_VERSION})`\n let handlersReady = () => {}\n let handlersError = () => {}\n\n let handlersPromise: Promise<void> | undefined = new Promise<void>(\n (resolve, reject) => {\n handlersReady = resolve\n handlersError = reject\n }\n )\n let requestHandler: WorkerRequestHandler = async (\n req: IncomingMessage,\n res: ServerResponse\n ): Promise<void> => {\n if (handlersPromise) {\n await handlersPromise\n return requestHandler(req, res)\n }\n throw new Error('Invariant request handler was not setup')\n }\n let upgradeHandler: WorkerUpgradeHandler = async (\n req,\n socket,\n head\n ): Promise<void> => {\n if (handlersPromise) {\n await handlersPromise\n return upgradeHandler(req, socket, head)\n }\n throw new Error('Invariant upgrade handler was not setup')\n }\n\n let nextServer: NextServer | undefined\n\n // setup server listener as fast as possible\n if (selfSignedCertificate && !isDev) {\n throw new Error(\n 'Using a self signed certificate is only supported with `next dev`.'\n )\n }\n\n async function requestListener(req: IncomingMessage, res: ServerResponse) {\n try {\n if (handlersPromise) {\n await handlersPromise\n handlersPromise = undefined\n }\n await requestHandler(req, res)\n } catch (err) {\n res.statusCode = 500\n res.end('Internal Server Error')\n Log.error(`Failed to handle request for ${req.url}`)\n console.error(err)\n } finally {\n if (isDev) {\n if (\n v8.getHeapStatistics().used_heap_size >\n 0.8 * v8.getHeapStatistics().heap_size_limit\n ) {\n Log.warn(\n `Server is approaching the used memory threshold, restarting...`\n )\n trace('server-restart-close-to-memory-threshold', undefined, {\n 'memory.heapSizeLimit': String(\n v8.getHeapStatistics().heap_size_limit\n ),\n 'memory.heapUsed': String(v8.getHeapStatistics().used_heap_size),\n }).stop()\n await flushAllTraces()\n process.exit(RESTART_EXIT_CODE)\n }\n }\n }\n }\n\n const server = selfSignedCertificate\n ? https.createServer(\n {\n key: fs.readFileSync(selfSignedCertificate.key),\n cert: fs.readFileSync(selfSignedCertificate.cert),\n },\n requestListener\n )\n : http.createServer(requestListener)\n\n if (keepAliveTimeout) {\n server.keepAliveTimeout = keepAliveTimeout\n }\n server.on('upgrade', async (req, socket, head) => {\n try {\n await upgradeHandler(req, socket, head)\n } catch (err) {\n socket.destroy()\n Log.error(`Failed to handle request for ${req.url}`)\n console.error(err)\n }\n })\n\n let portRetryCount = 0\n const originalPort = port\n\n server.on('error', (err: NodeJS.ErrnoException) => {\n if (\n allowRetry &&\n port &&\n isDev &&\n err.code === 'EADDRINUSE' &&\n portRetryCount < 10\n ) {\n port += 1\n portRetryCount += 1\n server.listen(port, hostname)\n } else {\n Log.error(`Failed to start server`)\n console.error(err)\n process.exit(1)\n }\n })\n\n let cleanupListeners = isDev ? new AsyncCallbackSet() : undefined\n\n await new Promise<void>((resolve) => {\n server.on('listening', async () => {\n const nodeDebugType = getNodeDebugType()\n\n const addr = server.address()\n const actualHostname = formatHostname(\n typeof addr === 'object'\n ? addr?.address || hostname || 'localhost'\n : addr\n )\n const formattedHostname =\n !hostname || actualHostname === '0.0.0.0'\n ? 'localhost'\n : actualHostname === '[::]'\n ? '[::1]'\n : formatHostname(hostname)\n\n port = typeof addr === 'object' ? addr?.port || port : port\n\n if (portRetryCount) {\n const pid = await getProcessIdUsingPort(originalPort)\n if (pid) {\n Log.warn(\n `Port ${originalPort} is in use by process ${pid}, using available port ${port} instead.`\n )\n } else {\n Log.warn(\n `Port ${originalPort} is in use by an unknown process, using available port ${port} instead.`\n )\n }\n }\n\n const networkHostname =\n hostname ?? getNetworkHost(isIPv6(actualHostname) ? 'IPv6' : 'IPv4')\n\n const protocol = selfSignedCertificate ? 'https' : 'http'\n\n const networkUrl = networkHostname\n ? `${protocol}://${formatHostname(networkHostname)}:${port}`\n : null\n\n const appUrl = `${protocol}://${formattedHostname}:${port}`\n\n if (nodeDebugType) {\n const formattedDebugAddress = getFormattedDebugAddress()\n Log.info(\n `the --${nodeDebugType} option was detected, the Next.js router server should be inspected at ${formattedDebugAddress}.`\n )\n }\n\n // Store the selected port to:\n // - expose it to render workers\n // - re-use it for automatic dev server restarts with a randomly selected port\n process.env.PORT = port + ''\n\n process.env.__NEXT_PRIVATE_ORIGIN = appUrl\n\n // Set experimental HTTPS flag for metadata resolution\n if (selfSignedCertificate) {\n process.env.__NEXT_EXPERIMENTAL_HTTPS = '1'\n }\n\n // Only load env and config in dev to for logging purposes\n let envInfo: string[] | undefined\n let experimentalFeatures: ConfiguredExperimentalFeature[] | undefined\n if (isDev) {\n const startServerInfo = await getStartServerInfo({ dir, dev: isDev })\n envInfo = startServerInfo.envInfo\n experimentalFeatures = startServerInfo.experimentalFeatures\n }\n logStartInfo({\n networkUrl,\n appUrl,\n envInfo,\n experimentalFeatures,\n })\n\n Log.event(`Starting...`)\n\n try {\n let cleanupStarted = false\n let closeUpgraded: (() => void) | null = null\n const cleanup = () => {\n if (cleanupStarted) {\n // We can get duplicate signals, e.g. when `ctrl+c` is used in an\n // interactive shell (i.e. bash, zsh), the shell will recursively\n // send SIGINT to children. The parent `next-dev` process will also\n // send us SIGINT.\n return\n }\n cleanupStarted = true\n ;(async () => {\n debug('start-server process cleanup')\n\n // first, stop accepting new connections and finish pending requests,\n // because they might affect `nextServer.close()` (e.g. by scheduling an `after`)\n await new Promise<void>((res) => {\n server.close((err) => {\n if (err) console.error(err)\n res()\n })\n if (isDev) {\n server.closeAllConnections()\n closeUpgraded?.()\n }\n })\n\n // now that no new requests can come in, clean up the rest\n await Promise.all([\n nextServer?.close().catch(console.error),\n cleanupListeners?.runAll().catch(console.error),\n ])\n\n debug('start-server process cleanup finished')\n process.exit(0)\n })()\n }\n\n // Make sure commands gracefully respect termination signals (e.g. from Docker)\n // Allow the graceful termination to be manually configurable\n if (!process.env.NEXT_MANUAL_SIG_HANDLE) {\n process.on('SIGINT', cleanup)\n process.on('SIGTERM', cleanup)\n }\n\n const initResult = await getRequestHandlers({\n dir,\n port,\n isDev,\n onDevServerCleanup: cleanupListeners\n ? cleanupListeners.add.bind(cleanupListeners)\n : undefined,\n server,\n hostname,\n minimalMode,\n keepAliveTimeout,\n experimentalHttpsServer: !!selfSignedCertificate,\n })\n requestHandler = initResult.requestHandler\n upgradeHandler = initResult.upgradeHandler\n nextServer = initResult.server\n closeUpgraded = initResult.closeUpgraded\n\n const startServerProcessDuration =\n performance.mark('next-start-end') &&\n performance.measure(\n 'next-start-duration',\n 'next-start',\n 'next-start-end'\n ).duration\n\n handlersReady()\n const formatDurationText =\n startServerProcessDuration > 2000\n ? `${Math.round(startServerProcessDuration / 100) / 10}s`\n : `${Math.round(startServerProcessDuration)}ms`\n\n Log.event(`Ready in ${formatDurationText}`)\n\n if (process.env.TURBOPACK) {\n await validateTurboNextConfig({\n dir: serverOptions.dir,\n isDev: true,\n })\n }\n } catch (err) {\n // fatal error if we can't setup\n handlersError()\n console.error(err)\n process.exit(1)\n }\n\n resolve()\n })\n server.listen(port, hostname)\n })\n\n if (isDev) {\n function watchConfigFiles(\n dirToWatch: string,\n onChange: (filename: string) => void\n ) {\n const wp = new Watchpack()\n wp.watch({\n files: CONFIG_FILES.map((file) => path.join(dirToWatch, file)),\n })\n wp.on('change', onChange)\n }\n watchConfigFiles(dir, async (filename) => {\n if (process.env.__NEXT_DISABLE_MEMORY_WATCHER) {\n Log.info(\n `Detected change, manual restart required due to '__NEXT_DISABLE_MEMORY_WATCHER' usage`\n )\n return\n }\n\n Log.warn(\n `Found a change in ${path.basename(\n filename\n )}. Restarting the server to apply the changes...`\n )\n process.exit(RESTART_EXIT_CODE)\n })\n }\n}\n\nif (process.env.NEXT_PRIVATE_WORKER && process.send) {\n process.addListener('message', async (msg: any) => {\n if (\n msg &&\n typeof msg === 'object' &&\n msg.nextWorkerOptions &&\n process.send\n ) {\n startServerSpan = trace('start-dev-server', undefined, {\n cpus: String(os.cpus().length),\n platform: os.platform(),\n 'memory.freeMem': String(os.freemem()),\n 'memory.totalMem': String(os.totalmem()),\n 'memory.heapSizeLimit': String(v8.getHeapStatistics().heap_size_limit),\n })\n await startServerSpan.traceAsyncFn(() =>\n startServer(msg.nextWorkerOptions)\n )\n const memoryUsage = process.memoryUsage()\n startServerSpan.setAttribute('memory.rss', String(memoryUsage.rss))\n startServerSpan.setAttribute(\n 'memory.heapTotal',\n String(memoryUsage.heapTotal)\n )\n startServerSpan.setAttribute(\n 'memory.heapUsed',\n String(memoryUsage.heapUsed)\n )\n process.send({ nextServerReady: true, port: process.env.PORT })\n }\n })\n process.send({ nextWorkerReady: true })\n}\n"],"names":["getRequestHandlers","startServer","performance","getEntriesByName","length","mark","debug","setupDebug","startServerSpan","getProcessIdUsingPort","port","timeoutMs","processLookupController","AbortController","pidPromise","Promise","resolve","handleError","error","process","platform","exec","signal","stdout","pid","trim","cleanOutput","replace","lines","split","firstLine","parts","cause","Error","timeoutId","setTimeout","abort","finally","clearTimeout","dir","isDev","onDevServerCleanup","server","hostname","minimalMode","keepAliveTimeout","experimentalHttpsServer","quiet","initialize","dev","serverOptions","allowRetry","selfSignedCertificate","title","env","__NEXT_VERSION","handlersReady","handlersError","handlersPromise","reject","requestHandler","req","res","upgradeHandler","socket","head","nextServer","requestListener","undefined","err","statusCode","end","Log","url","console","v8","getHeapStatistics","used_heap_size","heap_size_limit","warn","trace","String","stop","flushAllTraces","exit","RESTART_EXIT_CODE","https","createServer","key","fs","readFileSync","cert","http","on","destroy","portRetryCount","originalPort","code","listen","cleanupListeners","AsyncCallbackSet","nodeDebugType","getNodeDebugType","addr","address","actualHostname","formatHostname","formattedHostname","networkHostname","getNetworkHost","isIPv6","protocol","networkUrl","appUrl","formattedDebugAddress","getFormattedDebugAddress","info","PORT","__NEXT_PRIVATE_ORIGIN","__NEXT_EXPERIMENTAL_HTTPS","envInfo","experimentalFeatures","startServerInfo","getStartServerInfo","logStartInfo","event","cleanupStarted","closeUpgraded","cleanup","close","closeAllConnections","all","catch","runAll","NEXT_MANUAL_SIG_HANDLE","initResult","add","bind","startServerProcessDuration","measure","duration","formatDurationText","Math","round","TURBOPACK","validateTurboNextConfig","watchConfigFiles","dirToWatch","onChange","wp","Watchpack","watch","files","CONFIG_FILES","map","file","path","join","filename","__NEXT_DISABLE_MEMORY_WATCHER","basename","NEXT_PRIVATE_WORKER","send","addListener","msg","nextWorkerOptions","cpus","os","freemem","totalmem","traceAsyncFn","memoryUsage","setAttribute","rss","he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AAY,CAC1B,oBACA3F,OAAO0F,YAAYG,SAAS;YAE9BtK,gBAAgBoK,YAAY,CAC1B,mBACA3F,OAAO0F,YAAYI,QAAQ;YAE7B5J,QAAQ+I,IAAI,CAAC;gBAAEc,iBAAiB;gBAAMtK,MAAMS,QAAQmC,GAAG,CAAC+D,IAAI;YAAC;QAC/D;IACF;IACAlG,QAAQ+I,IAAI,CAAC;QAAEe,iBAAiB;IAAK;AACvC","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/server/lib/start-server.ts"],"sourcesContent":["// Start CPU profile if it wasn't already started.\nimport './cpu-profile'\nimport { getNetworkHost } from '../../lib/get-network-host'\n\nif (performance.getEntriesByName('next-start').length === 0) {\n performance.mark('next-start')\n}\nimport '../next'\nimport '../require-hook'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { SelfSignedCertificate } from '../../lib/mkcert'\nimport type { WorkerRequestHandler, WorkerUpgradeHandler } from './types'\n\nimport fs from 'fs'\nimport v8 from 'v8'\nimport path from 'path'\nimport http from 'http'\nimport https from 'https'\nimport os from 'os'\nimport { exec } from 'child_process'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport * as Log from '../../build/output/log'\nimport setupDebug from 'next/dist/compiled/debug'\nimport {\n RESTART_EXIT_CODE,\n getFormattedDebugAddress,\n getNodeDebugType,\n} from './utils'\nimport { formatHostname } from './format-hostname'\nimport { initialize } from './router-server'\nimport { CONFIG_FILES } from '../../shared/lib/constants'\nimport { getStartServerInfo, logStartInfo } from './app-info-log'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { type Span, trace, flushAllTraces } from '../../trace'\nimport { isIPv6 } from './is-ipv6'\nimport { AsyncCallbackSet } from './async-callback-set'\nimport type { NextServer } from '../next'\nimport type { ConfiguredExperimentalFeature } from '../config'\n\nconst debug = setupDebug('next:start-server')\nlet startServerSpan: Span | undefined\n\n/**\n * Get the process ID (PID) of the process using the specified port\n */\nasync function getProcessIdUsingPort(port: number): Promise<string | null> {\n const timeoutMs = 250\n const processLookupController = new AbortController()\n\n const pidPromise = new Promise<string | null>((resolve) => {\n const handleError = (error: Error) => {\n debug('Failed to get process ID for port', port, error)\n resolve(null)\n }\n\n try {\n // Use lsof on Unix-like systems (macOS, Linux)\n if (process.platform !== 'win32') {\n exec(\n `lsof -ti:${port} -sTCP:LISTEN`,\n { signal: processLookupController.signal },\n (error, stdout) => {\n if (error) {\n handleError(error)\n return\n }\n // `-sTCP` will ensure there's only one port, clean up output\n const pid = stdout.trim()\n resolve(pid || null)\n }\n )\n } else {\n // Use netstat on Windows\n exec(\n `netstat -ano | findstr /C:\":${port} \" | findstr LISTENING`,\n { signal: processLookupController.signal },\n (error, stdout) => {\n if (error) {\n handleError(error)\n return\n }\n // Clean up output and extract PID\n const cleanOutput = stdout.replace(/\\s+/g, ' ').trim()\n if (cleanOutput) {\n const lines = cleanOutput.split('\\n')\n const firstLine = lines[0].trim()\n if (firstLine) {\n const parts = firstLine.split(' ')\n const pid = parts[parts.length - 1]\n resolve(pid || null)\n } else {\n resolve(null)\n }\n } else {\n resolve(null)\n }\n }\n )\n }\n } catch (cause) {\n handleError(\n new Error('Unexpected error during process lookup', { cause })\n )\n }\n })\n\n const timeoutId = setTimeout(() => {\n processLookupController.abort(\n `PID detection timed out after ${timeoutMs}ms for port ${port}.`\n )\n }, timeoutMs)\n\n pidPromise.finally(() => clearTimeout(timeoutId))\n\n return pidPromise\n}\n\nexport interface StartServerOptions {\n dir: string\n port: number\n isDev: boolean\n hostname?: string\n allowRetry?: boolean\n customServer?: boolean\n minimalMode?: boolean\n keepAliveTimeout?: number\n // this is dev-server only\n selfSignedCertificate?: SelfSignedCertificate\n}\n\nexport async function getRequestHandlers({\n dir,\n port,\n isDev,\n onDevServerCleanup,\n server,\n hostname,\n minimalMode,\n keepAliveTimeout,\n experimentalHttpsServer,\n quiet,\n}: {\n dir: string\n port: number\n isDev: boolean\n onDevServerCleanup: ((listener: () => Promise<void>) => void) | undefined\n server?: import('http').Server\n hostname?: string\n minimalMode?: boolean\n keepAliveTimeout?: number\n experimentalHttpsServer?: boolean\n quiet?: boolean\n}): ReturnType<typeof initialize> {\n return initialize({\n dir,\n port,\n hostname,\n onDevServerCleanup,\n dev: isDev,\n minimalMode,\n server,\n keepAliveTimeout,\n experimentalHttpsServer,\n startServerSpan,\n quiet,\n })\n}\n\nexport async function startServer(\n serverOptions: StartServerOptions\n): Promise<void> {\n const {\n dir,\n isDev,\n hostname,\n minimalMode,\n allowRetry,\n keepAliveTimeout,\n selfSignedCertificate,\n } = serverOptions\n let { port } = serverOptions\n\n process.title = `next-server (v${process.env.__NEXT_VERSION})`\n let handlersReady = () => {}\n let handlersError = () => {}\n\n let handlersPromise: Promise<void> | undefined = new Promise<void>(\n (resolve, reject) => {\n handlersReady = resolve\n handlersError = reject\n }\n )\n let requestHandler: WorkerRequestHandler = async (\n req: IncomingMessage,\n res: ServerResponse\n ): Promise<void> => {\n if (handlersPromise) {\n await handlersPromise\n return requestHandler(req, res)\n }\n throw new Error('Invariant request handler was not setup')\n }\n let upgradeHandler: WorkerUpgradeHandler = async (\n req,\n socket,\n head\n ): Promise<void> => {\n if (handlersPromise) {\n await handlersPromise\n return upgradeHandler(req, socket, head)\n }\n throw new Error('Invariant upgrade handler was not setup')\n }\n\n let nextServer: NextServer | undefined\n\n // setup server listener as fast as possible\n if (selfSignedCertificate && !isDev) {\n throw new Error(\n 'Using a self signed certificate is only supported with `next dev`.'\n )\n }\n\n async function requestListener(req: IncomingMessage, res: ServerResponse) {\n try {\n if (handlersPromise) {\n await handlersPromise\n handlersPromise = undefined\n }\n await requestHandler(req, res)\n } catch (err) {\n res.statusCode = 500\n res.end('Internal Server Error')\n Log.error(`Failed to handle request for ${req.url}`)\n console.error(err)\n } finally {\n if (isDev) {\n if (\n v8.getHeapStatistics().used_heap_size >\n 0.8 * v8.getHeapStatistics().heap_size_limit\n ) {\n Log.warn(\n `Server is approaching the used memory threshold, restarting...`\n )\n trace('server-restart-close-to-memory-threshold', undefined, {\n 'memory.heapSizeLimit': String(\n v8.getHeapStatistics().heap_size_limit\n ),\n 'memory.heapUsed': String(v8.getHeapStatistics().used_heap_size),\n }).stop()\n await flushAllTraces()\n process.exit(RESTART_EXIT_CODE)\n }\n }\n }\n }\n\n const server = selfSignedCertificate\n ? https.createServer(\n {\n key: fs.readFileSync(selfSignedCertificate.key),\n cert: fs.readFileSync(selfSignedCertificate.cert),\n },\n requestListener\n )\n : http.createServer(requestListener)\n\n if (keepAliveTimeout) {\n server.keepAliveTimeout = keepAliveTimeout\n }\n server.on('upgrade', async (req, socket, head) => {\n try {\n await upgradeHandler(req, socket, head)\n } catch (err) {\n socket.destroy()\n Log.error(`Failed to handle request for ${req.url}`)\n console.error(err)\n }\n })\n\n let portRetryCount = 0\n const originalPort = port\n\n server.on('error', (err: NodeJS.ErrnoException) => {\n if (\n allowRetry &&\n port &&\n isDev &&\n err.code === 'EADDRINUSE' &&\n portRetryCount < 10\n ) {\n port += 1\n portRetryCount += 1\n server.listen(port, hostname)\n } else {\n Log.error(`Failed to start server`)\n console.error(err)\n process.exit(1)\n }\n })\n\n let cleanupListeners = isDev ? new AsyncCallbackSet() : undefined\n\n await new Promise<void>((resolve) => {\n server.on('listening', async () => {\n const nodeDebugType = getNodeDebugType()\n\n const addr = server.address()\n const actualHostname = formatHostname(\n typeof addr === 'object'\n ? addr?.address || hostname || 'localhost'\n : addr\n )\n const formattedHostname =\n !hostname || actualHostname === '0.0.0.0'\n ? 'localhost'\n : actualHostname === '[::]'\n ? '[::1]'\n : formatHostname(hostname)\n\n port = typeof addr === 'object' ? addr?.port || port : port\n\n if (portRetryCount) {\n const pid = await getProcessIdUsingPort(originalPort)\n if (pid) {\n Log.warn(\n `Port ${originalPort} is in use by process ${pid}, using available port ${port} instead.`\n )\n } else {\n Log.warn(\n `Port ${originalPort} is in use by an unknown process, using available port ${port} instead.`\n )\n }\n }\n\n const networkHostname =\n hostname ?? getNetworkHost(isIPv6(actualHostname) ? 'IPv6' : 'IPv4')\n\n const protocol = selfSignedCertificate ? 'https' : 'http'\n\n const networkUrl = networkHostname\n ? `${protocol}://${formatHostname(networkHostname)}:${port}`\n : null\n\n const appUrl = `${protocol}://${formattedHostname}:${port}`\n\n if (nodeDebugType) {\n const formattedDebugAddress = getFormattedDebugAddress()\n Log.info(\n `the --${nodeDebugType} option was detected, the Next.js router server should be inspected at ${formattedDebugAddress}.`\n )\n }\n\n // Store the selected port to:\n // - expose it to render workers\n // - re-use it for automatic dev server restarts with a randomly selected port\n process.env.PORT = port + ''\n\n process.env.__NEXT_PRIVATE_ORIGIN = appUrl\n\n // Set experimental HTTPS flag for metadata resolution\n if (selfSignedCertificate) {\n process.env.__NEXT_EXPERIMENTAL_HTTPS = '1'\n }\n\n // Only load env and config in dev to for logging purposes\n let envInfo: string[] | undefined\n let experimentalFeatures: ConfiguredExperimentalFeature[] | undefined\n if (isDev) {\n const startServerInfo = await getStartServerInfo({ dir, dev: isDev })\n envInfo = startServerInfo.envInfo\n experimentalFeatures = startServerInfo.experimentalFeatures\n }\n logStartInfo({\n networkUrl,\n appUrl,\n envInfo,\n experimentalFeatures,\n logBundler: isDev,\n })\n\n Log.event(`Starting...`)\n\n try {\n let cleanupStarted = false\n let closeUpgraded: (() => void) | null = null\n const cleanup = () => {\n if (cleanupStarted) {\n // We can get duplicate signals, e.g. when `ctrl+c` is used in an\n // interactive shell (i.e. bash, zsh), the shell will recursively\n // send SIGINT to children. The parent `next-dev` process will also\n // send us SIGINT.\n return\n }\n cleanupStarted = true\n ;(async () => {\n debug('start-server process cleanup')\n\n // first, stop accepting new connections and finish pending requests,\n // because they might affect `nextServer.close()` (e.g. by scheduling an `after`)\n await new Promise<void>((res) => {\n server.close((err) => {\n if (err) console.error(err)\n res()\n })\n if (isDev) {\n server.closeAllConnections()\n closeUpgraded?.()\n }\n })\n\n // now that no new requests can come in, clean up the rest\n await Promise.all([\n nextServer?.close().catch(console.error),\n cleanupListeners?.runAll().catch(console.error),\n ])\n\n debug('start-server process cleanup finished')\n process.exit(0)\n })()\n }\n\n // Make sure commands gracefully respect termination signals (e.g. from Docker)\n // Allow the graceful termination to be manually configurable\n if (!process.env.NEXT_MANUAL_SIG_HANDLE) {\n process.on('SIGINT', cleanup)\n process.on('SIGTERM', cleanup)\n }\n\n const initResult = await getRequestHandlers({\n dir,\n port,\n isDev,\n onDevServerCleanup: cleanupListeners\n ? cleanupListeners.add.bind(cleanupListeners)\n : undefined,\n server,\n hostname,\n minimalMode,\n keepAliveTimeout,\n experimentalHttpsServer: !!selfSignedCertificate,\n })\n requestHandler = initResult.requestHandler\n upgradeHandler = initResult.upgradeHandler\n nextServer = initResult.server\n closeUpgraded = initResult.closeUpgraded\n\n const startServerProcessDuration =\n performance.mark('next-start-end') &&\n performance.measure(\n 'next-start-duration',\n 'next-start',\n 'next-start-end'\n ).duration\n\n handlersReady()\n const formatDurationText =\n startServerProcessDuration > 2000\n ? `${Math.round(startServerProcessDuration / 100) / 10}s`\n : `${Math.round(startServerProcessDuration)}ms`\n\n Log.event(`Ready in ${formatDurationText}`)\n\n if (process.env.TURBOPACK) {\n await validateTurboNextConfig({\n dir: serverOptions.dir,\n isDev: true,\n })\n }\n } catch (err) {\n // fatal error if we can't setup\n handlersError()\n console.error(err)\n process.exit(1)\n }\n\n resolve()\n })\n server.listen(port, hostname)\n })\n\n if (isDev) {\n function watchConfigFiles(\n dirToWatch: string,\n onChange: (filename: string) => void\n ) {\n const wp = new Watchpack()\n wp.watch({\n files: CONFIG_FILES.map((file) => path.join(dirToWatch, file)),\n })\n wp.on('change', onChange)\n }\n watchConfigFiles(dir, async (filename) => {\n if (process.env.__NEXT_DISABLE_MEMORY_WATCHER) {\n Log.info(\n `Detected change, manual restart required due to '__NEXT_DISABLE_MEMORY_WATCHER' usage`\n )\n return\n }\n\n Log.warn(\n `Found a change in ${path.basename(\n filename\n )}. Restarting the server to apply the changes...`\n )\n process.exit(RESTART_EXIT_CODE)\n })\n }\n}\n\nif (process.env.NEXT_PRIVATE_WORKER && process.send) {\n process.addListener('message', async (msg: any) => {\n if (\n msg &&\n typeof msg === 'object' &&\n msg.nextWorkerOptions &&\n process.send\n ) {\n startServerSpan = trace('start-dev-server', undefined, {\n cpus: String(os.cpus().length),\n platform: os.platform(),\n 'memory.freeMem': String(os.freemem()),\n 'memory.totalMem': String(os.totalmem()),\n 'memory.heapSizeLimit': String(v8.getHeapStatistics().heap_size_limit),\n })\n await startServerSpan.traceAsyncFn(() =>\n startServer(msg.nextWorkerOptions)\n )\n const memoryUsage = process.memoryUsage()\n startServerSpan.setAttribute('memory.rss', String(memoryUsage.rss))\n startServerSpan.setAttribute(\n 'memory.heapTotal',\n String(memoryUsage.heapTotal)\n )\n startServerSpan.setAttribute(\n 'memory.heapUsed',\n String(memoryUsage.heapUsed)\n )\n process.send({ nextServerReady: true, port: process.env.PORT })\n }\n })\n process.send({ nextWorkerReady: true })\n}\n"],"names":["getRequestHandlers","startServer","performance","getEntriesByName","length","mark","debug","setupDebug","startServerSpan","getProcessIdUsingPort","port","timeoutMs","processLookupController","AbortController","pidPromise","Promise","resolve","handleError","error","process","platform","exec","signal","stdout","pid","trim","cleanOutput","replace","lines","split","firstLine","parts","cause","Error","timeoutId","setTimeout","abort","finally","clearTimeout","dir","isDev","onDevServerCleanup","server","hostname","minimalMode","keepAliveTimeout","experimentalHttpsServer","quiet","initialize","dev","serverOptions","allowRetry","selfSignedCertificate","title","env","__NEXT_VERSION","handlersReady","handlersError","handlersPromise","reject","requestHandler","req","res","upgradeHandler","socket","head","nextServer","requestListener","undefined","err","statusCode","end","Log","url","console","v8","getHeapStatistics","used_heap_size","heap_size_limit","warn","trace","String","stop","flushAllTraces","exit","RESTART_EXIT_CODE","https","createServer","key","fs","readFileSync","cert","http","on","destroy","portRetryCount","originalPort","code","listen","cleanupListeners","AsyncCallbackSet","nodeDebugType","getNodeDebugType","addr","address","actualHostname","formatHostname","formattedHostname","networkHostname","getNetworkHost","isIPv6","protocol","networkUrl","appUrl","formattedDebugAddress","getFormattedDebugAddress","info","PORT","__NEXT_PRIVATE_ORIGIN","__NEXT_EXPERIMENTAL_HTTPS","envInfo","experimentalFeatures","startServerInfo","getStartServerInfo","logStartInfo","logBundler","event","cleanupStarted","closeUpgraded","cleanup","close","closeAllConnections","all","catch","runAll","NEXT_MANUAL_SIG_HANDLE","initResult","add","bind","startServerProcessDuration","measure","duration","formatDurationText","Math","round","TURBOPACK","validateTurboNextConfig","watchConfigFiles","dirToWatch","onChange","wp","Watchpack","watch","files","CONFIG_FILES","map","file","path","join","filename","__NEXT_DISABLE_MEMORY_WATCHER","basename","NEXT_PRIVATE_WORKER","send","addListener","msg","nextWorkerOptions","cpus","os","freemem","totalmem","traceAsyncFn","memoryUsage","setAttribute","rss","heapTotal","heapUsed","nextServerReady","nextWorkerReady"],"mappings":"AAAA,kDAAkD;;;;;;;;;;;;;;;;IAmI5BA,kBAAkB;eAAlBA;;IAsCAC,WAAW;eAAXA;;;QAxKf;gCACwB;QAKxB;QACA;2DAMQ;2DACA;6DACE;6DACA;8DACC;2DACH;+BACM;kEACC;6DACD;8DACE;uBAKhB;gCACwB;8BACJ;2BACE;4BACoB;kCACT;uBACS;wBAC1B;kCACU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAhCjC,IAAIC,YAAYC,gBAAgB,CAAC,cAAcC,MAAM,KAAK,GAAG;IAC3DF,YAAYG,IAAI,CAAC;AACnB;AAkCA,MAAMC,QAAQC,IAAAA,cAAU,EAAC;AACzB,IAAIC;AAEJ;;CAEC,GACD,eAAeC,sBAAsBC,IAAY;IAC/C,MAAMC,YAAY;IAClB,MAAMC,0BAA0B,IAAIC;IAEpC,MAAMC,aAAa,IAAIC,QAAuB,CAACC;QAC7C,MAAMC,cAAc,CAACC;YACnBZ,MAAM,qCAAqCI,MAAMQ;YACjDF,QAAQ;QACV;QAEA,IAAI;YACF,+CAA+C;YAC/C,IAAIG,QAAQC,QAAQ,KAAK,SAAS;gB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