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
8.7 KiB
Text
1 line
No EOL
8.7 KiB
Text
{"version":3,"sources":["../../../../src/build/babel/plugins/next-page-config.ts"],"sourcesContent":["import { types as BabelTypes } from 'next/dist/compiled/babel/core'\nimport type {\n PluginObj,\n PluginPass,\n Visitor,\n NodePath,\n} from 'next/dist/compiled/babel/core'\n\nconst CONFIG_KEY = 'config'\n\nfunction errorMessage(state: any, details: string): string {\n const pageName =\n (state.filename || '').split(state.cwd || '').pop() || 'unknown'\n return `Invalid page config export found. ${details} in file ${pageName}. See: https://nextjs.org/docs/messages/invalid-page-config`\n}\n\ninterface ConfigState extends PluginPass {\n bundleDropped?: boolean\n}\n\n// config to parsing pageConfig for client bundles\nexport default function nextPageConfig({\n types: t,\n}: {\n types: typeof BabelTypes\n}): PluginObj {\n return {\n visitor: {\n Program: {\n enter(path, state) {\n path.traverse(\n {\n ExportDeclaration(exportPath, exportState) {\n if (\n BabelTypes.isExportNamedDeclaration(exportPath.node) &&\n exportPath.node.specifiers?.some((specifier) => {\n return (\n (t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : specifier.exported.value) === CONFIG_KEY\n )\n }) &&\n BabelTypes.isStringLiteral(\n (exportPath.node as BabelTypes.ExportNamedDeclaration)\n .source\n )\n ) {\n throw new Error(\n errorMessage(\n exportState,\n 'Expected object but got export from'\n )\n )\n }\n },\n ExportNamedDeclaration(\n exportPath: NodePath<BabelTypes.ExportNamedDeclaration>,\n exportState: any\n ) {\n if (\n exportState.bundleDropped ||\n (!exportPath.node.declaration &&\n exportPath.node.specifiers.length === 0)\n ) {\n return\n }\n\n const declarations: BabelTypes.VariableDeclarator[] = [\n ...((\n exportPath.node\n .declaration as BabelTypes.VariableDeclaration\n )?.declarations || []),\n exportPath.scope.getBinding(CONFIG_KEY)?.path\n .node as BabelTypes.VariableDeclarator,\n ].filter(Boolean)\n\n for (const specifier of exportPath.node.specifiers) {\n if (\n (t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : specifier.exported.value) === CONFIG_KEY\n ) {\n // export {} from 'somewhere'\n if (BabelTypes.isStringLiteral(exportPath.node.source)) {\n throw new Error(\n errorMessage(\n exportState,\n `Expected object but got import`\n )\n )\n // import hello from 'world'\n // export { hello as config }\n } else if (\n BabelTypes.isIdentifier(\n (specifier as BabelTypes.ExportSpecifier).local\n )\n ) {\n if (\n BabelTypes.isImportSpecifier(\n exportPath.scope.getBinding(\n (specifier as BabelTypes.ExportSpecifier).local.name\n )?.path.node\n )\n ) {\n throw new Error(\n errorMessage(\n exportState,\n `Expected object but got import`\n )\n )\n }\n }\n }\n }\n\n for (const declaration of declarations) {\n if (\n !BabelTypes.isIdentifier(declaration.id, {\n name: CONFIG_KEY,\n })\n ) {\n continue\n }\n\n let { init } = declaration\n if (BabelTypes.isTSAsExpression(init)) {\n init = init.expression\n }\n\n if (!BabelTypes.isObjectExpression(init)) {\n const got = init ? init.type : 'undefined'\n throw new Error(\n errorMessage(\n exportState,\n `Expected object but got ${got}`\n )\n )\n }\n\n for (const prop of init.properties) {\n if (BabelTypes.isSpreadElement(prop)) {\n throw new Error(\n errorMessage(\n exportState,\n `Property spread is not allowed`\n )\n )\n }\n }\n }\n },\n },\n state\n )\n },\n },\n } as Visitor<ConfigState>,\n }\n}\n"],"names":["types","BabelTypes","CONFIG_KEY","errorMessage","state","details","pageName","filename","split","cwd","pop","nextPageConfig","t","visitor","Program","enter","path","traverse","ExportDeclaration","exportPath","exportState","isExportNamedDeclaration","node","specifiers","some","specifier","isIdentifier","exported","name","value","isStringLiteral","source","Error","ExportNamedDeclaration","bundleDropped","declaration","length","declarations","scope","getBinding","filter","Boolean","local","isImportSpecifier","id","init","isTSAsExpression","expression","isObjectExpression","got","type","prop","properties","isSpreadElement"],"mappings":"AAAA,SAASA,SAASC,UAAU,QAAQ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