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
11 KiB
Text
1 line
No EOL
11 KiB
Text
{"version":3,"sources":["../../../src/build/next-config-ts/transpile-config.ts"],"sourcesContent":["import type { Options as SWCOptions } from '@swc/core'\nimport type { CompilerOptions } from 'typescript'\n\nimport { resolve } from 'node:path'\nimport { readFile } from 'node:fs/promises'\nimport { pathToFileURL } from 'node:url'\nimport { deregisterHook, registerHook, requireFromString } from './require-hook'\nimport { warn, warnOnce } from '../output/log'\nimport { installDependencies } from '../../lib/install-dependencies'\nimport { getNodeOptionsArgs } from '../../server/lib/utils'\n\nfunction resolveSWCOptions(\n cwd: string,\n compilerOptions: CompilerOptions\n): SWCOptions {\n return {\n jsc: {\n parser: {\n syntax: 'typescript',\n },\n ...(compilerOptions.paths ? { paths: compilerOptions.paths } : {}),\n ...(compilerOptions.baseUrl\n ? // Needs to be an absolute path.\n { baseUrl: resolve(cwd, compilerOptions.baseUrl) }\n : compilerOptions.paths\n ? // If paths is given, baseUrl is required.\n { baseUrl: cwd }\n : {}),\n },\n module: {\n type: 'commonjs',\n },\n isModule: 'unknown',\n env: {\n targets: {\n // Setting the Node.js version can reduce unnecessary code generation.\n node: process?.versions?.node ?? '20.19.0',\n },\n },\n } satisfies SWCOptions\n}\n\n// Ported from next/src/lib/verify-typescript-setup.ts\n// Although this overlaps with the later `verifyTypeScriptSetup`,\n// it is acceptable since the time difference in the worst case is trivial,\n// as we are only preparing to install the dependencies once more.\nasync function verifyTypeScriptSetup(cwd: string, configFileName: string) {\n try {\n // Quick module check.\n require.resolve('typescript', { paths: [cwd] })\n } catch (error) {\n if (\n error &&\n typeof error === 'object' &&\n 'code' in error &&\n error.code === 'MODULE_NOT_FOUND'\n ) {\n warn(\n `Installing TypeScript as it was not found while loading \"${configFileName}\".`\n )\n\n await installDependencies(cwd, [{ pkg: 'typescript' }], true).catch(\n (err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install TypeScript, please install it manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n }\n )\n }\n }\n}\n\nasync function getTsConfig(cwd: string): Promise<CompilerOptions> {\n const ts: typeof import('typescript') = require(\n require.resolve('typescript', { paths: [cwd] })\n )\n\n // NOTE: This doesn't fully cover the edge case for setting\n // \"typescript.tsconfigPath\" in next config which is currently\n // a restriction.\n const tsConfigPath = ts.findConfigFile(\n cwd,\n ts.sys.fileExists,\n 'tsconfig.json'\n )\n\n if (!tsConfigPath) {\n // It is ok to not return ts.getDefaultCompilerOptions() because\n // we are only looking for paths and baseUrl from tsConfig.\n return {}\n }\n\n const configFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile)\n const parsedCommandLine = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n cwd\n )\n\n return parsedCommandLine.options\n}\n\nexport async function transpileConfig({\n nextConfigPath,\n configFileName,\n cwd,\n}: {\n nextConfigPath: string\n configFileName: string\n cwd: string\n}) {\n try {\n // envs are passed to the workers and preserve the flag\n if (process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED === 'true') {\n try {\n // Node.js v22.10.0+\n // Value is 'strip' or 'transform' based on how the feature is enabled.\n // https://nodejs.org/api/process.html#processfeaturestypescript\n // TODO: Remove `as any` once we bump @types/node to v22.10.0+\n if ((process.features as any).typescript) {\n // Run import() here to catch errors and fallback to legacy resolution.\n return (await import(pathToFileURL(nextConfigPath).href)).default\n }\n\n if (\n getNodeOptionsArgs().includes('--no-experimental-strip-types') ||\n process.execArgv.includes('--no-experimental-strip-types')\n ) {\n warnOnce(\n `Skipped resolving \"${configFileName}\" using Node.js native TypeScript resolution because it was disabled by the \"--no-experimental-strip-types\" flag.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts'\n )\n }\n\n // Feature is not enabled, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n } catch (cause) {\n warnOnce(\n `Failed to import \"${configFileName}\" using Node.js native TypeScript resolution.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts',\n { cause }\n )\n // Once failed, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n }\n }\n\n // Ensure TypeScript is installed to use the API.\n await verifyTypeScriptSetup(cwd, configFileName)\n const compilerOptions = await getTsConfig(cwd)\n\n return handleCJS({ cwd, nextConfigPath, compilerOptions })\n } catch (cause) {\n throw new Error(`Failed to transpile \"${configFileName}\".`, { cause })\n }\n}\n\nasync function handleCJS({\n cwd,\n nextConfigPath,\n compilerOptions,\n}: {\n cwd: string\n nextConfigPath: string\n compilerOptions: CompilerOptions\n}) {\n const swcOptions = resolveSWCOptions(cwd, compilerOptions)\n let hasRequire = false\n try {\n const nextConfigString = await readFile(nextConfigPath, 'utf8')\n // lazy require swc since it loads React before even setting NODE_ENV\n // resulting loading Development React on Production\n const { transform } = require('../swc') as typeof import('../swc')\n const { code } = await transform(nextConfigString, swcOptions)\n\n // register require hook only if require exists\n if (code.includes('require(')) {\n registerHook(swcOptions)\n hasRequire = true\n }\n\n // filename & extension don't matter here\n return requireFromString(code, resolve(cwd, 'next.config.compiled.js'))\n } catch (error) {\n throw error\n } finally {\n if (hasRequire) {\n deregisterHook()\n }\n }\n}\n"],"names":["resolve","readFile","pathToFileURL","deregisterHook","registerHook","requireFromString","warn","warnOnce","installDependencies","getNodeOptionsArgs","resolveSWCOptions","cwd","compilerOptions","process","jsc","parser","syntax","paths","baseUrl","module","type","isModule","env","targets","node","versions","verifyTypeScriptSetup","configFileName","require","error","code","pkg","catch","err","console","command","getTsConfig","ts","tsConfigPath","findConfigFile","sys","fileExists","configFile","readConfigFile","parsedCommandLine","parseJsonConfigFileContent","config","options","transpileConfig","nextConfigPath","__NEXT_NODE_NATIVE_TS_LOADER_ENABLED","features","typescript","href","default","includes","execArgv","cause","handleCJS","Error","swcOptions","hasRequire","nextConfigString","transform"],"mappings":"AAGA,SAASA,OAAO,QAAQ,YAAW;AACnC,SAASC,QAAQ,QAAQ,mBAAkB;AAC3C,SAASC,aAAa,QAAQ,WAAU;AACxC,SAASC,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,iBAAgB;AAChF,SAASC,IAAI,EAAEC,QAAQ,QAAQ,gBAAe;AAC9C,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,kBAAkB,QAAQ,yBAAwB;AAE3D,SAASC,kBACPC,GAAW,EACXC,eAAgC;QAuBpBC,mBAAAA;IArBZ,OAAO;QACLC,KAAK;YACHC,QAAQ;gBACNC,QAAQ;YACV;YACA,GAAIJ,gBAAgBK,KAAK,GAAG;gBAAEA,OAAOL,gBAAgBK,KAAK;YAAC,IAAI,CAAC,CAAC;YACjE,GAAIL,gBAAgBM,OAAO,GAEvB;gBAAEA,SAASlB,QAAQW,KAAKC,gBAAgBM,OAAO;YAAE,IACjDN,gBAAgBK,KAAK,GAEnB;gBAAEC,SAASP;YAAI,IACf,CAAC,CAAC;QACV;QACAQ,QAAQ;YACNC,MAAM;QACR;QACAC,UAAU;QACVC,KAAK;YACHC,SAAS;gBACP,sEAAsE;gBACtEC,MAAMX,EAAAA,WAAAA,6BAAAA,oBAAAA,SAASY,QAAQ,qBAAjBZ,kBAAmBW,IAAI,KAAI;YACnC;QACF;IACF;AACF;AAEA,sDAAsD;AACtD,iEAAiE;AACjE,2EAA2E;AAC3E,kEAAkE;AAClE,eAAeE,sBAAsBf,GAAW,EAAEgB,cAAsB;IACtE,IAAI;QACF,sBAAsB;QACtBC,QAAQ5B,OAAO,CAAC,cAAc;YAAEiB,OAAO;gBAACN;aAAI;QAAC;IAC/C,EAAE,OAAOkB,O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