-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
278 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 3 additions & 4 deletions
7
src/routes/api/react-version.json.ts → src/routes/api/react-version.json/+server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import detectReactVersion from "$lib/internal/detectReactVersion"; | ||
import type { RequestHandler } from "@sveltejs/kit"; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const GET: RequestHandler = async () => { | ||
return { | ||
body: await detectReactVersion(), | ||
}; | ||
return new Response(`${await detectReactVersion()}`, { | ||
headers: { "Content-Type": "application/json; charset=utf-8" }, | ||
}); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
33 changes: 7 additions & 26 deletions
33
src/routes/playwright.svelte → src/routes/playwright/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* This page exposes variables on the window object that can be used by the Playwright tests. | ||
*/ | ||
|
||
import type { PageLoad } from "./$types"; | ||
|
||
export const load: PageLoad = async ({ fetch }) => { | ||
const reactVersion = await (await fetch("/api/react-version.json")).json(); | ||
const reactDomModule = | ||
reactVersion <= 17 | ||
? () => import("react-dom") | ||
: () => import("react-dom/client"); | ||
return { | ||
reactVersion, | ||
ReactDOM: (await reactDomModule()).default, | ||
}; | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/routes/preprocessor.svelte → src/routes/preprocessor/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import detectReactVersion from "$lib/internal/detectReactVersion"; | ||
import { redirect, type RequestHandler } from "@sveltejs/kit"; | ||
|
||
export const GET: RequestHandler = async () => { | ||
const version = await detectReactVersion(); | ||
const location = version <= 17 ? "/sveltify-react17" : "/sveltify-react18"; | ||
throw redirect(302, location); | ||
}; |
2 changes: 1 addition & 1 deletion
2
src/routes/sveltify-react17.svelte → src/routes/sveltify-react17/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<script lang="ts"> | ||
import ReactDOM from "react-dom"; | ||
import Examples from "../demo/components/Examples.svelte"; | ||
import Examples from "../../demo/components/Examples.svelte"; | ||
</script> | ||
|
||
<Examples {ReactDOM} /> |
2 changes: 1 addition & 1 deletion
2
src/routes/sveltify-react18.svelte → src/routes/sveltify-react18/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<script lang="ts"> | ||
import ReactDOM from "react-dom/client"; | ||
import Examples from "../demo/components/Examples.svelte"; | ||
import Examples from "../../demo/components/Examples.svelte"; | ||
</script> | ||
|
||
<Examples {ReactDOM} /> |
Oops, something went wrong.