Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
No EOL
14 KiB
Text
1 line
No EOL
14 KiB
Text
{"version":3,"sources":["../../../../src/server/dev/browser-logs/source-map.ts"],"sourcesContent":["import { getOriginalStackFrames as getOriginalStackFramesWebpack } from '../middleware-webpack'\nimport { getOriginalStackFrames as getOriginalStackFramesTurbopack } from '../middleware-turbopack'\nimport type { Project } from '../../../build/swc/types'\nimport { dim } from '../../../lib/picocolors'\nimport { parseStack, type StackFrame } from '../../lib/parse-stack'\nimport path from 'path'\nimport { LRUCache } from '../../lib/lru-cache'\n\ntype WebpackMappingContext = {\n bundler: 'webpack'\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n clientStats: () => any\n serverStats: () => any\n edgeServerStats: () => any\n rootDirectory: string\n}\n\ntype TurbopackMappingContext = {\n bundler: 'turbopack'\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n project: Project\n projectPath: string\n}\n\nexport type MappingContext = WebpackMappingContext | TurbopackMappingContext\n\n// TODO: handle server vs browser error source mapping correctly\nexport async function mapFramesUsingBundler(\n frames: StackFrame[],\n ctx: MappingContext\n) {\n switch (ctx.bundler) {\n case 'webpack': {\n const {\n isServer,\n isEdgeServer,\n isAppDirectory,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n } = ctx\n const res = await getOriginalStackFramesWebpack({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n })\n return res\n }\n case 'turbopack': {\n const { project, projectPath, isServer, isEdgeServer, isAppDirectory } =\n ctx\n const res = await getOriginalStackFramesTurbopack({\n project,\n projectPath,\n frames,\n isServer,\n isEdgeServer,\n isAppDirectory,\n })\n\n return res\n }\n default: {\n return null!\n }\n }\n}\n\n// converts _next/static/chunks/... to file:///.next/static/chunks/... for parseStack\n// todo: where does next dev overlay handle this case and re-use that logic\nfunction preprocessStackTrace(stackTrace: string, distDir?: string): string {\n return stackTrace\n .split('\\n')\n .map((line) => {\n const match = line.match(/^(\\s*at\\s+.*?)\\s+\\(([^)]+)\\)$/)\n if (match) {\n const [, prefix, location] = match\n\n if (location.startsWith('_next/static/') && distDir) {\n const normalizedDistDir = distDir\n .replace(/\\\\/g, '/')\n .replace(/\\/$/, '')\n\n const absolutePath =\n normalizedDistDir + '/' + location.slice('_next/'.length)\n const fileUrl = `file://${path.resolve(absolutePath)}`\n\n return `${prefix} (${fileUrl})`\n }\n }\n\n return line\n })\n .join('\\n')\n}\n\nconst cache = new LRUCache<\n Awaited<ReturnType<typeof getSourceMappedStackFramesInternal>>\n>(25)\nasync function getSourceMappedStackFramesInternal(\n stackTrace: string,\n ctx: MappingContext,\n distDir: string,\n ignore = true\n) {\n try {\n const normalizedStack = preprocessStackTrace(stackTrace, distDir)\n const frames = parseStack(normalizedStack, distDir)\n\n if (frames.length === 0) {\n return {\n kind: 'stack' as const,\n stack: stackTrace,\n }\n }\n\n const mappingResults = await mapFramesUsingBundler(frames, ctx)\n\n const processedFrames = mappingResults\n .map((result, index) => ({\n result,\n originalFrame: frames[index],\n }))\n .map(({ result, originalFrame }) => {\n if (result.status === 'rejected') {\n return {\n kind: 'rejected' as const,\n frameText: formatStackFrame(originalFrame),\n codeFrame: null,\n }\n }\n\n const { originalStackFrame, originalCodeFrame } = result.value\n if (originalStackFrame?.ignored && ignore) {\n return {\n kind: 'ignored' as const,\n }\n }\n\n // should we apply this generally to dev overlay (dev overlay does not ignore chrome-extension://)\n if (originalStackFrame?.file?.startsWith('chrome-extension://')) {\n return {\n kind: 'ignored' as const,\n }\n }\n\n return {\n kind: 'success' as const,\n // invariant: if result is not rejected and not ignored, then original stack frame exists\n // verifiable by tracing `getOriginalStackFrame`. The invariant exists because of bad types\n frameText: formatStackFrame(originalStackFrame!),\n codeFrame: originalCodeFrame,\n }\n })\n\n const allIgnored = processedFrames.every(\n (frame) => frame.kind === 'ignored'\n )\n\n // we want to handle **all** ignored vs all/some rejected differently\n // if all are ignored we should show no frames\n // if all are rejected, we want to fallback to showing original stack frames\n if (allIgnored) {\n return {\n kind: 'all-ignored' as const,\n }\n }\n\n const filteredFrames = processedFrames.filter(\n (frame) => frame.kind !== 'ignored'\n )\n\n if (filteredFrames.length === 0) {\n return {\n kind: 'stack' as const,\n stack: stackTrace,\n }\n }\n\n const stackOutput = filteredFrames\n .map((frame) => frame.frameText)\n .join('\\n')\n const firstFrameCode = filteredFrames.find(\n (frame) => frame.codeFrame\n )?.codeFrame\n\n if (firstFrameCode) {\n return {\n kind: 'with-frame-code' as const,\n frameCode: firstFrameCode,\n stack: stackOutput,\n frames: filteredFrames,\n }\n }\n // i don't think this a real case, but good for exhaustion\n return {\n kind: 'mapped-stack' as const,\n stack: stackOutput,\n frames: filteredFrames,\n }\n } catch (error) {\n return {\n kind: 'stack' as const,\n stack: stackTrace,\n }\n }\n}\n\n// todo: cache the actual async call, not the wrapper with post processing\nexport async function getSourceMappedStackFrames(\n stackTrace: string,\n ctx: MappingContext,\n distDir: string,\n ignore = true\n) {\n const cacheKey = `sm_${stackTrace}-${ctx.bundler}-${ctx.isAppDirectory}-${ctx.isEdgeServer}-${ctx.isServer}-${distDir}-${ignore}`\n\n const cacheItem = cache.get(cacheKey)\n if (cacheItem) {\n return cacheItem\n }\n\n const result = await getSourceMappedStackFramesInternal(\n stackTrace,\n ctx,\n distDir,\n ignore\n )\n cache.set(cacheKey, result)\n return result\n}\n\nfunction formatStackFrame(frame: StackFrame): string {\n const functionName = frame.methodName || '<anonymous>'\n const location =\n frame.file && frame.line1\n ? `${frame.file}:${frame.line1}${frame.column1 ? `:${frame.column1}` : ''}`\n : frame.file || '<unknown>'\n\n return ` at ${functionName} (${location})`\n}\n\n// appends the source mapped location of the console method\nexport const withLocation = async (\n {\n original,\n stack,\n }: {\n original: Array<any>\n stack: string | null\n },\n ctx: MappingContext,\n distDir: string,\n config: boolean | { logDepth?: number; showSourceLocation?: boolean }\n) => {\n if (typeof config === 'object' && config.showSourceLocation === false) {\n return original\n }\n if (!stack) {\n return original\n }\n\n const res = await getSourceMappedStackFrames(stack, ctx, distDir)\n const location = getConsoleLocation(res)\n\n if (!location) {\n return original\n }\n\n return [...original, dim(`(${location})`)]\n}\n\nexport const getConsoleLocation = (\n mapped: Awaited<ReturnType<typeof getSourceMappedStackFrames>>\n) => {\n if (mapped.kind !== 'mapped-stack' && mapped.kind !== 'with-frame-code') {\n return null\n }\n\n const first = mapped.frames.at(0)\n\n if (!first) {\n return null\n }\n\n // we don't want to show the name of parent function (at <fn> thing in stack), just source location for minimal noise\n const match = first.frameText.match(/\\(([^)]+)\\)/)\n const locationText = match ? match[1] : first.frameText\n return locationText\n}\n"],"names":["getConsoleLocation","getSourceMappedStackFrames","mapFramesUsingBundler","withLocation","frames","ctx","bundler","isServer","isEdgeServer","isAppDirectory","clientStats","serverStats","edgeServerStats","rootDirectory","res","getOriginalStackFramesWebpack","project","projectPath","getOriginalStackFramesTurbopack","preprocessStackTrace","stackTrace","distDir","split","map","line","match","prefix","location","startsWith","normalizedDistDir","replace","absolutePath","slice","length","fileUrl","path","resolve","join","cache","LRUCache","getSourceMappedStackFramesInternal","ignore","filteredFrames","normalizedStack","parseStack","kind","stack","mappingResults","processedFrames","result","index","originalFrame","originalStackFrame","status","frameText","formatStackFrame","codeFrame","originalCodeFrame","value","ignored","file","allIgnored","every","frame","filter","stackOutput","firstFrameCode","find","frameCode","error","cacheKey","cacheItem","get","set","functionName","methodName","line1","column1","original","config","showSourceLocation","dim","mapped","first","at","locationText"],"mappings":";;;;;;;;;;;;;;;;;IA0RaA,kBAAkB;eAAlBA;;IA/DSC,0BAA0B;eAA1BA;;IA5LAC,qBAAqB;eAArBA;;IA8NTC,YAAY;eAAZA;;;mCA7P2D;qCACE;4BAEtD;4BACwB;6DAC3B;0BACQ;;;;;;AAyBlB,eAAeD,sBACp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