Skip to content

Commit

Permalink
chore: Updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
bfanger committed Aug 21, 2022
1 parent 410ae7c commit aad76f3
Show file tree
Hide file tree
Showing 14 changed files with 278 additions and 179 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"license": "MIT",
"type": "module",
"scripts": {
"dev": "svelte-kit package && vite dev",
"dev": "svelte-package && vite dev",
"build": "vite build",
"preview": "vite preview",
"package": "svelte-kit package",
"package": "svelte-package",
"lint": "concurrently -c \"#c596c7\",\"#676778\",\"#3074c0\",\"#7c7cea\" --kill-others-on-fail \"npm:lint:*\"",
"lint:prettier": "prettier --check --loglevel=warn \"src/**/*.svelte\"",
"lint:svelte-check": "svelte-check --fail-on-warnings --fail-on-hints --ignore build,package,src/tests",
Expand Down Expand Up @@ -51,6 +51,7 @@
"@playwright/test": "^1.25.0",
"@sveltejs/adapter-static": "next",
"@sveltejs/kit": "next",
"@sveltejs/package": "^1.0.0-next.1",
"@testing-library/svelte": "^3.1.3",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
Expand Down Expand Up @@ -84,7 +85,7 @@
"typescript": "^4.7.4",
"vite": "^3.0.6",
"vite-tsconfig-paths": "^3.5.0",
"vitest": "^0.21.1"
"vitest": "^0.22.1"
},
"dependencies": {
"magic-string": "^0.26.2"
Expand Down
File renamed without changes.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { createPortal } from "react-dom";
import ReactDOM from "react-dom/client";
import { setContext } from "svelte";
import DebugContext from "../demo/components/DebugContext.svelte";
import DebugContext from "../../demo/components/DebugContext.svelte";
setContext("message", "Hello from svelte route");
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
<script lang="ts" context="module">
/**
* This page exposes variables on the window object that can be used by the Playwright tests.
*/
import type { Load } from "@sveltejs/kit";
export const load: Load = async ({ fetch }) => {
const reactVersion = await (await fetch("/api/react-version.json")).json();
const reactDomModule =
reactVersion <= 17
? () => import("react-dom")
: () => import("react-dom/client");
return {
props: {
reactVersion,
ReactDOM: (await reactDomModule()).default,
},
};
};
</script>

<script lang="ts">
import sveltify from "$lib/sveltify";
import { onMount } from "svelte";
import ClickerReact from "../tests/fixtures/Clicker";
import ClickerReact from "../../tests/fixtures/Clicker";
import { createPortal } from "react-dom";
import type { PageData } from "./$types";
export let data: PageData;
export let reactVersion: number;
export let ReactDOM: any;
$: reactVersion = data.reactVersion as number;
$: ReactDOM = data.ReactDOM;
let loading = true;
onMount(() => {
const win: any = window;
win.sveltify = sveltify;
Expand Down
17 changes: 17 additions & 0 deletions src/routes/playwright/+page.ts
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,
};
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import Counter from "../demo/react-components/Counter";
import Alert from "../demo/react-components/Alert";
import Counter from "../../demo/react-components/Counter";
import Alert from "../../demo/react-components/Alert";
if (!Counter && !Alert) {
// Bypass: is declared but its value is never read. (ts)
Expand Down
13 changes: 0 additions & 13 deletions src/routes/sveltify-react.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/routes/sveltify-react/+server.ts
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);
};
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} />
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} />
Loading

0 comments on commit aad76f3

Please sign in to comment.