Rocky_Mountain_Vending/.pnpm-store/v10/files/fb/07d30137ddb5d48db6302499dbad57cd14f2afea762afaed77a9e5129dcb7bc13ca81057d5566484d05bee61e7358aa199cbac7ef40fa0817baa95b602d769
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

1 line
No EOL
14 KiB
Text

{"version":3,"sources":["../../../src/server/lib/utils.ts"],"sourcesContent":["import { parseArgs } from 'node:util'\nimport { InvalidArgumentError } from 'next/dist/compiled/commander'\n\nexport function printAndExit(message: string, code = 1) {\n if (code === 0) {\n console.log(message)\n } else {\n console.error(message)\n }\n\n return process.exit(code)\n}\n\nconst parseNodeArgs = (args: string[]) => {\n const { values, tokens } = parseArgs({ args, strict: false, tokens: true })\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]\n\n if (token.kind === 'option-terminator') {\n break\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === 'option') {\n orphan = typeof token.value === 'undefined' ? token : null\n continue\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== 'positional') {\n orphan = null\n continue\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in values && typeof values[orphan.name] === 'string') {\n values[orphan.name] += ` ${token.value}`\n } else {\n values[orphan.name] = token.value\n }\n }\n\n return values\n}\n\n/**\n * Tokenizes the arguments string into an array of strings, supporting quoted\n * values and escaped characters.\n * Converted from: https://github.com/nodejs/node/blob/c29d53c5cfc63c5a876084e788d70c9e87bed880/src/node_options.cc#L1401\n *\n * @param input The arguments string to be tokenized.\n * @returns An array of strings with the tokenized arguments.\n */\nexport const tokenizeArgs = (input: string): string[] => {\n let args: string[] = []\n let isInString = false\n let willStartNewArg = true\n\n for (let i = 0; i < input.length; i++) {\n let char = input[i]\n\n // Skip any escaped characters in strings.\n if (char === '\\\\' && isInString) {\n // Ensure we don't have an escape character at the end.\n if (input.length === i + 1) {\n throw new Error('Invalid escape character at the end.')\n }\n\n // Skip the next character.\n char = input[++i]\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === ' ' && !isInString) {\n willStartNewArg = true\n continue\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString\n continue\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char)\n willStartNewArg = false\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char\n }\n }\n\n if (isInString) {\n throw new Error('Unterminated string')\n }\n\n return args\n}\n\n/**\n * Get the node options from the environment variable `NODE_OPTIONS` and returns\n * them as an array of strings.\n *\n * @returns An array of strings with the node options.\n */\nexport const getNodeOptionsArgs = () => {\n if (!process.env.NODE_OPTIONS) return []\n\n return tokenizeArgs(process.env.NODE_OPTIONS)\n}\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ntype DebugAddress = {\n host: string | undefined\n port: number\n}\n\n/**\n * Formats the debug address into a string.\n */\nexport const formatDebugAddress = ({ host, port }: DebugAddress): string => {\n if (host) return `${host}:${port}`\n return `${port}`\n}\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nexport const getParsedDebugAddress = (): DebugAddress => {\n const args = getNodeOptionsArgs()\n if (args.length === 0) return { host: undefined, port: 9229 }\n\n const parsed = parseNodeArgs(args)\n\n // We expect to find the debug port in one of these options. The first one\n // found will be used.\n const address =\n parsed.inspect ?? parsed['inspect-brk'] ?? parsed['inspect_brk']\n\n if (!address || typeof address !== 'string') {\n return { host: undefined, port: 9229 }\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(':')) {\n const [host, port] = address.split(':')\n return { host, port: parseInt(port, 10) }\n }\n\n return { host: undefined, port: parseInt(address, 10) }\n}\n\n/**\n * Checks if the debug address from `NODE_OPTIONS` specifies to use a random port (e.g., the port set to 0).\n *\n * @returns A boolean indicating whether or not the debug address is assigned to a random port.\n */\nexport const isDebugAddressEphemeral = () => getParsedDebugAddress()?.port === 0\n\n/**\n * Get the debug address from the `NODE_OPTIONS` environment variable and format\n * it into a string.\n *\n * @returns A string with the formatted debug address.\n */\nexport const getFormattedDebugAddress = () =>\n formatDebugAddress(getParsedDebugAddress())\n\n/**\n * Stringify the arguments to be used in a command line. It will ignore any\n * argument that has a value of `undefined`.\n *\n * @param args The arguments to be stringified.\n * @returns A string with the arguments.\n */\nexport function formatNodeOptions(\n args: Record<string, string | boolean | undefined>\n): string {\n return Object.entries(args)\n .map(([key, value]) => {\n if (value === true) {\n return `--${key}`\n }\n\n if (value) {\n return `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(' ') && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`\n }\n\n return null\n })\n .filter((arg) => arg !== null)\n .join(' ')\n}\n\n/**\n * Get the node options from the `NODE_OPTIONS` environment variable and parse\n * them into an object without the inspect options.\n *\n * @returns An object with the parsed node options.\n */\nexport function getParsedNodeOptionsWithoutInspect() {\n const args = getNodeOptionsArgs()\n if (args.length === 0) return {}\n\n const parsed = parseNodeArgs(args)\n\n // Remove inspect options.\n delete parsed.inspect\n delete parsed['inspect-brk']\n delete parsed['inspect_brk']\n\n return parsed\n}\n\n/**\n * Get the node options from the `NODE_OPTIONS` environment variable and format\n * them into a string without the inspect options.\n *\n * @returns A string with the formatted node options.\n */\nexport function getFormattedNodeOptionsWithoutInspect() {\n const args = getParsedNodeOptionsWithoutInspect()\n if (Object.keys(args).length === 0) return ''\n\n return formatNodeOptions(args)\n}\n\n/**\n * Check if the value is a valid positive integer and parse it. If it's not, it will throw an error.\n *\n * @param value The value to be parsed.\n */\nexport function parseValidPositiveInteger(value: string): number {\n const parsedValue = parseInt(value, 10)\n\n if (isNaN(parsedValue) || !isFinite(parsedValue) || parsedValue < 0) {\n throw new InvalidArgumentError(`'${value}' is not a non-negative number.`)\n }\n return parsedValue\n}\n\nexport const RESTART_EXIT_CODE = 77\n\nexport type NodeInspectType = 'inspect' | 'inspect-brk' | undefined\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nexport function getNodeDebugType(): NodeInspectType {\n const args = [...process.execArgv, ...getNodeOptionsArgs()]\n if (args.length === 0) return\n\n const parsed = parseNodeArgs(args)\n\n if (parsed.inspect) return 'inspect'\n if (parsed['inspect-brk'] || parsed['inspect_brk']) return 'inspect-brk'\n}\n\n/**\n * Get the `max-old-space-size` value from the `NODE_OPTIONS` environment\n * variable.\n *\n * @returns The value of the `max-old-space-size` option as a number.\n */\nexport function getMaxOldSpaceSize() {\n const args = getNodeOptionsArgs()\n if (args.length === 0) return\n\n const parsed = parseNodeArgs(args)\n\n const size = parsed['max-old-space-size'] || parsed['max_old_space_size']\n if (!size || typeof size !== 'string') return\n\n return parseInt(size, 10)\n}\n"],"names":["parseArgs","InvalidArgumentError","printAndExit","message","code","console","log","error","process","exit","parseNodeArgs","args","values","tokens","strict","orphan","i","length","token","kind","value","name","tokenizeArgs","input","isInString","willStartNewArg","char","Error","push","getNodeOptionsArgs","env","NODE_OPTIONS","formatDebugAddress","host","port","getParsedDebugAddress","undefined","parsed","address","inspect","includes","split","parseInt","isDebugAddressEphemeral","getFormattedDebugAddress","formatNodeOptions","Object","entries","map","key","startsWith","JSON","stringify","filter","arg","join","getParsedNodeOptionsWithoutInspect","getFormattedNodeOptionsWithoutInspect","keys","parseValidPositiveInteger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