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":["serverLayer","filterCompletionsAtPosition","entries","filter","e","DISALLOWED_SERVER_REACT_APIS","includes","name","source","hasDisallowedReactAPIDefinition","definitions","some","d","containerName","getSemanticDiagnosticsForImportDeclaration","node","ts","getTs","diagnostics","importPath","moduleSpecifier","getText","importClause","namedBindings","test","isNamedImports","elements","element","push","file","category","DiagnosticCategory","Error","code","NEXT_TS_ERRORS","INVALID_SERVER_API","messageText","start","getStart","length","getWidth","DISALLOWED_SERVER_REACT_DOM_APIS"],"mappings":";;;;+BA2FA;;;eAAA;;;0BAvFO;uBACe;AAGtB,MAAMA,cAAc;IAClB,6EAA6E;IAC7EC,6BAA4BC,OAAmC;QAC7D,OAAOA,QAAQC,MAAM,CAAC,CAACC;YACrB,gCAAgC;YAChC,IACEC,sCAA4B,CAACC,QAAQ,CAACF,EAAEG,IAAI,KAC5CH,EAAEI,MAAM,KAAK,SACb;gBACA,OAAO;YACT;YACA,OAAO;QACT;IACF;IAEA,6CAA6C;IAC7CC,iCACEC,WAA+C;QAE/C,OAAOA,+BAAAA,YAAaC,IAAI,CACtB,CAACC,IACCP,sCAA4B,CAACC,QAAQ,CAACM,EAAEL,IAAI,KAC5CK,EAAEC,aAAa,KAAK;IAE1B;IAEA,2DAA2D;IAC3DC,4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