From 7a972c54f2ff37870653cef195913da07f0e880c Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Thu, 5 Sep 2024 20:00:46 +0800 Subject: [PATCH 1/3] use render children if svelte 5 --- packages/kit/src/core/sync/create_manifest_data/index.js | 3 ++- .../kit/src/runtime/components/{ => svelte-4}/error.svelte | 0 .../kit/src/runtime/components/{ => svelte-4}/layout.svelte | 0 packages/kit/src/runtime/components/svelte-5/error.svelte | 6 ++++++ packages/kit/src/runtime/components/svelte-5/layout.svelte | 5 +++++ 5 files changed, 13 insertions(+), 1 deletion(-) rename packages/kit/src/runtime/components/{ => svelte-4}/error.svelte (100%) rename packages/kit/src/runtime/components/{ => svelte-4}/layout.svelte (100%) create mode 100644 packages/kit/src/runtime/components/svelte-5/error.svelte create mode 100644 packages/kit/src/runtime/components/svelte-5/layout.svelte diff --git a/packages/kit/src/core/sync/create_manifest_data/index.js b/packages/kit/src/core/sync/create_manifest_data/index.js index ab807f9f2f50..acf6476b5a9c 100644 --- a/packages/kit/src/core/sync/create_manifest_data/index.js +++ b/packages/kit/src/core/sync/create_manifest_data/index.js @@ -6,6 +6,7 @@ import { list_files, runtime_directory } from '../../utils.js'; import { posixify, resolve_entry } from '../../../utils/filesystem.js'; import { parse_route_id } from '../../../utils/routing.js'; import { sort_routes } from './sort.js'; +import { isSvelte5Plus } from '../utils.js'; /** * Generates the manifest data used for the client-side manifest and types generation. @@ -18,7 +19,7 @@ import { sort_routes } from './sort.js'; */ export default function create_manifest_data({ config, - fallback = `${runtime_directory}/components`, + fallback = `${runtime_directory}/components/${isSvelte5Plus() ? 'svelte-5' : 'svelte-4'}`, cwd = process.cwd() }) { const assets = create_assets(config); diff --git a/packages/kit/src/runtime/components/error.svelte b/packages/kit/src/runtime/components/svelte-4/error.svelte similarity index 100% rename from packages/kit/src/runtime/components/error.svelte rename to packages/kit/src/runtime/components/svelte-4/error.svelte diff --git a/packages/kit/src/runtime/components/layout.svelte b/packages/kit/src/runtime/components/svelte-4/layout.svelte similarity index 100% rename from packages/kit/src/runtime/components/layout.svelte rename to packages/kit/src/runtime/components/svelte-4/layout.svelte diff --git a/packages/kit/src/runtime/components/svelte-5/error.svelte b/packages/kit/src/runtime/components/svelte-5/error.svelte new file mode 100644 index 000000000000..b82ddfaed4b4 --- /dev/null +++ b/packages/kit/src/runtime/components/svelte-5/error.svelte @@ -0,0 +1,6 @@ + + +

{$page.status}

+

{$page.error?.message}

diff --git a/packages/kit/src/runtime/components/svelte-5/layout.svelte b/packages/kit/src/runtime/components/svelte-5/layout.svelte new file mode 100644 index 000000000000..4b7cb066e5aa --- /dev/null +++ b/packages/kit/src/runtime/components/svelte-5/layout.svelte @@ -0,0 +1,5 @@ + + +{@render children()} From f6c21bd830366d9c2e5fa44ae38e3bf56f3eb2a2 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Thu, 5 Sep 2024 20:07:03 +0800 Subject: [PATCH 2/3] changeset --- .changeset/pretty-planets-deliver.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/pretty-planets-deliver.md diff --git a/.changeset/pretty-planets-deliver.md b/.changeset/pretty-planets-deliver.md new file mode 100644 index 000000000000..6bcebc66c2a4 --- /dev/null +++ b/.changeset/pretty-planets-deliver.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: use `{@render ...}` tag when generating default fallback page for svelte 5 apps From b042b497ecf9b64e4c2cc39580fd24d26a22ccbb Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Thu, 5 Sep 2024 20:46:16 +0800 Subject: [PATCH 3/3] add prettier ignore for svelte 5 layout --- packages/kit/.prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kit/.prettierignore b/packages/kit/.prettierignore index b9b739abb5ca..db7d272040ac 100644 --- a/packages/kit/.prettierignore +++ b/packages/kit/.prettierignore @@ -1,2 +1,3 @@ test/build-errors/apps/syntax-error/src/routes/+page.svelte /types +src/runtime/components/svelte-5/layout.svelte \ No newline at end of file