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
6.8 KiB
Text
1 line
No EOL
6.8 KiB
Text
{"version":3,"sources":["../../src/build/duration-to-string.ts"],"sourcesContent":["// Time thresholds in seconds\nconst SECONDS_IN_MINUTE = 60\nconst MINUTES_THRESHOLD_SECONDS = 120 // 2 minutes\nconst SECONDS_THRESHOLD_HIGH = 40\nconst SECONDS_THRESHOLD_LOW = 2\nconst MILLISECONDS_PER_SECOND = 1000\n\n// Time thresholds and conversion factors for nanoseconds\nconst NANOSECONDS_PER_SECOND = 1_000_000_000\nconst NANOSECONDS_PER_MILLISECOND = 1_000_000\nconst NANOSECONDS_PER_MICROSECOND = 1_000\nconst NANOSECONDS_IN_MINUTE = 60_000_000_000 // 60 * 1_000_000_000\nconst MINUTES_THRESHOLD_NANOSECONDS = 120_000_000_000 // 2 minutes in nanoseconds\nconst SECONDS_THRESHOLD_HIGH_NANOSECONDS = 40_000_000_000 // 40 seconds in nanoseconds\nconst SECONDS_THRESHOLD_LOW_NANOSECONDS = 2_000_000_000 // 2 seconds in nanoseconds\nconst MILLISECONDS_THRESHOLD_NANOSECONDS = 2_000_000 // 2 milliseconds in nanoseconds\n\n/**\n * Converts a duration in seconds to a human-readable string format.\n * Formats duration based on magnitude for optimal readability:\n * - >= 2 minutes: show in minutes with 1 decimal place (e.g., \"2.5min\")\n * - >= 40 seconds: show in whole seconds (e.g., \"45s\")\n * - >= 2 seconds: show in seconds with 1 decimal place (e.g., \"3.2s\")\n * - < 2 seconds: show in milliseconds with 1 decimal place (e.g., \"1500.0ms\")\n *\n * @deprecated Use durationToStringWithNanoseconds instead, collect time in nanoseconds using process.hrtime.bigint().\n * @param compilerDuration - Duration in seconds as a number\n * @returns Formatted duration string with appropriate unit and precision\n */\nexport function durationToString(compilerDuration: number) {\n if (compilerDuration > MINUTES_THRESHOLD_SECONDS) {\n return `${(compilerDuration / SECONDS_IN_MINUTE).toFixed(1)}min`\n } else if (compilerDuration > SECONDS_THRESHOLD_HIGH) {\n return `${compilerDuration.toFixed(0)}s`\n } else if (compilerDuration > SECONDS_THRESHOLD_LOW) {\n return `${compilerDuration.toFixed(1)}s`\n } else {\n return `${(compilerDuration * MILLISECONDS_PER_SECOND).toFixed(1)}ms`\n }\n}\n\n/**\n * Converts a nanosecond duration to a human-readable string format.\n * Formats duration based on magnitude for optimal readability:\n * - >= 2 minutes: show in minutes with 1 decimal place (e.g., \"2.5min\")\n * - >= 40 seconds: show in whole seconds (e.g., \"45s\")\n * - >= 2 seconds: show in seconds with 1 decimal place (e.g., \"3.2s\")\n * - >= 2 milliseconds: show in whole milliseconds (e.g., \"250ms\")\n * - < 2 milliseconds: show in whole microseconds (e.g., \"500µs\")\n *\n * @param durationBigInt - Duration in nanoseconds as a BigInt\n * @returns Formatted duration string with appropriate unit and precision\n */\nfunction durationToStringWithNanoseconds(durationBigInt: bigint): string {\n const duration = Number(durationBigInt)\n if (duration >= MINUTES_THRESHOLD_NANOSECONDS) {\n return `${(duration / NANOSECONDS_IN_MINUTE).toFixed(1)}min`\n } else if (duration >= SECONDS_THRESHOLD_HIGH_NANOSECONDS) {\n return `${(duration / NANOSECONDS_PER_SECOND).toFixed(0)}s`\n } else if (duration >= SECONDS_THRESHOLD_LOW_NANOSECONDS) {\n return `${(duration / NANOSECONDS_PER_SECOND).toFixed(1)}s`\n } else if (duration >= MILLISECONDS_THRESHOLD_NANOSECONDS) {\n return `${(duration / NANOSECONDS_PER_MILLISECOND).toFixed(0)}ms`\n } else {\n return `${(duration / NANOSECONDS_PER_MICROSECOND).toFixed(0)}µs`\n }\n}\n\n/**\n * Converts a high-resolution time tuple to seconds.\n *\n * @param hrtime - High-resolution time tuple of [seconds, nanoseconds]\n * @returns Duration in seconds as a floating-point number\n */\nexport function hrtimeToSeconds(hrtime: [number, number]): number {\n // hrtime is a tuple of [seconds, nanoseconds]\n return hrtime[0] + hrtime[1] / NANOSECONDS_PER_SECOND\n}\n\n/**\n * Converts a BigInt nanosecond duration to a human-readable string format.\n * This is the preferred method for formatting high-precision durations.\n *\n * @param hrtime - Duration in nanoseconds as a BigInt (typically from process.hrtime.bigint())\n * @returns Formatted duration string with appropriate unit and precision\n */\nexport function hrtimeBigIntDurationToString(hrtime: bigint) {\n return durationToStringWithNanoseconds(hrtime)\n}\n\n/**\n * Converts a high-resolution time tuple to a human-readable string format.\n *\n * @deprecated Use hrtimeBigIntDurationToString with process.hrtime.bigint() for better precision.\n * @param hrtime - High-resolution time tuple of [seconds, nanoseconds]\n * @returns Formatted duration string with appropriate unit and precision\n */\nexport function hrtimeDurationToString(hrtime: [number, number]): string {\n return durationToString(hrtimeToSeconds(hrtime))\n}\n"],"names":["SECONDS_IN_MINUTE","MINUTES_THRESHOLD_SECONDS","SECONDS_THRESHOLD_HIGH","SECONDS_THRESHOLD_LOW","MILLISECONDS_PER_SECOND","NANOSECONDS_PER_SECOND","NANOSECONDS_PER_MILLISECOND","NANOSECONDS_PER_MICROSECOND","NANOSECONDS_IN_MINUTE","MINUTES_THRESHOLD_NANOSECONDS","SECONDS_THRESHOLD_HIGH_NANOSECONDS","SECONDS_THRESHOLD_LOW_NANOSECONDS","MILLISECONDS_THRESHOLD_NANOSECONDS","durationToString","compilerDuration","toFixed","durationToStringWithNanoseconds","durationBigInt","duration","Number","hrtimeToSeconds","hrtime","hrtimeBigIntDurationToString","hrtimeDurationToString"],"mappings":"AAAA,6BAA6B;AAC7B,MAAMA,oBAAoB;AAC1B,MAAMC,4BAA4B,IAAI,YAAY;;AAClD,MAAMC,yBAAyB;AAC/B,MAAMC,wBAAwB;AAC9B,MAAMC,0BAA0B;AAEhC,yDAAyD;AACzD,MAAMC,yBAAyB;AAC/B,MAAMC,8BAA8B;AACpC,MAAMC,8BAA8B;AACpC,MAAMC,wBAAwB,YAAe,qBAAqB;;AAClE,MAAMC,gCAAgC,aAAgB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