├── turbofan ├── netlify.toml └── netlify │ └── edge-functions │ └── turbofan.ts ├── edge-runtime ├── matchers.json ├── next.config.json ├── lib │ ├── fixture │ │ └── cjs │ │ │ ├── .gitignore │ │ │ ├── node_modules │ │ │ ├── package │ │ │ │ ├── package.json │ │ │ │ ├── index.js │ │ │ │ └── internal-module.js │ │ │ ├── package-main │ │ │ │ ├── main.js │ │ │ │ ├── internal-module.js │ │ │ │ └── package.json │ │ │ ├── package-exports-main │ │ │ │ ├── main.js │ │ │ │ ├── root-export.js │ │ │ │ └── package.json │ │ │ ├── package-exports │ │ │ │ ├── not-allowed.js │ │ │ │ ├── root-export.js │ │ │ │ ├── dist │ │ │ │ │ ├── exported-module.js │ │ │ │ │ └── wildcard │ │ │ │ │ │ └── module.js │ │ │ │ └── package.json │ │ │ ├── package-exports-sugar │ │ │ │ ├── root-export.js │ │ │ │ └── package.json │ │ │ └── package-exports-conditions │ │ │ │ ├── root-export.js │ │ │ │ ├── dist │ │ │ │ ├── exported-module.js │ │ │ │ └── wildcard │ │ │ │ │ └── module.js │ │ │ │ └── package.json │ │ │ └── package.json │ └── logging.ts └── deno.json ├── tests ├── fixtures │ ├── dist-dir │ │ ├── .gitignore │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── other │ │ │ │ └── page.js │ │ │ ├── redirect │ │ │ │ ├── route.js │ │ │ │ └── response │ │ │ │ │ └── route.js │ │ │ ├── api │ │ │ │ └── url │ │ │ │ │ └── route.js │ │ │ ├── page.js │ │ │ ├── layout.js │ │ │ ├── image │ │ │ │ └── page.js │ │ │ └── stale-cache-serving │ │ │ │ └── app-page │ │ │ │ └── page.js │ │ ├── next.config.js │ │ └── package.json │ ├── turborepo-npm │ │ ├── .npmrc │ │ ├── apps │ │ │ ├── page-router │ │ │ │ ├── .env │ │ │ │ ├── test.cjs │ │ │ │ ├── .env.local │ │ │ │ ├── .env.production │ │ │ │ ├── .env.production.local │ │ │ │ ├── next-env.d.ts │ │ │ │ ├── pages │ │ │ │ │ └── api │ │ │ │ │ │ ├── revalidate.js │ │ │ │ │ │ └── env.js │ │ │ │ ├── tsconfig.json │ │ │ │ └── next.config.js │ │ │ ├── docs │ │ │ │ ├── next.config.js │ │ │ │ ├── app │ │ │ │ │ ├── favicon.ico │ │ │ │ │ └── layout.tsx │ │ │ │ ├── next-env.d.ts │ │ │ │ ├── .eslintrc.js │ │ │ │ └── tsconfig.json │ │ │ └── web │ │ │ │ ├── next.config.js │ │ │ │ ├── app │ │ │ │ ├── favicon.ico │ │ │ │ └── layout.tsx │ │ │ │ ├── next-env.d.ts │ │ │ │ ├── .eslintrc.js │ │ │ │ └── tsconfig.json │ │ ├── tsconfig.json │ │ ├── packages │ │ │ ├── dep-a │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── dep-b │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── eslint-config │ │ │ │ └── README.md │ │ │ ├── ui │ │ │ │ ├── turbo.json │ │ │ │ ├── tsconfig.json │ │ │ │ ├── tsconfig.lint.json │ │ │ │ ├── src │ │ │ │ │ ├── code.tsx │ │ │ │ │ └── button.tsx │ │ │ │ ├── turbo │ │ │ │ │ └── generators │ │ │ │ │ │ └── templates │ │ │ │ │ │ └── component.hbs │ │ │ │ └── .eslintrc.js │ │ │ └── typescript-config │ │ │ │ ├── package.json │ │ │ │ ├── react-library.json │ │ │ │ └── nextjs.json │ │ ├── .eslintrc.js │ │ ├── turbo.json │ │ └── .gitignore │ ├── pnpm │ │ ├── .npmrc │ │ ├── app │ │ │ ├── page.js │ │ │ ├── other │ │ │ │ └── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── simple │ │ ├── static │ │ │ ├── words.txt │ │ │ └── prebuilt.html │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── other │ │ │ │ └── page.js │ │ │ ├── route-resolves-to-not-found │ │ │ │ └── page.js │ │ │ ├── api │ │ │ │ ├── url │ │ │ │ │ └── route.js │ │ │ │ ├── cjs-file-with-js-extension │ │ │ │ │ ├── bundled.cjs │ │ │ │ │ └── route.js │ │ │ │ ├── static │ │ │ │ │ └── route.js │ │ │ │ ├── cached-permanent │ │ │ │ │ └── route.js │ │ │ │ └── cached-revalidate │ │ │ │ │ └── route.js │ │ │ ├── not-found.js │ │ │ ├── page.js │ │ │ ├── redirect │ │ │ │ ├── route.js │ │ │ │ └── response │ │ │ │ │ └── route.js │ │ │ ├── config-rewrite │ │ │ │ ├── dest │ │ │ │ │ └── page.js │ │ │ │ └── page.js │ │ │ ├── config-redirect │ │ │ │ ├── dest │ │ │ │ │ └── page.js │ │ │ │ └── page.js │ │ │ ├── app-redirect │ │ │ │ ├── dest │ │ │ │ │ └── page.js │ │ │ │ └── [slug] │ │ │ │ │ └── page.js │ │ │ ├── .well-known │ │ │ │ └── farcaster │ │ │ │ │ └── route.js │ │ │ ├── layout.js │ │ │ ├── image │ │ │ │ ├── local │ │ │ │ │ └── page.js │ │ │ │ ├── remote-domain │ │ │ │ │ └── page.js │ │ │ │ ├── remote-pattern-1 │ │ │ │ │ └── page.js │ │ │ │ ├── remote-pattern-2 │ │ │ │ │ └── page.js │ │ │ │ └── migration-from-v4-runtime │ │ │ │ │ └── page.js │ │ │ ├── unstable_cache │ │ │ │ └── page.js │ │ │ └── stale-cache-serving │ │ │ │ └── app-page │ │ │ │ └── page.js │ │ ├── cjs-file-with-js-extension.js │ │ ├── pages │ │ │ └── fully-static.js │ │ └── package.json │ ├── nx-integrated │ │ ├── apps │ │ │ ├── next-app │ │ │ │ ├── public │ │ │ │ │ ├── .gitkeep │ │ │ │ │ └── favicon.ico │ │ │ │ ├── static │ │ │ │ │ └── words.txt │ │ │ │ ├── app │ │ │ │ │ ├── page.module.css │ │ │ │ │ ├── api │ │ │ │ │ │ ├── hello │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ └── static │ │ │ │ │ │ │ └── route.js │ │ │ │ │ └── layout.tsx │ │ │ │ ├── netlify.toml │ │ │ │ ├── index.d.ts │ │ │ │ ├── next-env.d.ts │ │ │ │ └── tsconfig.spec.json │ │ │ └── custom-dist-dir │ │ │ │ ├── .env │ │ │ │ ├── .env.local │ │ │ │ ├── .env.production │ │ │ │ ├── .env.production.local │ │ │ │ ├── app │ │ │ │ ├── other │ │ │ │ │ └── page.js │ │ │ │ ├── redirect │ │ │ │ │ ├── route.js │ │ │ │ │ └── response │ │ │ │ │ │ └── route.js │ │ │ │ ├── api │ │ │ │ │ ├── url │ │ │ │ │ │ └── route.js │ │ │ │ │ └── env │ │ │ │ │ │ └── route.ts │ │ │ │ ├── page.js │ │ │ │ ├── layout.js │ │ │ │ └── image │ │ │ │ │ └── page.js │ │ │ │ ├── public │ │ │ │ └── squirrel.jpg │ │ │ │ ├── next-env.d.ts │ │ │ │ └── tsconfig.spec.json │ │ └── .npmrc │ ├── skew-protection │ │ ├── public │ │ │ ├── variant-b.txt │ │ │ ├── variant.txt │ │ │ ├── local-image.png │ │ │ └── local-image-b.png │ │ ├── variant-config-b.mjs │ │ ├── variant-config.mjs │ │ ├── app │ │ │ ├── dynamic-import │ │ │ │ └── dynamically-imported-module.js │ │ │ ├── app-router │ │ │ │ ├── actions.js │ │ │ │ ├── route-handler │ │ │ │ │ └── route.js │ │ │ │ └── linked │ │ │ │ │ ├── client-component.js │ │ │ │ │ └── page.js │ │ │ ├── layout.js │ │ │ ├── middleware │ │ │ │ └── [slug] │ │ │ │ │ └── page.js │ │ │ └── next-config │ │ │ │ └── [slug] │ │ │ │ └── page.js │ │ ├── pages │ │ │ ├── api │ │ │ │ └── api-route.js │ │ │ └── pages-router │ │ │ │ └── linked-static.js │ │ ├── test-variants.json │ │ └── package.json │ ├── netlify-forms │ │ ├── public │ │ │ └── form.html │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next-env.d.ts │ │ ├── next.config.js │ │ └── package.json │ ├── output-export-custom-dist │ │ ├── .gitignore │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── turborepo │ │ ├── .npmrc │ │ ├── pnpm-workspace.yaml │ │ ├── tsconfig.json │ │ ├── packages │ │ │ ├── dep-a │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── dep-b │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── ui │ │ │ │ ├── turbo.json │ │ │ │ ├── tsconfig.json │ │ │ │ ├── tsconfig.lint.json │ │ │ │ ├── src │ │ │ │ │ ├── code.tsx │ │ │ │ │ └── button.tsx │ │ │ │ └── turbo │ │ │ │ │ └── generators │ │ │ │ │ └── templates │ │ │ │ │ └── component.hbs │ │ │ └── typescript-config │ │ │ │ ├── package.json │ │ │ │ ├── react-library.json │ │ │ │ └── nextjs.json │ │ ├── .vscode │ │ │ └── settings.json │ │ ├── apps │ │ │ ├── web │ │ │ │ ├── app │ │ │ │ │ ├── favicon.ico │ │ │ │ │ └── layout.tsx │ │ │ │ ├── next.config.js │ │ │ │ ├── next-env.d.ts │ │ │ │ └── tsconfig.json │ │ │ ├── docs │ │ │ │ ├── app │ │ │ │ │ ├── favicon.ico │ │ │ │ │ └── layout.tsx │ │ │ │ ├── next.config.js │ │ │ │ ├── next-env.d.ts │ │ │ │ └── tsconfig.json │ │ │ └── page-router │ │ │ │ ├── next-env.d.ts │ │ │ │ ├── src │ │ │ │ └── pages │ │ │ │ │ └── api │ │ │ │ │ └── revalidate.js │ │ │ │ ├── tsconfig.json │ │ │ │ └── next.config.js │ │ ├── turbo.json │ │ └── package.json │ ├── page-router │ │ ├── .env │ │ ├── .env.local │ │ ├── .env.production │ │ ├── .env.production.local │ │ ├── pages │ │ │ ├── 404.js │ │ │ ├── api │ │ │ │ ├── sleep-5.js │ │ │ │ ├── unstable-cache-node.js │ │ │ │ ├── revalidate.js │ │ │ │ └── env.js │ │ │ └── static │ │ │ │ ├── fully-static.js │ │ │ │ └── not-found.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-i18n │ │ ├── middleware.ts │ │ ├── pages │ │ │ ├── api │ │ │ │ └── ok.js │ │ │ ├── new-home.js │ │ │ ├── link │ │ │ │ ├── next-fullystatic.js │ │ │ │ ├── rewrite-target-fullystatic.js │ │ │ │ ├── next-getstaticprops.js │ │ │ │ ├── rewrite-target-getstaticprops.js │ │ │ │ ├── next-getserversideprops.js │ │ │ │ └── rewrite-target-getserversideprops.js │ │ │ ├── _app.js │ │ │ └── dynamic │ │ │ │ └── [slug].js │ │ ├── middleware-node.ts │ │ ├── package.json │ │ └── test-variants.json │ ├── middleware-pages │ │ ├── middleware.ts │ │ ├── pages │ │ │ ├── [id].js │ │ │ ├── about │ │ │ │ ├── a.js │ │ │ │ └── b.js │ │ │ ├── api │ │ │ │ ├── headers.js │ │ │ │ └── edge-headers.js │ │ │ ├── link │ │ │ │ ├── next-fullystatic.js │ │ │ │ ├── rewrite-target-fullystatic.js │ │ │ │ ├── next-getstaticprops.js │ │ │ │ ├── next-getserversideprops.js │ │ │ │ ├── rewrite-target-getstaticprops.js │ │ │ │ └── rewrite-target-getserversideprops.js │ │ │ ├── ssr-page.js │ │ │ ├── ssr-page-2.js │ │ │ ├── error.js │ │ │ ├── _app.js │ │ │ ├── error-throw.js │ │ │ └── html-links.js │ │ ├── middleware-node.ts │ │ ├── next-env.d.ts │ │ ├── test-variants.json │ │ ├── package.json │ │ └── tsconfig.json │ ├── netlify-forms-workaround │ │ ├── public │ │ │ └── form.html │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-static-asset-matcher │ │ ├── public │ │ │ └── hello │ │ │ │ └── world.txt │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── middleware.ts │ │ ├── middleware-node.ts │ │ ├── next.config.js │ │ ├── package.json │ │ ├── middleware-shared.ts │ │ └── test-variants.json │ ├── middleware-trailing-slash │ │ ├── middleware.ts │ │ ├── app │ │ │ ├── page.js │ │ │ ├── other │ │ │ │ └── page.js │ │ │ ├── test │ │ │ │ ├── redirect │ │ │ │ │ └── page.js │ │ │ │ ├── rewrite │ │ │ │ │ └── page.js │ │ │ │ └── next │ │ │ │ │ └── page.js │ │ │ └── layout.js │ │ ├── middleware-node.ts │ │ ├── package.json │ │ ├── next.config.js │ │ └── test-variants.json │ ├── middleware-i18n-skip-normalize │ │ ├── middleware.ts │ │ ├── pages │ │ │ ├── api │ │ │ │ └── ok.js │ │ │ ├── new-home.js │ │ │ ├── _app.js │ │ │ └── dynamic │ │ │ │ └── [slug].js │ │ ├── middleware-node.ts │ │ ├── package.json │ │ └── test-variants.json │ ├── middleware-node-runtime-specific │ │ ├── public │ │ │ └── http-test-target.json │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── wasm │ │ ├── pages │ │ │ ├── index.js │ │ │ └── api │ │ │ │ └── og-wrong-runtime.js │ │ ├── add.wasm │ │ ├── app │ │ │ ├── og-node │ │ │ │ └── route.js │ │ │ └── og │ │ │ │ └── route.js │ │ ├── package.json │ │ └── middleware.js │ ├── wasm-src │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── index.js │ │ │ │ └── api │ │ │ │ │ └── og-wrong-runtime.js │ │ │ ├── add.wasm │ │ │ └── app │ │ │ │ ├── og-node │ │ │ │ └── route.js │ │ │ │ └── og │ │ │ │ └── route.js │ │ └── package.json │ ├── dynamic-cms │ │ ├── pages │ │ │ ├── 404.js │ │ │ └── api │ │ │ │ └── revalidate.js │ │ ├── README.md │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-og │ │ ├── app │ │ │ ├── opengraph-image.js │ │ │ ├── page.js │ │ │ ├── layout.js │ │ │ └── og.js │ │ ├── next.config.js │ │ └── package.json │ ├── ppr │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ └── package.json │ ├── server-components │ │ ├── app │ │ │ ├── dynamic-fetch │ │ │ │ └── loading.js │ │ │ ├── api │ │ │ │ ├── zero-length-response │ │ │ │ │ └── route.ts │ │ │ │ ├── static │ │ │ │ │ └── [slug] │ │ │ │ │ │ └── route.ts │ │ │ │ ├── revalidate-handler │ │ │ │ │ └── route.ts │ │ │ │ └── on-demand-revalidate │ │ │ │ │ └── path │ │ │ │ │ └── route.ts │ │ │ ├── layout.js │ │ │ └── page.js │ │ ├── next-env.d.ts │ │ ├── next.config.js │ │ └── package.json │ ├── base-path │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── other │ │ │ │ └── page.js │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware │ │ ├── app │ │ │ ├── page.js │ │ │ ├── other │ │ │ │ └── page.js │ │ │ ├── test │ │ │ │ ├── rewrite-target │ │ │ │ │ └── page.js │ │ │ │ ├── redirect │ │ │ │ │ └── page.js │ │ │ │ ├── rewrite │ │ │ │ │ └── page.js │ │ │ │ └── next │ │ │ │ │ └── page.js │ │ │ ├── caching-redirect-target │ │ │ │ └── page.js │ │ │ ├── caching-rewrite-target │ │ │ │ └── page.js │ │ │ ├── layout.js │ │ │ ├── link-to-rewrite-to-cached-page │ │ │ │ └── page.js │ │ │ └── link-to-redirect-to-cached-page │ │ │ │ └── page.js │ │ ├── middleware.ts │ │ ├── middleware-node.ts │ │ └── package.json │ ├── output-export │ │ ├── public │ │ │ └── squirrel.jpg │ │ ├── app │ │ │ ├── page.js │ │ │ ├── layout.js │ │ │ └── image │ │ │ │ └── local │ │ │ │ └── page.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-src │ │ ├── src │ │ │ ├── app │ │ │ │ ├── page.js │ │ │ │ ├── layout.js │ │ │ │ └── test │ │ │ │ │ └── next │ │ │ │ │ └── page.js │ │ │ ├── middleware.ts │ │ │ └── middleware-node.ts │ │ ├── next.config.js │ │ ├── package.json │ │ └── test-variants.json │ ├── revalidate-fetch │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-conditions │ │ ├── pages │ │ │ ├── index.js │ │ │ ├── other.js │ │ │ └── test │ │ │ │ ├── redirect.js │ │ │ │ ├── rewrite.js │ │ │ │ └── next.js │ │ ├── package.json │ │ ├── middleware.ts │ │ ├── middleware-node.ts │ │ ├── next.config.js │ │ └── test-variants.json │ ├── middleware-node-unsupported-cpp-addons │ │ ├── app │ │ │ ├── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ └── package.json │ ├── middleware-subrequest-vuln │ │ ├── app │ │ │ ├── [[...wildcard]] │ │ │ │ └── page.js │ │ │ └── layout.js │ │ ├── next.config.js │ │ ├── middleware.ts │ │ └── package.json │ ├── hello-world-turbopack │ │ ├── app │ │ │ ├── layout.js │ │ │ ├── page.js │ │ │ └── edge-page │ │ │ │ └── page.js │ │ ├── next.config.ts │ │ ├── middleware.ts │ │ └── package.json │ ├── page-router-base-path-i18n │ │ ├── pages │ │ │ ├── static │ │ │ │ └── not-found.js │ │ │ └── 404.js │ │ ├── package.json │ │ └── next.config.js │ ├── advanced-api-routes │ │ ├── next-env.d.ts │ │ ├── pages │ │ │ └── api │ │ │ │ ├── hello-background.ts │ │ │ │ └── hello-scheduled.js │ │ ├── next.config.js │ │ ├── package.json │ │ └── tsconfig.json │ ├── use-cache │ │ ├── next-env.d.ts │ │ ├── app │ │ │ └── layout.js │ │ └── package.json │ ├── after │ │ ├── next.config.js │ │ ├── app │ │ │ ├── layout.js │ │ │ └── after │ │ │ │ └── check │ │ │ │ └── page.js │ │ └── package.json │ ├── cli-before-regional-blobs-support │ │ ├── next.config.js │ │ ├── pages │ │ │ └── index.js │ │ └── package.json │ ├── middleware-i18n-excluded-paths │ │ ├── next-env.d.ts │ │ ├── pages │ │ │ └── api │ │ │ │ └── [[...catchall]].ts │ │ ├── next.config.js │ │ ├── test-variants.json │ │ └── package.json │ ├── next-16-tag-revalidation │ │ ├── next-env.d.ts │ │ ├── app │ │ │ └── layout.js │ │ └── next.config.js │ ├── page-router-404-get-static-props-with-revalidate │ │ ├── next.config.js │ │ ├── package.json │ │ └── pages │ │ │ └── 404.js │ └── proxy-i18n-skip-normalize │ │ ├── pages │ │ └── dynamic │ │ │ └── [slug].js │ │ └── package.json ├── netlify-e2e-legacy.json ├── index.ts ├── utils │ ├── constants.mjs │ └── index.ts ├── smoke │ └── fixtures │ │ ├── yarn-monorepo-with-pnpm-linker │ │ ├── .yarnrc.yml │ │ ├── packages │ │ │ └── ui │ │ │ │ ├── src │ │ │ │ └── test.jsx │ │ │ │ └── package.json │ │ ├── apps │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── package.json │ │ │ │ └── pages │ │ │ │ └── index.js │ │ └── package.json │ │ ├── pnpm-monorepo-base-proxy │ │ ├── pnpm-workspace.yaml │ │ ├── package.json │ │ ├── netlify.toml │ │ └── app │ │ │ ├── next.config.js │ │ │ ├── proxy.ts │ │ │ ├── package.json │ │ │ └── pages │ │ │ └── index.js │ │ ├── npm-monorepo-proxy │ │ ├── apps │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── pages │ │ │ │ └── index.js │ │ │ │ ├── proxy.ts │ │ │ │ └── package.json │ │ └── package.json │ │ ├── npm-monorepo-empty-base │ │ ├── packages │ │ │ └── ui │ │ │ │ ├── src │ │ │ │ └── test.jsx │ │ │ │ └── package.json │ │ ├── apps │ │ │ └── site │ │ │ │ ├── netlify.toml │ │ │ │ ├── next.config.js │ │ │ │ ├── package.json │ │ │ │ └── pages │ │ │ │ └── index.js │ │ └── package.json │ │ ├── next-12.0.3 │ │ ├── next.config.js │ │ ├── pages │ │ │ └── index.js │ │ └── package.json │ │ ├── next-12.1.0 │ │ ├── next.config.js │ │ ├── pages │ │ │ └── index.js │ │ └── package.json │ │ ├── npm-monorepo-site-created-at-build │ │ ├── mock-download │ │ │ ├── packages │ │ │ │ └── ui │ │ │ │ │ ├── src │ │ │ │ │ └── test.jsx │ │ │ │ │ └── package.json │ │ │ └── apps │ │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── package.json │ │ │ │ └── pages │ │ │ │ └── index.js │ │ ├── netlify.toml │ │ ├── package.json │ │ └── pre-deploy.mjs │ │ ├── yarn-monorepo-multiple-next-versions-site-compatible │ │ ├── packages │ │ │ └── ui │ │ │ │ ├── src │ │ │ │ └── test.jsx │ │ │ │ └── package.json │ │ ├── apps │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── package.json │ │ │ │ └── pages │ │ │ │ └── index.js │ │ └── package.json │ │ ├── yarn-monorepo-multiple-next-versions-site-incompatible │ │ ├── packages │ │ │ └── ui │ │ │ │ ├── src │ │ │ │ └── test.jsx │ │ │ │ └── package.json │ │ ├── apps │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── pages │ │ │ │ └── index.js │ │ │ │ └── package.json │ │ └── package.json │ │ ├── npm-nested-site-multiple-next-version-site-compatible │ │ ├── apps │ │ │ └── site │ │ │ │ ├── next.config.js │ │ │ │ ├── package.json │ │ │ │ └── pages │ │ │ │ └── index.js │ │ └── package.json │ │ └── npm-nested-site-multiple-next-version-site-incompatible │ │ ├── apps │ │ └── site │ │ │ ├── next.config.js │ │ │ ├── pages │ │ │ └── index.js │ │ │ └── package.json │ │ └── package.json ├── test-setup-e2e.ts ├── playwright-slack-conf.json └── e2e-utils.patch ├── manifest.yml ├── e2e-report ├── README.md ├── public │ ├── favicon.ico │ └── MulishVar-latin.woff2 ├── jsconfig.json ├── postcss.config.js ├── netlify.toml ├── next.config.mjs ├── app │ └── layout.js ├── utils │ └── consts.js ├── eslint.config.js ├── tailwind.config.js └── .gitignore ├── report └── netlify.toml ├── .release-please-manifest.json ├── .github ├── CODEOWNERS └── .kodiak.toml ├── .eslintignore ├── next-js-runtime.png ├── .vscode └── settings.json ├── .prettierrc.cjs ├── renovate.json ├── .editorconfig ├── release-please-config.json ├── .prettierignore ├── src └── run │ └── constants.ts ├── tsconfig.json ├── tools └── vendor-deno-tools.js └── .gitignore /turbofan/netlify.toml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /edge-runtime/matchers.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /edge-runtime/next.config.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/.gitignore: -------------------------------------------------------------------------------- 1 | cool -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/.npmrc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/netlify-e2e-legacy.json: -------------------------------------------------------------------------------- 1 | null 2 | -------------------------------------------------------------------------------- /manifest.yml: -------------------------------------------------------------------------------- 1 | name: '@netlify/plugin-nextjs' 2 | -------------------------------------------------------------------------------- /e2e-report/README.md: -------------------------------------------------------------------------------- 1 | # Next Runtime v5 Report 2 | -------------------------------------------------------------------------------- /report/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "." 3 | -------------------------------------------------------------------------------- /tests/fixtures/pnpm/.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | -------------------------------------------------------------------------------- /tests/fixtures/simple/static/words.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /tests/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils/index.js' 2 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/public/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/public/variant-b.txt: -------------------------------------------------------------------------------- 1 | B 2 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/public/variant.txt: -------------------------------------------------------------------------------- 1 | A 2 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "5.15.3" 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/public/form.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/.gitignore: -------------------------------------------------------------------------------- 1 | custom-dist -------------------------------------------------------------------------------- /tests/fixtures/turborepo/.npmrc: -------------------------------------------------------------------------------- 1 | public-hoist-pattern[]=* 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @opennextjs/netlify-frameworks-and-build 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/.gitignore: -------------------------------------------------------------------------------- 1 | !node_modules 2 | !dist 3 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/.env: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV="defined in .env" 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | demo/ 3 | tests/ 4 | edge-runtime 5 | tools/deno -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/static/words.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /tests/utils/constants.mjs: -------------------------------------------------------------------------------- 1 | export const BLOB_TOKEN = 'secret-token' 2 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/app/page.module.css: -------------------------------------------------------------------------------- 1 | .page { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/.env.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_LOCAL="defined in .env.local" 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/.env: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV="defined in .env" 2 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: pnpm 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package/index.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/.env: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV="defined in .env" 2 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'app' 3 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-main/main.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms-workaround/public/form.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'apps/*' 3 | - 'packages/*' 4 | -------------------------------------------------------------------------------- /tests/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './helpers.js' 2 | export * from './mock-file-system.js' 3 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-main/main.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package/internal-module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /next-js-runtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/next-js-runtime.png -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/public/hello/world.txt: -------------------------------------------------------------------------------- 1 | hello from a static asset 2 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/.env.production: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION="defined in .env.production" 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/test.cjs: -------------------------------------------------------------------------------- 1 | console.log(require.resolve('styled-jsx')) 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/base.json" 3 | } 4 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports/not-allowed.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports/root-export.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-main/internal-module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/.env.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_LOCAL="defined in .env.local" 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/base.json" 3 | } 4 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-main/root-export.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-sugar/root-export.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports/dist/exported-module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports/dist/wildcard/module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-runtime-specific/public/http-test-target.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "world" 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/.env.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_LOCAL="defined in .env.local" 2 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return

hello world

3 | } 4 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-conditions/root-export.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/src/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return

hello world

3 | } 4 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "monorepo", 3 | "private": true 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enablePaths": ["tools/deno", "edge-runtime"], 3 | "deno.unstable": true 4 | } 5 | -------------------------------------------------------------------------------- /e2e-report/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/e2e-report/public/favicon.ico -------------------------------------------------------------------------------- /tests/fixtures/dynamic-cms/pages/404.js: -------------------------------------------------------------------------------- 1 | export default function NotFound() { 2 | return

Custom 404 page

3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/api/ok.js: -------------------------------------------------------------------------------- 1 | export default function handler(req, res) { 2 | res.send('ok') 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/variant-config-b.mjs: -------------------------------------------------------------------------------- 1 | export const variant = 'B' 2 | export const remoteImage = 'pixabay' 3 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/variant-config.mjs: -------------------------------------------------------------------------------- 1 | export const variant = 'A' 2 | export const remoteImage = 'unsplash' 3 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/.env.production: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION="defined in .env.production" 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/dep-a/index.js: -------------------------------------------------------------------------------- 1 | import lodash from 'lodash' 2 | 3 | export default lodash.VERSION 4 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/dep-b/index.js: -------------------------------------------------------------------------------- 1 | import lodash from 'lodash' 2 | 3 | export default lodash.VERSION 4 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/dep-a/index.js: -------------------------------------------------------------------------------- 1 | import lodash from 'lodash' 2 | 3 | export default lodash.VERSION 4 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/dep-b/index.js: -------------------------------------------------------------------------------- 1 | import lodash from 'lodash' 2 | 3 | export default lodash.VERSION 4 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/add.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/wasm/add.wasm -------------------------------------------------------------------------------- /e2e-report/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "@/*": ["./*"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-conditions/dist/exported-module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-conditions/dist/wildcard/module.js: -------------------------------------------------------------------------------- 1 | module.exports = __filename 2 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-sugar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": "./root-export.js" 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/dynamic-cms/README.md: -------------------------------------------------------------------------------- 1 | This fixture is meant to emulate dynamic content responses of a CMS-backed next site 2 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/app/opengraph-image.js: -------------------------------------------------------------------------------- 1 | export const alt = 'Open Graph' 2 | 3 | export { default } from './og' 4 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false 2 | auto-install-peers=true 3 | public-hoist-pattern[]=* 4 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/.env.production: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION="defined in .env.production" 2 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/.env.production.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL="defined in .env.production.local" 2 | -------------------------------------------------------------------------------- /.prettierrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@netlify/eslint-config-node/.prettierrc.json'), 3 | printWidth: 100, 4 | } 5 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cjs-fixture", 3 | "private": true, 4 | "type": "commonjs" 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/dynamic-import/dynamically-imported-module.js: -------------------------------------------------------------------------------- 1 | export const variant = process.env.SKEW_VARIANT 2 | -------------------------------------------------------------------------------- /e2e-report/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/pages/api/ok.js: -------------------------------------------------------------------------------- 1 | export default function handler(req, res) { 2 | res.send('ok') 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/src/add.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/wasm-src/src/add.wasm -------------------------------------------------------------------------------- /e2e-report/public/MulishVar-latin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/e2e-report/public/MulishVar-latin.woff2 -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/[id].js: -------------------------------------------------------------------------------- 1 | export default function Index() { 2 | return

Dynamic route

3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/ppr/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/ppr/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/dynamic-fetch/loading.js: -------------------------------------------------------------------------------- 1 | export default function Loading() { 2 | return

Loading Data...

3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/simple/static/prebuilt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello static html NOT produced by Next.js 4 | 5 | 6 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["local>netlify/renovate-config"] 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/.env.production.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL="defined in .env.production.local" 2 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/404.js: -------------------------------------------------------------------------------- 1 | export default function NotFound() { 2 | return

Custom 404 page

3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/simple/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/simple/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/.env.production.local: -------------------------------------------------------------------------------- 1 | FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL="defined in .env.production.local" 2 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/eslint-config/README.md: -------------------------------------------------------------------------------- 1 | # `@turbo/eslint-config` 2 | 3 | Collection of internal eslint configurations. 4 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.workingDirectories": [ 3 | { 4 | "mode": "auto" 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/base-path/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/base-path/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/dist-dir/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/pnpm/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/pages/api/api-route.js: -------------------------------------------------------------------------------- 1 | export default function handler(_req, res) { 2 | res.send(process.env.SKEW_VARIANT) 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/netlify.toml: -------------------------------------------------------------------------------- 1 | [functions] 2 | directory = "netlify/functions" 3 | included_files = ["apps/next-app/static/**"] 4 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "package-main", 3 | "main": "./main.js", 4 | "type": "commonjs" 5 | } 6 | -------------------------------------------------------------------------------- /edge-runtime/lib/logging.ts: -------------------------------------------------------------------------------- 1 | export { 2 | logger, 3 | LogLevel, 4 | StructuredLogger, 5 | } from '../vendor/v1-7-0--edge-utils.netlify.app/logger/mod.ts' 6 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/test/:path*', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/output-export/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/pnpm/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/app-router/actions.js: -------------------------------------------------------------------------------- 1 | 'use server' 2 | 3 | export async function testAction() { 4 | return process.env.SKEW_VARIANT 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/web/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/turborepo/apps/web/app/favicon.ico -------------------------------------------------------------------------------- /e2e-report/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "e2e-report/" 3 | command = "next build" 4 | publish = ".next" 5 | 6 | [[plugins]] 7 | package = "@netlify/plugin-nextjs" -------------------------------------------------------------------------------- /tests/fixtures/base-path/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | runtime: 'nodejs', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | runtime: 'nodejs', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/src/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/app/api/hello/route.ts: -------------------------------------------------------------------------------- 1 | export async function GET(request: Request) { 2 | return new Response('Hello, from API!') 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/revalidate-fetch/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/app-router/route-handler/route.js: -------------------------------------------------------------------------------- 1 | export const GET = async (req) => { 2 | return new Response(process.env.SKEW_VARIANT) 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | transpilePackages: ['@repo/ui'], 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | transpilePackages: ['@repo/ui'], 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/docs/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/turborepo/apps/docs/app/favicon.ico -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./main.js", 3 | "exports": { 4 | ".": "./root-export.js" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/pages/other.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/about/a.js: -------------------------------------------------------------------------------- 1 | export default function AboutA() { 2 | return ( 3 |
4 |

AboutA

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/about/b.js: -------------------------------------------------------------------------------- 1 | export default function AboutB() { 2 | return ( 3 |
4 |

AboutB

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/src/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/test/:path*', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/public/local-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/skew-protection/public/local-image.png -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/turborepo-npm/apps/docs/app/favicon.ico -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/turborepo-npm/apps/web/app/favicon.ico -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | runtime: 'nodejs', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/public/local-image-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/skew-protection/public/local-image-b.png -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/dep-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/dep-a", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "lodash": "3.10.1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | runtime: 'nodejs', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-runtime-specific/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/route-resolves-to-not-found/page.js: -------------------------------------------------------------------------------- 1 | import { notFound } from 'next/navigation' 2 | 3 | export default async function Page() { 4 | notFound() 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/dep-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/dep-a", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "lodash": "3.10.1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/dep-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/dep-b", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "lodash": "4.17.21" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/dep-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/dep-b", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "lodash": "4.17.21" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /e2e-report/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | outputFileTracingRoot: import.meta.dirname, 4 | } 5 | 6 | export default nextConfig 7 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/redirect/route.js: -------------------------------------------------------------------------------- 1 | import { redirect } from 'next/navigation' 2 | 3 | export async function GET() { 4 | return redirect('https://www.netlify.com/') 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-unsupported-cpp-addons/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/hello/world.txt', 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-subrequest-vuln/app/[[...wildcard]]/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Hi

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/nx-integrated/apps/next-app/public/favicon.ico -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/output-export-custom-dist/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/api/zero-length-response/route.ts: -------------------------------------------------------------------------------- 1 | export async function GET() { 2 | return new Response('') 3 | } 4 | 5 | export const dynamic = 'force-static' 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/test/rewrite-target/page.js: -------------------------------------------------------------------------------- 1 | export default function Rewrite() { 2 | return ( 3 |
4 |

Hello rewrite

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/test/:path*', 5 | runtime: 'nodejs', 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/other/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Other

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /.github/.kodiak.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [merge.automerge_dependencies] 4 | versions = ["minor", "patch"] 5 | usernames = ["renovate"] 6 | 7 | [approve] 8 | auto_approve_usernames = ["renovate"] -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/api/url/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET(request) { 4 | return NextResponse.json({ url: request.url }) 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/url/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET(request) { 4 | return NextResponse.json({ url: request.url }) 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/src/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/test/:path*', 5 | runtime: 'nodejs', 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 | 5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/public/squirrel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opennextjs/opennextjs-netlify/HEAD/tests/fixtures/nx-integrated/apps/custom-dist-dir/public/squirrel.jpg -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "app" 3 | command = "pnpm run build" 4 | publish = ".next" 5 | 6 | [[plugins]] 7 | package = "@netlify/plugin-nextjs" 8 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-proxy/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | } 5 | 6 | module.exports = nextConfig 7 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/app/layout.js: -------------------------------------------------------------------------------- 1 | export default function RootLayout({ children }) { 2 | return ( 3 | 4 | {children} 5 | 6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/app/page.js: -------------------------------------------------------------------------------- 1 | import { connection } from 'next/server' 2 | 3 | export default async function Page() { 4 | await connection() 5 | return

Hello, Next.js!

6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/new-home.js: -------------------------------------------------------------------------------- 1 | export default function Account() { 2 | return ( 3 |

4 | Welcome to a new page 5 |

6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/test/redirect/page.js: -------------------------------------------------------------------------------- 1 | export default function Redirect() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/test/rewrite/page.js: -------------------------------------------------------------------------------- 1 | export default function Rewrite() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/redirect/route.js: -------------------------------------------------------------------------------- 1 | import { redirect } from 'next/navigation' 2 | 3 | export async function GET() { 4 | return redirect('https://www.netlify.com/') 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/api/sleep-5.js: -------------------------------------------------------------------------------- 1 | export default async function handler(req, res) { 2 | await new Promise((resolve) => setTimeout(resolve, 5000)) 3 | 4 | res.json({ message: 'ok' }) 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/static/fully-static.js: -------------------------------------------------------------------------------- 1 | const FullyStatic = () => ( 2 |
3 |

This page is not using getStaticProps()

4 |
5 | ) 6 | 7 | export default FullyStatic 8 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/not-found.js: -------------------------------------------------------------------------------- 1 | export default function NotFound() { 2 | return ( 3 |
4 |

404 Not Found

5 |

Custom Not Found Page

6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/packages/ui/src/test.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export const TestElement = ({ children, testid }) => { 4 | return
{children}
5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/api/headers.js: -------------------------------------------------------------------------------- 1 | export default function handler(req, res) { 2 | res.headers = { 'headers-from-function': '1' } 3 | res.json({ url: req.url, headers: req.headers }) 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: '/hello/world.txt', 5 | runtime: 'nodejs', 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms-workaround/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 | 5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/apps/site/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "" 3 | command = "npm run build" 4 | publish = "apps/site/.next" 5 | 6 | [[plugins]] 7 | package = "@netlify/plugin-nextjs" 8 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/redirect/response/route.js: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.redirect('https://www.netlify.com/') 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/pages/test/redirect.js: -------------------------------------------------------------------------------- 1 | export default function Redirect() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/pages/test/rewrite.js: -------------------------------------------------------------------------------- 1 | export default function Rewrite() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/api/url/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET(request) { 4 | return NextResponse.json({ url: request.url }) 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/docs/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | transpilePackages: ['@repo/ui'], 7 | } 8 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.0.3/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | } 7 | 8 | module.exports = nextConfig 9 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.1.0/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | } 7 | 8 | module.exports = nextConfig 9 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/packages/ui/src/test.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export const TestElement = ({ children, testid }) => { 4 | return
{children}
5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/pages/new-home.js: -------------------------------------------------------------------------------- 1 | export default function Account() { 2 | return ( 3 |

4 | Welcome to a new page 5 |

6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/test/redirect/page.js: -------------------------------------------------------------------------------- 1 | export default function Redirect() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/test/rewrite/page.js: -------------------------------------------------------------------------------- 1 | export default function Rewrite() { 2 | return ( 3 |
4 |

If middleware works, we shoudn't get here

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/ppr/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | max_line_length = 100 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/redirect/route.js: -------------------------------------------------------------------------------- 1 | import { redirect } from 'next/navigation' 2 | 3 | export async function GET() { 4 | return redirect('https://www.netlify.com/') 5 | } 6 | 7 | export const dynamic = 'force-dynamic' 8 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "outputs": ["dist/**"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/next-fullystatic.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

fully static page

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/next-fullystatic.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

fully static page

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "outputs": ["dist/**"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/mock-download/packages/ui/src/test.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export const TestElement = ({ children, testid }) => { 4 | return
{children}
5 | } 6 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/app/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | } 7 | 8 | module.exports = nextConfig 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-path/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare module '*.svg' { 3 | const content: any 4 | export const ReactComponent: any 5 | export default content 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/static/not-found.js: -------------------------------------------------------------------------------- 1 | const Show = () =>
Won't be used
2 | 3 | export async function getStaticProps() { 4 | return { 5 | notFound: true, 6 | } 7 | } 8 | 9 | export default Show 10 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/packages/ui/src/test.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export const TestElement = ({ children, testid }) => { 4 | return
{children}
5 | } 6 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/packages/ui/src/test.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export const TestElement = ({ children, testid }) => { 4 | return
{children}
5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/redirect/response/route.js: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.redirect('https://www.netlify.com/') 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/config-rewrite/dest/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Hello rewrite target

5 |
6 | ) 7 | } 8 | 9 | export const dynamic = 'force-static' 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/web/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | -------------------------------------------------------------------------------- /edge-runtime/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "lint": { 3 | "files": { 4 | "include": ["edge-runtime/middleware.ts"] 5 | } 6 | }, 7 | "imports": { 8 | "@netlify/edge-functions": "https://edge.netlify.com/v1/index.ts" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/rewrite-target-fullystatic.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

fully static page

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/rewrite-target-fullystatic.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

fully static page

5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/config-redirect/dest/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Hello redirect target

5 |
6 | ) 7 | } 8 | 9 | export const dynamic = 'force-static' 10 | -------------------------------------------------------------------------------- /turbofan/netlify/edge-functions/turbofan.ts: -------------------------------------------------------------------------------- 1 | export { handleRequest as default } from 'https://deno.land/x/turbofan/mod.ts' 2 | 3 | export const config = { 4 | method: ['GET', 'PUT'], 5 | path: '/v8/artifacts/:hash', 6 | cache: 'manual', 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/page.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 |

Home

5 | a cute squirrel 6 |
7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-base-path-i18n/pages/static/not-found.js: -------------------------------------------------------------------------------- 1 | const Show = () =>
Won't be used
2 | 3 | export async function getStaticProps() { 4 | return { 5 | notFound: true, 6 | } 7 | } 8 | 9 | export default Show 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/react-library.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/react-library.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "node setup-site.mjs && npm install && npm run build -w apps/site" 3 | publish = "./apps/site/.next" 4 | 5 | [[plugins]] 6 | package = "@netlify/plugin-nextjs" 7 | -------------------------------------------------------------------------------- /tests/test-setup-e2e.ts: -------------------------------------------------------------------------------- 1 | import { execaCommand } from 'execa' 2 | 3 | // build the runtime before running tests 4 | export default async () => { 5 | console.log(`🔨 Building runtime...`, process.cwd()) 6 | await execaCommand('npm run build') 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/app/edge-page/page.js: -------------------------------------------------------------------------------- 1 | import { connection } from 'next/server' 2 | 3 | export const runtime = 'edge' 4 | 5 | export default async function Page() { 6 | await connection() 7 | return

Hello, Next.js!

8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/app-redirect/dest/page.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

Hello next/navigation#redirect target

5 |
6 | ) 7 | } 8 | 9 | export const dynamic = 'force-static' 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/config-rewrite/page.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function Home() { 4 | return ( 5 |
6 | NextConfig.rewrite 7 |
8 | ) 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/typescript-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/typescript-config", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "MIT", 6 | "publishConfig": { 7 | "access": "public" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-proxy/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 |
4 | This should never render, because proxy/middleware always respond before handling pages 5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/caching-redirect-target/page.js: -------------------------------------------------------------------------------- 1 | export default function CachingRedirect() { 2 | return ( 3 |
4 |

Hello redirect target

5 |
6 | ) 7 | } 8 | 9 | export const dynamic = 'force-static' 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/caching-rewrite-target/page.js: -------------------------------------------------------------------------------- 1 | export default function CachingRewrite() { 2 | return ( 3 |
4 |

Hello rewrite target

5 |
6 | ) 7 | } 8 | 9 | export const dynamic = 'force-static' 10 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/.well-known/farcaster/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.json({ 5 | msg: 'Hi!', 6 | }) 7 | } 8 | 9 | export const dynamic = 'force-dynamic' 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/config-redirect/page.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function Home() { 4 | return ( 5 |
6 | NextConfig.redirect 7 |
8 | ) 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/redirect/response/route.js: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.redirect('https://www.netlify.com/') 5 | } 6 | 7 | export const dynamic = 'force-dynamic' 8 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/typescript-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@repo/typescript-config", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "MIT", 6 | "publishConfig": { 7 | "access": "public" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/web/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/typescript-config/react-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Library", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "jsx": "react-jsx" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/tsconfig.lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/react-library.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src", "turbo"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/typescript-config/react-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Library", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "jsx": "react-jsx" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/tsconfig.lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/react-library.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src", "turbo"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/docs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/src/code.tsx: -------------------------------------------------------------------------------- 1 | export function Code({ 2 | children, 3 | className, 4 | }: { 5 | children: React.ReactNode 6 | className?: string 7 | }): JSX.Element { 8 | return {children} 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/use-cache/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-proxy/apps/site/proxy.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server' 2 | import { NextResponse } from 'next/server' 3 | 4 | export async function proxy(request: NextRequest) { 5 | return NextResponse.json({ proxy: true }) 6 | } 7 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/app/proxy.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server' 2 | import { NextResponse } from 'next/server' 3 | 4 | export async function proxy(request: NextRequest) { 5 | return NextResponse.json({ proxy: true }) 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/src/code.tsx: -------------------------------------------------------------------------------- 1 | export function Code({ 2 | children, 3 | className, 4 | }: { 5 | children: React.ReactNode 6 | className?: string 7 | }): JSX.Element { 8 | return {children} 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/turbo/generators/templates/component.hbs: -------------------------------------------------------------------------------- 1 | export const 2 | {{pascalCase name}} 3 | = ({ children }: { children: React.ReactNode }) => { return ( 4 |
5 |

{{pascalCase name}} Component

6 | {children} 7 |
8 | ); }; -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/page-router/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/after/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/cli-before-regional-blobs-support/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | outputFileTracingRoot: __dirname, 7 | } 8 | 9 | module.exports = nextConfig 10 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-excluded-paths/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'export', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/api/edge-headers.js: -------------------------------------------------------------------------------- 1 | export const runtime = 'edge' 2 | 3 | export default (req) => { 4 | return Response.json(Object.fromEntries(req.headers.entries()), { 5 | headers: { 6 | 'headers-from-edge-function': '1', 7 | }, 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/ssr-page.js: -------------------------------------------------------------------------------- 1 | export default function SSRPage(props) { 2 | return

{props.message}

3 | } 4 | 5 | export const getServerSideProps = (req) => { 6 | return { 7 | props: { 8 | message: 'Hello World', 9 | }, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/revalidate-fetch/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | ".": "./root-export.js", 4 | "./exported-module.js": "./dist/exported-module.js", 5 | "./wildcard/*": "./dist/wildcard/*.js", 6 | "./wildcard/*.js": "./dist/wildcard/*.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/next.config.ts: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/ssr-page-2.js: -------------------------------------------------------------------------------- 1 | export default function SSRPage(props) { 2 | return

{props.message}

3 | } 4 | 5 | export const getServerSideProps = (req) => { 6 | return { 7 | props: { 8 | message: 'Bye Cruel World', 9 | }, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | module.exports = { 3 | root: true, 4 | extends: ['@repo/eslint-config/next.js'], 5 | parser: '@typescript-eslint/parser', 6 | parserOptions: { 7 | project: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@packages/ui", 3 | "version": "0.0.0", 4 | "private": true, 5 | "exports": { 6 | "./test.jsx": "./src/test.jsx" 7 | }, 8 | "devDependencies": { 9 | "react": "^18.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-subrequest-vuln/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "variant-b": { 3 | "files": { 4 | "variant-config.mjs": "variant-config-b.mjs", 5 | "public/local-image.png": "public/local-image-b.png", 6 | "public/variant.txt": "public/variant-b.txt" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | module.exports = { 3 | root: true, 4 | extends: ['@repo/eslint-config/next.js'], 5 | parser: '@typescript-eslint/parser', 6 | parserOptions: { 7 | project: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/turbo/generators/templates/component.hbs: -------------------------------------------------------------------------------- 1 | import * as React from "react"; interface Props { children?: React.ReactNode; } export const 2 | {{pascalCase name}} 3 | = ({ children }: Props) => { return ( 4 |
5 |

{{name}}

6 | {children} 7 |
8 | ); }; -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@packages/ui", 3 | "version": "0.0.0", 4 | "private": true, 5 | "exports": { 6 | "./test.jsx": "./src/test.jsx" 7 | }, 8 | "devDependencies": { 9 | "react": "^18.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/_app.js: -------------------------------------------------------------------------------- 1 | export default function App({ Component, pageProps }) { 2 | if (!pageProps || typeof pageProps !== 'object') { 3 | throw new Error(`Invariant: received invalid pageProps in _app, received ${pageProps}`) 4 | } 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/error.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function Errors() { 4 | return ( 5 |
6 | 7 | Throw on data 8 | 9 |
10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/pnpm/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | swcMinify: true, 4 | output: 'standalone', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /e2e-report/app/layout.js: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | 3 | export const metadata = { 4 | title: 'Netlify - Next.js E2E Tests', 5 | } 6 | 7 | export default function RootLayout({ children }) { 8 | return ( 9 | 10 | {children} 11 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/pages/api/hello-background.ts: -------------------------------------------------------------------------------- 1 | export default (req, res) => { 2 | res.setHeader('Content-Type', 'application/json') 3 | res.status(200) 4 | res.json({ message: 'hello world :)' }) 5 | } 6 | 7 | export const config = { 8 | type: 'experimental-background', 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/_app.js: -------------------------------------------------------------------------------- 1 | export default function App({ Component, pageProps }) { 2 | if (!pageProps || typeof pageProps !== 'object') { 3 | throw new Error(`Invariant: received invalid pageProps in _app, received ${pageProps}`) 4 | } 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-path/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | basePath: '/base/path', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | distDir: 'cool/output', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/next-16-tag-revalidation/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import './.next/types/routes.d.ts' 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /e2e-report/utils/consts.js: -------------------------------------------------------------------------------- 1 | export const badgeSettings = { 2 | // Badge image resolution should be 2x display size for hi-res displays 3 | imageSize: { width: 370, height: 50 }, 4 | displaySize: { width: 185, height: 25 }, 5 | label: 'Next.js runtime v5', 6 | alt: 'Netlify Next.js runtime v5 test status', 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/pages/_app.js: -------------------------------------------------------------------------------- 1 | export default function App({ Component, pageProps }) { 2 | if (!pageProps || typeof pageProps !== 'object') { 3 | throw new Error(`Invariant: received invalid pageProps in _app, received ${pageProps}`) 4 | } 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/mock-download/packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@packages/ui", 3 | "version": "0.0.0", 4 | "private": true, 5 | "exports": { 6 | "./test.jsx": "./src/test.jsx" 7 | }, 8 | "devDependencies": { 9 | "react": "^18.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-monorepo-site-created-at-build", 3 | "private": true, 4 | "engines": { 5 | "node": ">=18" 6 | }, 7 | "packageManager": "npm@10.2.3", 8 | "workspaces": [ 9 | "apps/*", 10 | "packages/*" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", 3 | "exclude-paths": [".github", ".vscode", "e2e-report", "report", "tests", "tools", "turbofan"], 4 | "include-component-in-tag": false, 5 | "packages": { 6 | ".": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/after/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'export', 4 | distDir: 'custom-dist', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/pnpm/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/ppr/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/app-redirect/[slug]/page.js: -------------------------------------------------------------------------------- 1 | import { redirect } from 'next/navigation' 2 | 3 | const Page = async () => { 4 | return redirect(`/app-redirect/dest`) 5 | } 6 | 7 | export const generateStaticParams = async () => { 8 | return [{ slug: 'prerendered' }] 9 | } 10 | 11 | export default Page 12 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@packages/ui", 3 | "version": "0.0.0", 4 | "private": true, 5 | "exports": { 6 | "./test.jsx": "./src/test.jsx" 7 | }, 8 | "devDependencies": { 9 | "react": "^18.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@packages/ui", 3 | "version": "0.0.0", 4 | "private": true, 5 | "exports": { 6 | "./test.jsx": "./src/test.jsx" 7 | }, 8 | "devDependencies": { 9 | "react": "^18.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/base-path/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | generateBuildId: () => 'build-id', 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | outputFileTracingRoot: __dirname, 8 | generateBuildId: () => 'build-id', 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | module.exports = { 3 | root: true, 4 | extends: ['@repo/eslint-config/react-internal.js'], 5 | parser: '@typescript-eslint/parser', 6 | parserOptions: { 7 | project: './tsconfig.lint.json', 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/use-cache/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Use cache App', 3 | description: 'Description for Use cache Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/pre-deploy.mjs: -------------------------------------------------------------------------------- 1 | import { rm } from 'node:fs/promises' 2 | 3 | console.log('running pre-test.mjs') 4 | // ensure we don't have monorepo setup before starting deploy 5 | await rm('apps', { force: true, recursive: true }) 6 | await rm('packages', { force: true, recursive: true }) 7 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | generateBuildId: () => 'build-id', 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/pages/api/hello-scheduled.js: -------------------------------------------------------------------------------- 1 | export default (req, res) => { 2 | res.setHeader('Content-Type', 'application/json') 3 | res.status(200) 4 | res.json({ message: 'hello world :)' }) 5 | } 6 | 7 | export const config = { 8 | type: 'experimental-scheduled', 9 | schedule: '@hourly', 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Netlify Forms', 3 | description: 'Test for verifying Netlify Forms', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-proxy/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "latest", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/src/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms-workaround/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | generateBuildId: () => 'build-id', 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/fixtures/revalidate-fetch/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Revalidate fetch', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Revalidate fetch', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/mock-download/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms-workaround/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Netlify Forms', 3 | description: 'Test for verifying Netlify Forms', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/next-16-tag-revalidation/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Revalidate fetch', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/cjs-file-with-js-extension/bundled.cjs: -------------------------------------------------------------------------------- 1 | const { parse: pathParse } = require('node:path') 2 | 3 | const fileBase = pathParse(__filename).base 4 | 5 | module.exports = { 6 | fileBase, 7 | // if fileBase is not the same as this module name, it was bundled 8 | isBundled: fileBase !== 'bundled.cjs', 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/app/og-node/route.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export async function GET() { 5 | return new ImageResponse(
hi
, { 6 | width: 1200, 7 | height: 630, 8 | }) 9 | } 10 | 11 | export const dynamic = 'force-dynamic' 12 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-compatible/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-incompatible/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/apps/site/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | transpilePackages: ['@repo/ui'], 8 | } 9 | 10 | module.exports = nextConfig 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-subrequest-vuln/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/static/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | import { readFile } from 'node:fs/promises' 3 | 4 | export async function GET(request) { 5 | const words = await readFile('static/words.txt', 'utf-8') 6 | return NextResponse.json({ words }) 7 | } 8 | 9 | export const dynamic = 'force-dynamic' 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/cjs-file-with-js-extension.js: -------------------------------------------------------------------------------- 1 | const { parse: pathParse } = require('node:path') 2 | 3 | const fileBase = pathParse(__filename).base 4 | 5 | module.exports = { 6 | fileBase, 7 | // if fileBase is not the same as this module name, it was bundled 8 | isBundled: fileBase !== 'cjs-file-with-js-extension.js', 9 | } 10 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-monorepo-proxy", 3 | "private": true, 4 | "scripts": { 5 | "build": "npm run build --workspace @apps/site" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "npm@10.2.3", 11 | "workspaces": [ 12 | "apps/*" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pnpm-monorepo-base-proxy-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "latest", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-runtime-specific/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/pages/api/revalidate.js: -------------------------------------------------------------------------------- 1 | export default async function handler(req, res) { 2 | try { 3 | await res.revalidate('/static/revalidate-manual') 4 | return res.json({ code: 200, message: 'success' }) 5 | } catch (err) { 6 | return res.status(500).send({ code: 500, message: err.message }) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/page-router/src/pages/api/revalidate.js: -------------------------------------------------------------------------------- 1 | export default async function handler(req, res) { 2 | try { 3 | await res.revalidate('/static/revalidate-manual') 4 | return res.json({ code: 200, message: 'success' }) 5 | } catch (err) { 6 | return res.status(500).send({ code: 500, message: err.message }) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/src/app/og-node/route.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export async function GET() { 5 | return new ImageResponse(
hi
, { 6 | width: 1200, 7 | height: 630, 8 | }) 9 | } 10 | 11 | export const dynamic = 'force-dynamic' 12 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/image/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Next/Image + Netlify Image CDN

7 | a cute squirrel (next/image) 8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-unsupported-cpp-addons/app/layout.js: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Simple Next App', 3 | description: 'Description for Simple Next App', 4 | } 5 | 6 | export default function RootLayout({ children }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/image/local/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Next/Image + Netlify Image CDN

7 | a cute squirrel (next/image) 8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-404-get-static-props-with-revalidate/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | generateBuildId: () => 'build-id', 8 | outputFileTracingRoot: __dirname, 9 | } 10 | 11 | module.exports = nextConfig 12 | -------------------------------------------------------------------------------- /tests/playwright-slack-conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "sendResults": "on-failure", 3 | "slackLogLevel": "debug", 4 | "sendUsingBot": { 5 | "channels": ["C020GQEKC13"] 6 | }, 7 | "meta": [ 8 | { "key": "version", "value": "__ENV_RESULTS_VERSION" }, 9 | { 10 | "key": "results", 11 | "value": "__ENV_RESULTS_URL" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.0.3/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.1.0/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base-path", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dist-dir", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-runtime-specific/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | experimental: { 8 | nodeMiddleware: true, 9 | }, 10 | outputFileTracingRoot: __dirname, 11 | } 12 | 13 | module.exports = nextConfig 14 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/app/api/static/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | import { readFile } from 'node:fs/promises' 3 | 4 | export async function GET(request) { 5 | const words = await readFile('static/words.txt', 'utf-8') 6 | return NextResponse.json({ words }) 7 | } 8 | 9 | export const dynamic = 'force-dynamic' 10 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/app/image/local/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Next/Image + Netlify Image CDN

7 | a cute squirrel (next/image) 8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/api/static/[slug]/route.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from 'next/server' 2 | 3 | export function generateStaticParams() { 4 | return [{ slug: 'first' }, { slug: 'second' }] 5 | } 6 | 7 | export const GET = async (_req: NextRequest, { params }) => { 8 | return NextResponse.json({ params: await params }) 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/pages/fully-static.js: -------------------------------------------------------------------------------- 1 | // This is forcing this fixture to produce static html pages router 2 | // to not rely just on Next.js currently always handling default pages router 404.html page 3 | const FullyStatic = () => ( 4 |
5 |

This page is not using getStaticProps()

6 |
7 | ) 8 | 9 | export default FullyStatic 10 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/app-router/linked/client-component.js: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | export function ClientComponent() { 4 | return ( 5 |

6 | Client Component - variant:{' '} 7 | 8 | {process.env.SKEW_VARIANT} 9 | 10 |

11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "@packages/ui": "*", 10 | "next": "latest", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-unsupported-cpp-addons/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | experimental: { 8 | nodeMiddleware: true, 9 | }, 10 | outputFileTracingRoot: __dirname, 11 | } 12 | 13 | module.exports = nextConfig 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/test/next/page.js: -------------------------------------------------------------------------------- 1 | import { headers } from 'next/headers' 2 | 3 | export default async function Page() { 4 | const headersList = await headers() 5 | const message = headersList.get('x-hello-from-middleware-req') 6 | 7 | return ( 8 |
9 |

Message from middleware: {message}

10 |
11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/api/unstable-cache-node.js: -------------------------------------------------------------------------------- 1 | import { unstable_cache } from 'next/cache' 2 | 3 | export default async function handler(req, res) { 4 | const data = await unstable_cache(async () => { 5 | return { 6 | random: Math.random(), 7 | } 8 | })() 9 | 10 | res.json({ 11 | now: Date.now(), 12 | data, 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/simple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-next-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "@packages/ui": "*", 10 | "next": "latest", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/cli-before-regional-blobs-support/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/link-to-rewrite-to-cached-page/page.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function LinksToRewrittenCachedPage() { 4 | return ( 5 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/output-export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "output-export", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/page-router/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalDependencies": ["**/.env.*local"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**"] 8 | }, 9 | "dev": { 10 | "cache": false, 11 | "persistent": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/app/og/route.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export async function GET() { 5 | return new ImageResponse(
hi
, { 6 | width: 1200, 7 | height: 630, 8 | }) 9 | } 10 | 11 | export const runtime = 'edge' 12 | 13 | export const dynamic = 'force-dynamic' 14 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-monorepo-empty-base", 3 | "private": true, 4 | "scripts": { 5 | "build": "cd apps/site && npm run build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "npm@10.2.3", 11 | "workspaces": [ 12 | "apps/*", 13 | "packages/*" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/pnpm-monorepo-base-proxy/app/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/next-getstaticprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getStaticProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getStaticProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/next-getstaticprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getStaticProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getStaticProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/src/app/test/next/page.js: -------------------------------------------------------------------------------- 1 | import { headers } from 'next/headers' 2 | 3 | export default async function Page() { 4 | const headersList = await headers() 5 | const message = headersList.get('x-hello-from-middleware-req') 6 | 7 | return ( 8 |
9 |

Message from middleware: {message}

10 |
11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/app/link-to-redirect-to-cached-page/page.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function LinksToRedirectedCachedPage() { 4 | return ( 5 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/image/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Next/Image + Netlify Image CDN

7 | a cute squirrel (next/image) 8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "skew-protection", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@repo/typescript-config/nextjs.json", 3 | "compilerOptions": { 4 | "plugins": [ 5 | { 6 | "name": "next" 7 | } 8 | ] 9 | }, 10 | "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | .next 3 | playwright-report/ 4 | .netlify 5 | CHANGELOG.md 6 | package-lock.json 7 | package.json 8 | edge-runtime/vendor/ 9 | deno.lock 10 | tests/fixtures/dist-dir/cool/output 11 | tests/fixtures/output-export-custom-dist/custom-dist 12 | .nx 13 | custom-dist-dir 14 | pnpm.lock 15 | # to avoid needing extra permissions to format files 16 | .github/workflows -------------------------------------------------------------------------------- /src/run/constants.ts: -------------------------------------------------------------------------------- 1 | import { resolve } from 'node:path' 2 | import { fileURLToPath } from 'node:url' 3 | 4 | export const MODULE_DIR = fileURLToPath(new URL('.', import.meta.url)) 5 | export const PLUGIN_DIR = resolve(`${MODULE_DIR}../../..`) 6 | // a file where we store the required-server-files config object in to access during runtime 7 | export const RUN_CONFIG_FILE = 'run-config.json' 8 | -------------------------------------------------------------------------------- /tests/fixtures/after/app/after/check/page.js: -------------------------------------------------------------------------------- 1 | export const revalidate = 3600 // arbitrarily long, just so that it doesn't happen during a test run 2 | 3 | export default async function Page() { 4 | const data = { 5 | timestamp: Date.now(), 6 | } 7 | console.log('/timestamp/key/[key] rendered', data) 8 | 9 | return
{JSON.stringify(data)}
10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-excluded-paths/pages/api/[[...catchall]].ts: -------------------------------------------------------------------------------- 1 | import type { NextApiRequest, NextApiResponse } from 'next' 2 | 3 | type ResponseData = { 4 | params: { 5 | catchall?: string[] 6 | } 7 | } 8 | 9 | export default function handler(req: NextApiRequest, res: NextApiResponse) { 10 | res.status(200).json({ params: req.query }) 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/dynamic/[slug].js: -------------------------------------------------------------------------------- 1 | export default function Account({ slug }) { 2 | return ( 3 |

4 | Welcome to a /dynamic/[slug]: {slug} 5 |

6 | ) 7 | } 8 | 9 | export function getServerSideProps({ params }) { 10 | return { 11 | props: { 12 | slug: params.slug, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/app/test/next/page.js: -------------------------------------------------------------------------------- 1 | import { headers } from 'next/headers' 2 | 3 | export default async function Page() { 4 | const headersList = await headers() 5 | const message = headersList.get('x-hello-from-middleware-req') 6 | 7 | return ( 8 |
9 |

Message from middleware: {message}

10 |
11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/output-export-custom-dist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "output-export", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // This configuration only applies to the package manager root. 2 | /** @type {import("eslint").Linter.Config} */ 3 | module.exports = { 4 | ignorePatterns: ['apps/**', 'packages/**'], 5 | extends: ['@repo/eslint-config/library.js'], 6 | parser: '@typescript-eslint/parser', 7 | parserOptions: { 8 | project: true, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/src/app/og/route.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export async function GET() { 5 | return new ImageResponse(
hi
, { 6 | width: 1200, 7 | height: 630, 8 | }) 9 | } 10 | 11 | export const runtime = 'edge' 12 | 13 | export const dynamic = 'force-dynamic' 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/rewrite-target-getstaticprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getStaticProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getStaticProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/error-throw.js: -------------------------------------------------------------------------------- 1 | export default function ThrowOnData({ message }) { 2 | return ( 3 |
4 |

Throw on data request

5 |

{message}

6 |
7 | ) 8 | } 9 | 10 | export const getServerSideProps = ({ query }) => ({ 11 | props: { message: query.message || '' }, 12 | }) 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/mock-download/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "@packages/ui": "*", 10 | "next": "latest", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yarn-monorepo-with-pnpm-linker", 3 | "private": true, 4 | "scripts": { 5 | "build": "yarn workspace @apps/site build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "yarn@3.2.4", 11 | "workspaces": [ 12 | "apps/*", 13 | "packages/*" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/next-getserversideprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getServerSideProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getServerSideProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/next-getserversideprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getServerSideProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getServerSideProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/rewrite-target-getstaticprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getStaticProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getStaticProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/pnpm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pnpm", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "packageManager": "pnpm@8.9.0" 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/proxy-i18n-skip-normalize/pages/dynamic/[slug].js: -------------------------------------------------------------------------------- 1 | export default function Account({ slug }) { 2 | return ( 3 |

4 | Welcome to a /dynamic/[slug]: {slug} 5 |

6 | ) 7 | } 8 | 9 | export function getServerSideProps({ params }) { 10 | return { 11 | props: { 12 | slug: params.slug, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/revalidate-fetch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "incremental-static-regeneration", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/pages/pages-router/linked-static.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 | <> 4 |

Skew Protection Testing - Pages Router - fully static page

5 |

6 | Current variant:{' '} 7 | {process.env.SKEW_VARIANT} 8 |

9 | 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "@packages/ui": "*", 10 | "next": "latest", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/dynamic-cms/pages/api/revalidate.js: -------------------------------------------------------------------------------- 1 | export default async function handler(req, res) { 2 | try { 3 | const pathToPurge = req.query.path ?? '/static/revalidate-manual' 4 | await res.revalidate(pathToPurge) 5 | return res.json({ code: 200, message: 'success' }) 6 | } catch (err) { 7 | return res.status(500).send({ code: 500, message: err.message }) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/pages/dynamic/[slug].js: -------------------------------------------------------------------------------- 1 | export default function Account({ slug }) { 2 | return ( 3 |

4 | Welcome to a /dynamic/[slug]: {slug} 5 |

6 | ) 7 | } 8 | 9 | export function getServerSideProps({ params }) { 10 | return { 11 | props: { 12 | slug: params.slug, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | distDir: process.env.NEXT_DIST_DIR ?? '.next', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | experimental: { 9 | nodeMiddleware: true, 10 | }, 11 | outputFileTracingRoot: __dirname, 12 | } 13 | 14 | module.exports = nextConfig 15 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/api/revalidate.js: -------------------------------------------------------------------------------- 1 | export default async function handler(req, res) { 2 | try { 3 | const pathToPurge = req.query.path ?? '/static/revalidate-manual' 4 | await res.revalidate(pathToPurge) 5 | return res.json({ code: 200, message: 'success' }) 6 | } catch (err) { 7 | return res.status(500).send({ code: 500, message: err.message }) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/cached-permanent/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.json({ 5 | message: 6 | 'Route handler not using request and using force-static dynamic strategy with permanent caching', 7 | }) 8 | } 9 | export const revalidate = false 10 | 11 | export const dynamic = 'force-static' 12 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/cached-revalidate/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.json({ 5 | message: 6 | 'Route handler not using request and using force-static dynamic strategy with 15 seconds revalidate', 7 | }) 8 | } 9 | export const revalidate = 15 10 | 11 | export const dynamic = 'force-static' 12 | -------------------------------------------------------------------------------- /e2e-report/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { FlatCompat } from '@eslint/eslintrc' 2 | 3 | const compat = new FlatCompat({ 4 | baseDirectory: import.meta.dirname, 5 | }) 6 | 7 | const eslintConfig = [ 8 | { 9 | ignores: ['node_modules/**', '.next/**', 'tailwind.config.js'], 10 | }, 11 | ...compat.extends('next/core-web-vitals', 'next/typescript'), 12 | ] 13 | 14 | export default eslintConfig 15 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/middleware.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server' 2 | import { NextResponse } from 'next/server' 3 | 4 | export function middleware(request: NextRequest) { 5 | return NextResponse.json({ 6 | message: `Hello from middleware at ${request.nextUrl.pathname}`, 7 | }) 8 | } 9 | 10 | export const config = { 11 | matcher: '/middleware/:path*', 12 | } 13 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.0.3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-12.0.3", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "12.0.3", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0" 12 | }, 13 | "test": { 14 | "dependencies": { 15 | "next": "12.0.3" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/next-12.1.0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-12.1.0", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "12.1.0", 10 | "react": "^17.0.2", 11 | "react-dom": "^17.0.2" 12 | }, 13 | "test": { 14 | "dependencies": { 15 | "next": "12.1.0" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-compatible/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-nested-site-multiple-next-version-site-compatible", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "latest", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/dynamic-cms/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | i18n: { 8 | locales: ['en', 'fr'], 9 | defaultLocale: 'en', 10 | }, 11 | generateBuildId: () => 'build-id', 12 | outputFileTracingRoot: __dirname, 13 | } 14 | 15 | module.exports = nextConfig 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/pages/link/rewrite-target-getserversideprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getServerSideProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getServerSideProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/link/rewrite-target-getserversideprops.js: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return ( 3 |
4 |

5 | getServerSideProps page 6 |

7 |
8 | ) 9 | } 10 | 11 | export function getServerSideProps() { 12 | return { 13 | props: {}, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-compatible/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-incompatible/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | export default function Home({ ssr }) { 2 | return ( 3 |
4 |
SSR: {ssr ? 'yes' : 'no'}
5 |
6 | ) 7 | } 8 | 9 | export const getServerSideProps = async () => { 10 | return { 11 | props: { 12 | ssr: true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './global.css' 2 | 3 | export const metadata = { 4 | title: 'Welcome to next-app', 5 | description: 'Generated by create-nx-workspace', 6 | } 7 | 8 | export default function RootLayout({ children }: { children: React.ReactNode }) { 9 | return ( 10 | 11 | {children} 12 | 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/typescript-config/nextjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Next.js", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "plugins": [{ "name": "next" }], 7 | "module": "ESNext", 8 | "moduleResolution": "Bundler", 9 | "allowJs": true, 10 | "jsx": "preserve", 11 | "noEmit": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-conditions", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-excluded-paths/next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: 'standalone', 3 | distDir: process.env.NEXT_DIST_DIR ?? '.next', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | i18n: { 8 | locales: ['en', 'fr'], 9 | defaultLocale: 'en', 10 | }, 11 | experimental: { 12 | nodeMiddleware: true, 13 | }, 14 | outputFileTracingRoot: __dirname, 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | distDir: process.env.NEXT_DIST_DIR ?? '.next', 5 | eslint: { 6 | ignoreDuringBuilds: true, 7 | }, 8 | experimental: { 9 | nodeMiddleware: true, 10 | }, 11 | outputFileTracingRoot: __dirname, 12 | } 13 | 14 | module.exports = nextConfig 15 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/typescript-config/nextjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Next.js", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "plugins": [{ "name": "next" }], 7 | "module": "ESNext", 8 | "moduleResolution": "Bundler", 9 | "allowJs": true, 10 | "jsx": "preserve", 11 | "noEmit": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "og-api", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@vercel/og": "latest", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0", 15 | "semver": "^7.7.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/cli-before-regional-blobs-support/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "old-cli", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "netlify-cli": "17.21.1", 13 | "react": "^18.2.0", 14 | "react-dom": "^18.2.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-trailing-slash", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-base-path-i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "page-router", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/functions": "^2.7.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "og-api", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@vercel/og": "latest", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0", 15 | "semver": "^7.7.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-incompatible/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-nested-site-multiple-next-version-site-incompatible", 3 | "private": true, 4 | "scripts": { 5 | "build": "cd apps/site && npm run build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "npm@10.2.3", 11 | "dependencies": { 12 | "next": "latest" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/api/revalidate-handler/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | const res = await fetch(`https://api.tvmaze.com/shows/1`, { 5 | next: { revalidate: 7 }, 6 | }) 7 | const data = await res.json() 8 | 9 | return NextResponse.json({ data, time: new Date().toISOString() }) 10 | } 11 | 12 | export const dynamic = 'force-static' 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "turborepo", 3 | "private": true, 4 | "scripts": { 5 | "postinstall": "turbo build", 6 | "build": "turbo build", 7 | "dev": "turbo dev" 8 | }, 9 | "devDependencies": { 10 | "@repo/typescript-config": "workspace:*", 11 | "turbo": "latest" 12 | }, 13 | "packageManager": "pnpm@8.9.0", 14 | "engines": { 15 | "node": ">=18" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/middleware.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | matcher: [ 5 | { 6 | source: '/foo', 7 | missing: [{ type: 'header', key: 'x-custom-header', value: 'custom-value' }], 8 | }, 9 | { 10 | source: '/hello', 11 | }, 12 | { 13 | source: '/nl/about', 14 | locale: false, 15 | }, 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/middleware-shared.ts: -------------------------------------------------------------------------------- 1 | export function middleware() { 2 | return new Response('hello from middleware', { 3 | headers: { 4 | // report Next.js Middleware Runtime (not the execution runtime, but target runtime) 5 | // @ts-expect-error EdgeRuntime global not declared 6 | 'x-runtime': typeof EdgeRuntime !== 'undefined' ? EdgeRuntime : 'node', 7 | }, 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | trailingSlash: true, 4 | output: 'standalone', 5 | distDir: process.env.NEXT_DIST_DIR ?? '.next', 6 | eslint: { 7 | ignoreDuringBuilds: true, 8 | }, 9 | experimental: { 10 | nodeMiddleware: true, 11 | }, 12 | outputFileTracingRoot: __dirname, 13 | } 14 | 15 | module.exports = nextConfig 16 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/api/cjs-file-with-js-extension/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | import { resolve } from 'node:path' 3 | 4 | export async function GET() { 5 | return NextResponse.json({ 6 | notBundledCJSModule: __non_webpack_require__(resolve('./cjs-file-with-js-extension.js')), 7 | bundledCJSModule: require('./bundled.cjs'), 8 | }) 9 | } 10 | 11 | export const dynamic = 'force-dynamic' 12 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/image/remote-domain/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function Domains() { 4 | return ( 5 |
6 |

Remote Images with Netlify CDN

7 | dog up close 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-404-get-static-props-with-revalidate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "page-router-404-get-static-props-with-revalidate", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalDependencies": ["**/.env.*local"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**"] 8 | }, 9 | "lint": { 10 | "dependsOn": ["^lint"] 11 | }, 12 | "dev": { 13 | "cache": false, 14 | "persistent": true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/page-router/next.config.js: -------------------------------------------------------------------------------- 1 | const { join } = require('node:path') 2 | 3 | /** @type {import('next').NextConfig} */ 4 | const nextConfig = { 5 | output: 'standalone', 6 | eslint: { 7 | ignoreDuringBuilds: true, 8 | }, 9 | transpilePackages: ['@repo/ui'], 10 | outputFileTracingRoot: join(__dirname, '..', '..'), 11 | serverExternalPackages: ['lodash'], 12 | } 13 | 14 | module.exports = nextConfig 15 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-base-path-i18n/pages/404.js: -------------------------------------------------------------------------------- 1 | export default function NotFound({ locale }) { 2 | return ( 3 |

4 | Custom 404 page for locale:

{locale}
5 |

6 | ) 7 | } 8 | 9 | /** @type {import('next').GetStaticProps} */ 10 | export const getStaticProps = ({ locale }) => { 11 | return { 12 | props: { 13 | locale, 14 | }, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "page-router", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/blobs": "^8.1.0", 12 | "@netlify/functions": "^2.7.0", 13 | "next": "latest", 14 | "react": "18.2.0", 15 | "react-dom": "18.2.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/next.config.js: -------------------------------------------------------------------------------- 1 | const { join } = require('node:path') 2 | 3 | /** @type {import('next').NextConfig} */ 4 | const nextConfig = { 5 | output: 'standalone', 6 | eslint: { 7 | ignoreDuringBuilds: true, 8 | }, 9 | transpilePackages: ['@repo/ui'], 10 | outputFileTracingRoot: join(__dirname, '..', '..'), 11 | serverExternalPackages: ['lodash'], 12 | } 13 | 14 | module.exports = nextConfig 15 | -------------------------------------------------------------------------------- /tests/fixtures/after/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "after", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "test": { 16 | "dependencies": { 17 | "next": ">=15.1.0" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-empty-base/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | import { TestElement } from '@packages/ui/test.jsx' 2 | 3 | export default function Home({ ssr }) { 4 | return ( 5 |
6 | SSR: {ssr ? 'yes' : 'no'} 7 |
8 | ) 9 | } 10 | 11 | export const getServerSideProps = async () => { 12 | return { 13 | props: { 14 | ssr: true, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-base-path-i18n/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | generateBuildId: () => 'build-id', 8 | basePath: '/base/path', 9 | i18n: { 10 | locales: ['en', 'fr', 'de'], 11 | defaultLocale: 'en', 12 | }, 13 | outputFileTracingRoot: __dirname, 14 | } 15 | 16 | module.exports = nextConfig 17 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-incompatible/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "next": "13.4.1", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0" 12 | }, 13 | "test": { 14 | "dependencies": { 15 | "next": "13.4.1" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-with-pnpm-linker/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | import { TestElement } from '@packages/ui/test.jsx' 2 | 3 | export default function Home({ ssr }) { 4 | return ( 5 |
6 | SSR: {ssr ? 'yes' : 'no'} 7 |
8 | ) 9 | } 10 | 11 | export const getServerSideProps = async () => { 12 | return { 13 | props: { 14 | ssr: true, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/middleware-node.ts: -------------------------------------------------------------------------------- 1 | export { middleware } from './middleware-shared' 2 | 3 | export const config = { 4 | runtime: 'nodejs', 5 | matcher: [ 6 | { 7 | source: '/foo', 8 | missing: [{ type: 'header', key: 'x-custom-header', value: 'custom-value' }], 9 | }, 10 | { 11 | source: '/hello', 12 | }, 13 | { 14 | source: '/nl/about', 15 | locale: false, 16 | }, 17 | ], 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/image/remote-pattern-1/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Remote Images with Netlify CDN

7 | a cute Giraffe 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/image/remote-pattern-2/page.js: -------------------------------------------------------------------------------- 1 | import Image from 'next/image' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Remote Images with Netlify CDN

7 | a cute Cat 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/pages/test/next.js: -------------------------------------------------------------------------------- 1 | export default function Page({ message }) { 2 | return ( 3 |
4 |

Message from middleware: {message}

5 |
6 | ) 7 | } 8 | 9 | /** @type {import('next').GetServerSideProps} */ 10 | export const getServerSideProps = async (ctx) => { 11 | return { 12 | props: { 13 | message: ctx.req.headers['x-hello-from-middleware-req'] || null, 14 | }, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-og", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "test": { 16 | "dependencies": { 17 | "next": ">=14.0.0" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /e2e-report/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], 4 | daisyui: { 5 | themes: ['light'], 6 | }, 7 | theme: { 8 | extend: { 9 | fontFamily: { 10 | primary: 'Mulish', 11 | }, 12 | colors: { 13 | primary: '#2036a1', 14 | }, 15 | }, 16 | }, 17 | plugins: [require('daisyui')], 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/next-16-tag-revalidation/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | outputFileTracingRoot: __dirname, 5 | experimental: { 6 | cacheLife: { 7 | testCacheLife: { 8 | stale: 0, 9 | revalidate: 365 * 60 * 60 * 24, // 1 year 10 | expire: 5, // 5 seconds to test expiration 11 | }, 12 | }, 13 | }, 14 | } 15 | 16 | module.exports = nextConfig 17 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-pages", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/react": "18.2.47" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/packages/ui/src/button.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { ReactNode } from 'react' 4 | 5 | interface ButtonProps { 6 | children: ReactNode 7 | className?: string 8 | appName: string 9 | } 10 | 11 | export const Button = ({ children, className, appName }: ButtonProps) => { 12 | return ( 13 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/packages/ui/src/button.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { ReactNode } from 'react' 4 | 5 | interface ButtonProps { 6 | children: ReactNode 7 | className?: string 8 | appName: string 9 | } 10 | 11 | export const Button = ({ children, className, appName }: ButtonProps) => { 12 | return ( 13 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-monorepo-site-created-at-build/mock-download/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | import { TestElement } from '@packages/ui/test.jsx' 2 | 3 | export default function Home({ ssr }) { 4 | return ( 5 |
6 | SSR: {ssr ? 'yes' : 'no'} 7 |
8 | ) 9 | } 10 | 11 | export const getServerSideProps = async () => { 12 | return { 13 | props: { 14 | ssr: true, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/npm-nested-site-multiple-next-version-site-compatible/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-package-path-set", 3 | "private": true, 4 | "scripts": { 5 | "build": "cd apps/site && npm run build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "npm@10.2.3", 11 | "dependencies": { 12 | "next": "13.4.1" 13 | }, 14 | "test": { 15 | "dependencies": { 16 | "next": "13.4.1" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/middleware/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "@aws-amplify/adapter-nextjs": "^1.0.18", 12 | "aws-amplify": "^6.0.18", 13 | "next": "latest", 14 | "react": "18.2.0", 15 | "react-dom": "18.2.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # Dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # Testing 9 | coverage 10 | 11 | # Turbo 12 | .turbo 13 | 14 | # Vercel 15 | .vercel 16 | 17 | # Build Outputs 18 | .next/ 19 | out/ 20 | build 21 | dist 22 | 23 | 24 | # Debug 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | 29 | # Misc 30 | .DS_Store 31 | *.pem 32 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | import { TestElement } from '@packages/ui/test.jsx' 2 | 3 | export default function Home({ ssr }) { 4 | return ( 5 |
6 | SSR: {ssr ? 'yes' : 'no'} 7 |
8 | ) 9 | } 10 | 11 | export const getServerSideProps = async () => { 12 | return { 13 | props: { 14 | ssr: true, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/apps/site/pages/index.js: -------------------------------------------------------------------------------- 1 | import { TestElement } from '@packages/ui/test.jsx' 2 | 3 | export default function Home({ ssr }) { 4 | return ( 5 |
6 | SSR: {ssr ? 'yes' : 'no'} 7 |
8 | ) 9 | } 10 | 11 | export const getServerSideProps = async () => { 12 | return { 13 | props: { 14 | ssr: true, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "NodeNext", 5 | "moduleResolution": "NodeNext", 6 | "resolveJsonModule": true, 7 | "outDir": "./dist", 8 | "rootDir": "src", 9 | "strict": true, 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["src/**/*"], 14 | "exclude": ["tests/**/*", "src/**/*.test.ts", "edge-runtime/**", "tests/netlify-deploy.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-og/app/og.js: -------------------------------------------------------------------------------- 1 | import { ImageResponse } from 'next/og' 2 | 3 | export default function og() { 4 | return new ImageResponse( 5 |
16 | Open Graph 17 |
, 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-subrequest-vuln/middleware.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | import { NextRequest } from 'next/server' 3 | 4 | import packageJson from 'next/package.json' 5 | 6 | export async function middleware(request: NextRequest) { 7 | const response = NextResponse.next() 8 | 9 | response.headers.set('x-test-used-middleware', 'true') 10 | response.headers.set('x-test-used-next-version', packageJson.version) 11 | 12 | return response 13 | } 14 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netlify-forms", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/functions": "^2.7.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/react": "18.2.75" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/ppr/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ppr", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "canary", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0", 14 | "semver": "^7.7.2" 15 | }, 16 | "test": { 17 | "dependencies": { 18 | "next": "canary || >=16.0.0" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/unstable_cache/page.js: -------------------------------------------------------------------------------- 1 | import { unstable_cache } from 'next/cache' 2 | 3 | export const dynamic = 'force-dynamic' 4 | 5 | const getData = unstable_cache( 6 | async () => { 7 | return { 8 | timestamp: Date.now(), 9 | } 10 | }, 11 | [], 12 | { 13 | revalidate: 1, 14 | }, 15 | ) 16 | 17 | export default async function Page() { 18 | const data = await getData() 19 | 20 | return
{JSON.stringify(data, null, 2)}
21 | } 22 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/apps/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apps/site", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build" 7 | }, 8 | "dependencies": { 9 | "@packages/ui": "*", 10 | "next": "13.4.1", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | }, 14 | "test": { 15 | "dependencies": { 16 | "next": "13.4.1" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-pages", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/react": "18.2.47" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-subrequest-vuln/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-subrequest-vuln", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "15.1.11", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "test": { 16 | "dependencies": { 17 | "next": "15.1.11" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "advanced-api-routes", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/functions": "^2.7.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/react": "18.2.75" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/netlify-forms-workaround/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netlify-forms", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/functions": "^2.7.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/react": "18.2.75" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-incompatible/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yarn-monorepo-multiple-next-versions-site-incompatible", 3 | "private": true, 4 | "scripts": { 5 | "build": "cd apps/site && npm run build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "yarn@1.22.21", 11 | "workspaces": [ 12 | "apps/*", 13 | "packages/*" 14 | ], 15 | "dependencies": { 16 | "next": "latest" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tools/vendor-deno-tools.js: -------------------------------------------------------------------------------- 1 | import { dirname, join } from 'node:path' 2 | import { fileURLToPath } from 'node:url' 3 | 4 | import { vendorDeno } from './build-helpers.js' 5 | 6 | const denoToolsDirectory = join(dirname(fileURLToPath(import.meta.url)), 'deno') 7 | 8 | await vendorDeno({ 9 | vendorSource: join(denoToolsDirectory, 'eszip.ts'), 10 | cwd: denoToolsDirectory, 11 | wasmFilesToDownload: ['https://deno.land/x/eszip@v0.55.4/eszip_wasm_bg.wasm'], 12 | initEmptyDenoJson: true, 13 | }) 14 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | output: 'standalone', 4 | distDir: process.env.NEXT_DIST_DIR ?? '.next', 5 | i18n: { 6 | locales: ['en', 'fr', 'nl', 'es'], 7 | defaultLocale: 'en', 8 | }, 9 | eslint: { 10 | ignoreDuringBuilds: true, 11 | }, 12 | experimental: { 13 | nodeMiddleware: true, 14 | }, 15 | outputFileTracingRoot: __dirname, 16 | } 17 | 18 | module.exports = nextConfig 19 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-runtime-specific/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-node-runtime-specific", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "test": { 16 | "dependencies": { 17 | "next": ">=15.2.6" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/hello-world-turbopack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build --turbopack", 7 | "dev": "next dev --turbopack", 8 | "build": "next build --turbopack" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "test": { 16 | "dependencies": { 17 | "next": ">=15.3.6" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/page-router-404-get-static-props-with-revalidate/pages/404.js: -------------------------------------------------------------------------------- 1 | export default function NotFound({ timestamp }) { 2 | return ( 3 |

4 | Custom 404 page with revalidate:

{timestamp}
5 |

6 | ) 7 | } 8 | 9 | /** @type {import('next').GetStaticProps} */ 10 | export const getStaticProps = ({ locale }) => { 11 | return { 12 | props: { 13 | timestamp: Date.now(), 14 | }, 15 | revalidate: 300, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/image/migration-from-v4-runtime/page.js: -------------------------------------------------------------------------------- 1 | import { NextImageWithLoaderSimulatingRuntimeV4 } from './next-image-runtime-v4' 2 | 3 | export default function NextImageUsingNetlifyImageCDN() { 4 | return ( 5 |
6 |

Next/Image + Netlify Image CDN

7 | 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /edge-runtime/lib/fixture/cjs/node_modules/package-exports-conditions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | ".": { 4 | "import": "./does-not-exist.js", 5 | "require": "./root-export.js" 6 | }, 7 | "./exported-module.js": { 8 | "default": "./dist/exported-module.js" 9 | }, 10 | "./wildcard/*": { 11 | "default": { 12 | "require": "./dist/wildcard/*.js" 13 | } 14 | }, 15 | "./wildcard/*.js": { 16 | "node": "./dist/wildcard/*.js" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/e2e-utils.patch: -------------------------------------------------------------------------------- 1 | diff --git a/test/lib/e2e-utils.ts b/test/lib/e2e-utils.ts 2 | index ee43a460d6..9f9aa30d33 100644 3 | --- a/test/lib/e2e-utils.ts 4 | +++ b/test/lib/e2e-utils.ts 5 | @@ -7,3 +7,3 @@ import { NextDevInstance } from './next-modes/next-dev' 6 | import { NextStartInstance } from './next-modes/next-start' 7 | -import { NextDeployInstance } from './next-modes/next-deploy' 8 | +import { NextDeployInstance } from './next-modes/netlify-deploy' 9 | import { shouldRunTurboDevTest } from './next-test-utils' 10 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | .next 4 | .next-node-middleware 5 | edge-runtime/vendor 6 | # deno.json is ephemeral and generated for the purpose of vendoring remote modules in CI 7 | tools/deno/deno.json 8 | tools/deno/vendor 9 | 10 | # Local Netlify folder 11 | .netlify 12 | 13 | /test-results/ 14 | /playwright-report/ 15 | /blob-report/ 16 | /playwright/.cache/ 17 | 18 | deno.lock 19 | .eslintcache 20 | .DS_Store 21 | tests/**/package-lock.json 22 | tests/**/pnpm-lock.yaml 23 | tests/**/yarn.lock 24 | tests/**/out/ 25 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-conditions/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-src/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "src/middleware.ts": "src/middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/app-router/linked/page.js: -------------------------------------------------------------------------------- 1 | import { ClientComponent } from './client-component' 2 | 3 | export default function Page() { 4 | return ( 5 | <> 6 |

Skew Protection Testing - App Router - next/link navigation test

7 |

8 | Current variant:{' '} 9 | 10 | {process.env.SKEW_VARIANT} 11 | 12 |

13 | 14 | 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/use-cache/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "use-cache", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/react": "19.1.2" 17 | }, 18 | "test": { 19 | "dependencies": { 20 | "next": ">=15.3.6" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-trailing-slash/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/middleware/[slug]/page.js: -------------------------------------------------------------------------------- 1 | export default async function Page({ params }) { 2 | const { slug } = await params 3 | 4 | return ( 5 | <> 6 |

Skew Protection Testing - Middleware - link target page

7 |

8 | Current variant:{' '} 9 | {process.env.SKEW_VARIANT} 10 |

11 |

12 | Slug: {slug} 13 |

14 | 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-excluded-paths/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-skip-normalize/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/pages/html-links.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function Page() { 4 | return ( 5 |
    6 |
  • 7 | 8 | Does not work 9 | 10 |
  • 11 |
  • 12 | 13 | Works 14 | 15 |
  • 16 |
17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-static-asset-matcher/test-variants.json: -------------------------------------------------------------------------------- 1 | { 2 | "node-middleware": { 3 | "distDir": ".next-node-middleware", 4 | "files": { 5 | "middleware.ts": "middleware-node.ts" 6 | }, 7 | "test": { 8 | "dependencies": { 9 | "next": [ 10 | { 11 | "versionConstraint": ">=15.2.6", 12 | "canaryOnly": true 13 | }, 14 | { 15 | "versionConstraint": ">=15.5.7" 16 | } 17 | ] 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-node-unsupported-cpp-addons/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-node-unsupported-cpp-addons", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "bcrypt": "^6.0.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "test": { 17 | "dependencies": { 18 | "next": ">=15.2.6" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-pages", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/node": "^20.10.6", 17 | "@types/react": "18.2.47", 18 | "typescript": "^5.3.3" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/api/on-demand-revalidate/path/route.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from 'next/server' 2 | import { revalidatePath } from 'next/cache' 3 | 4 | export async function GET(request: NextRequest) { 5 | const url = new URL(request.url) 6 | const pathToRevalidate = url.searchParams.get('path') ?? '/static-fetch/[id]/page' 7 | 8 | revalidatePath(pathToRevalidate) 9 | return NextResponse.json({ revalidated: true, now: new Date().toISOString() }) 10 | } 11 | 12 | export const dynamic = 'force-dynamic' 13 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/pages/api/og-wrong-runtime.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export default function () { 5 | return new ImageResponse( 6 |
17 | Hello! 18 |
, 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/app/api/env/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | 3 | export async function GET() { 4 | return NextResponse.json({ 5 | '.env': process.env.FROM_DOT_ENV ?? 'undefined', 6 | '.env.local': process.env.FROM_DOT_ENV_DOT_LOCAL ?? 'undefined', 7 | '.env.production': process.env.FROM_DOT_ENV_DOT_PRODUCTION ?? 'undefined', 8 | '.env.production.local': process.env.FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL ?? 'undefined', 9 | }) 10 | } 11 | 12 | export const dynamic = 'force-dynamic' 13 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server-components", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/functions": "^2.7.0", 12 | "next": "latest", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^20.11.5", 18 | "@types/react": "18.2.34", 19 | "typescript": "^5.3.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/wasm-src/src/pages/api/og-wrong-runtime.js: -------------------------------------------------------------------------------- 1 | // see next.config for details about 'next-og-alias' 2 | import { ImageResponse } from 'next-og-alias' 3 | 4 | export default function () { 5 | return new ImageResponse( 6 |
17 | Hello! 18 |
, 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/advanced-api-routes/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": false, 7 | "noEmit": true, 8 | "incremental": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve" 15 | }, 16 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 17 | "exclude": ["node_modules"] 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/page-router/pages/api/env.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {import('next').NextApiRequest} _req 3 | * @param {import('next').NextApiResponse} res 4 | */ 5 | export default async function handler(_req, res) { 6 | res.status(200).json({ 7 | '.env': process.env.FROM_DOT_ENV ?? 'undefined', 8 | '.env.local': process.env.FROM_DOT_ENV_DOT_LOCAL ?? 'undefined', 9 | '.env.production': process.env.FROM_DOT_ENV_DOT_PRODUCTION ?? 'undefined', 10 | '.env.production.local': process.env.FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL ?? 'undefined', 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /e2e-report/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-i18n-excluded-paths/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middleware-i18n-excluded-paths", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "node ../../utils/build-variants.mjs" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/node": "^17.0.12", 17 | "@types/react": "18.2.47", 18 | "typescript": "^5.2.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/proxy-i18n-skip-normalize/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "proxy-i18n-skip-normalize", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "next": "latest", 12 | "react": "18.2.0", 13 | "react-dom": "18.2.0" 14 | }, 15 | "devDependencies": { 16 | "@types/react": "18.2.47" 17 | }, 18 | "test": { 19 | "dependencies": { 20 | "next": ">=16.0.0-alpha.0" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/fixtures/dist-dir/app/stale-cache-serving/app-page/page.js: -------------------------------------------------------------------------------- 1 | export const dynamic = 'force-dynamic' 2 | 3 | const delay = 3000 4 | 5 | export default async function Page(props) { 6 | const start = Date.now() 7 | const data = await fetch(`https://next-data-api-endpoint.vercel.app/api/delay?delay=${delay}`, { 8 | next: { revalidate: 3 }, 9 | }).then((res) => res.json()) 10 | const fetchDuration = Date.now() - start 11 | 12 | return ( 13 | <> 14 |

{JSON.stringify({ fetchDuration, data, now: Date.now() })}

15 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/simple/app/stale-cache-serving/app-page/page.js: -------------------------------------------------------------------------------- 1 | export const dynamic = 'force-dynamic' 2 | 3 | const delay = 3000 4 | 5 | export default async function Page(props) { 6 | const start = Date.now() 7 | const data = await fetch(`https://next-data-api-endpoint.vercel.app/api/delay?delay=${delay}`, { 8 | next: { revalidate: 3 }, 9 | }).then((res) => res.json()) 10 | const fetchDuration = Date.now() - start 11 | 12 | return ( 13 | <> 14 |

{JSON.stringify({ fetchDuration, data, now: Date.now() })}

15 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /tests/fixtures/skew-protection/app/next-config/[slug]/page.js: -------------------------------------------------------------------------------- 1 | export default async function Page({ params }) { 2 | const { slug } = await params 3 | 4 | return ( 5 | <> 6 |

7 | Skew Protection Testing - next.config.js - link target page 8 |

9 |

10 | Current variant:{' '} 11 | {process.env.SKEW_VARIANT} 12 |

13 |

14 | Slug: {slug} 15 |

16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/smoke/fixtures/yarn-monorepo-multiple-next-versions-site-compatible/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yarn-monorepo-multiple-next-versions-site-compatible", 3 | "private": true, 4 | "scripts": { 5 | "build": "cd apps/site && npm run build" 6 | }, 7 | "engines": { 8 | "node": ">=18" 9 | }, 10 | "packageManager": "yarn@1.22.21", 11 | "workspaces": [ 12 | "apps/*", 13 | "packages/*" 14 | ], 15 | "dependencies": { 16 | "next": "13.4.1" 17 | }, 18 | "test": { 19 | "dependencies": { 20 | "next": "13.4.1" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/fixtures/dynamic-cms/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dynamic-cms", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "next build", 7 | "dev": "next dev", 8 | "build": "next build" 9 | }, 10 | "dependencies": { 11 | "@netlify/blobs": "^8.1.0", 12 | "@netlify/functions": "^2.7.0", 13 | "next": "latest", 14 | "react": "18.2.0", 15 | "react-dom": "18.2.0" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "22.13.13", 19 | "@types/react": "19.0.12", 20 | "typescript": "5.8.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/next-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "jsx": "react" 8 | }, 9 | "include": [ 10 | "jest.config.ts", 11 | "src/**/*.test.ts", 12 | "src/**/*.spec.ts", 13 | "src/**/*.test.tsx", 14 | "src/**/*.spec.tsx", 15 | "src/**/*.test.js", 16 | "src/**/*.spec.js", 17 | "src/**/*.test.jsx", 18 | "src/**/*.spec.jsx", 19 | "src/**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/docs/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Turborepo', 9 | description: 'Generated by create turbo', 10 | } 11 | 12 | export default function RootLayout({ children }: { children: React.ReactNode }): JSX.Element { 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo/apps/web/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Turborepo', 9 | description: 'Generated by create turbo', 10 | } 11 | 12 | export default function RootLayout({ children }: { children: React.ReactNode }): JSX.Element { 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/middleware-pages/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": false, 7 | "noEmit": true, 8 | "incremental": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "target": "ES2017" 16 | }, 17 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 18 | "exclude": ["node_modules"] 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/nx-integrated/apps/custom-dist-dir/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "jsx": "react" 8 | }, 9 | "include": [ 10 | "jest.config.ts", 11 | "src/**/*.test.ts", 12 | "src/**/*.spec.ts", 13 | "src/**/*.test.tsx", 14 | "src/**/*.spec.tsx", 15 | "src/**/*.test.js", 16 | "src/**/*.spec.js", 17 | "src/**/*.test.jsx", 18 | "src/**/*.spec.jsx", 19 | "src/**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tests/fixtures/server-components/app/page.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function Page() { 4 | return ( 5 |
6 |

Hello, Statically Rendered Server Component

7 |
    8 |
  • 9 | static-fetch-1 10 |
  • 11 |
  • 12 | static-fetch-1 13 |
  • 14 |
  • 15 | static-fetch-dynamic 16 |
  • 17 |
18 |
19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/docs/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Turborepo', 9 | description: 'Generated by create turbo', 10 | } 11 | 12 | export default function RootLayout({ children }: { children: React.ReactNode }): JSX.Element { 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/page-router/pages/api/env.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {import('next').NextApiRequest} _req 3 | * @param {import('next').NextApiResponse} res 4 | */ 5 | export default async function handler(_req, res) { 6 | res.status(200).json({ 7 | '.env': process.env.FROM_DOT_ENV ?? 'undefined', 8 | '.env.local': process.env.FROM_DOT_ENV_DOT_LOCAL ?? 'undefined', 9 | '.env.production': process.env.FROM_DOT_ENV_DOT_PRODUCTION ?? 'undefined', 10 | '.env.production.local': process.env.FROM_DOT_ENV_DOT_PRODUCTION_DOT_LOCAL ?? 'undefined', 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /tests/fixtures/turborepo-npm/apps/web/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Turborepo', 9 | description: 'Generated by create turbo', 10 | } 11 | 12 | export default function RootLayout({ children }: { children: React.ReactNode }): JSX.Element { 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/wasm/middleware.js: -------------------------------------------------------------------------------- 1 | import wasm from './add.wasm?module' 2 | const instance$ = WebAssembly.instantiate(wasm) 3 | 4 | async function increment(a) { 5 | const { instance } = await instance$ 6 | return instance.exports.add_one(a) 7 | } 8 | export default async function middleware(request) { 9 | const input = Number(request.nextUrl.searchParams.get('input')) || 1 10 | const value = await increment(input) 11 | return new Response(null, { headers: { data: JSON.stringify({ input, value }) } }) 12 | } 13 | 14 | export const config = { 15 | matcher: '/wasm', 16 | } 17 | --------------------------------------------------------------------------------