diff --git a/Cargo.lock b/Cargo.lock index a143c06e75d01..9a1a7f76b2462 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "auto-hash-map" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "serde", "smallvec", @@ -3421,7 +3421,7 @@ dependencies = [ [[package]] name = "node-file-trace" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "serde", @@ -7408,7 +7408,7 @@ dependencies = [ [[package]] name = "turbo-tasks" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-trait", @@ -7440,7 +7440,7 @@ dependencies = [ [[package]] name = "turbo-tasks-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "cargo-lock", @@ -7452,7 +7452,7 @@ dependencies = [ [[package]] name = "turbo-tasks-bytes" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "bytes", @@ -7467,7 +7467,7 @@ dependencies = [ [[package]] name = "turbo-tasks-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "dotenvs", @@ -7481,7 +7481,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fetch" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7498,7 +7498,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "auto-hash-map", @@ -7529,7 +7529,7 @@ dependencies = [ [[package]] name = "turbo-tasks-hash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "base16", "hex", @@ -7541,7 +7541,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -7555,7 +7555,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros-shared" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "proc-macro2", "quote", @@ -7565,7 +7565,7 @@ dependencies = [ [[package]] name = "turbo-tasks-malloc" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "mimalloc", ] @@ -7573,7 +7573,7 @@ dependencies = [ [[package]] name = "turbo-tasks-memory" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "auto-hash-map", @@ -7598,7 +7598,7 @@ dependencies = [ [[package]] name = "turbopack" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-recursion", @@ -7630,7 +7630,7 @@ dependencies = [ [[package]] name = "turbopack-binding" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "auto-hash-map", "mdxjs", @@ -7671,7 +7671,7 @@ dependencies = [ [[package]] name = "turbopack-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7696,7 +7696,7 @@ dependencies = [ [[package]] name = "turbopack-cli-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "clap 4.4.2", @@ -7714,7 +7714,7 @@ dependencies = [ [[package]] name = "turbopack-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-recursion", @@ -7745,7 +7745,7 @@ dependencies = [ [[package]] name = "turbopack-css" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-trait", @@ -7773,7 +7773,7 @@ dependencies = [ [[package]] name = "turbopack-dev" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7798,7 +7798,7 @@ dependencies = [ [[package]] name = "turbopack-dev-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-compression", @@ -7835,7 +7835,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-trait", @@ -7871,7 +7871,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-hmr-protocol" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "serde", "serde_json", @@ -7882,7 +7882,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-plugins" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-trait", @@ -7907,7 +7907,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-runtime" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indoc", @@ -7924,7 +7924,7 @@ dependencies = [ [[package]] name = "turbopack-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7940,7 +7940,7 @@ dependencies = [ [[package]] name = "turbopack-image" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "base64 0.21.4", @@ -7960,7 +7960,7 @@ dependencies = [ [[package]] name = "turbopack-json" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "serde", @@ -7975,7 +7975,7 @@ dependencies = [ [[package]] name = "turbopack-mdx" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "mdxjs", @@ -7990,7 +7990,7 @@ dependencies = [ [[package]] name = "turbopack-node" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "async-stream", @@ -8025,7 +8025,7 @@ dependencies = [ [[package]] name = "turbopack-static" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "serde", @@ -8041,7 +8041,7 @@ dependencies = [ [[package]] name = "turbopack-swc-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "swc_core", "turbo-tasks", @@ -8052,7 +8052,7 @@ dependencies = [ [[package]] name = "turbopack-trace-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "crossbeam-channel", @@ -8068,7 +8068,7 @@ dependencies = [ [[package]] name = "turbopack-wasm" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240216.2#d6aadf377226db84a4c222b6bde2415516a2e501" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240219.1#7b77d1b56339c5a976f75029c1e8e2bf593e8691" dependencies = [ "anyhow", "indexmap 1.9.3", diff --git a/Cargo.toml b/Cargo.toml index 1da256202e756..a6a524dd87d63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,11 +37,11 @@ swc_core = { version = "0.90.8", features = [ testing = { version = "0.35.18" } # Turbo crates -turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240216.2" } +turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240219.1" } # [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros.. -turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240216.2" } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240219.1" } # [TODO]: need to refactor embed_directory! macro usage in next-core -turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240216.2" } +turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240219.1" } # General Deps diff --git a/docs/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx b/docs/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx index 9a3e22f6157a6..4c326d59d2005 100644 --- a/docs/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx +++ b/docs/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx @@ -5,7 +5,7 @@ description: Create your first page and shared layout with the App Router. > We recommend reading the [Routing Fundamentals](/docs/app/building-your-application/routing) and [Defining Routes](/docs/app/building-your-application/routing/defining-routes) pages before continuing. -The special files [layout.js](#layouts), [pages.js](#pages), and [template.js](#templates) allow you to create UI for a [route](/docs/app/building-your-application/routing/defining-routes#creating-routes). This page will guide you through how and when to use these special files. +The special files [layout.js](#layouts), [page.js](#pages), and [template.js](#templates) allow you to create UI for a [route](/docs/app/building-your-application/routing/defining-routes#creating-routes). This page will guide you through how and when to use these special files. ## Pages diff --git a/examples/with-supabase/app/auth/callback/route.ts b/examples/with-supabase/app/auth/callback/route.ts index c30a560eb9c4b..b3877c6516af4 100644 --- a/examples/with-supabase/app/auth/callback/route.ts +++ b/examples/with-supabase/app/auth/callback/route.ts @@ -7,12 +7,13 @@ export async function GET(request: Request) { // https://supabase.com/docs/guides/auth/server-side/nextjs const requestUrl = new URL(request.url); const code = requestUrl.searchParams.get("code"); + const origin = requestUrl.origin; if (code) { const supabase = createClient(); await supabase.auth.exchangeCodeForSession(code); } - // URL to redirect to after sign in process completes - return NextResponse.redirect(requestUrl.origin); + // URL to redirect to after sign up process completes + return NextResponse.redirect(`${origin}/protected`); } diff --git a/examples/with-supabase/app/login/page.tsx b/examples/with-supabase/app/login/page.tsx index 43af1f669076e..7358f05420d84 100644 --- a/examples/with-supabase/app/login/page.tsx +++ b/examples/with-supabase/app/login/page.tsx @@ -2,6 +2,7 @@ import Link from "next/link"; import { headers } from "next/headers"; import { createClient } from "@/utils/supabase/server"; import { redirect } from "next/navigation"; +import { SubmitButton } from "./submit-button"; export default function Login({ searchParams, @@ -24,7 +25,7 @@ export default function Login({ return redirect("/login?message=Could not authenticate user"); } - return redirect("/"); + return redirect("/protected"); }; const signUp = async (formData: FormData) => { @@ -73,10 +74,7 @@ export default function Login({ Back -
+ @@ -96,15 +94,20 @@ export default function Login({ placeholder="••••••••" required /> - - + {searchParams?.message && (

{searchParams.message} diff --git a/examples/with-supabase/app/login/submit-button.tsx b/examples/with-supabase/app/login/submit-button.tsx new file mode 100644 index 0000000000000..9d8553358db11 --- /dev/null +++ b/examples/with-supabase/app/login/submit-button.tsx @@ -0,0 +1,20 @@ +"use client"; + +import { useFormStatus } from "react-dom"; +import { type ComponentProps } from "react"; + +type Props = ComponentProps<"button"> & { + pendingText?: string; +}; + +export function SubmitButton({ children, pendingText, ...props }: Props) { + const { pending, action } = useFormStatus(); + + const isPending = pending && action === props.formAction; + + return ( + + ); +} diff --git a/examples/with-supabase/app/page.tsx b/examples/with-supabase/app/page.tsx index c52c7a21d2ae2..1881cc13f0f36 100644 --- a/examples/with-supabase/app/page.tsx +++ b/examples/with-supabase/app/page.tsx @@ -1,8 +1,8 @@ import DeployButton from "../components/DeployButton"; import AuthButton from "../components/AuthButton"; import { createClient } from "@/utils/supabase/server"; -import ConnectSupabaseSteps from "@/components/ConnectSupabaseSteps"; -import SignUpUserSteps from "@/components/SignUpUserSteps"; +import ConnectSupabaseSteps from "@/components/tutorial/ConnectSupabaseSteps"; +import SignUpUserSteps from "@/components/tutorial/SignUpUserSteps"; import Header from "@/components/Header"; export default async function Index() { diff --git a/examples/with-supabase/app/protected/page.tsx b/examples/with-supabase/app/protected/page.tsx new file mode 100644 index 0000000000000..1d73e55118b63 --- /dev/null +++ b/examples/with-supabase/app/protected/page.tsx @@ -0,0 +1,57 @@ +import DeployButton from "@/components/DeployButton"; +import AuthButton from "@/components/AuthButton"; +import { createClient } from "@/utils/supabase/server"; +import FetchDataSteps from "@/components/tutorial/FetchDataSteps"; +import Header from "@/components/Header"; +import { redirect } from "next/navigation"; + +export default async function ProtectedPage() { + const supabase = createClient(); + + const { + data: { user }, + } = await supabase.auth.getUser(); + + if (!user) { + return redirect("/login"); + } + + return ( +

+
+
+ This is a protected page that you can only see as an authenticated + user +
+ +
+ +
+
+
+

Next steps

+ +
+
+ + +
+ ); +} diff --git a/examples/with-supabase/components/Code.tsx b/examples/with-supabase/components/tutorial/Code.tsx similarity index 100% rename from examples/with-supabase/components/Code.tsx rename to examples/with-supabase/components/tutorial/Code.tsx diff --git a/examples/with-supabase/components/ConnectSupabaseSteps.tsx b/examples/with-supabase/components/tutorial/ConnectSupabaseSteps.tsx similarity index 100% rename from examples/with-supabase/components/ConnectSupabaseSteps.tsx rename to examples/with-supabase/components/tutorial/ConnectSupabaseSteps.tsx diff --git a/examples/with-supabase/components/SignUpUserSteps.tsx b/examples/with-supabase/components/tutorial/FetchDataSteps.tsx similarity index 82% rename from examples/with-supabase/components/SignUpUserSteps.tsx rename to examples/with-supabase/components/tutorial/FetchDataSteps.tsx index 4285e43c5c40a..0099f8e155c0b 100644 --- a/examples/with-supabase/components/SignUpUserSteps.tsx +++ b/examples/with-supabase/components/tutorial/FetchDataSteps.tsx @@ -1,10 +1,9 @@ -import Link from "next/link"; import Step from "./Step"; -import Code from "@/components/Code"; +import Code from "./Code"; const create = ` create table notes ( - id serial primary key, + id bigserial primary key, title text ); @@ -48,23 +47,9 @@ export default function Page() { } `.trim(); -export default function SignUpUserSteps() { +export default function FetchDataSteps() { return (
    - -

    - Head over to the{" "} - - Login - {" "} - page and sign up your first user. It's okay if this is just you for - now. Your awesome idea will have plenty of users later! -

    -
    -

    Head over to the{" "} diff --git a/examples/with-supabase/components/tutorial/SignUpUserSteps.tsx b/examples/with-supabase/components/tutorial/SignUpUserSteps.tsx new file mode 100644 index 0000000000000..6af78a08ddd9e --- /dev/null +++ b/examples/with-supabase/components/tutorial/SignUpUserSteps.tsx @@ -0,0 +1,22 @@ +import Link from "next/link"; +import Step from "./Step"; + +export default function SignUpUserSteps() { + return ( +

      + +

      + Head over to the{" "} + + Login + {" "} + page and sign up your first user. It's okay if this is just you for + now. Your awesome idea will have plenty of users later! +

      +
      +
    + ); +} diff --git a/examples/with-supabase/components/Step.tsx b/examples/with-supabase/components/tutorial/Step.tsx similarity index 100% rename from examples/with-supabase/components/Step.tsx rename to examples/with-supabase/components/tutorial/Step.tsx diff --git a/examples/with-supabase/utils/supabase/middleware.ts b/examples/with-supabase/utils/supabase/middleware.ts index c095c250e686c..8c6338c8026f3 100644 --- a/examples/with-supabase/utils/supabase/middleware.ts +++ b/examples/with-supabase/utils/supabase/middleware.ts @@ -1,70 +1,64 @@ import { createServerClient, type CookieOptions } from "@supabase/ssr"; import { type NextRequest, NextResponse } from "next/server"; -export const createClient = (request: NextRequest) => { - // Create an unmodified response - let response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); +export const updateSession = async (request: NextRequest) => { + // This `try/catch` block is only here for the interactive tutorial. + // Feel free to remove once you have Supabase connected. + try { + // Create an unmodified response + let response = NextResponse.next({ + request: { + headers: request.headers, + }, + }); - const supabase = createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - get(name: string) { - return request.cookies.get(name)?.value; - }, - set(name: string, value: string, options: CookieOptions) { - // If the cookie is updated, update the cookies for the request and response - request.cookies.set({ - name, - value, - ...options, - }); - response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); - response.cookies.set({ - name, - value, - ...options, - }); - }, - remove(name: string, options: CookieOptions) { - // If the cookie is removed, update the cookies for the request and response - request.cookies.set({ - name, - value: "", - ...options, - }); - response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); - response.cookies.set({ - name, - value: "", - ...options, - }); + const supabase = createServerClient( + process.env.NEXT_PUBLIC_SUPABASE_URL!, + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + { + cookies: { + get(name: string) { + return request.cookies.get(name)?.value; + }, + set(name: string, value: string, options: CookieOptions) { + // If the cookie is updated, update the cookies for the request and response + request.cookies.set({ + name, + value, + ...options, + }); + response = NextResponse.next({ + request: { + headers: request.headers, + }, + }); + response.cookies.set({ + name, + value, + ...options, + }); + }, + remove(name: string, options: CookieOptions) { + // If the cookie is removed, update the cookies for the request and response + request.cookies.set({ + name, + value: "", + ...options, + }); + response = NextResponse.next({ + request: { + headers: request.headers, + }, + }); + response.cookies.set({ + name, + value: "", + ...options, + }); + }, }, }, - }, - ); - - return { supabase, response }; -}; - -export const updateSession = async (request: NextRequest) => { - try { - // This `try/catch` block is only here for the interactive tutorial. - // Feel free to remove once you have Supabase connected. - const { supabase, response } = createClient(request); + ); // This will refresh session if expired - required for Server Components // https://supabase.com/docs/guides/auth/server-side/nextjs diff --git a/lerna.json b/lerna.json index 54f97e2e0311a..d5ae18d551808 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "14.1.1-canary.59" + "version": "14.1.1-canary.61" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 24c1aebd0e3e4..2ab665cd023c1 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 4a86c0b0849a5..34cf54ebcdea8 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "14.1.1-canary.59", + "@next/eslint-plugin-next": "14.1.1-canary.61", "@rushstack/eslint-patch": "^1.3.3", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0", "eslint-import-resolver-node": "^0.3.6", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index e083bac2f8858..9fcd8158b89a1 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index ef807aeee67e6..e8e6f37aaa1e2 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,6 +1,6 @@ { "name": "@next/font", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 8266773af8190..4d55e3f6bb77f 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 8c1a70031f04d..d24a0de91c5e7 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 06ea3cb832bd7..0ae7d8432036b 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 7bec87f684405..03df0f64aed27 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 22391d9a539d8..f1858f2130cc9 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index f809368c92e3f..c7d7a38c292b9 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index ac44054e504e5..3c773b0ce6b41 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 6478e6979938f..f8b74a800e685 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 9260ff54241d9..931219490c8e6 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -92,7 +92,7 @@ ] }, "dependencies": { - "@next/env": "14.1.1-canary.59", + "@next/env": "14.1.1-canary.61", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", @@ -145,10 +145,10 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/polyfill-module": "14.1.1-canary.59", - "@next/polyfill-nomodule": "14.1.1-canary.59", - "@next/react-refresh-utils": "14.1.1-canary.59", - "@next/swc": "14.1.1-canary.59", + "@next/polyfill-module": "14.1.1-canary.61", + "@next/polyfill-nomodule": "14.1.1-canary.61", + "@next/react-refresh-utils": "14.1.1-canary.61", + "@next/swc": "14.1.1-canary.61", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@taskr/clear": "1.1.0", @@ -192,7 +192,7 @@ "@types/ws": "8.2.0", "@vercel/ncc": "0.34.0", "@vercel/nft": "0.26.4", - "@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240216.2", + "@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240219.1", "acorn": "8.5.0", "amphtml-validator": "1.0.35", "anser": "1.4.9", diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index dffed951f962d..d192fbd220074 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -1525,12 +1525,8 @@ export default async function build( let buildTraceContext: undefined | BuildTraceContext let buildTracesPromise: Promise | undefined = undefined - // If there's has a custom webpack config and disable the build worker. - // Otherwise respect the option if it's set. - const useBuildWorker = - config.experimental.webpackBuildWorker || - (config.experimental.webpackBuildWorker === undefined && - !config.webpack) + // webpack build worker is always enabled unless manually disabled + const useBuildWorker = config.experimental.webpackBuildWorker !== false const runServerAndEdgeInParallel = config.experimental.parallelServerCompiles const collectServerBuildTracesInParallel = diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index d908524debc84..122651ee7c71f 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -715,11 +715,15 @@ export default async function getBaseWebpackConfig( // Packages which will be split into the 'framework' chunk. // Only top-level packages are included, e.g. nested copies like // 'node_modules/meow/node_modules/object-assign' are not included. + const nextFrameworkPaths: string[] = [] const topLevelFrameworkPaths: string[] = [] const visitedFrameworkPackages = new Set() - // Adds package-paths of dependencies recursively - const addPackagePath = (packageName: string, relativeToPath: string) => { + const addPackagePath = ( + packageName: string, + relativeToPath: string, + paths: string[] + ) => { try { if (visitedFrameworkPackages.has(packageName)) { return @@ -738,11 +742,11 @@ export default async function getBaseWebpackConfig( const directory = path.join(packageJsonPath, '../') // Returning from the function in case the directory has already been added and traversed - if (topLevelFrameworkPaths.includes(directory)) return - topLevelFrameworkPaths.push(directory) + if (paths.includes(directory)) return + paths.push(directory) const dependencies = require(packageJsonPath).dependencies || {} for (const name of Object.keys(dependencies)) { - addPackagePath(name, directory) + addPackagePath(name, directory, paths) } } catch (_) { // don't error on failing to resolve framework packages @@ -759,8 +763,9 @@ export default async function getBaseWebpackConfig( ] : []), ]) { - addPackagePath(packageName, dir) + addPackagePath(packageName, dir, topLevelFrameworkPaths) } + addPackagePath('next', dir, nextFrameworkPaths) const crossOrigin = config.crossOrigin @@ -913,6 +918,7 @@ export default async function getBaseWebpackConfig( splitChunks: ((): | Required['optimization']['splitChunks'] | false => { + // server chunking if (dev) { if (isNodeServer) { /* @@ -963,21 +969,6 @@ export default async function getBaseWebpackConfig( return false } - if (isNodeServer) { - return { - filename: '[name].js', - chunks: 'all', - minChunks: 2, - } - } - - if (isEdgeServer) { - return { - filename: 'edge-chunks/[name].js', - minChunks: 2, - } - } - const frameworkCacheGroup = { chunks: 'all' as const, name: 'framework', @@ -996,6 +987,22 @@ export default async function getBaseWebpackConfig( // becoming a part of the commons chunk) enforce: true, } + + const nextRuntimeCacheGroup = { + chunks: 'all' as const, + name: 'next-runtime', + test(module: any) { + const resource = module.nameForCondition?.() + return resource + ? nextFrameworkPaths.some((pkgPath) => + resource.startsWith(pkgPath) + ) + : false + }, + priority: 30, + enforce: true, + } + const libCacheGroup = { test(module: { size: Function @@ -1037,6 +1044,20 @@ export default async function getBaseWebpackConfig( minChunks: 1, reuseExistingChunk: true, } + + if (isNodeServer || isEdgeServer) { + return { + filename: `${isEdgeServer ? 'edge-chunks/' : ''}[name].js`, + cacheGroups: { + nextRuntime: nextRuntimeCacheGroup, + framework: frameworkCacheGroup, + lib: libCacheGroup, + }, + minChunks: 2, + } + } + + // client chunking const cssCacheGroup = { test: /\.(css|sass|scss)$/i, chunks: 'all' as const, diff --git a/packages/next/src/build/webpack/plugins/terser-webpack-plugin/src/index.ts b/packages/next/src/build/webpack/plugins/terser-webpack-plugin/src/index.ts index 5112b9cc503e7..96f847c2a94c4 100644 --- a/packages/next/src/build/webpack/plugins/terser-webpack-plugin/src/index.ts +++ b/packages/next/src/build/webpack/plugins/terser-webpack-plugin/src/index.ts @@ -98,16 +98,6 @@ export class TerserPlugin { return false } - // don't minify _middleware as it can break in some cases - // and doesn't provide too much of a benefit as it's server-side - if ( - name.match( - /(edge-runtime-webpack\.js|edge-chunks|middleware\.js$)/ - ) - ) { - return false - } - const { info } = res // Skip double minimize assets from child compilation diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index f959be7d28547..34eb535fd8639 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 2d3f85f7016bb..b76c2f07aa4c0 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "14.1.1-canary.59", + "version": "14.1.1-canary.61", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "14.1.1-canary.59", + "next": "14.1.1-canary.61", "outdent": "0.8.0", "prettier": "2.5.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2c7b39d32920..f488efa0497d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -750,7 +750,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.3.3 @@ -812,7 +812,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../next-env '@swc/helpers': specifier: 0.5.5 @@ -933,16 +933,16 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/polyfill-module': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../react-refresh-utils '@next/swc': - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1074,8 +1074,8 @@ importers: specifier: 0.26.4 version: 0.26.4 '@vercel/turbopack-ecmascript-runtime': - specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240216.2 - version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240216.2' + specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240219.1 + version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240219.1' acorn: specifier: 8.5.0 version: 8.5.0 @@ -1554,7 +1554,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 14.1.1-canary.59 + specifier: 14.1.1-canary.61 version: link:../next outdent: specifier: 0.8.0 @@ -25626,8 +25626,8 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} - '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240216.2': - resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240216.2} + '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240219.1': + resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240219.1} name: '@vercel/turbopack-ecmascript-runtime' version: 0.0.0 dependencies: diff --git a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap index 0de6151394bf7..a8034ecf8ddf6 100644 --- a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -148,6 +148,15 @@ exports[`ReactRefreshLogBox app turbo conversion to class component (1) 1`] = ` 6 | }" `; +exports[`ReactRefreshLogBox app turbo css syntax errors 1`] = ` +"./index.module.css:1:1 +Parsing css source code failed +> 1 | button {} + | ^^^^^^ + +Selector is not pure (pure selectors must contain at least one local class or id)" +`; + exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`; exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 2`] = `"http://nextjs.org/"`; diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap index 39a28182a0df0..43b2542b89b1c 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -74,6 +74,15 @@ exports[`ReactRefreshLogBox turbo boundaries 1`] = `null`; exports[`ReactRefreshLogBox turbo conversion to class component (1) 1`] = `null`; +exports[`ReactRefreshLogBox turbo css syntax errors 1`] = ` +"./index.module.css:1:1 +Parsing css source code failed +> 1 | button {} + | ^^^^^^ + +Selector is not pure (pure selectors must contain at least one local class or id)" +`; + exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`; exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 2`] = `"http://nextjs.org/"`; diff --git a/test/e2e/app-dir/app-css/index.test.ts b/test/e2e/app-dir/app-css/index.test.ts index 6802b3691271b..9115168eef628 100644 --- a/test/e2e/app-dir/app-css/index.test.ts +++ b/test/e2e/app-dir/app-css/index.test.ts @@ -288,10 +288,11 @@ createNextDescribe( describe('chunks', () => { it('should bundle css resources into chunks', async () => { const html = await next.render('/dashboard') + expect( [ ...html.matchAll( - / { ) expect(manifest.middleware).toEqual({ '/': { - files: [ + files: expect.arrayContaining([ 'prerender-manifest.js', 'server/edge-runtime-webpack.js', 'server/middleware.js', - ], + ]), name: 'middleware', page: '/', matchers: [{ regexp: '^/.*$', originalSource: '/:path*' }], diff --git a/test/e2e/streaming-ssr/index.test.ts b/test/e2e/streaming-ssr/index.test.ts index ad48d6807d5af..9aa5a463c591d 100644 --- a/test/e2e/streaming-ssr/index.test.ts +++ b/test/e2e/streaming-ssr/index.test.ts @@ -170,7 +170,11 @@ if (isNextProd) { it('should pass correct nextRuntime values', async () => { const content = await next.readFile('runtimes.txt') - expect(content.split('\n').sort()).toEqual(['client', 'edge', 'nodejs']) + expect([...new Set(content.split('\n'))].sort()).toEqual([ + 'client', + 'edge', + 'nodejs', + ]) }) it('should generate html response by streaming correctly', async () => { diff --git a/test/e2e/switchable-runtime/index.test.ts b/test/e2e/switchable-runtime/index.test.ts index 831c5141ef5b7..f88ccf1045261 100644 --- a/test/e2e/switchable-runtime/index.test.ts +++ b/test/e2e/switchable-runtime/index.test.ts @@ -187,10 +187,10 @@ describe('Switchable runtime', () => { expect(manifest).toMatchObject({ functions: { '/api/hello': { - files: [ + files: expect.arrayContaining([ 'server/edge-runtime-webpack.js', 'server/pages/api/hello.js', - ], + ]), name: 'pages/api/hello', page: '/api/hello', matchers: [ @@ -199,10 +199,10 @@ describe('Switchable runtime', () => { wasm: [], }, '/api/edge': { - files: [ + files: expect.arrayContaining([ 'server/edge-runtime-webpack.js', 'server/pages/api/edge.js', - ], + ]), name: 'pages/api/edge', page: '/api/edge', matchers: [ @@ -621,11 +621,11 @@ describe('Switchable runtime', () => { expect(manifest).toMatchObject({ functions: { '/api/hello': { - files: [ + files: expect.arrayContaining([ 'prerender-manifest.js', 'server/edge-runtime-webpack.js', 'server/pages/api/hello.js', - ], + ]), name: 'pages/api/hello', page: '/api/hello', matchers: [ @@ -634,11 +634,11 @@ describe('Switchable runtime', () => { wasm: [], }, '/api/edge': { - files: [ + files: expect.arrayContaining([ 'prerender-manifest.js', 'server/edge-runtime-webpack.js', 'server/pages/api/edge.js', - ], + ]), name: 'pages/api/edge', page: '/api/edge', matchers: [ diff --git a/test/integration/build-trace-extra-entries/test/index.test.js b/test/integration/build-trace-extra-entries/test/index.test.js index 97722c25477c4..f4e1a7cb7e6dd 100644 --- a/test/integration/build-trace-extra-entries/test/index.test.js +++ b/test/integration/build-trace-extra-entries/test/index.test.js @@ -50,11 +50,6 @@ describe('build trace with extra entries', () => { expect(appTrace.files.some((file) => file.endsWith('hello.json'))).toBe( true ) - expect( - appTrace.files.filter( - (file) => file.includes('chunks') && file.endsWith('.js') - ).length - ).toBe(0) expect( indexTrace.files.filter( diff --git a/test/turbopack-tests-manifest.json b/test/turbopack-tests-manifest.json index db5bc5c2c8410..4ca4e9534a0e6 100644 --- a/test/turbopack-tests-manifest.json +++ b/test/turbopack-tests-manifest.json @@ -2475,10 +2475,10 @@ "app dir - css sass support server layouts should support sass/scss modules inside server layouts", "app dir - css sass support server pages should support global sass/scss inside server pages", "app dir - css sass support server pages should support sass/scss modules inside server pages", - "app dir - css HMR should not create duplicate link tags during HMR" + "app dir - css HMR should not create duplicate link tags during HMR", + "app dir - css css support chunks should bundle css resources into chunks" ], "failed": [ - "app dir - css css support chunks should bundle css resources into chunks", "app dir - css css support should not preload styles twice during HMR" ], "pending": [