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
5.4 KiB
Text
1 line
No EOL
5.4 KiB
Text
{"version":3,"sources":["../../../../src/server/typescript/rules/server.ts"],"sourcesContent":["import {\n DISALLOWED_SERVER_REACT_APIS,\n DISALLOWED_SERVER_REACT_DOM_APIS,\n NEXT_TS_ERRORS,\n} from '../constant'\nimport { getTs } from '../utils'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst serverLayer = {\n // On the server layer we need to filter out some invalid completion results.\n filterCompletionsAtPosition(entries: tsModule.CompletionEntry[]) {\n return entries.filter((e: tsModule.CompletionEntry) => {\n // Remove disallowed React APIs.\n if (\n DISALLOWED_SERVER_REACT_APIS.includes(e.name) &&\n e.source === 'react'\n ) {\n return false\n }\n return true\n })\n },\n\n // Filter out quick info for some React APIs.\n hasDisallowedReactAPIDefinition(\n definitions: readonly tsModule.DefinitionInfo[]\n ) {\n return definitions?.some(\n (d) =>\n DISALLOWED_SERVER_REACT_APIS.includes(d.name) &&\n d.containerName === 'React'\n )\n },\n\n // Give errors about disallowed imports such as `useState`.\n getSemanticDiagnosticsForImportDeclaration(\n source: tsModule.SourceFile,\n node: tsModule.ImportDeclaration\n ) {\n const ts = getTs()\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n const importPath = node.moduleSpecifier.getText(source!)\n const importClause = node.importClause\n const namedBindings = importClause?.namedBindings\n\n if (importClause) {\n if (/^['\"]react['\"]$/.test(importPath)) {\n // Check if it imports \"useState\"\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n const elements = namedBindings.elements\n for (const element of elements) {\n const name = element.name.getText(source!)\n if (DISALLOWED_SERVER_REACT_APIS.includes(name)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_API,\n messageText: `\"${name}\" is not allowed in Server Components.`,\n start: element.name.getStart(),\n length: element.name.getWidth(),\n })\n }\n }\n }\n } else if (/^['\"]react-dom['\"]$/.test(importPath)) {\n // Check if it imports \"useFormState\"\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n const elements = namedBindings.elements\n for (const element of elements) {\n const name = element.name.getText(source!)\n if (DISALLOWED_SERVER_REACT_DOM_APIS.includes(name)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_API,\n messageText: `\"${name}\" is not allowed in Server Components.`,\n start: element.name.getStart(),\n length: element.name.getWidth(),\n })\n }\n }\n }\n }\n }\n\n return diagnostics\n },\n}\n\nexport default serverLayer\n"],"names":["DISALLOWED_SERVER_REACT_APIS","DISALLOWED_SERVER_REACT_DOM_APIS","NEXT_TS_ERRORS","getTs","serverLayer","filterCompletionsAtPosition","entries","filter","e","includes","name","source","hasDisallowedReactAPIDefinition","definitions","some","d","containerName","getSemanticDiagnosticsForImportDeclaration","node","ts","diagnostics","importPath","moduleSpecifier","getText","importClause","namedBindings","test","isNamedImports","elements","element","push","file","category","DiagnosticCategory","Error","code","INVALID_SERVER_API","messageText","start","getStart","length","getWidth"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,gCAAgC,EAChCC,cAAc,QACT,cAAa;AACpB,SAASC,KAAK,QAAQ,WAAU;AAGhC,MAAMC,cAAc;IAClB,6EAA6E;IAC7EC,6BAA4BC,OAAmC;QAC7D,OAAOA,QAAQC,MAAM,CAAC,CAACC;YACrB,gCAAgC;YAChC,IACER,6BAA6BS,QAAQ,CAACD,EAAEE,IAAI,KAC5CF,EAAEG,MAAM,KAAK,SACb;gBACA,OAAO;YACT;YACA,OAAO;QACT;IACF;IAEA,6CAA6C;IAC7CC,iCACEC,WAA+C;QAE/C,OAAOA,+BAAAA,YAAaC,IAAI,CACtB,CAACC,IACCf,6BAA6BS,QAAQ,CAACM,EAAEL,IAAI,KAC5CK,EAAEC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