CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.8.14 (changelog, source)
Search

Module NextJS

Provides classes and predicates modeling Next.js.

Import path

import javascript

Predicates

apiFolder

Gets a folder that contains API endpoints for a Next.js application. These API endpoints act as Express-like route-handlers.

getAModuleWithFallbackPaths

Gets a module inside a “pages” folder where fallback from getStaticPaths is not set to false. In such a module the getStaticProps method can be called with user-defined parameters. If fallback is set to false, then only values defined by getStaticPaths are allowed.

getANextPackage

Gets a package.json that depends on the Next.js library.

getAPagesFolder

Gets a “pages” folder in a Next.js application. JavaScript files inside these folders are mapped to routes.

getAPagesModule

Gets a module corrosponding to a Next.js page.

getAPropsSource

Gets a reference to a props object computed by the Next.js server. This props object is both used both by the server and client to render the page.

getInitialProps

Gets the getInitialProps function in a Next.js page. This function is executed on the server every time a request for the page is made. The function receives a context parameter, which includes HTTP request/response objects.

getServerSidePropsFunction

Gets the getServerSideProps function in a Next.js page. This function is executed on the server every time a request for the page is made. The function receives a context parameter, which includes HTTP request/response objects.

getStaticPropsFunction

Gets the getStaticProps function in a Next.js page. This function is executed at build time, or when a page with a new URL is requested for the first time (if fallback is not false).

nextRouter

Gets a reference to a Next.js router.

Classes

NextApiRouteHandler

A Next.js route handler for an API endpoint. The response (res) includes a set of Express.js-like methods, and we therefore model the routehandler as an Express.js routehandler.

NextHttpRequestSource

A NodeJS HTTP request object in a Next.js page.

NextHttpResponseSource

A NodeJS HTTP response object in a Next.js page.

NextHttpRouteHandler

A Next.js function that is exected on the server for every request, seen as a routehandler.

NextJSStaticPropsStep

A step modeling the flow from the server-computed props object to the default exported function that renders the page.

NextJSStaticReactComponentPropsStep

A step modeling the flow from the server-computed props object to the default exported React component that renders the page.

NextParams

A user defined path or query parameter in Next.js.

NextReqResHandler

A function that handles both a request and response from Next.js, seen as a routehandler.