@enjoys/context-engine 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/codeActions/angular.json +126 -0
- package/data/codeActions/nestjs.json +124 -0
- package/data/codeActions/nextjs.json +198 -0
- package/data/codeActions/react.json +154 -0
- package/data/codeActions/shadcn.json +112 -0
- package/data/codeActions/shell.json +169 -26
- package/data/codeLens/angular.json +22 -0
- package/data/codeLens/nestjs.json +21 -0
- package/data/codeLens/nextjs.json +117 -0
- package/data/codeLens/react.json +89 -0
- package/data/codeLens/shadcn.json +89 -0
- package/data/codeLens/shell.json +59 -17
- package/data/codeLens/tailwindcss.json +56 -0
- package/data/color/angular.json +21 -0
- package/data/color/nestjs.json +18 -0
- package/data/color/nextjs.json +22 -0
- package/data/color/react.json +93 -0
- package/data/color/shadcn.json +66 -0
- package/data/color/shell.json +106 -80
- package/data/commands/angular.json +312 -0
- package/data/commands/manifest.json +5 -0
- package/data/commands/nestjs.json +273 -0
- package/data/commands/nextjs.json +123 -0
- package/data/commands/react.json +210 -0
- package/data/commands/shadcn.json +410 -0
- package/data/commands/shell.json +571 -41
- package/data/completion/angular.json +1490 -0
- package/data/completion/css.json +793 -0
- package/data/completion/nestjs.json +1454 -0
- package/data/completion/nextjs.json +1373 -0
- package/data/completion/react.json +1319 -0
- package/data/completion/shadcn.json +1202 -0
- package/data/completion/shell.json +2446 -510
- package/data/declaration/angular.json +46 -0
- package/data/declaration/nestjs.json +47 -0
- package/data/declaration/nextjs.json +274 -0
- package/data/declaration/react.json +199 -0
- package/data/declaration/shadcn.json +211 -0
- package/data/declaration/shell.json +343 -24
- package/data/declaration/tailwindcss.json +72 -0
- package/data/definition/angular.json +670 -0
- package/data/definition/nestjs.json +684 -0
- package/data/definition/nextjs.json +439 -0
- package/data/definition/react.json +397 -0
- package/data/definition/shadcn.json +99 -0
- package/data/definition/shell.json +820 -0
- package/data/documentHighlight/angular.json +414 -0
- package/data/documentHighlight/css.json +77 -2
- package/data/documentHighlight/nestjs.json +115 -0
- package/data/documentHighlight/nextjs.json +212 -0
- package/data/documentHighlight/react.json +119 -0
- package/data/documentHighlight/shadcn.json +168 -0
- package/data/documentHighlight/shell.json +664 -334
- package/data/documentHighlight/tailwindcss.json +105 -10
- package/data/documentRangeFormatting/angular.json +45 -0
- package/data/documentRangeFormatting/nestjs.json +17 -0
- package/data/documentRangeFormatting/nextjs.json +17 -0
- package/data/documentRangeFormatting/react.json +78 -0
- package/data/documentRangeFormatting/shadcn.json +45 -0
- package/data/documentRangeFormatting/shell.json +120 -53
- package/data/documentSymbol/angular.json +180 -0
- package/data/documentSymbol/nestjs.json +152 -0
- package/data/documentSymbol/nextjs.json +159 -0
- package/data/documentSymbol/react.json +145 -0
- package/data/documentSymbol/shadcn.json +131 -0
- package/data/documentSymbol/shell.json +166 -26
- package/data/documentSymbol/tailwindcss.json +49 -0
- package/data/foldingRange/angular.json +99 -0
- package/data/foldingRange/nestjs.json +26 -0
- package/data/foldingRange/nextjs.json +26 -0
- package/data/foldingRange/react.json +120 -0
- package/data/foldingRange/shadcn.json +93 -0
- package/data/foldingRange/shell.json +106 -46
- package/data/formatting/angular.json +21 -0
- package/data/formatting/nestjs.json +23 -0
- package/data/formatting/nextjs.json +23 -0
- package/data/formatting/react.json +71 -0
- package/data/formatting/shadcn.json +61 -0
- package/data/formatting/shell.json +103 -19
- package/data/hover/angular.json +455 -0
- package/data/hover/css.json +232 -0
- package/data/hover/nestjs.json +296 -0
- package/data/hover/nextjs.json +305 -0
- package/data/hover/react.json +173 -0
- package/data/hover/shadcn.json +450 -0
- package/data/hover/shell.json +684 -75
- package/data/implementation/angular.json +22 -0
- package/data/implementation/nestjs.json +24 -0
- package/data/implementation/nextjs.json +137 -0
- package/data/implementation/react.json +125 -0
- package/data/implementation/shadcn.json +89 -0
- package/data/implementation/shell.json +59 -3
- package/data/inlayHints/angular.json +24 -0
- package/data/inlayHints/nestjs.json +24 -0
- package/data/inlayHints/nextjs.json +143 -0
- package/data/inlayHints/react.json +177 -0
- package/data/inlayHints/shadcn.json +109 -0
- package/data/inlayHints/shell.json +223 -35
- package/data/inlineCompletions/angular.json +135 -0
- package/data/inlineCompletions/nestjs.json +25 -0
- package/data/inlineCompletions/nextjs.json +179 -0
- package/data/inlineCompletions/react.json +203 -0
- package/data/inlineCompletions/shadcn.json +115 -0
- package/data/inlineCompletions/shell.json +185 -35
- package/data/linkedEditingRange/angular.json +23 -0
- package/data/linkedEditingRange/nestjs.json +10 -0
- package/data/linkedEditingRange/nextjs.json +11 -0
- package/data/linkedEditingRange/react.json +75 -0
- package/data/linkedEditingRange/shadcn.json +23 -0
- package/data/linkedEditingRange/shell.json +25 -25
- package/data/links/angular.json +95 -0
- package/data/links/nestjs.json +130 -0
- package/data/links/nextjs.json +91 -0
- package/data/links/react.json +75 -0
- package/data/links/shadcn.json +98 -0
- package/data/links/shell.json +56 -0
- package/data/links/tailwindcss.json +25 -0
- package/data/manifest.json +339 -152
- package/data/onTypeFormatting/angular.json +14 -0
- package/data/onTypeFormatting/nestjs.json +16 -0
- package/data/onTypeFormatting/nextjs.json +17 -0
- package/data/onTypeFormatting/react.json +127 -0
- package/data/onTypeFormatting/shadcn.json +54 -0
- package/data/onTypeFormatting/shell.json +72 -68
- package/data/rangeSemanticTokens/angular.json +140 -0
- package/data/rangeSemanticTokens/nestjs.json +27 -0
- package/data/rangeSemanticTokens/nextjs.json +28 -0
- package/data/rangeSemanticTokens/react.json +216 -0
- package/data/rangeSemanticTokens/shadcn.json +140 -0
- package/data/rangeSemanticTokens/shell.json +247 -69
- package/data/rangeSemanticTokens/tailwindcss.json +99 -8
- package/data/references/angular.json +26 -0
- package/data/references/nestjs.json +24 -0
- package/data/references/nextjs.json +178 -0
- package/data/references/react.json +192 -0
- package/data/references/shadcn.json +101 -0
- package/data/references/shell.json +323 -92
- package/data/references/tailwindcss.json +66 -0
- package/data/rename/angular.json +131 -0
- package/data/rename/nestjs.json +32 -0
- package/data/rename/nextjs.json +31 -0
- package/data/rename/react.json +88 -0
- package/data/rename/shadcn.json +79 -0
- package/data/rename/shell.json +101 -31
- package/data/selectionRange/angular.json +95 -0
- package/data/selectionRange/nestjs.json +21 -0
- package/data/selectionRange/nextjs.json +22 -0
- package/data/selectionRange/react.json +87 -0
- package/data/selectionRange/shadcn.json +89 -0
- package/data/selectionRange/shell.json +65 -35
- package/data/semanticTokens/angular.json +198 -0
- package/data/semanticTokens/nestjs.json +35 -0
- package/data/semanticTokens/nextjs.json +38 -0
- package/data/semanticTokens/react.json +215 -0
- package/data/semanticTokens/shadcn.json +180 -0
- package/data/semanticTokens/shell.json +238 -65
- package/data/signatureHelp/angular.json +182 -0
- package/data/signatureHelp/nestjs.json +128 -0
- package/data/signatureHelp/nextjs.json +127 -0
- package/data/signatureHelp/react.json +281 -0
- package/data/signatureHelp/shadcn.json +237 -0
- package/data/signatureHelp/shell.json +797 -104
- package/data/typeDefinition/angular.json +362 -0
- package/data/typeDefinition/nestjs.json +334 -0
- package/data/typeDefinition/nextjs.json +285 -0
- package/data/typeDefinition/react.json +236 -0
- package/data/typeDefinition/shadcn.json +292 -0
- package/data/typeDefinition/shell.json +104 -40
- package/package.json +1 -1
- package/data/codeActions/bash.json +0 -169
- package/data/codeActions/zsh.json +0 -49
- package/data/codeLens/bash.json +0 -75
- package/data/codeLens/zsh.json +0 -19
- package/data/color/bash.json +0 -100
- package/data/color/zsh.json +0 -80
- package/data/commands/bash.json +0 -102
- package/data/commands/zsh.json +0 -166
- package/data/completion/bash.json +0 -1184
- package/data/completion/zsh.json +0 -973
- package/data/declaration/bash.json +0 -301
- package/data/declaration/zsh.json +0 -205
- package/data/definition/bash.json +0 -565
- package/data/definition/zsh.json +0 -350
- package/data/documentHighlight/bash.json +0 -393
- package/data/documentHighlight/zsh.json +0 -266
- package/data/documentRangeFormatting/bash.json +0 -41
- package/data/documentRangeFormatting/zsh.json +0 -59
- package/data/documentSymbol/bash.json +0 -124
- package/data/documentSymbol/zsh.json +0 -26
- package/data/foldingRange/bash.json +0 -76
- package/data/foldingRange/zsh.json +0 -46
- package/data/formatting/bash.json +0 -88
- package/data/formatting/zsh.json +0 -28
- package/data/hover/bash.json +0 -579
- package/data/hover/zsh.json +0 -96
- package/data/implementation/bash.json +0 -44
- package/data/implementation/zsh.json +0 -41
- package/data/inlayHints/bash.json +0 -207
- package/data/inlayHints/zsh.json +0 -43
- package/data/inlineCompletions/bash.json +0 -155
- package/data/inlineCompletions/zsh.json +0 -17
- package/data/linkedEditingRange/bash.json +0 -25
- package/data/linkedEditingRange/zsh.json +0 -25
- package/data/links/bash.json +0 -56
- package/data/links/zsh.json +0 -15
- package/data/onTypeFormatting/bash.json +0 -68
- package/data/onTypeFormatting/zsh.json +0 -68
- package/data/rangeSemanticTokens/bash.json +0 -90
- package/data/rangeSemanticTokens/zsh.json +0 -76
- package/data/references/bash.json +0 -221
- package/data/references/zsh.json +0 -166
- package/data/rename/bash.json +0 -37
- package/data/rename/zsh.json +0 -31
- package/data/selectionRange/bash.json +0 -35
- package/data/selectionRange/zsh.json +0 -35
- package/data/semanticTokens/bash.json +0 -71
- package/data/semanticTokens/zsh.json +0 -71
- package/data/signatureHelp/bash.json +0 -111
- package/data/signatureHelp/zsh.json +0 -118
- package/data/typeDefinition/bash.json +0 -95
- package/data/typeDefinition/zsh.json +0 -40
|
@@ -0,0 +1,1373 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "nextjs",
|
|
3
|
+
"completions": [
|
|
4
|
+
{
|
|
5
|
+
"label": "page-app-router",
|
|
6
|
+
"kind": 28,
|
|
7
|
+
"detail": "Next.js App Router Page Component",
|
|
8
|
+
"documentation": { "value": "Creates a new App Router page component with typed props including params and searchParams." },
|
|
9
|
+
"insertText": "export default function ${1:Page}({ params, searchParams }: {\n params: { ${2:slug}: string };\n searchParams: { [key: string]: string | string[] | undefined };\n}) {\n return (\n <div>\n <h1>${3:Page Title}</h1>\n $0\n </div>\n );\n}",
|
|
10
|
+
"insertTextRules": 4,
|
|
11
|
+
"sortText": "00_page_app_router"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"label": "layout-component",
|
|
15
|
+
"kind": 28,
|
|
16
|
+
"detail": "Next.js Layout Component",
|
|
17
|
+
"documentation": { "value": "Creates a root or nested layout component for the App Router with children prop." },
|
|
18
|
+
"insertText": "export default function ${1:RootLayout}({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <html lang=\"en\">\n <body>${2:{children\\}}</body>\n </html>\n );\n}",
|
|
19
|
+
"insertTextRules": 4,
|
|
20
|
+
"sortText": "00_layout"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "loading-component",
|
|
24
|
+
"kind": 28,
|
|
25
|
+
"detail": "Next.js Loading Component",
|
|
26
|
+
"documentation": { "value": "Creates a loading.tsx component that shows a loading UI while a route segment loads using React Suspense." },
|
|
27
|
+
"insertText": "export default function Loading() {\n return (\n <div className=\"${1:loading}\">\n <${2:p}>Loading...</${2:p}>\n $0\n </div>\n );\n}",
|
|
28
|
+
"insertTextRules": 4,
|
|
29
|
+
"sortText": "00_loading"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"label": "error-component",
|
|
33
|
+
"kind": 28,
|
|
34
|
+
"detail": "Next.js Error Component",
|
|
35
|
+
"documentation": { "value": "Creates an error.tsx component with error boundary handling and reset functionality. Must be a Client Component." },
|
|
36
|
+
"insertText": "'use client';\n\nexport default function Error({\n error,\n reset,\n}: {\n error: Error & { digest?: string };\n reset: () => void;\n}) {\n return (\n <div>\n <h2>Something went wrong!</h2>\n <p>{error.message}</p>\n <button onClick={() => reset()}>Try again</button>\n $0\n </div>\n );\n}",
|
|
37
|
+
"insertTextRules": 4,
|
|
38
|
+
"sortText": "00_error"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"label": "not-found-component",
|
|
42
|
+
"kind": 28,
|
|
43
|
+
"detail": "Next.js Not Found Component",
|
|
44
|
+
"documentation": { "value": "Creates a not-found.tsx component displayed when notFound() is called within a route segment." },
|
|
45
|
+
"insertText": "import Link from 'next/link';\n\nexport default function NotFound() {\n return (\n <div>\n <h2>${1:Not Found}</h2>\n <p>${2:Could not find requested resource}</p>\n <Link href=\"/\">Return Home</Link>\n $0\n </div>\n );\n}",
|
|
46
|
+
"insertTextRules": 4,
|
|
47
|
+
"sortText": "00_not_found"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"label": "route-handler-get",
|
|
51
|
+
"kind": 28,
|
|
52
|
+
"detail": "Next.js Route Handler (GET)",
|
|
53
|
+
"documentation": { "value": "Creates a GET route handler for the App Router using the Web Request/Response API." },
|
|
54
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function GET(request: NextRequest) {\n ${1:const data = { message: 'Hello' \\};}\n return NextResponse.json(${2:data});\n}",
|
|
55
|
+
"insertTextRules": 4,
|
|
56
|
+
"sortText": "00_route_get"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"label": "route-handler-post",
|
|
60
|
+
"kind": 28,
|
|
61
|
+
"detail": "Next.js Route Handler (POST)",
|
|
62
|
+
"documentation": { "value": "Creates a POST route handler for the App Router with request body parsing." },
|
|
63
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function POST(request: NextRequest) {\n const body = await request.json();\n ${1:// Process the request body}\n return NextResponse.json({ ${2:success: true} }, { status: 201 });\n}",
|
|
64
|
+
"insertTextRules": 4,
|
|
65
|
+
"sortText": "00_route_post"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"label": "route-handler-put",
|
|
69
|
+
"kind": 28,
|
|
70
|
+
"detail": "Next.js Route Handler (PUT)",
|
|
71
|
+
"documentation": { "value": "Creates a PUT route handler for updating resources." },
|
|
72
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function PUT(request: NextRequest) {\n const body = await request.json();\n ${1:// Update logic}\n return NextResponse.json({ ${2:updated: true} });\n}",
|
|
73
|
+
"insertTextRules": 4,
|
|
74
|
+
"sortText": "00_route_put"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"label": "route-handler-delete",
|
|
78
|
+
"kind": 28,
|
|
79
|
+
"detail": "Next.js Route Handler (DELETE)",
|
|
80
|
+
"documentation": { "value": "Creates a DELETE route handler for removing resources." },
|
|
81
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function DELETE(request: NextRequest) {\n ${1:// Delete logic}\n return NextResponse.json({ ${2:deleted: true} });\n}",
|
|
82
|
+
"insertTextRules": 4,
|
|
83
|
+
"sortText": "00_route_delete"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "route-handler-patch",
|
|
87
|
+
"kind": 28,
|
|
88
|
+
"detail": "Next.js Route Handler (PATCH)",
|
|
89
|
+
"documentation": { "value": "Creates a PATCH route handler for partial updates." },
|
|
90
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function PATCH(request: NextRequest) {\n const body = await request.json();\n ${1:// Partial update logic}\n return NextResponse.json({ ${2:patched: true} });\n}",
|
|
91
|
+
"insertTextRules": 4,
|
|
92
|
+
"sortText": "00_route_patch"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"label": "middleware",
|
|
96
|
+
"kind": 28,
|
|
97
|
+
"detail": "Next.js Middleware",
|
|
98
|
+
"documentation": { "value": "Creates a middleware.ts file for request interception with matcher configuration." },
|
|
99
|
+
"insertText": "import { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nexport function middleware(request: NextRequest) {\n ${1:// Middleware logic}\n return NextResponse.next();\n}\n\nexport const config = {\n matcher: ['${2:/((?!api|_next/static|_next/image|favicon.ico).*)}']\n};",
|
|
100
|
+
"insertTextRules": 4,
|
|
101
|
+
"sortText": "00_middleware"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"label": "generateMetadata",
|
|
105
|
+
"kind": 28,
|
|
106
|
+
"detail": "Next.js generateMetadata Function",
|
|
107
|
+
"documentation": { "value": "Creates an async generateMetadata function for dynamic metadata generation in App Router pages." },
|
|
108
|
+
"insertText": "import type { Metadata } from 'next';\n\nexport async function generateMetadata({\n params,\n searchParams,\n}: {\n params: { ${1:slug}: string };\n searchParams: { [key: string]: string | string[] | undefined };\n}): Promise<Metadata> {\n return {\n title: '${2:Page Title}',\n description: '${3:Page description}',\n $0\n };\n}",
|
|
109
|
+
"insertTextRules": 4,
|
|
110
|
+
"sortText": "00_generateMetadata"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"label": "generateStaticParams",
|
|
114
|
+
"kind": 28,
|
|
115
|
+
"detail": "Next.js generateStaticParams Function",
|
|
116
|
+
"documentation": { "value": "Creates a generateStaticParams function for static generation of dynamic route segments at build time." },
|
|
117
|
+
"insertText": "export async function generateStaticParams() {\n ${1:const items = await fetch('https://api.example.com/items').then(res => res.json());}\n return ${2:items}.map((${3:item}: ${4:any}) => ({\n ${5:slug}: ${3:item}.${6:slug},\n }));\n}",
|
|
118
|
+
"insertTextRules": 4,
|
|
119
|
+
"sortText": "00_generateStaticParams"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"label": "server-action",
|
|
123
|
+
"kind": 28,
|
|
124
|
+
"detail": "Next.js Server Action",
|
|
125
|
+
"documentation": { "value": "Creates a server action function with 'use server' directive for form handling and data mutations." },
|
|
126
|
+
"insertText": "'use server';\n\nexport async function ${1:submitAction}(formData: FormData) {\n const ${2:name} = formData.get('${3:name}') as string;\n ${4:// Server-side logic}\n $0\n}",
|
|
127
|
+
"insertTextRules": 4,
|
|
128
|
+
"sortText": "00_server_action"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"label": "server-action-inline",
|
|
132
|
+
"kind": 28,
|
|
133
|
+
"detail": "Next.js Inline Server Action",
|
|
134
|
+
"documentation": { "value": "Creates an inline server action inside a Server Component." },
|
|
135
|
+
"insertText": "async function ${1:handleSubmit}(formData: FormData) {\n 'use server';\n const ${2:data} = formData.get('${3:field}') as string;\n ${4:// Mutation logic}\n}",
|
|
136
|
+
"insertTextRules": 4,
|
|
137
|
+
"sortText": "00_server_action_inline"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"label": "use-client",
|
|
141
|
+
"kind": 28,
|
|
142
|
+
"detail": "Next.js Client Component",
|
|
143
|
+
"documentation": { "value": "Creates a Client Component with 'use client' directive for interactive UI with hooks and event handlers." },
|
|
144
|
+
"insertText": "'use client';\n\nimport { useState } from 'react';\n\nexport default function ${1:Component}() {\n const [${2:state}, set${2/(.*)/${1:/capitalize}/}] = useState(${3:null});\n\n return (\n <div>\n $0\n </div>\n );\n}",
|
|
145
|
+
"insertTextRules": 4,
|
|
146
|
+
"sortText": "00_use_client"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"label": "server-component",
|
|
150
|
+
"kind": 28,
|
|
151
|
+
"detail": "Next.js Server Component",
|
|
152
|
+
"documentation": { "value": "Creates an async Server Component with data fetching capabilities." },
|
|
153
|
+
"insertText": "export default async function ${1:Component}() {\n const ${2:data} = await fetch('${3:https://api.example.com/data}', {\n ${4:cache: 'force-cache'}\n }).then(res => res.json());\n\n return (\n <div>\n $0\n </div>\n );\n}",
|
|
154
|
+
"insertTextRules": 4,
|
|
155
|
+
"sortText": "00_server_component"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"label": "api-route-pages",
|
|
159
|
+
"kind": 28,
|
|
160
|
+
"detail": "Next.js API Route (Pages Router)",
|
|
161
|
+
"documentation": { "value": "Creates a Pages Router API route handler with typed request and response." },
|
|
162
|
+
"insertText": "import type { NextApiRequest, NextApiResponse } from 'next';\n\ntype ${1:Data} = {\n ${2:message}: string;\n};\n\nexport default function handler(\n req: NextApiRequest,\n res: NextApiResponse<${1:Data}>\n) {\n if (req.method === '${3:GET}') {\n res.status(200).json({ ${2:message}: '${4:Hello}' });\n } else {\n res.setHeader('Allow', ['${3:GET}']);\n res.status(405).end(`Method \\${req.method} Not Allowed`);\n }\n}",
|
|
163
|
+
"insertTextRules": 4,
|
|
164
|
+
"sortText": "00_api_route_pages"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"label": "getServerSideProps-snippet",
|
|
168
|
+
"kind": 28,
|
|
169
|
+
"detail": "Next.js getServerSideProps",
|
|
170
|
+
"documentation": { "value": "Creates a getServerSideProps function for server-side rendering on each request in Pages Router." },
|
|
171
|
+
"insertText": "import type { GetServerSideProps } from 'next';\n\nexport const getServerSideProps: GetServerSideProps = async (context) => {\n const { params, req, res, query } = context;\n ${1:const data = await fetch('https://api.example.com/data').then(r => r.json());}\n return {\n props: {\n ${2:data},\n },\n };\n};",
|
|
172
|
+
"insertTextRules": 4,
|
|
173
|
+
"sortText": "00_getServerSideProps"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"label": "getStaticProps-snippet",
|
|
177
|
+
"kind": 28,
|
|
178
|
+
"detail": "Next.js getStaticProps",
|
|
179
|
+
"documentation": { "value": "Creates a getStaticProps function for static generation with optional ISR revalidation in Pages Router." },
|
|
180
|
+
"insertText": "import type { GetStaticProps } from 'next';\n\nexport const getStaticProps: GetStaticProps = async (context) => {\n ${1:const data = await fetch('https://api.example.com/data').then(r => r.json());}\n return {\n props: {\n ${2:data},\n },\n ${3:revalidate: 60},\n };\n};",
|
|
181
|
+
"insertTextRules": 4,
|
|
182
|
+
"sortText": "00_getStaticProps"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"label": "getStaticPaths-snippet",
|
|
186
|
+
"kind": 28,
|
|
187
|
+
"detail": "Next.js getStaticPaths",
|
|
188
|
+
"documentation": { "value": "Creates a getStaticPaths function for defining dynamic paths at build time in Pages Router." },
|
|
189
|
+
"insertText": "import type { GetStaticPaths } from 'next';\n\nexport const getStaticPaths: GetStaticPaths = async () => {\n ${1:const items = await fetch('https://api.example.com/items').then(r => r.json());}\n const paths = ${1:items}.map((${2:item}: ${3:any}) => ({\n params: { ${4:id}: ${2:item}.${5:id}.toString() },\n }));\n return {\n paths,\n fallback: ${6|false,'blocking'|},\n };\n};",
|
|
190
|
+
"insertTextRules": 4,
|
|
191
|
+
"sortText": "00_getStaticPaths"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"label": "app-component",
|
|
195
|
+
"kind": 28,
|
|
196
|
+
"detail": "Next.js _app.tsx (Pages Router)",
|
|
197
|
+
"documentation": { "value": "Creates a custom _app.tsx component for Pages Router to initialize pages." },
|
|
198
|
+
"insertText": "import type { AppProps } from 'next/app';\n\nexport default function App({ Component, pageProps }: AppProps) {\n return <Component {...pageProps} />;\n}",
|
|
199
|
+
"insertTextRules": 4,
|
|
200
|
+
"sortText": "00_app_component"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"label": "document-component",
|
|
204
|
+
"kind": 28,
|
|
205
|
+
"detail": "Next.js _document.tsx (Pages Router)",
|
|
206
|
+
"documentation": { "value": "Creates a custom _document.tsx component for Pages Router to augment the HTML document structure." },
|
|
207
|
+
"insertText": "import { Html, Head, Main, NextScript } from 'next/document';\n\nexport default function Document() {\n return (\n <Html lang=\"${1:en}\">\n <Head />\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n}",
|
|
208
|
+
"insertTextRules": 4,
|
|
209
|
+
"sortText": "00_document_component"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"label": "dynamic-route-page",
|
|
213
|
+
"kind": 28,
|
|
214
|
+
"detail": "Next.js Dynamic Route Page",
|
|
215
|
+
"documentation": { "value": "Creates a page component for a dynamic route segment [param]." },
|
|
216
|
+
"insertText": "export default function ${1:Page}({\n params,\n}: {\n params: { ${2:id}: string };\n}) {\n return (\n <div>\n <h1>${3:Item} {params.${2:id}}</h1>\n $0\n </div>\n );\n}",
|
|
217
|
+
"insertTextRules": 4,
|
|
218
|
+
"sortText": "00_dynamic_route"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"label": "parallel-route",
|
|
222
|
+
"kind": 28,
|
|
223
|
+
"detail": "Next.js Parallel Route Layout",
|
|
224
|
+
"documentation": { "value": "Creates a layout for parallel routes with named slots using @folder convention." },
|
|
225
|
+
"insertText": "export default function ${1:Layout}({\n children,\n ${2:modal},\n}: {\n children: React.ReactNode;\n ${2:modal}: React.ReactNode;\n}) {\n return (\n <>\n {children}\n {${2:modal}}\n </>\n );\n}",
|
|
226
|
+
"insertTextRules": 4,
|
|
227
|
+
"sortText": "00_parallel_route"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"label": "intercepting-route",
|
|
231
|
+
"kind": 28,
|
|
232
|
+
"detail": "Next.js Intercepting Route Page",
|
|
233
|
+
"documentation": { "value": "Creates a page for intercepting routes using (.) (..) (...) conventions." },
|
|
234
|
+
"insertText": "export default function ${1:InterceptedPage}({\n params,\n}: {\n params: { ${2:id}: string };\n}) {\n return (\n <div className=\"${3:modal}\">\n <h2>${4:Intercepted Content}</h2>\n $0\n </div>\n );\n}",
|
|
235
|
+
"insertTextRules": 4,
|
|
236
|
+
"sortText": "00_intercepting_route"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"label": "route-group-layout",
|
|
240
|
+
"kind": 28,
|
|
241
|
+
"detail": "Next.js Route Group Layout",
|
|
242
|
+
"documentation": { "value": "Creates a layout for a route group using (groupName) convention without affecting URL structure." },
|
|
243
|
+
"insertText": "export default function ${1:GroupLayout}({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <div className=\"${2:group-layout}\">\n ${3:{children\\}}\n $0\n </div>\n );\n}",
|
|
244
|
+
"insertTextRules": 4,
|
|
245
|
+
"sortText": "00_route_group"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"label": "template-component",
|
|
249
|
+
"kind": 28,
|
|
250
|
+
"detail": "Next.js Template Component",
|
|
251
|
+
"documentation": { "value": "Creates a template.tsx component that re-mounts on navigation unlike layouts." },
|
|
252
|
+
"insertText": "export default function ${1:Template}({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return <div>${2:{children\\}}</div>;\n}",
|
|
253
|
+
"insertTextRules": 4,
|
|
254
|
+
"sortText": "00_template"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"label": "default-export-page",
|
|
258
|
+
"kind": 28,
|
|
259
|
+
"detail": "Next.js Default Page Export",
|
|
260
|
+
"documentation": { "value": "Creates a minimal page with default export." },
|
|
261
|
+
"insertText": "export default function ${1:Page}() {\n return (\n <div>\n $0\n </div>\n );\n}",
|
|
262
|
+
"insertTextRules": 4,
|
|
263
|
+
"sortText": "00_default_page"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"label": "global-error",
|
|
267
|
+
"kind": 28,
|
|
268
|
+
"detail": "Next.js Global Error Component",
|
|
269
|
+
"documentation": { "value": "Creates a global-error.tsx component for the root layout error boundary." },
|
|
270
|
+
"insertText": "'use client';\n\nexport default function GlobalError({\n error,\n reset,\n}: {\n error: Error & { digest?: string };\n reset: () => void;\n}) {\n return (\n <html>\n <body>\n <h2>Something went wrong!</h2>\n <button onClick={() => reset()}>Try again</button>\n </body>\n </html>\n );\n}",
|
|
271
|
+
"insertTextRules": 4,
|
|
272
|
+
"sortText": "00_global_error"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"label": "metadata-static",
|
|
276
|
+
"kind": 28,
|
|
277
|
+
"detail": "Next.js Static Metadata Export",
|
|
278
|
+
"documentation": { "value": "Creates a static metadata export object for App Router pages and layouts." },
|
|
279
|
+
"insertText": "import type { Metadata } from 'next';\n\nexport const metadata: Metadata = {\n title: '${1:Page Title}',\n description: '${2:Page description}',\n keywords: [${3:'nextjs'}],\n openGraph: {\n title: '${1:Page Title}',\n description: '${2:Page description}',\n type: 'website',\n },\n $0\n};",
|
|
280
|
+
"insertTextRules": 4,
|
|
281
|
+
"sortText": "00_metadata_static"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"label": "sitemap",
|
|
285
|
+
"kind": 28,
|
|
286
|
+
"detail": "Next.js Sitemap",
|
|
287
|
+
"documentation": { "value": "Creates a sitemap.ts file for generating XML sitemaps." },
|
|
288
|
+
"insertText": "import type { MetadataRoute } from 'next';\n\nexport default function sitemap(): MetadataRoute.Sitemap {\n return [\n {\n url: '${1:https://example.com}',\n lastModified: new Date(),\n changeFrequency: '${2:yearly}',\n priority: 1,\n },\n $0\n ];\n}",
|
|
289
|
+
"insertTextRules": 4,
|
|
290
|
+
"sortText": "00_sitemap"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"label": "robots",
|
|
294
|
+
"kind": 28,
|
|
295
|
+
"detail": "Next.js Robots.txt",
|
|
296
|
+
"documentation": { "value": "Creates a robots.ts file for generating robots.txt." },
|
|
297
|
+
"insertText": "import type { MetadataRoute } from 'next';\n\nexport default function robots(): MetadataRoute.Robots {\n return {\n rules: {\n userAgent: '*',\n allow: '/',\n disallow: '${1:/private/}',\n },\n sitemap: '${2:https://example.com/sitemap.xml}',\n };\n}",
|
|
298
|
+
"insertTextRules": 4,
|
|
299
|
+
"sortText": "00_robots"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"label": "opengraph-image",
|
|
303
|
+
"kind": 28,
|
|
304
|
+
"detail": "Next.js OG Image Route",
|
|
305
|
+
"documentation": { "value": "Creates an opengraph-image.tsx route for dynamic OG image generation." },
|
|
306
|
+
"insertText": "import { ImageResponse } from 'next/og';\n\nexport const runtime = 'edge';\nexport const alt = '${1:OG Image}';\nexport const size = { width: 1200, height: 630 };\nexport const contentType = 'image/png';\n\nexport default async function Image() {\n return new ImageResponse(\n (\n <div\n style={{\n fontSize: 128,\n background: '${2:white}',\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n ${3:Hello}\n </div>\n ),\n { ...size }\n );\n}",
|
|
307
|
+
"insertTextRules": 4,
|
|
308
|
+
"sortText": "00_og_image"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"label": "useRouter",
|
|
312
|
+
"kind": 1,
|
|
313
|
+
"detail": "next/navigation - useRouter hook",
|
|
314
|
+
"documentation": { "value": "The useRouter hook from next/navigation allows programmatic navigation in Client Components. Returns router object with push, replace, refresh, prefetch, back, forward methods." },
|
|
315
|
+
"insertText": "const router = useRouter();",
|
|
316
|
+
"insertTextRules": 0,
|
|
317
|
+
"sortText": "02_useRouter"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"label": "usePathname",
|
|
321
|
+
"kind": 1,
|
|
322
|
+
"detail": "next/navigation - usePathname hook",
|
|
323
|
+
"documentation": { "value": "The usePathname hook returns the current URL pathname as a string. Must be used in a Client Component." },
|
|
324
|
+
"insertText": "const pathname = usePathname();",
|
|
325
|
+
"insertTextRules": 0,
|
|
326
|
+
"sortText": "02_usePathname"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"label": "useSearchParams",
|
|
330
|
+
"kind": 1,
|
|
331
|
+
"detail": "next/navigation - useSearchParams hook",
|
|
332
|
+
"documentation": { "value": "The useSearchParams hook returns a read-only URLSearchParams object for the current URL's query parameters." },
|
|
333
|
+
"insertText": "const searchParams = useSearchParams();",
|
|
334
|
+
"insertTextRules": 0,
|
|
335
|
+
"sortText": "02_useSearchParams"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"label": "useParams",
|
|
339
|
+
"kind": 1,
|
|
340
|
+
"detail": "next/navigation - useParams hook",
|
|
341
|
+
"documentation": { "value": "The useParams hook returns an object containing the current route's dynamic parameters." },
|
|
342
|
+
"insertText": "const params = useParams();",
|
|
343
|
+
"insertTextRules": 0,
|
|
344
|
+
"sortText": "02_useParams"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"label": "useSelectedLayoutSegment",
|
|
348
|
+
"kind": 1,
|
|
349
|
+
"detail": "next/navigation - useSelectedLayoutSegment hook",
|
|
350
|
+
"documentation": { "value": "Returns the active route segment one level below the Layout it is called from. Useful for active navigation styling." },
|
|
351
|
+
"insertText": "const segment = useSelectedLayoutSegment();",
|
|
352
|
+
"insertTextRules": 0,
|
|
353
|
+
"sortText": "02_useSelectedLayoutSegment"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"label": "useSelectedLayoutSegments",
|
|
357
|
+
"kind": 1,
|
|
358
|
+
"detail": "next/navigation - useSelectedLayoutSegments hook",
|
|
359
|
+
"documentation": { "value": "Returns an array of active route segments below the Layout it is called from." },
|
|
360
|
+
"insertText": "const segments = useSelectedLayoutSegments();",
|
|
361
|
+
"insertTextRules": 0,
|
|
362
|
+
"sortText": "02_useSelectedLayoutSegments"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"label": "redirect",
|
|
366
|
+
"kind": 1,
|
|
367
|
+
"detail": "next/navigation - redirect function",
|
|
368
|
+
"documentation": { "value": "Redirects the user to another URL. Can be used in Server Components, Route Handlers, and Server Actions. Throws a NEXT_REDIRECT error internally." },
|
|
369
|
+
"insertText": "redirect('${1:/path}');",
|
|
370
|
+
"insertTextRules": 4,
|
|
371
|
+
"sortText": "02_redirect"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"label": "permanentRedirect",
|
|
375
|
+
"kind": 1,
|
|
376
|
+
"detail": "next/navigation - permanentRedirect function",
|
|
377
|
+
"documentation": { "value": "Redirects the user to another URL with a 308 status code (permanent redirect)." },
|
|
378
|
+
"insertText": "permanentRedirect('${1:/path}');",
|
|
379
|
+
"insertTextRules": 4,
|
|
380
|
+
"sortText": "02_permanentRedirect"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"label": "notFound",
|
|
384
|
+
"kind": 1,
|
|
385
|
+
"detail": "next/navigation - notFound function",
|
|
386
|
+
"documentation": { "value": "Throws a NEXT_NOT_FOUND error and renders the not-found.tsx UI for the route segment." },
|
|
387
|
+
"insertText": "notFound();",
|
|
388
|
+
"insertTextRules": 0,
|
|
389
|
+
"sortText": "02_notFound"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"label": "NextRequest",
|
|
393
|
+
"kind": 5,
|
|
394
|
+
"detail": "next/server - NextRequest class",
|
|
395
|
+
"documentation": { "value": "Extends the Web Request API with additional convenience methods. Used in Middleware and Route Handlers. Provides nextUrl, cookies, geo, ip properties." },
|
|
396
|
+
"insertText": "NextRequest",
|
|
397
|
+
"insertTextRules": 0,
|
|
398
|
+
"sortText": "02_NextRequest"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"label": "NextResponse",
|
|
402
|
+
"kind": 5,
|
|
403
|
+
"detail": "next/server - NextResponse class",
|
|
404
|
+
"documentation": { "value": "Extends the Web Response API with additional methods. Provides json(), redirect(), rewrite(), next() static methods." },
|
|
405
|
+
"insertText": "NextResponse",
|
|
406
|
+
"insertTextRules": 0,
|
|
407
|
+
"sortText": "02_NextResponse"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"label": "NextResponse.json",
|
|
411
|
+
"kind": 1,
|
|
412
|
+
"detail": "NextResponse static method",
|
|
413
|
+
"documentation": { "value": "Creates a JSON response with the given body and optional response init options." },
|
|
414
|
+
"insertText": "NextResponse.json(${1:data}, { status: ${2:200} })",
|
|
415
|
+
"insertTextRules": 4,
|
|
416
|
+
"sortText": "02_NextResponse_json"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"label": "NextResponse.redirect",
|
|
420
|
+
"kind": 1,
|
|
421
|
+
"detail": "NextResponse static method",
|
|
422
|
+
"documentation": { "value": "Creates a redirect response to the given URL with optional status code." },
|
|
423
|
+
"insertText": "NextResponse.redirect(new URL('${1:/path}', request.url))",
|
|
424
|
+
"insertTextRules": 4,
|
|
425
|
+
"sortText": "02_NextResponse_redirect"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"label": "NextResponse.rewrite",
|
|
429
|
+
"kind": 1,
|
|
430
|
+
"detail": "NextResponse static method",
|
|
431
|
+
"documentation": { "value": "Creates a rewrite response that renders a different URL while preserving the original URL." },
|
|
432
|
+
"insertText": "NextResponse.rewrite(new URL('${1:/path}', request.url))",
|
|
433
|
+
"insertTextRules": 4,
|
|
434
|
+
"sortText": "02_NextResponse_rewrite"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"label": "NextResponse.next",
|
|
438
|
+
"kind": 1,
|
|
439
|
+
"detail": "NextResponse static method",
|
|
440
|
+
"documentation": { "value": "Continues the middleware chain. Optionally modify request headers." },
|
|
441
|
+
"insertText": "NextResponse.next(${1})",
|
|
442
|
+
"insertTextRules": 4,
|
|
443
|
+
"sortText": "02_NextResponse_next"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"label": "cookies",
|
|
447
|
+
"kind": 1,
|
|
448
|
+
"detail": "next/headers - cookies function",
|
|
449
|
+
"documentation": { "value": "Returns a read-only cookies store for incoming request cookies in Server Components and Route Handlers. Use .get(), .getAll(), .has(), .set(), .delete() methods." },
|
|
450
|
+
"insertText": "const cookieStore = cookies();",
|
|
451
|
+
"insertTextRules": 0,
|
|
452
|
+
"sortText": "02_cookies"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"label": "headers",
|
|
456
|
+
"kind": 1,
|
|
457
|
+
"detail": "next/headers - headers function",
|
|
458
|
+
"documentation": { "value": "Returns a read-only Headers object for the incoming request in Server Components and Route Handlers." },
|
|
459
|
+
"insertText": "const headersList = headers();",
|
|
460
|
+
"insertTextRules": 0,
|
|
461
|
+
"sortText": "02_headers"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"label": "revalidatePath",
|
|
465
|
+
"kind": 1,
|
|
466
|
+
"detail": "next/cache - revalidatePath function",
|
|
467
|
+
"documentation": { "value": "Purges cached data for a specific path. Can be used in Server Actions, Route Handlers. Accepts path and optional type ('page' or 'layout')." },
|
|
468
|
+
"insertText": "revalidatePath('${1:/path}');",
|
|
469
|
+
"insertTextRules": 4,
|
|
470
|
+
"sortText": "02_revalidatePath"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"label": "revalidateTag",
|
|
474
|
+
"kind": 1,
|
|
475
|
+
"detail": "next/cache - revalidateTag function",
|
|
476
|
+
"documentation": { "value": "Purges cached data associated with a specific cache tag. Used with fetch cache tags for on-demand revalidation." },
|
|
477
|
+
"insertText": "revalidateTag('${1:tag}');",
|
|
478
|
+
"insertTextRules": 4,
|
|
479
|
+
"sortText": "02_revalidateTag"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"label": "unstable_cache",
|
|
483
|
+
"kind": 1,
|
|
484
|
+
"detail": "next/cache - unstable_cache function",
|
|
485
|
+
"documentation": { "value": "Wraps an async function to cache its result. Supports cache tags and revalidation period." },
|
|
486
|
+
"insertText": "const getCachedData = unstable_cache(\n async (${1:id}: string) => {\n ${2:return await db.query(id);}\n },\n ['${3:cache-key}'],\n { revalidate: ${4:3600}, tags: ['${5:tag}'] }\n);",
|
|
487
|
+
"insertTextRules": 4,
|
|
488
|
+
"sortText": "02_unstable_cache"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"label": "generateViewport",
|
|
492
|
+
"kind": 1,
|
|
493
|
+
"detail": "Next.js generateViewport function",
|
|
494
|
+
"documentation": { "value": "Generates dynamic viewport configuration. Similar to generateMetadata but for viewport meta tags." },
|
|
495
|
+
"insertText": "export function generateViewport(): Viewport {\n return {\n themeColor: '${1:#000000}',\n width: 'device-width',\n initialScale: 1,\n };\n}",
|
|
496
|
+
"insertTextRules": 4,
|
|
497
|
+
"sortText": "02_generateViewport"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"label": "fetch-with-cache",
|
|
501
|
+
"kind": 1,
|
|
502
|
+
"detail": "Next.js fetch with cache options",
|
|
503
|
+
"documentation": { "value": "Extended fetch API with Next.js caching and revalidation options. Supports cache: 'force-cache' | 'no-store' and next.revalidate/tags." },
|
|
504
|
+
"insertText": "const ${1:data} = await fetch('${2:url}', {\n ${3|cache: 'force-cache',cache: 'no-store',next: { revalidate: 3600 \\},next: { tags: ['tag'] \\}|}\n}).then(res => res.json());",
|
|
505
|
+
"insertTextRules": 4,
|
|
506
|
+
"sortText": "02_fetch_cache"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"label": "fetch-revalidate",
|
|
510
|
+
"kind": 1,
|
|
511
|
+
"detail": "fetch with next.revalidate",
|
|
512
|
+
"documentation": { "value": "Fetch data with time-based revalidation using Next.js extended fetch options." },
|
|
513
|
+
"insertText": "const ${1:data} = await fetch('${2:url}', {\n next: { revalidate: ${3:3600} }\n}).then(res => res.json());",
|
|
514
|
+
"insertTextRules": 4,
|
|
515
|
+
"sortText": "02_fetch_revalidate"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"label": "fetch-tags",
|
|
519
|
+
"kind": 1,
|
|
520
|
+
"detail": "fetch with next.tags",
|
|
521
|
+
"documentation": { "value": "Fetch data with cache tags for on-demand revalidation." },
|
|
522
|
+
"insertText": "const ${1:data} = await fetch('${2:url}', {\n next: { tags: ['${3:tag}'] }\n}).then(res => res.json());",
|
|
523
|
+
"insertTextRules": 4,
|
|
524
|
+
"sortText": "02_fetch_tags"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"label": "useRouter-pages",
|
|
528
|
+
"kind": 1,
|
|
529
|
+
"detail": "next/router - useRouter hook (Pages Router)",
|
|
530
|
+
"documentation": { "value": "The useRouter hook from next/router for Pages Router. Returns router with pathname, query, asPath, push, replace, prefetch, events." },
|
|
531
|
+
"insertText": "const router = useRouter();",
|
|
532
|
+
"insertTextRules": 0,
|
|
533
|
+
"sortText": "02_useRouter_pages"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"label": "getServerSideProps",
|
|
537
|
+
"kind": 1,
|
|
538
|
+
"detail": "Pages Router - Server-side rendering",
|
|
539
|
+
"documentation": { "value": "Fetches data on each request for server-side rendering. Returns props to the page component. Only works in pages/ directory." },
|
|
540
|
+
"insertText": "export const getServerSideProps: GetServerSideProps = async (context) => {\n return { props: { ${1} } };\n};",
|
|
541
|
+
"insertTextRules": 4,
|
|
542
|
+
"sortText": "02_getServerSideProps"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"label": "getStaticProps",
|
|
546
|
+
"kind": 1,
|
|
547
|
+
"detail": "Pages Router - Static generation",
|
|
548
|
+
"documentation": { "value": "Fetches data at build time for static generation. Supports ISR with revalidate option. Only works in pages/ directory." },
|
|
549
|
+
"insertText": "export const getStaticProps: GetStaticProps = async (context) => {\n return { props: { ${1} }, revalidate: ${2:60} };\n};",
|
|
550
|
+
"insertTextRules": 4,
|
|
551
|
+
"sortText": "02_getStaticProps"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"label": "getStaticPaths",
|
|
555
|
+
"kind": 1,
|
|
556
|
+
"detail": "Pages Router - Static paths",
|
|
557
|
+
"documentation": { "value": "Defines dynamic routes to be statically generated at build time. Used with getStaticProps for dynamic pages." },
|
|
558
|
+
"insertText": "export const getStaticPaths: GetStaticPaths = async () => {\n return { paths: [${1}], fallback: ${2:false} };\n};",
|
|
559
|
+
"insertTextRules": 4,
|
|
560
|
+
"sortText": "02_getStaticPaths"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"label": "NextPage",
|
|
564
|
+
"kind": 5,
|
|
565
|
+
"detail": "next - NextPage type",
|
|
566
|
+
"documentation": { "value": "Type for page components in Pages Router. Generic type accepting props type parameter." },
|
|
567
|
+
"insertText": "NextPage<${1:Props}>",
|
|
568
|
+
"insertTextRules": 4,
|
|
569
|
+
"sortText": "02_NextPage"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"label": "GetServerSideProps",
|
|
573
|
+
"kind": 5,
|
|
574
|
+
"detail": "next - GetServerSideProps type",
|
|
575
|
+
"documentation": { "value": "Type for getServerSideProps function in Pages Router." },
|
|
576
|
+
"insertText": "GetServerSideProps<${1:Props}>",
|
|
577
|
+
"insertTextRules": 4,
|
|
578
|
+
"sortText": "02_GetServerSideProps_type"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"label": "GetStaticProps",
|
|
582
|
+
"kind": 5,
|
|
583
|
+
"detail": "next - GetStaticProps type",
|
|
584
|
+
"documentation": { "value": "Type for getStaticProps function in Pages Router." },
|
|
585
|
+
"insertText": "GetStaticProps<${1:Props}>",
|
|
586
|
+
"insertTextRules": 4,
|
|
587
|
+
"sortText": "02_GetStaticProps_type"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"label": "GetStaticPaths",
|
|
591
|
+
"kind": 5,
|
|
592
|
+
"detail": "next - GetStaticPaths type",
|
|
593
|
+
"documentation": { "value": "Type for getStaticPaths function in Pages Router." },
|
|
594
|
+
"insertText": "GetStaticPaths",
|
|
595
|
+
"insertTextRules": 0,
|
|
596
|
+
"sortText": "02_GetStaticPaths_type"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"label": "import next/image",
|
|
600
|
+
"kind": 8,
|
|
601
|
+
"detail": "Import Next.js Image component",
|
|
602
|
+
"documentation": { "value": "Import the optimized Image component from next/image for automatic image optimization, lazy loading, and responsive images." },
|
|
603
|
+
"insertText": "import Image from 'next/image';",
|
|
604
|
+
"insertTextRules": 0,
|
|
605
|
+
"sortText": "03_next_image"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"label": "import next/link",
|
|
609
|
+
"kind": 8,
|
|
610
|
+
"detail": "Import Next.js Link component",
|
|
611
|
+
"documentation": { "value": "Import the Link component from next/link for client-side navigation with prefetching." },
|
|
612
|
+
"insertText": "import Link from 'next/link';",
|
|
613
|
+
"insertTextRules": 0,
|
|
614
|
+
"sortText": "03_next_link"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"label": "import next/font/google",
|
|
618
|
+
"kind": 8,
|
|
619
|
+
"detail": "Import Google Font",
|
|
620
|
+
"documentation": { "value": "Import a Google Font with automatic self-hosting and zero layout shift using next/font." },
|
|
621
|
+
"insertText": "import { ${1:Inter} } from 'next/font/google';\n\nconst ${2:inter} = ${1:Inter}({ subsets: ['${3:latin}'] });",
|
|
622
|
+
"insertTextRules": 4,
|
|
623
|
+
"sortText": "03_next_font_google"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"label": "import next/font/local",
|
|
627
|
+
"kind": 8,
|
|
628
|
+
"detail": "Import Local Font",
|
|
629
|
+
"documentation": { "value": "Import a local font file with automatic optimization." },
|
|
630
|
+
"insertText": "import localFont from 'next/font/local';\n\nconst ${1:myFont} = localFont({ src: '${2:./fonts/font.woff2}' });",
|
|
631
|
+
"insertTextRules": 4,
|
|
632
|
+
"sortText": "03_next_font_local"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
"label": "import next/script",
|
|
636
|
+
"kind": 8,
|
|
637
|
+
"detail": "Import Next.js Script component",
|
|
638
|
+
"documentation": { "value": "Import the Script component for optimized third-party script loading with strategy options." },
|
|
639
|
+
"insertText": "import Script from 'next/script';",
|
|
640
|
+
"insertTextRules": 0,
|
|
641
|
+
"sortText": "03_next_script"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"label": "import next/head",
|
|
645
|
+
"kind": 8,
|
|
646
|
+
"detail": "Import Next.js Head component",
|
|
647
|
+
"documentation": { "value": "Import the Head component from next/head for managing document head in Pages Router." },
|
|
648
|
+
"insertText": "import Head from 'next/head';",
|
|
649
|
+
"insertTextRules": 0,
|
|
650
|
+
"sortText": "03_next_head"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"label": "import next/dynamic",
|
|
654
|
+
"kind": 8,
|
|
655
|
+
"detail": "Import Next.js dynamic function",
|
|
656
|
+
"documentation": { "value": "Import the dynamic function for lazy loading components with SSR control and loading states." },
|
|
657
|
+
"insertText": "import dynamic from 'next/dynamic';",
|
|
658
|
+
"insertTextRules": 0,
|
|
659
|
+
"sortText": "03_next_dynamic"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"label": "import next/navigation",
|
|
663
|
+
"kind": 8,
|
|
664
|
+
"detail": "Import from next/navigation",
|
|
665
|
+
"documentation": { "value": "Import navigation hooks and utilities from next/navigation for App Router." },
|
|
666
|
+
"insertText": "import { ${1|useRouter,usePathname,useSearchParams,useParams,redirect,notFound,useSelectedLayoutSegment|} } from 'next/navigation';",
|
|
667
|
+
"insertTextRules": 4,
|
|
668
|
+
"sortText": "03_next_navigation"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"label": "import next/router",
|
|
672
|
+
"kind": 8,
|
|
673
|
+
"detail": "Import from next/router (Pages Router)",
|
|
674
|
+
"documentation": { "value": "Import the useRouter hook from next/router for Pages Router navigation." },
|
|
675
|
+
"insertText": "import { useRouter } from 'next/router';",
|
|
676
|
+
"insertTextRules": 0,
|
|
677
|
+
"sortText": "03_next_router"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"label": "import next/server",
|
|
681
|
+
"kind": 8,
|
|
682
|
+
"detail": "Import from next/server",
|
|
683
|
+
"documentation": { "value": "Import NextRequest, NextResponse, and other server utilities from next/server." },
|
|
684
|
+
"insertText": "import { ${1|NextRequest,NextResponse|} } from 'next/server';",
|
|
685
|
+
"insertTextRules": 4,
|
|
686
|
+
"sortText": "03_next_server"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"label": "import next/headers",
|
|
690
|
+
"kind": 8,
|
|
691
|
+
"detail": "Import from next/headers",
|
|
692
|
+
"documentation": { "value": "Import cookies and headers functions for reading request data in Server Components." },
|
|
693
|
+
"insertText": "import { ${1|cookies,headers|} } from 'next/headers';",
|
|
694
|
+
"insertTextRules": 4,
|
|
695
|
+
"sortText": "03_next_headers"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"label": "import next/cache",
|
|
699
|
+
"kind": 8,
|
|
700
|
+
"detail": "Import from next/cache",
|
|
701
|
+
"documentation": { "value": "Import revalidatePath, revalidateTag, and unstable_cache for cache management." },
|
|
702
|
+
"insertText": "import { ${1|revalidatePath,revalidateTag,unstable_cache|} } from 'next/cache';",
|
|
703
|
+
"insertTextRules": 4,
|
|
704
|
+
"sortText": "03_next_cache"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"label": "import next/og",
|
|
708
|
+
"kind": 8,
|
|
709
|
+
"detail": "Import from next/og",
|
|
710
|
+
"documentation": { "value": "Import ImageResponse for dynamic Open Graph image generation." },
|
|
711
|
+
"insertText": "import { ImageResponse } from 'next/og';",
|
|
712
|
+
"insertTextRules": 0,
|
|
713
|
+
"sortText": "03_next_og"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"label": "images",
|
|
717
|
+
"kind": 9,
|
|
718
|
+
"detail": "next.config.js - images configuration",
|
|
719
|
+
"documentation": { "value": "Configure image optimization settings including domains, remote patterns, formats, and device sizes." },
|
|
720
|
+
"insertText": "images: {\n remotePatterns: [\n {\n protocol: '${1:https}',\n hostname: '${2:example.com}',\n port: '',\n pathname: '${3:/**}',\n }\n ],\n formats: ['image/avif', 'image/webp'],\n}",
|
|
721
|
+
"insertTextRules": 4,
|
|
722
|
+
"sortText": "09_images"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"label": "rewrites",
|
|
726
|
+
"kind": 9,
|
|
727
|
+
"detail": "next.config.js - rewrites configuration",
|
|
728
|
+
"documentation": { "value": "Configure URL rewrites to map incoming request paths to different destination paths." },
|
|
729
|
+
"insertText": "async rewrites() {\n return [\n {\n source: '${1:/api/:path*}',\n destination: '${2:https://api.example.com/:path*}',\n }\n ];\n}",
|
|
730
|
+
"insertTextRules": 4,
|
|
731
|
+
"sortText": "09_rewrites"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"label": "redirects",
|
|
735
|
+
"kind": 9,
|
|
736
|
+
"detail": "next.config.js - redirects configuration",
|
|
737
|
+
"documentation": { "value": "Configure URL redirects with permanent or temporary status codes." },
|
|
738
|
+
"insertText": "async redirects() {\n return [\n {\n source: '${1:/old-path}',\n destination: '${2:/new-path}',\n permanent: ${3:true},\n }\n ];\n}",
|
|
739
|
+
"insertTextRules": 4,
|
|
740
|
+
"sortText": "09_redirects"
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
"label": "headers-config",
|
|
744
|
+
"kind": 9,
|
|
745
|
+
"detail": "next.config.js - headers configuration",
|
|
746
|
+
"documentation": { "value": "Configure custom HTTP headers for specific routes." },
|
|
747
|
+
"insertText": "async headers() {\n return [\n {\n source: '${1:/:path*}',\n headers: [\n {\n key: '${2:X-Frame-Options}',\n value: '${3:DENY}',\n }\n ],\n }\n ];\n}",
|
|
748
|
+
"insertTextRules": 4,
|
|
749
|
+
"sortText": "09_headers_config"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"label": "env",
|
|
753
|
+
"kind": 9,
|
|
754
|
+
"detail": "next.config.js - env configuration",
|
|
755
|
+
"documentation": { "value": "Expose environment variables to the browser by adding them to the env config." },
|
|
756
|
+
"insertText": "env: {\n ${1:CUSTOM_KEY}: process.env.${1:CUSTOM_KEY},\n}",
|
|
757
|
+
"insertTextRules": 4,
|
|
758
|
+
"sortText": "09_env"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"label": "webpack-config",
|
|
762
|
+
"kind": 9,
|
|
763
|
+
"detail": "next.config.js - webpack configuration",
|
|
764
|
+
"documentation": { "value": "Customize the webpack configuration used by Next.js." },
|
|
765
|
+
"insertText": "webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {\n ${1:// Custom webpack config}\n return config;\n}",
|
|
766
|
+
"insertTextRules": 4,
|
|
767
|
+
"sortText": "09_webpack"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"label": "experimental",
|
|
771
|
+
"kind": 9,
|
|
772
|
+
"detail": "next.config.js - experimental features",
|
|
773
|
+
"documentation": { "value": "Enable experimental Next.js features including serverActions, ppr, and more." },
|
|
774
|
+
"insertText": "experimental: {\n ${1|serverActions: true,ppr: true,typedRoutes: true|}\n}",
|
|
775
|
+
"insertTextRules": 4,
|
|
776
|
+
"sortText": "09_experimental"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"label": "metadata-object",
|
|
780
|
+
"kind": 9,
|
|
781
|
+
"detail": "Metadata object configuration",
|
|
782
|
+
"documentation": { "value": "Static metadata configuration object with title, description, openGraph, twitter, icons, robots." },
|
|
783
|
+
"insertText": "{\n title: '${1:Title}',\n description: '${2:Description}',\n openGraph: {\n title: '${1:Title}',\n description: '${2:Description}',\n url: '${3:https://example.com}',\n siteName: '${4:Site Name}',\n images: [\n {\n url: '${5:/og.png}',\n width: 1200,\n height: 630,\n }\n ],\n locale: 'en_US',\n type: 'website',\n },\n twitter: {\n card: 'summary_large_image',\n title: '${1:Title}',\n description: '${2:Description}',\n images: ['${5:/og.png}'],\n },\n robots: {\n index: true,\n follow: true,\n },\n}",
|
|
784
|
+
"insertTextRules": 4,
|
|
785
|
+
"sortText": "09_metadata_object"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"label": "viewport-object",
|
|
789
|
+
"kind": 9,
|
|
790
|
+
"detail": "Viewport configuration",
|
|
791
|
+
"documentation": { "value": "Viewport metadata configuration for controlling initial scale, width, and theme color." },
|
|
792
|
+
"insertText": "export const viewport: Viewport = {\n themeColor: '${1:#000000}',\n width: 'device-width',\n initialScale: 1,\n maximumScale: 1,\n};",
|
|
793
|
+
"insertTextRules": 4,
|
|
794
|
+
"sortText": "09_viewport"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
"label": "dynamic-config",
|
|
798
|
+
"kind": 9,
|
|
799
|
+
"detail": "Route Segment Config - dynamic",
|
|
800
|
+
"documentation": { "value": "Controls the dynamic behavior of a route segment. Options: 'auto' | 'force-dynamic' | 'error' | 'force-static'." },
|
|
801
|
+
"insertText": "export const dynamic = '${1|auto,force-dynamic,error,force-static|}';",
|
|
802
|
+
"insertTextRules": 4,
|
|
803
|
+
"sortText": "09_dynamic_config"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"label": "revalidate-config",
|
|
807
|
+
"kind": 9,
|
|
808
|
+
"detail": "Route Segment Config - revalidate",
|
|
809
|
+
"documentation": { "value": "Sets the default revalidation time for the layout or page in seconds." },
|
|
810
|
+
"insertText": "export const revalidate = ${1:3600};",
|
|
811
|
+
"insertTextRules": 4,
|
|
812
|
+
"sortText": "09_revalidate_config"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"label": "runtime-config",
|
|
816
|
+
"kind": 9,
|
|
817
|
+
"detail": "Route Segment Config - runtime",
|
|
818
|
+
"documentation": { "value": "Sets the runtime for the route segment. Options: 'nodejs' | 'edge'." },
|
|
819
|
+
"insertText": "export const runtime = '${1|nodejs,edge|}';",
|
|
820
|
+
"insertTextRules": 4,
|
|
821
|
+
"sortText": "09_runtime_config"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"label": "preferredRegion-config",
|
|
825
|
+
"kind": 9,
|
|
826
|
+
"detail": "Route Segment Config - preferredRegion",
|
|
827
|
+
"documentation": { "value": "Sets the preferred deployment region for the route segment for optimal latency." },
|
|
828
|
+
"insertText": "export const preferredRegion = '${1|auto,global,home,iad1,sfo1|}';",
|
|
829
|
+
"insertTextRules": 4,
|
|
830
|
+
"sortText": "09_preferredRegion"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"label": "maxDuration-config",
|
|
834
|
+
"kind": 9,
|
|
835
|
+
"detail": "Route Segment Config - maxDuration",
|
|
836
|
+
"documentation": { "value": "Sets the maximum execution time for the route segment in seconds." },
|
|
837
|
+
"insertText": "export const maxDuration = ${1:60};",
|
|
838
|
+
"insertTextRules": 4,
|
|
839
|
+
"sortText": "09_maxDuration"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"label": "fetchCache-config",
|
|
843
|
+
"kind": 9,
|
|
844
|
+
"detail": "Route Segment Config - fetchCache",
|
|
845
|
+
"documentation": { "value": "Controls the caching behavior of fetch requests in the route segment." },
|
|
846
|
+
"insertText": "export const fetchCache = '${1|auto,default-cache,only-cache,force-cache,default-no-store,only-no-store,force-no-store|}';",
|
|
847
|
+
"insertTextRules": 4,
|
|
848
|
+
"sortText": "09_fetchCache"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"label": "dynamicParams-config",
|
|
852
|
+
"kind": 9,
|
|
853
|
+
"detail": "Route Segment Config - dynamicParams",
|
|
854
|
+
"documentation": { "value": "Controls whether dynamic params not generated by generateStaticParams return 404." },
|
|
855
|
+
"insertText": "export const dynamicParams = ${1|true,false|};",
|
|
856
|
+
"insertTextRules": 4,
|
|
857
|
+
"sortText": "09_dynamicParams"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"label": "Image",
|
|
861
|
+
"kind": 5,
|
|
862
|
+
"detail": "next/image - Image Component",
|
|
863
|
+
"documentation": { "value": "Optimized image component with automatic lazy loading, responsive sizing, blur placeholder support, and image format optimization." },
|
|
864
|
+
"insertText": "<Image\n src=\"${1:/image.png}\"\n alt=\"${2:description}\"\n width={${3:500}}\n height={${4:300}}\n ${5:priority}\n/>",
|
|
865
|
+
"insertTextRules": 4,
|
|
866
|
+
"sortText": "02_Image_component"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"label": "Link",
|
|
870
|
+
"kind": 5,
|
|
871
|
+
"detail": "next/link - Link Component",
|
|
872
|
+
"documentation": { "value": "Client-side navigation component with automatic prefetching. Extends HTML <a> tag with Next.js routing capabilities." },
|
|
873
|
+
"insertText": "<Link href=\"${1:/path}\"${2: className=\"${3:link}\"}>\n ${4:Link Text}\n</Link>",
|
|
874
|
+
"insertTextRules": 4,
|
|
875
|
+
"sortText": "02_Link_component"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"label": "Script",
|
|
879
|
+
"kind": 5,
|
|
880
|
+
"detail": "next/script - Script Component",
|
|
881
|
+
"documentation": { "value": "Optimized script loading component with strategy options: beforeInteractive, afterInteractive, lazyOnload, worker." },
|
|
882
|
+
"insertText": "<Script\n src=\"${1:https://example.com/script.js}\"\n strategy=\"${2|beforeInteractive,afterInteractive,lazyOnload,worker|}\"\n/>",
|
|
883
|
+
"insertTextRules": 4,
|
|
884
|
+
"sortText": "02_Script_component"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"label": "Font",
|
|
888
|
+
"kind": 5,
|
|
889
|
+
"detail": "next/font - Font Configuration",
|
|
890
|
+
"documentation": { "value": "Configure a font with next/font for automatic self-hosting and optimization." },
|
|
891
|
+
"insertText": "const ${1:font} = ${2:Inter}({\n subsets: ['${3:latin}'],\n weight: [${4:'400', '700'}],\n display: '${5:swap}',\n});",
|
|
892
|
+
"insertTextRules": 4,
|
|
893
|
+
"sortText": "02_Font_config"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"label": "dynamic-import",
|
|
897
|
+
"kind": 1,
|
|
898
|
+
"detail": "next/dynamic - Dynamic Import",
|
|
899
|
+
"documentation": { "value": "Lazy load a component with optional SSR disable and custom loading component." },
|
|
900
|
+
"insertText": "const ${1:Component} = dynamic(() => import('${2:./Component}'), {\n loading: () => <p>Loading...</p>,\n ssr: ${3:false},\n});",
|
|
901
|
+
"insertTextRules": 4,
|
|
902
|
+
"sortText": "02_dynamic_import"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"label": "use client",
|
|
906
|
+
"kind": 17,
|
|
907
|
+
"detail": "Client Component directive",
|
|
908
|
+
"documentation": { "value": "Marks a component as a Client Component, enabling use of hooks, event handlers, browser APIs, and interactivity." },
|
|
909
|
+
"insertText": "'use client';",
|
|
910
|
+
"insertTextRules": 0,
|
|
911
|
+
"sortText": "01_use_client"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
"label": "use server",
|
|
915
|
+
"kind": 17,
|
|
916
|
+
"detail": "Server Action directive",
|
|
917
|
+
"documentation": { "value": "Marks a function or file as a Server Action, enabling server-side execution from client components." },
|
|
918
|
+
"insertText": "'use server';",
|
|
919
|
+
"insertTextRules": 0,
|
|
920
|
+
"sortText": "01_use_server"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
"label": "export default",
|
|
924
|
+
"kind": 17,
|
|
925
|
+
"detail": "Default export keyword",
|
|
926
|
+
"documentation": { "value": "Export default for page components, layouts, and route handlers." },
|
|
927
|
+
"insertText": "export default",
|
|
928
|
+
"insertTextRules": 0,
|
|
929
|
+
"sortText": "01_export_default"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"label": "export async",
|
|
933
|
+
"kind": 17,
|
|
934
|
+
"detail": "Async function export",
|
|
935
|
+
"documentation": { "value": "Export an async function for server components, route handlers, and data fetching." },
|
|
936
|
+
"insertText": "export async function",
|
|
937
|
+
"insertTextRules": 0,
|
|
938
|
+
"sortText": "01_export_async"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
"label": "export const metadata",
|
|
942
|
+
"kind": 17,
|
|
943
|
+
"detail": "Static metadata export",
|
|
944
|
+
"documentation": { "value": "Export a static Metadata object for the page or layout." },
|
|
945
|
+
"insertText": "export const metadata: Metadata = {\n $0\n};",
|
|
946
|
+
"insertTextRules": 4,
|
|
947
|
+
"sortText": "01_export_metadata"
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
"label": "next.config.js",
|
|
951
|
+
"kind": 28,
|
|
952
|
+
"detail": "Next.js Configuration File",
|
|
953
|
+
"documentation": { "value": "Creates a next.config.js file with common configuration options." },
|
|
954
|
+
"insertText": "/** @type {import('next').NextConfig} */\nconst nextConfig = {\n ${1:reactStrictMode: true},\n $0\n};\n\nmodule.exports = nextConfig;",
|
|
955
|
+
"insertTextRules": 4,
|
|
956
|
+
"sortText": "00_next_config"
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
"label": "next.config.mjs",
|
|
960
|
+
"kind": 28,
|
|
961
|
+
"detail": "Next.js Configuration File (ESM)",
|
|
962
|
+
"documentation": { "value": "Creates a next.config.mjs file with ESM syntax." },
|
|
963
|
+
"insertText": "/** @type {import('next').NextConfig} */\nconst nextConfig = {\n ${1:reactStrictMode: true},\n $0\n};\n\nexport default nextConfig;",
|
|
964
|
+
"insertTextRules": 4,
|
|
965
|
+
"sortText": "00_next_config_mjs"
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
"label": "Suspense-boundary",
|
|
969
|
+
"kind": 28,
|
|
970
|
+
"detail": "React Suspense Boundary",
|
|
971
|
+
"documentation": { "value": "Wraps an async component with Suspense for streaming and loading states." },
|
|
972
|
+
"insertText": "<Suspense fallback={<${1:Loading} />}>\n ${2:<AsyncComponent />}\n</Suspense>",
|
|
973
|
+
"insertTextRules": 4,
|
|
974
|
+
"sortText": "00_suspense"
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
"label": "form-server-action",
|
|
978
|
+
"kind": 28,
|
|
979
|
+
"detail": "Form with Server Action",
|
|
980
|
+
"documentation": { "value": "Creates a form that submits to a Server Action." },
|
|
981
|
+
"insertText": "<form action={${1:serverAction}}>\n <input type=\"${2:text}\" name=\"${3:field}\" />\n <button type=\"submit\">${4:Submit}</button>\n</form>",
|
|
982
|
+
"insertTextRules": 4,
|
|
983
|
+
"sortText": "00_form_action"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"label": "useFormStatus",
|
|
987
|
+
"kind": 1,
|
|
988
|
+
"detail": "react-dom - useFormStatus hook",
|
|
989
|
+
"documentation": { "value": "Returns status information of the last form submission. Must be used inside a form with a Server Action." },
|
|
990
|
+
"insertText": "const { pending, data, method, action } = useFormStatus();",
|
|
991
|
+
"insertTextRules": 0,
|
|
992
|
+
"sortText": "02_useFormStatus"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"label": "useFormState",
|
|
996
|
+
"kind": 1,
|
|
997
|
+
"detail": "react-dom - useFormState hook",
|
|
998
|
+
"documentation": { "value": "Manages form state based on the result of a Server Action." },
|
|
999
|
+
"insertText": "const [state, formAction] = useFormState(${1:action}, ${2:initialState});",
|
|
1000
|
+
"insertTextRules": 4,
|
|
1001
|
+
"sortText": "02_useFormState"
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
"label": "useOptimistic",
|
|
1005
|
+
"kind": 1,
|
|
1006
|
+
"detail": "React - useOptimistic hook",
|
|
1007
|
+
"documentation": { "value": "Enables optimistic UI updates while a Server Action is executing." },
|
|
1008
|
+
"insertText": "const [optimistic${1:State}, addOptimistic] = useOptimistic(${2:state}, (current, optimistic) => {\n return ${3:optimistic};\n});",
|
|
1009
|
+
"insertTextRules": 4,
|
|
1010
|
+
"sortText": "02_useOptimistic"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
"label": "generateImageMetadata",
|
|
1014
|
+
"kind": 1,
|
|
1015
|
+
"detail": "Next.js generateImageMetadata",
|
|
1016
|
+
"documentation": { "value": "Generates multiple images for a single route segment (icon, opengraph-image, etc.)." },
|
|
1017
|
+
"insertText": "export function generateImageMetadata() {\n return [\n {\n contentType: 'image/png',\n size: { width: ${1:48}, height: ${2:48} },\n id: '${3:small}',\n }\n ];\n}",
|
|
1018
|
+
"insertTextRules": 4,
|
|
1019
|
+
"sortText": "02_generateImageMetadata"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"label": "ImageResponse",
|
|
1023
|
+
"kind": 5,
|
|
1024
|
+
"detail": "next/og - ImageResponse",
|
|
1025
|
+
"documentation": { "value": "Creates a dynamic image response for OG images using JSX and CSS." },
|
|
1026
|
+
"insertText": "new ImageResponse(\n (\n <div style={{ ${1:display: 'flex'} }}>\n ${2:Content}\n </div>\n ),\n { width: ${3:1200}, height: ${4:630} }\n)",
|
|
1027
|
+
"insertTextRules": 4,
|
|
1028
|
+
"sortText": "02_ImageResponse"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
"label": "router.push",
|
|
1032
|
+
"kind": 0,
|
|
1033
|
+
"detail": "Navigate to a new URL",
|
|
1034
|
+
"documentation": { "value": "Programmatically navigate to a new URL using the App Router's router.push method." },
|
|
1035
|
+
"insertText": "router.push('${1:/path}');",
|
|
1036
|
+
"insertTextRules": 4,
|
|
1037
|
+
"sortText": "02_router_push"
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
"label": "router.replace",
|
|
1041
|
+
"kind": 0,
|
|
1042
|
+
"detail": "Replace current URL",
|
|
1043
|
+
"documentation": { "value": "Replace the current URL without adding a new entry to the browser's history stack." },
|
|
1044
|
+
"insertText": "router.replace('${1:/path}');",
|
|
1045
|
+
"insertTextRules": 4,
|
|
1046
|
+
"sortText": "02_router_replace"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
"label": "router.refresh",
|
|
1050
|
+
"kind": 0,
|
|
1051
|
+
"detail": "Refresh current route",
|
|
1052
|
+
"documentation": { "value": "Refresh the current route. Makes a new request to the server, re-fetching data and re-rendering Server Components." },
|
|
1053
|
+
"insertText": "router.refresh();",
|
|
1054
|
+
"insertTextRules": 0,
|
|
1055
|
+
"sortText": "02_router_refresh"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
"label": "router.prefetch",
|
|
1059
|
+
"kind": 0,
|
|
1060
|
+
"detail": "Prefetch a route",
|
|
1061
|
+
"documentation": { "value": "Prefetch the provided route for faster client-side transitions." },
|
|
1062
|
+
"insertText": "router.prefetch('${1:/path}');",
|
|
1063
|
+
"insertTextRules": 4,
|
|
1064
|
+
"sortText": "02_router_prefetch"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
"label": "router.back",
|
|
1068
|
+
"kind": 0,
|
|
1069
|
+
"detail": "Navigate back",
|
|
1070
|
+
"documentation": { "value": "Navigate back to the previous route in the browser's history stack." },
|
|
1071
|
+
"insertText": "router.back();",
|
|
1072
|
+
"insertTextRules": 0,
|
|
1073
|
+
"sortText": "02_router_back"
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"label": "router.forward",
|
|
1077
|
+
"kind": 0,
|
|
1078
|
+
"detail": "Navigate forward",
|
|
1079
|
+
"documentation": { "value": "Navigate forward to the next route in the browser's history stack." },
|
|
1080
|
+
"insertText": "router.forward();",
|
|
1081
|
+
"insertTextRules": 0,
|
|
1082
|
+
"sortText": "02_router_forward"
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
"label": "cookies.get",
|
|
1086
|
+
"kind": 0,
|
|
1087
|
+
"detail": "Get a cookie value",
|
|
1088
|
+
"documentation": { "value": "Get a cookie by name from the request cookies store." },
|
|
1089
|
+
"insertText": "cookies().get('${1:name}');",
|
|
1090
|
+
"insertTextRules": 4,
|
|
1091
|
+
"sortText": "02_cookies_get"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"label": "cookies.set",
|
|
1095
|
+
"kind": 0,
|
|
1096
|
+
"detail": "Set a cookie",
|
|
1097
|
+
"documentation": { "value": "Set a cookie in Server Actions or Route Handlers." },
|
|
1098
|
+
"insertText": "cookies().set('${1:name}', '${2:value}', { ${3:httpOnly: true} });",
|
|
1099
|
+
"insertTextRules": 4,
|
|
1100
|
+
"sortText": "02_cookies_set"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"label": "cookies.delete",
|
|
1104
|
+
"kind": 0,
|
|
1105
|
+
"detail": "Delete a cookie",
|
|
1106
|
+
"documentation": { "value": "Delete a cookie by name in Server Actions or Route Handlers." },
|
|
1107
|
+
"insertText": "cookies().delete('${1:name}');",
|
|
1108
|
+
"insertTextRules": 4,
|
|
1109
|
+
"sortText": "02_cookies_delete"
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
"label": "headers.get",
|
|
1113
|
+
"kind": 0,
|
|
1114
|
+
"detail": "Get a header value",
|
|
1115
|
+
"documentation": { "value": "Get a specific request header value." },
|
|
1116
|
+
"insertText": "headers().get('${1:content-type}');",
|
|
1117
|
+
"insertTextRules": 4,
|
|
1118
|
+
"sortText": "02_headers_get"
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"label": "searchParams.get",
|
|
1122
|
+
"kind": 0,
|
|
1123
|
+
"detail": "Get search param value",
|
|
1124
|
+
"documentation": { "value": "Get a query parameter value from URLSearchParams." },
|
|
1125
|
+
"insertText": "searchParams.get('${1:key}');",
|
|
1126
|
+
"insertTextRules": 4,
|
|
1127
|
+
"sortText": "02_searchParams_get"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
"label": "searchParams.getAll",
|
|
1131
|
+
"kind": 0,
|
|
1132
|
+
"detail": "Get all values for search param",
|
|
1133
|
+
"documentation": { "value": "Get all values for a query parameter." },
|
|
1134
|
+
"insertText": "searchParams.getAll('${1:key}');",
|
|
1135
|
+
"insertTextRules": 4,
|
|
1136
|
+
"sortText": "02_searchParams_getAll"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
"label": "import Metadata",
|
|
1140
|
+
"kind": 8,
|
|
1141
|
+
"detail": "Import Metadata type from next",
|
|
1142
|
+
"documentation": { "value": "Import the Metadata type for typed metadata exports." },
|
|
1143
|
+
"insertText": "import type { Metadata } from 'next';",
|
|
1144
|
+
"insertTextRules": 0,
|
|
1145
|
+
"sortText": "03_import_metadata"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
"label": "import Viewport",
|
|
1149
|
+
"kind": 8,
|
|
1150
|
+
"detail": "Import Viewport type from next",
|
|
1151
|
+
"documentation": { "value": "Import the Viewport type for typed viewport configuration." },
|
|
1152
|
+
"insertText": "import type { Viewport } from 'next';",
|
|
1153
|
+
"insertTextRules": 0,
|
|
1154
|
+
"sortText": "03_import_viewport"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"label": "import NextConfig",
|
|
1158
|
+
"kind": 8,
|
|
1159
|
+
"detail": "Import NextConfig type",
|
|
1160
|
+
"documentation": { "value": "Import the NextConfig type for typed configuration." },
|
|
1161
|
+
"insertText": "import type { NextConfig } from 'next';",
|
|
1162
|
+
"insertTextRules": 0,
|
|
1163
|
+
"sortText": "03_import_nextconfig"
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
"label": "import MetadataRoute",
|
|
1167
|
+
"kind": 8,
|
|
1168
|
+
"detail": "Import MetadataRoute from next",
|
|
1169
|
+
"documentation": { "value": "Import MetadataRoute type for sitemap and robots generation." },
|
|
1170
|
+
"insertText": "import type { MetadataRoute } from 'next';",
|
|
1171
|
+
"insertTextRules": 0,
|
|
1172
|
+
"sortText": "03_import_metadataroute"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
"label": "cache-force-cache",
|
|
1176
|
+
"kind": 14,
|
|
1177
|
+
"detail": "Force cache fetch option",
|
|
1178
|
+
"documentation": { "value": "Use cached data. Equivalent to getStaticProps behavior." },
|
|
1179
|
+
"insertText": "cache: 'force-cache'",
|
|
1180
|
+
"insertTextRules": 0,
|
|
1181
|
+
"sortText": "09_cache_force"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
"label": "cache-no-store",
|
|
1185
|
+
"kind": 14,
|
|
1186
|
+
"detail": "No store fetch option",
|
|
1187
|
+
"documentation": { "value": "Fetch fresh data on every request. Equivalent to getServerSideProps behavior." },
|
|
1188
|
+
"insertText": "cache: 'no-store'",
|
|
1189
|
+
"insertTextRules": 0,
|
|
1190
|
+
"sortText": "09_cache_no_store"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
"label": "next-revalidate",
|
|
1194
|
+
"kind": 14,
|
|
1195
|
+
"detail": "Next.js revalidate fetch option",
|
|
1196
|
+
"documentation": { "value": "Set time-based revalidation for a fetch request in seconds." },
|
|
1197
|
+
"insertText": "next: { revalidate: ${1:3600} }",
|
|
1198
|
+
"insertTextRules": 4,
|
|
1199
|
+
"sortText": "09_next_revalidate"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"label": "next-tags",
|
|
1203
|
+
"kind": 14,
|
|
1204
|
+
"detail": "Next.js tags fetch option",
|
|
1205
|
+
"documentation": { "value": "Set cache tags for a fetch request for on-demand revalidation." },
|
|
1206
|
+
"insertText": "next: { tags: ['${1:tag}'] }",
|
|
1207
|
+
"insertTextRules": 4,
|
|
1208
|
+
"sortText": "09_next_tags"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"label": "loading-tsx",
|
|
1212
|
+
"kind": 28,
|
|
1213
|
+
"detail": "Minimal loading.tsx",
|
|
1214
|
+
"documentation": { "value": "Quick loading.tsx skeleton component." },
|
|
1215
|
+
"insertText": "export default function Loading() {\n return <div className=\"animate-pulse\">${1:Loading...}</div>;\n}",
|
|
1216
|
+
"insertTextRules": 4,
|
|
1217
|
+
"sortText": "00_loading_tsx"
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
"label": "route-handler-full",
|
|
1221
|
+
"kind": 28,
|
|
1222
|
+
"detail": "Complete Route Handler with all methods",
|
|
1223
|
+
"documentation": { "value": "Creates a route handler file with GET, POST, PUT, DELETE methods." },
|
|
1224
|
+
"insertText": "import { NextRequest, NextResponse } from 'next/server';\n\nexport async function GET(request: NextRequest) {\n return NextResponse.json({ message: 'GET' });\n}\n\nexport async function POST(request: NextRequest) {\n const body = await request.json();\n return NextResponse.json({ message: 'POST', body }, { status: 201 });\n}\n\nexport async function PUT(request: NextRequest) {\n const body = await request.json();\n return NextResponse.json({ message: 'PUT', body });\n}\n\nexport async function DELETE(request: NextRequest) {\n return NextResponse.json({ message: 'DELETE' });\n}",
|
|
1225
|
+
"insertTextRules": 4,
|
|
1226
|
+
"sortText": "00_route_handler_full"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
"label": "middleware-auth",
|
|
1230
|
+
"kind": 28,
|
|
1231
|
+
"detail": "Authentication Middleware",
|
|
1232
|
+
"documentation": { "value": "Creates middleware with authentication check and redirect to login." },
|
|
1233
|
+
"insertText": "import { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nexport function middleware(request: NextRequest) {\n const token = request.cookies.get('${1:token}')?.value;\n if (!token) {\n return NextResponse.redirect(new URL('${2:/login}', request.url));\n }\n return NextResponse.next();\n}\n\nexport const config = {\n matcher: ['${3:/dashboard/:path*}'],\n};",
|
|
1234
|
+
"insertTextRules": 4,
|
|
1235
|
+
"sortText": "00_middleware_auth"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"label": "server-actions-file",
|
|
1239
|
+
"kind": 28,
|
|
1240
|
+
"detail": "Server Actions File",
|
|
1241
|
+
"documentation": { "value": "Creates a dedicated server actions file with 'use server' directive." },
|
|
1242
|
+
"insertText": "'use server';\n\nimport { revalidatePath } from 'next/cache';\n\nexport async function ${1:create}(formData: FormData) {\n const ${2:data} = {\n ${3:name}: formData.get('${3:name}') as string,\n };\n ${4:// Database operation}\n revalidatePath('${5:/}');\n}",
|
|
1243
|
+
"insertTextRules": 4,
|
|
1244
|
+
"sortText": "00_server_actions_file"
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"label": "useTransition-action",
|
|
1248
|
+
"kind": 1,
|
|
1249
|
+
"detail": "useTransition with Server Action",
|
|
1250
|
+
"documentation": { "value": "Use useTransition to wrap server action calls for pending states." },
|
|
1251
|
+
"insertText": "const [isPending, startTransition] = useTransition();\n\nfunction handle${1:Submit}() {\n startTransition(async () => {\n await ${2:serverAction}();\n });\n}",
|
|
1252
|
+
"insertTextRules": 4,
|
|
1253
|
+
"sortText": "02_useTransition"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"label": "middleware-i18n",
|
|
1257
|
+
"kind": 28,
|
|
1258
|
+
"detail": "Internationalization Middleware",
|
|
1259
|
+
"documentation": { "value": "Creates middleware for locale detection and routing." },
|
|
1260
|
+
"insertText": "import { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nconst locales = ['${1:en}', '${2:fr}', '${3:de}'];\nconst defaultLocale = '${1:en}';\n\nexport function middleware(request: NextRequest) {\n const { pathname } = request.nextUrl;\n const pathnameHasLocale = locales.some(\n (locale) => pathname.startsWith(`/\\${locale}/`) || pathname === `/\\${locale}`\n );\n if (pathnameHasLocale) return;\n const locale = defaultLocale;\n request.nextUrl.pathname = `/\\${locale}\\${pathname}`;\n return NextResponse.redirect(request.nextUrl);\n}\n\nexport const config = {\n matcher: ['/((?!_next).*)'],\n};",
|
|
1261
|
+
"insertTextRules": 4,
|
|
1262
|
+
"sortText": "00_middleware_i18n"
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
"label": "catch-all-route",
|
|
1266
|
+
"kind": 28,
|
|
1267
|
+
"detail": "Catch-all Route Page",
|
|
1268
|
+
"documentation": { "value": "Creates a page for catch-all route segments [...slug] or optional catch-all [[...slug]]." },
|
|
1269
|
+
"insertText": "export default function ${1:Page}({\n params,\n}: {\n params: { ${2:slug}: string[] };\n}) {\n return (\n <div>\n <h1>Path: {params.${2:slug}.join('/')}</h1>\n $0\n </div>\n );\n}",
|
|
1270
|
+
"insertTextRules": 4,
|
|
1271
|
+
"sortText": "00_catch_all"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
"label": "next-config-ts",
|
|
1275
|
+
"kind": 28,
|
|
1276
|
+
"detail": "Next.js Config (TypeScript)",
|
|
1277
|
+
"documentation": { "value": "Creates a next.config.ts file with TypeScript support." },
|
|
1278
|
+
"insertText": "import type { NextConfig } from 'next';\n\nconst nextConfig: NextConfig = {\n ${1:reactStrictMode: true},\n $0\n};\n\nexport default nextConfig;",
|
|
1279
|
+
"insertTextRules": 4,
|
|
1280
|
+
"sortText": "00_next_config_ts"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"label": "Suspense-streaming",
|
|
1284
|
+
"kind": 28,
|
|
1285
|
+
"detail": "Streaming with Suspense",
|
|
1286
|
+
"documentation": { "value": "Stream content using multiple Suspense boundaries for progressive loading." },
|
|
1287
|
+
"insertText": "import { Suspense } from 'react';\n\nexport default async function ${1:Page}() {\n return (\n <div>\n <Suspense fallback={<div>Loading header...</div>}>\n <${2:Header} />\n </Suspense>\n <Suspense fallback={<div>Loading content...</div>}>\n <${3:Content} />\n </Suspense>\n </div>\n );\n}",
|
|
1288
|
+
"insertTextRules": 4,
|
|
1289
|
+
"sortText": "00_suspense_streaming"
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
"label": "revalidatePath-page",
|
|
1293
|
+
"kind": 1,
|
|
1294
|
+
"detail": "Revalidate specific page path",
|
|
1295
|
+
"documentation": { "value": "Purge cache for a specific page path." },
|
|
1296
|
+
"insertText": "revalidatePath('${1:/path}', '${2|page,layout|}');",
|
|
1297
|
+
"insertTextRules": 4,
|
|
1298
|
+
"sortText": "02_revalidatePath_page"
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
"label": "fetch-no-store",
|
|
1302
|
+
"kind": 1,
|
|
1303
|
+
"detail": "Fetch without caching",
|
|
1304
|
+
"documentation": { "value": "Fetch fresh data on every request, opting out of caching." },
|
|
1305
|
+
"insertText": "const ${1:data} = await fetch('${2:url}', { cache: 'no-store' }).then(res => res.json());",
|
|
1306
|
+
"insertTextRules": 4,
|
|
1307
|
+
"sortText": "02_fetch_no_store"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"label": "NextRequest.nextUrl",
|
|
1311
|
+
"kind": 9,
|
|
1312
|
+
"detail": "NextRequest URL utilities",
|
|
1313
|
+
"documentation": { "value": "Access parsed URL with additional Next.js properties like pathname, searchParams, basePath, locale." },
|
|
1314
|
+
"insertText": "request.nextUrl.${1|pathname,searchParams,basePath,locale|}",
|
|
1315
|
+
"insertTextRules": 4,
|
|
1316
|
+
"sortText": "02_nextUrl"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"label": "request.cookies",
|
|
1320
|
+
"kind": 9,
|
|
1321
|
+
"detail": "Request cookies in middleware",
|
|
1322
|
+
"documentation": { "value": "Access cookies from NextRequest in middleware." },
|
|
1323
|
+
"insertText": "request.cookies.${1|get,getAll,set,delete,has|}('${2:name}')",
|
|
1324
|
+
"insertTextRules": 4,
|
|
1325
|
+
"sortText": "02_request_cookies"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"label": "response.cookies",
|
|
1329
|
+
"kind": 9,
|
|
1330
|
+
"detail": "Response cookies",
|
|
1331
|
+
"documentation": { "value": "Set cookies on NextResponse." },
|
|
1332
|
+
"insertText": "response.cookies.set('${1:name}', '${2:value}', {\n httpOnly: true,\n secure: true,\n sameSite: '${3|lax,strict,none|}',\n maxAge: ${4:3600},\n});",
|
|
1333
|
+
"insertTextRules": 4,
|
|
1334
|
+
"sortText": "02_response_cookies"
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"label": "turbopack",
|
|
1338
|
+
"kind": 9,
|
|
1339
|
+
"detail": "Turbopack configuration",
|
|
1340
|
+
"documentation": { "value": "Enable and configure Turbopack for faster development builds." },
|
|
1341
|
+
"insertText": "experimental: {\n turbo: {\n rules: {\n '${1:*.svg}': {\n loaders: ['${2:@svgr/webpack}'],\n as: '${3:*.js}',\n }\n }\n }\n}",
|
|
1342
|
+
"insertTextRules": 4,
|
|
1343
|
+
"sortText": "09_turbopack"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"label": "output-standalone",
|
|
1347
|
+
"kind": 9,
|
|
1348
|
+
"detail": "Standalone output configuration",
|
|
1349
|
+
"documentation": { "value": "Configure standalone output for Docker deployments." },
|
|
1350
|
+
"insertText": "output: 'standalone'",
|
|
1351
|
+
"insertTextRules": 0,
|
|
1352
|
+
"sortText": "09_output_standalone"
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
"label": "transpilePackages",
|
|
1356
|
+
"kind": 9,
|
|
1357
|
+
"detail": "Transpile external packages",
|
|
1358
|
+
"documentation": { "value": "Configure Next.js to transpile specific packages from node_modules." },
|
|
1359
|
+
"insertText": "transpilePackages: ['${1:package-name}']",
|
|
1360
|
+
"insertTextRules": 4,
|
|
1361
|
+
"sortText": "09_transpilePackages"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
"label": "serverExternalPackages",
|
|
1365
|
+
"kind": 9,
|
|
1366
|
+
"detail": "Server external packages",
|
|
1367
|
+
"documentation": { "value": "Opt specific packages out of Server Component bundling." },
|
|
1368
|
+
"insertText": "serverExternalPackages: ['${1:package-name}']",
|
|
1369
|
+
"insertTextRules": 4,
|
|
1370
|
+
"sortText": "09_serverExternalPackages"
|
|
1371
|
+
}
|
|
1372
|
+
]
|
|
1373
|
+
}
|