From 29e4ec6059e6d592b7974eb8381272d926a4296e Mon Sep 17 00:00:00 2001 From: "Alexis H. Munsayac" Date: Thu, 29 Feb 2024 15:12:20 +0800 Subject: [PATCH] Fix refresh pragma (#1348) * Fix refresh pragma * Add changeset --------- Co-authored-by: Ryan Carniato --- .changeset/neat-avocados-teach.md | 5 +++ examples/bare/src/app.tsx | 1 - examples/bare/src/entry-client.tsx | 1 + examples/bare/src/entry-server.tsx | 1 + examples/basic/src/app.tsx | 1 - examples/basic/src/entry-client.tsx | 1 + examples/basic/src/entry-server.tsx | 1 + examples/experiments/src/app.tsx | 1 - examples/experiments/src/entry-client.tsx | 1 + examples/experiments/src/entry-server.tsx | 1 + examples/hackernews/src/app.tsx | 1 - examples/hackernews/src/entry-client.tsx | 1 + examples/hackernews/src/entry-server.tsx | 1 + examples/notes/src/app.tsx | 1 - examples/notes/src/entry-client.tsx | 1 + examples/notes/src/entry-server.tsx | 1 + examples/todomvc/src/app.tsx | 1 - examples/todomvc/src/entry-client.tsx | 1 + examples/todomvc/src/entry-server.tsx | 1 + examples/with-auth/src/entry-client.tsx | 1 + examples/with-auth/src/entry-server.tsx | 1 + examples/with-mdx/src/app.tsx | 1 - examples/with-mdx/src/entry-client.tsx | 1 + examples/with-mdx/src/entry-server.tsx | 1 + examples/with-prisma/src/app.tsx | 1 - examples/with-prisma/src/entry-client.tsx | 1 + examples/with-prisma/src/entry-server.tsx | 1 + examples/with-solid-styled/src/app.tsx | 1 - .../with-solid-styled/src/entry-client.tsx | 1 + .../with-solid-styled/src/entry-server.tsx | 1 + examples/with-tailwindcss/src/app.tsx | 1 - .../with-tailwindcss/src/entry-client.tsx | 1 + .../with-tailwindcss/src/entry-server.tsx | 1 + examples/with-trpc/src/app.tsx | 1 - examples/with-trpc/src/entry-client.tsx | 1 + examples/with-trpc/src/entry-server.tsx | 1 + examples/with-unocss/src/app.tsx | 3 +- examples/with-unocss/src/entry-client.tsx | 1 + examples/with-unocss/src/entry-server.tsx | 1 + examples/with-vitest/src/app.tsx | 1 - examples/with-vitest/src/entry-client.tsx | 1 + examples/with-vitest/src/entry-server.tsx | 1 + packages/start/client/StartClient.tsx | 1 + packages/start/client/index.tsx | 3 ++ packages/start/client/islands.tsx | 1 + packages/start/client/spa/index.tsx | 1 + packages/start/index.tsx | 2 ++ packages/start/server/StartServer.tsx | 1 + packages/start/server/index.tsx | 2 ++ packages/start/server/islands/index.tsx | 5 +-- packages/start/server/islands/utils.tsx | 2 ++ packages/start/server/renderAsset.tsx | 2 ++ packages/start/server/spa/StartServer.tsx | 1 + packages/start/server/spa/index.tsx | 2 ++ packages/start/shared/ErrorBoundary.tsx | 36 +++++++++---------- packages/start/shared/FileRoutes.tsx | 6 ++-- packages/start/shared/HttpHeader.tsx | 16 ++++++--- packages/start/shared/HttpStatusCode.tsx | 14 +++++--- packages/start/shared/clientOnly.tsx | 1 + .../start/shared/dev-overlay/CodeView.tsx | 1 + .../shared/dev-overlay/DevOverlayDialog.tsx | 1 + packages/start/shared/dev-overlay/icons.tsx | 1 + packages/start/shared/dev-overlay/index.tsx | 1 + packages/start/shared/index.tsx | 2 ++ packages/start/shared/lazyRoute.tsx | 2 ++ 65 files changed, 106 insertions(+), 46 deletions(-) create mode 100644 .changeset/neat-avocados-teach.md diff --git a/.changeset/neat-avocados-teach.md b/.changeset/neat-avocados-teach.md new file mode 100644 index 000000000..702c229e7 --- /dev/null +++ b/.changeset/neat-avocados-teach.md @@ -0,0 +1,5 @@ +--- +"@solidjs/start": patch +--- + +Fix refresh pragma diff --git a/examples/bare/src/app.tsx b/examples/bare/src/app.tsx index ace119947..0b9a201f1 100644 --- a/examples/bare/src/app.tsx +++ b/examples/bare/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { createSignal } from "solid-js"; import "./app.css"; diff --git a/examples/bare/src/entry-client.tsx b/examples/bare/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/bare/src/entry-client.tsx +++ b/examples/bare/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/bare/src/entry-server.tsx b/examples/bare/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/bare/src/entry-server.tsx +++ b/examples/bare/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/basic/src/app.tsx b/examples/basic/src/app.tsx index 324967b0e..d24043290 100644 --- a/examples/basic/src/app.tsx +++ b/examples/basic/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { MetaProvider, Title } from "@solidjs/meta"; import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; diff --git a/examples/basic/src/entry-client.tsx b/examples/basic/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/basic/src/entry-client.tsx +++ b/examples/basic/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/basic/src/entry-server.tsx b/examples/basic/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/basic/src/entry-server.tsx +++ b/examples/basic/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/experiments/src/app.tsx b/examples/experiments/src/app.tsx index 5519f275d..558fe4de3 100644 --- a/examples/experiments/src/app.tsx +++ b/examples/experiments/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { MetaProvider, Title } from "@solidjs/meta"; import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; diff --git a/examples/experiments/src/entry-client.tsx b/examples/experiments/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/experiments/src/entry-client.tsx +++ b/examples/experiments/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/experiments/src/entry-server.tsx b/examples/experiments/src/entry-server.tsx index dbe8c3ce0..9ac19e964 100644 --- a/examples/experiments/src/entry-server.tsx +++ b/examples/experiments/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { StartServer, createHandler } from "@solidjs/start/server"; declare module "@solidjs/start/server" { diff --git a/examples/hackernews/src/app.tsx b/examples/hackernews/src/app.tsx index 7fb8b76ae..6353718ad 100644 --- a/examples/hackernews/src/app.tsx +++ b/examples/hackernews/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/hackernews/src/entry-client.tsx b/examples/hackernews/src/entry-client.tsx index 0b072f9fa..774b89274 100644 --- a/examples/hackernews/src/entry-client.tsx +++ b/examples/hackernews/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/hackernews/src/entry-server.tsx b/examples/hackernews/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/hackernews/src/entry-server.tsx +++ b/examples/hackernews/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/notes/src/app.tsx b/examples/notes/src/app.tsx index 08671f38f..9a5e4bc5f 100644 --- a/examples/notes/src/app.tsx +++ b/examples/notes/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/notes/src/entry-client.tsx b/examples/notes/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/notes/src/entry-client.tsx +++ b/examples/notes/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/notes/src/entry-server.tsx b/examples/notes/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/notes/src/entry-server.tsx +++ b/examples/notes/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/todomvc/src/app.tsx b/examples/todomvc/src/app.tsx index e698549d5..34117f9ff 100644 --- a/examples/todomvc/src/app.tsx +++ b/examples/todomvc/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/todomvc/src/entry-client.tsx b/examples/todomvc/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/todomvc/src/entry-client.tsx +++ b/examples/todomvc/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/todomvc/src/entry-server.tsx b/examples/todomvc/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/todomvc/src/entry-server.tsx +++ b/examples/todomvc/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-auth/src/entry-client.tsx b/examples/with-auth/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-auth/src/entry-client.tsx +++ b/examples/with-auth/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-auth/src/entry-server.tsx b/examples/with-auth/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-auth/src/entry-server.tsx +++ b/examples/with-auth/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-mdx/src/app.tsx b/examples/with-mdx/src/app.tsx index bd993d700..b0534aacd 100644 --- a/examples/with-mdx/src/app.tsx +++ b/examples/with-mdx/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/with-mdx/src/entry-client.tsx b/examples/with-mdx/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-mdx/src/entry-client.tsx +++ b/examples/with-mdx/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-mdx/src/entry-server.tsx b/examples/with-mdx/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-mdx/src/entry-server.tsx +++ b/examples/with-mdx/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-prisma/src/app.tsx b/examples/with-prisma/src/app.tsx index 726b6d5ec..4d8b00e3d 100644 --- a/examples/with-prisma/src/app.tsx +++ b/examples/with-prisma/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/with-prisma/src/entry-client.tsx b/examples/with-prisma/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-prisma/src/entry-client.tsx +++ b/examples/with-prisma/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-prisma/src/entry-server.tsx b/examples/with-prisma/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-prisma/src/entry-server.tsx +++ b/examples/with-prisma/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-solid-styled/src/app.tsx b/examples/with-solid-styled/src/app.tsx index 5fa7f5078..c1fb94671 100644 --- a/examples/with-solid-styled/src/app.tsx +++ b/examples/with-solid-styled/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { MetaProvider } from "@solidjs/meta"; import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; diff --git a/examples/with-solid-styled/src/entry-client.tsx b/examples/with-solid-styled/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-solid-styled/src/entry-client.tsx +++ b/examples/with-solid-styled/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-solid-styled/src/entry-server.tsx b/examples/with-solid-styled/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-solid-styled/src/entry-server.tsx +++ b/examples/with-solid-styled/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-tailwindcss/src/app.tsx b/examples/with-tailwindcss/src/app.tsx index 97ebb7e5f..9fe9b61cf 100644 --- a/examples/with-tailwindcss/src/app.tsx +++ b/examples/with-tailwindcss/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/with-tailwindcss/src/entry-client.tsx b/examples/with-tailwindcss/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-tailwindcss/src/entry-client.tsx +++ b/examples/with-tailwindcss/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-tailwindcss/src/entry-server.tsx b/examples/with-tailwindcss/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-tailwindcss/src/entry-server.tsx +++ b/examples/with-tailwindcss/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-trpc/src/app.tsx b/examples/with-trpc/src/app.tsx index 324967b0e..d24043290 100644 --- a/examples/with-trpc/src/app.tsx +++ b/examples/with-trpc/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { MetaProvider, Title } from "@solidjs/meta"; import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; diff --git a/examples/with-trpc/src/entry-client.tsx b/examples/with-trpc/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-trpc/src/entry-client.tsx +++ b/examples/with-trpc/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-trpc/src/entry-server.tsx b/examples/with-trpc/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-trpc/src/entry-server.tsx +++ b/examples/with-trpc/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-unocss/src/app.tsx b/examples/with-unocss/src/app.tsx index eff1ef4e4..0b221549d 100644 --- a/examples/with-unocss/src/app.tsx +++ b/examples/with-unocss/src/app.tsx @@ -1,7 +1,6 @@ -import "virtual:uno.css"; import "@unocss/reset/tailwind.css"; +import "virtual:uno.css"; -// @refresh reload import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; import { Suspense } from "solid-js"; diff --git a/examples/with-unocss/src/entry-client.tsx b/examples/with-unocss/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-unocss/src/entry-client.tsx +++ b/examples/with-unocss/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-unocss/src/entry-server.tsx b/examples/with-unocss/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-unocss/src/entry-server.tsx +++ b/examples/with-unocss/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/examples/with-vitest/src/app.tsx b/examples/with-vitest/src/app.tsx index 7adfd4592..50dcc1d73 100644 --- a/examples/with-vitest/src/app.tsx +++ b/examples/with-vitest/src/app.tsx @@ -1,4 +1,3 @@ -// @refresh reload import { MetaProvider, Title } from "@solidjs/meta"; import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start"; diff --git a/examples/with-vitest/src/entry-client.tsx b/examples/with-vitest/src/entry-client.tsx index 93211d714..0ca4e3c30 100644 --- a/examples/with-vitest/src/entry-client.tsx +++ b/examples/with-vitest/src/entry-client.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); diff --git a/examples/with-vitest/src/entry-server.tsx b/examples/with-vitest/src/entry-server.tsx index 407a2afa1..401eff83f 100644 --- a/examples/with-vitest/src/entry-server.tsx +++ b/examples/with-vitest/src/entry-server.tsx @@ -1,3 +1,4 @@ +// @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; export default createHandler(() => ( diff --git a/packages/start/client/StartClient.tsx b/packages/start/client/StartClient.tsx index f1a8a190b..9de6cafe4 100644 --- a/packages/start/client/StartClient.tsx +++ b/packages/start/client/StartClient.tsx @@ -1,3 +1,4 @@ +// @refresh skip // @ts-ignore import App from "#start/app"; import type { JSX } from "solid-js"; diff --git a/packages/start/client/index.tsx b/packages/start/client/index.tsx index af5239f0a..841e5327b 100644 --- a/packages/start/client/index.tsx +++ b/packages/start/client/index.tsx @@ -1,3 +1,6 @@ +// @refresh skip +// TODO rename to index.tsx? import "vinxi/client"; export { StartClient } from "./StartClient"; export { mount } from "./mount"; + diff --git a/packages/start/client/islands.tsx b/packages/start/client/islands.tsx index 80346f8da..0c9a085e2 100644 --- a/packages/start/client/islands.tsx +++ b/packages/start/client/islands.tsx @@ -1,3 +1,4 @@ +// @refresh skip import "vinxi/client"; export function StartClient() { return null; diff --git a/packages/start/client/spa/index.tsx b/packages/start/client/spa/index.tsx index 42a66f6d2..436fe8d19 100644 --- a/packages/start/client/spa/index.tsx +++ b/packages/start/client/spa/index.tsx @@ -1,3 +1,4 @@ +// @refresh skip import type { JSX } from "solid-js"; import { render, type MountableElement } from "solid-js/web"; import "vinxi/client"; diff --git a/packages/start/index.tsx b/packages/start/index.tsx index d0e72015d..aa80ea822 100644 --- a/packages/start/index.tsx +++ b/packages/start/index.tsx @@ -1 +1,3 @@ +// @refresh skip +// TODO rename to index.ts? export * from "./shared/index"; diff --git a/packages/start/server/StartServer.tsx b/packages/start/server/StartServer.tsx index 6fe54bc52..985b4fe61 100644 --- a/packages/start/server/StartServer.tsx +++ b/packages/start/server/StartServer.tsx @@ -1,3 +1,4 @@ +// @refresh skip // @ts-ignore import App from "#start/app"; import type { Component, JSX } from "solid-js"; diff --git a/packages/start/server/index.tsx b/packages/start/server/index.tsx index c34c8b4cb..92377a72d 100644 --- a/packages/start/server/index.tsx +++ b/packages/start/server/index.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to index.ts? export { StartServer } from "./StartServer"; export { createHandler } from "./handler"; export * from "./types"; diff --git a/packages/start/server/islands/index.tsx b/packages/start/server/islands/index.tsx index ac807de29..c90622279 100644 --- a/packages/start/server/islands/index.tsx +++ b/packages/start/server/islands/index.tsx @@ -1,5 +1,6 @@ -import { type Component, type ComponentProps, lazy, sharedConfig } from "solid-js"; -import { getRequestEvent, Hydration, NoHydration } from "solid-js/web"; +// @refresh skip +import { lazy, sharedConfig, type Component, type ComponentProps } from "solid-js"; +import { Hydration, NoHydration, getRequestEvent } from "solid-js/web"; // import { IslandManifest } from "./types"; import { splitProps } from "./utils"; diff --git a/packages/start/server/islands/utils.tsx b/packages/start/server/islands/utils.tsx index 7829801b7..766b99fa3 100644 --- a/packages/start/server/islands/utils.tsx +++ b/packages/start/server/islands/utils.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to utils.ts? // @ts-nocheck import { $PROXY } from "solid-js"; diff --git a/packages/start/server/renderAsset.tsx b/packages/start/server/renderAsset.tsx index cf28ab36b..4f8d84ed8 100644 --- a/packages/start/server/renderAsset.tsx +++ b/packages/start/server/renderAsset.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to renderAsset.ts? import type { JSX } from "solid-js"; import type { Asset } from "./types"; diff --git a/packages/start/server/spa/StartServer.tsx b/packages/start/server/spa/StartServer.tsx index f4d8dd32c..e69dc78b5 100644 --- a/packages/start/server/spa/StartServer.tsx +++ b/packages/start/server/spa/StartServer.tsx @@ -1,3 +1,4 @@ +// @refresh skip // @ts-ignore import type { Component } from "solid-js"; import { NoHydration, getRequestEvent, ssr } from "solid-js/web"; diff --git a/packages/start/server/spa/index.tsx b/packages/start/server/spa/index.tsx index de26c5734..62ef3491f 100644 --- a/packages/start/server/spa/index.tsx +++ b/packages/start/server/spa/index.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to index.ts? export * from "../types"; export { StartServer } from "./StartServer"; export { createHandler } from "./handler"; diff --git a/packages/start/shared/ErrorBoundary.tsx b/packages/start/shared/ErrorBoundary.tsx index 43bbd77f1..2d86ea235 100644 --- a/packages/start/shared/ErrorBoundary.tsx +++ b/packages/start/shared/ErrorBoundary.tsx @@ -1,23 +1,23 @@ +// @refresh skip import { ErrorBoundary as DefaultErrorBoundary, type ParentProps } from "solid-js"; import { isServer } from "solid-js/web"; import { HttpStatusCode } from "./HttpStatusCode"; import { DevOverlay } from "./dev-overlay"; -export function ErrorBoundary(props: ParentProps) { - if (import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY) { - return {props.children}; - } - const message = isServer ? "500 | Internal Server Error" : "Error | Uncaught Client Exception"; - return ( - - {message} - - - } - > - {props.children} - - ); -} +export const ErrorBoundary = import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY + ? (props: ParentProps) => {props.children} + : (props: ParentProps) => { + const message = isServer ? "500 | Internal Server Error" : "Error | Uncaught Client Exception"; + return ( + + {message} + + + } + > + {props.children} + + ) + }; diff --git a/packages/start/shared/FileRoutes.tsx b/packages/start/shared/FileRoutes.tsx index 708546e96..108f32afe 100644 --- a/packages/start/shared/FileRoutes.tsx +++ b/packages/start/shared/FileRoutes.tsx @@ -30,6 +30,6 @@ export function createRoutes() { } let routes: any[]; -export const FileRoutes = () => { - return isServer ? (getRequestEvent() as PageEvent).routes : routes || (routes = createRoutes()); -}; +export const FileRoutes = isServer + ? () => (getRequestEvent() as PageEvent).routes + : () => routes || (routes = createRoutes()); diff --git a/packages/start/shared/HttpHeader.tsx b/packages/start/shared/HttpHeader.tsx index d869e07b9..f74c72918 100644 --- a/packages/start/shared/HttpHeader.tsx +++ b/packages/start/shared/HttpHeader.tsx @@ -1,9 +1,16 @@ +// @refresh skip import { onCleanup } from "solid-js"; import { getRequestEvent, isServer } from "solid-js/web"; import type { PageEvent } from "../server/types"; -export function HttpHeader(props: { name: string; value: string; append?: boolean }) { - if (isServer) { +export interface HttpHeaderProps { + name: string; + value: string; + append?: boolean; +} + +export const HttpHeader = isServer + ? (props: HttpHeaderProps) => { const event = getRequestEvent() as PageEvent; if (props.append) event.response.headers.append(props.name, props.value); @@ -23,7 +30,6 @@ export function HttpHeader(props: { name: string; value: string; append?: boolea if (values.length) event.response.headers.set(props.name, values.join(",")); else event.response.headers.delete(props.name); }); + return null; } - - return null; -} + : (_props: HttpHeaderProps) => null; diff --git a/packages/start/shared/HttpStatusCode.tsx b/packages/start/shared/HttpStatusCode.tsx index 688cc1712..5b66e775c 100644 --- a/packages/start/shared/HttpStatusCode.tsx +++ b/packages/start/shared/HttpStatusCode.tsx @@ -1,13 +1,19 @@ +// @refresh skip import { onCleanup } from "solid-js"; import { getRequestEvent, isServer } from "solid-js/web"; import type { PageEvent } from "../server/types"; -export function HttpStatusCode(props: { code: number, text?: string }) { - if (isServer) { +export interface HttpStatusCodeProps { + code: number; + text?: string; +} + +export const HttpStatusCode = isServer + ? (props: HttpStatusCodeProps) => { const event = getRequestEvent() as PageEvent; event.response.status = props.code; event.response.statusText = props.text; onCleanup(() => !event.nativeEvent.handled && (event.response.status = 200)); + return null; } - return null; -} + : (_props: HttpStatusCodeProps) => null; diff --git a/packages/start/shared/clientOnly.tsx b/packages/start/shared/clientOnly.tsx index a6d1b2193..4032ede78 100644 --- a/packages/start/shared/clientOnly.tsx +++ b/packages/start/shared/clientOnly.tsx @@ -1,3 +1,4 @@ +// @refresh skip import type { Component, ComponentProps, JSX } from "solid-js"; import { createMemo, createSignal, onMount, sharedConfig, splitProps, untrack } from "solid-js"; import { isServer } from "solid-js/web"; diff --git a/packages/start/shared/dev-overlay/CodeView.tsx b/packages/start/shared/dev-overlay/CodeView.tsx index 35a12e472..1784d1e9e 100644 --- a/packages/start/shared/dev-overlay/CodeView.tsx +++ b/packages/start/shared/dev-overlay/CodeView.tsx @@ -1,3 +1,4 @@ +// @refresh skip import type { BuiltinLanguage, Highlighter } from 'shikiji'; import { getHighlighterCore, loadWasm } from 'shikiji/core'; import { createEffect, createResource, type JSX } from 'solid-js'; diff --git a/packages/start/shared/dev-overlay/DevOverlayDialog.tsx b/packages/start/shared/dev-overlay/DevOverlayDialog.tsx index b74fb93ae..5e412dc25 100644 --- a/packages/start/shared/dev-overlay/DevOverlayDialog.tsx +++ b/packages/start/shared/dev-overlay/DevOverlayDialog.tsx @@ -1,3 +1,4 @@ +// @refresh skip import ErrorStackParser from 'error-stack-parser'; import * as htmlToImage from 'html-to-image'; import type { JSX } from 'solid-js'; diff --git a/packages/start/shared/dev-overlay/icons.tsx b/packages/start/shared/dev-overlay/icons.tsx index 815d8e68d..210d328fa 100644 --- a/packages/start/shared/dev-overlay/icons.tsx +++ b/packages/start/shared/dev-overlay/icons.tsx @@ -1,3 +1,4 @@ +// @refresh skip import type { JSX } from 'solid-js'; export function ArrowRightIcon( diff --git a/packages/start/shared/dev-overlay/index.tsx b/packages/start/shared/dev-overlay/index.tsx index 1e26d9772..c9d20b6e4 100644 --- a/packages/start/shared/dev-overlay/index.tsx +++ b/packages/start/shared/dev-overlay/index.tsx @@ -1,3 +1,4 @@ +// @refresh skip import { ErrorBoundary, Show, diff --git a/packages/start/shared/index.tsx b/packages/start/shared/index.tsx index 54223e56b..bc34d6953 100644 --- a/packages/start/shared/index.tsx +++ b/packages/start/shared/index.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to index.ts? export { FileRoutes } from "./FileRoutes"; export { GET } from "./GET"; export { HttpHeader } from "./HttpHeader"; diff --git a/packages/start/shared/lazyRoute.tsx b/packages/start/shared/lazyRoute.tsx index f1a90c00b..b3b8272d6 100644 --- a/packages/start/shared/lazyRoute.tsx +++ b/packages/start/shared/lazyRoute.tsx @@ -1,3 +1,5 @@ +// @refresh skip +// TODO rename to lazyRoute.ts? /// import { createComponent, lazy, onCleanup, type Component, type JSX } from "solid-js"; import { appendStyles, cleanupStyles, preloadStyles, updateStyles } from "vinxi/css";