@solidjs/start 1.1.7 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,92 @@
1
- # Solid Start
1
+ <div align="center">
2
2
 
3
- This is the SolidStart framework and CLI.
3
+ [![Banner](https://assets.solidjs.com/banner?project=Start&type=core)](https://github.com/solidjs)
4
4
 
5
- The quickest way to get started:
5
+ [![Version](https://img.shields.io/npm/v/@solidjs/start.svg?style=for-the-badge&color=blue&logo=npm)](https://npmjs.com/package/@solidjs/start)
6
+ [![Downloads](https://img.shields.io/npm/dm/@solidjs/start.svg?style=for-the-badge&color=green&logo=npm)](https://npmjs.com/package/@solidjs/start)
7
+ [![Stars](https://img.shields.io/github/stars/solidjs/solid-start?style=for-the-badge&color=yellow&logo=github)](https://github.com/solidjs/solid-start)
8
+ [![Discord](https://img.shields.io/discord/722131463138705510?label=join&style=for-the-badge&color=5865F2&logo=discord&logoColor=white)](https://discord.com/invite/solidjs)
9
+ [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/solidjs?label=join&style=for-the-badge&color=FF4500&logo=reddit&logoColor=white)](https://reddit.com/r/solidjs)
10
+
11
+ </div>
12
+
13
+ **SolidStart** brings fine-grained reactivity fullstack with full flexibility. Built with features like unified rendering and isomorphic code execution, SolidStart enables you to create highly performant and scalable web applications.
14
+
15
+ Explore the official [documentation](https://docs.solidjs.com/solid-start) for detailed guides and examples.
16
+
17
+ ## Core Features
18
+
19
+ - **All Rendering Modes**:
20
+ - Server-Side Rendering _(SSR)_ with sync, async, and stream [modes](https://docs.solidjs.com/solid-start/reference/server/create-handler)
21
+ - Client-Side Rendering _(CSR)_ with the possibility of being page/component [scoped](https://docs.solidjs.com/solid-start/reference/client/client-only)
22
+ - Static Site Generation _(SSG)_ with route [pre-rendering](https://docs.solidjs.com/solid-start/building-your-application/route-prerendering)
23
+ - **TypeScript**: Full integration for robust, type-safe development
24
+ - **File-Based Routing**: Intuitive routing based on your project’s file structure
25
+ - **API Routes**: Dedicated server-side endpoints for seamless API development
26
+ - **Streaming**: Efficient data rendering for faster page loads
27
+ - **Build Optimizations**: Code splitting, tree shaking, and dead code elimination
28
+ - **Deployment Adapters**: Easily deploy to platforms like Vercel, Netlify, Cloudflare, and more
29
+
30
+ ## Getting Started
31
+
32
+ ### Installation
33
+
34
+ Create a SolidStart template project with your preferred package manager
35
+
36
+ ```bash
37
+ # using npm
38
+ npm create solid@latest -- -s
39
+ ```
6
40
 
7
41
  ```bash
8
- npm init solid@latest my-app
9
- cd my-app
10
- npm install
11
- npm run dev
12
- ```
42
+ # using pnpm
43
+ pnpm create solid@latest -s
44
+ ```
45
+
46
+ ```bash
47
+ # using bun
48
+ bun create solid@latest --s
49
+ ```
50
+
51
+ ### Project Structure
52
+
53
+ - `public/`: Static assets like icons, images, and fonts
54
+ - `src/`: Core application (aliased to `~/`)
55
+ - `routes/`: File-based routing for pages and APIs
56
+ - `app.tsx`: Root component of your application
57
+ - `entry-client.tsx`: Handles client-side hydration
58
+ - `entry-server.tsx`: Manages server-side request handling
59
+ - **Configuration Files**: `app.config.ts`, `package.json`, and more
60
+
61
+ Learn more about [routing](https://docs.solidjs.com/solid-start/building-your-application/routing)
62
+
63
+ ## Adapters
64
+
65
+ Configure adapters in `app.config.ts` to deploy to platforms like Vercel, Netlify, Cloudflare, and others
66
+
67
+ ```ts
68
+ import { defineConfig } from "@solidjs/start/config";
69
+
70
+ export default defineConfig({
71
+ ssr: true, // false for client-side rendering only
72
+ server: { preset: "netlify" },
73
+ });
74
+ ```
75
+
76
+ Presets also include runtimes like Node.js, Bun or Deno. For example, a preset like `node-server` enables hosting on your server.
77
+ Learn more about [`defineConfig`](https://docs.solidjs.com/solid-start/reference/config/define-config)
78
+
79
+ ## Building
80
+
81
+ Generate production-ready bundles
82
+
83
+ ```bash
84
+ npm run build # or pnpm build or bun build
85
+ ```
86
+
87
+ After the build completes, you’ll be guided through deployment for your specific preset.
88
+
89
+ ## Contributing
90
+
91
+ - For contributing to the codebase, check [CONTRIBUTING.md](https://github.com/solidjs/solid-start/blob/main/CONTRIBUTING.md)
92
+ - For creating a new template, please head on to [solidjs/templates](https://github.com/solidjs/templates)
@@ -1,4 +1,4 @@
1
- import { analyzeModule, BaseFileSystemRouter, cleanPath } from "vinxi/fs-router";
1
+ import {analyzeModule, BaseFileSystemRouter, cleanPath} from "vinxi/fs-router";
2
2
 
3
3
  export class SolidStartClientFileRouter extends BaseFileSystemRouter {
4
4
  toPath(src) {
@@ -43,13 +43,13 @@ export class SolidStartClientFileRouter extends BaseFileSystemRouter {
43
43
  page: true,
44
44
  $component: {
45
45
  src: src,
46
- pick: ["default", "$css"]
46
+ pick: [...exports.filter(e => e.n === e.ln && e.n !== "route").map(e => e.n), "default", "$css"]
47
47
  },
48
48
  $$route: hasRouteConfig
49
49
  ? {
50
- src: src,
51
- pick: ["route"]
52
- }
50
+ src: src,
51
+ pick: ["route"]
52
+ }
53
53
  : undefined,
54
54
  path,
55
55
  filePath: src
@@ -123,15 +123,15 @@ export class SolidStartServerFileRouter extends BaseFileSystemRouter {
123
123
  $component:
124
124
  !this.config.dataOnly && hasDefault
125
125
  ? {
126
- src: src,
127
- pick: ["default", "$css"]
128
- }
126
+ src: src,
127
+ pick: [...exports.filter(e => e.n === e.ln && e.n !== "route" && !HTTP_METHODS.includes(e.n)).map(e => e.n), "default", "$css"]
128
+ }
129
129
  : undefined,
130
130
  $$route: hasRouteConfig
131
131
  ? {
132
- src: src,
133
- pick: ["route"]
134
- }
132
+ src: src,
133
+ pick: ["route"]
134
+ }
135
135
  : undefined,
136
136
  ...createHTTPHandlers(src, exports),
137
137
  path,
package/config/index.d.ts CHANGED
@@ -14,6 +14,7 @@ type ViteCustomizableConfig = CustomizableConfig & {
14
14
  };
15
15
 
16
16
  type SolidStartInlineConfig = {
17
+ publicDir?: string;
17
18
  ssr?: boolean;
18
19
  solid?: Options;
19
20
  extensions?: string[];
package/config/index.js CHANGED
@@ -71,6 +71,7 @@ export function defineConfig(baseConfig = {}) {
71
71
  let { vite = {}, ...start } = baseConfig;
72
72
  const extensions = [...DEFAULT_EXTENSIONS, ...(start.extensions || [])];
73
73
  start = defu(start, {
74
+ publicDir: "./public",
74
75
  appRoot: "./src",
75
76
  routeDir: "./routes",
76
77
  ssr: true,
@@ -110,7 +111,7 @@ export function defineConfig(baseConfig = {}) {
110
111
  name: "public",
111
112
  type: "static",
112
113
  base: "/",
113
- dir: "./public"
114
+ dir: start.publicDir
114
115
  },
115
116
  {
116
117
  name: "ssr",
@@ -12,7 +12,7 @@ export declare function createMiddleware({ onRequest, onBeforeResponse }: {
12
12
  onRequest?: RequestMiddleware | RequestMiddleware[] | undefined;
13
13
  onBeforeResponse?: ResponseMiddleware | ResponseMiddleware[] | undefined;
14
14
  }): {
15
- onRequest?: import("h3")._RequestMiddleware | import("h3")._RequestMiddleware[] | undefined;
16
- onBeforeResponse?: import("h3")._ResponseMiddleware | import("h3")._ResponseMiddleware[] | undefined;
15
+ onRequest?: import("vinxi/http")._RequestMiddleware | import("vinxi/http")._RequestMiddleware[] | undefined;
16
+ onBeforeResponse?: import("vinxi/http")._ResponseMiddleware | import("vinxi/http")._ResponseMiddleware[] | undefined;
17
17
  };
18
18
  export {};
@@ -23,5 +23,6 @@ export declare const pageRoutes: Route[];
23
23
  export declare function matchAPIRoute(path: string, method: string): {
24
24
  handler: any;
25
25
  params: Record<string, any> | undefined;
26
+ isPage: boolean;
26
27
  } | undefined;
27
28
  export {};
@@ -26,14 +26,23 @@ function defineRoutes(fileRoutes) {
26
26
  export function matchAPIRoute(path, method) {
27
27
  const match = router.lookup(path);
28
28
  if (match && match.route) {
29
- const handler = method === "HEAD" ? match.route["$HEAD"] || match.route["$GET"] : match.route[`$${method}`];
29
+ const route = match.route;
30
+ // Find the appropriate handler for the HTTP method
31
+ const handler = method === "HEAD"
32
+ ? route.$HEAD || route.$GET
33
+ : route[`$${method}`];
30
34
  if (handler === undefined)
31
35
  return;
36
+ // Check if this is a page route
37
+ const isPage = route.page === true && route.$component !== undefined;
38
+ // Return comprehensive route information
32
39
  return {
33
40
  handler,
34
- params: match.params
41
+ params: match.params,
42
+ isPage
35
43
  };
36
44
  }
45
+ return undefined;
37
46
  }
38
47
  function containsHTTP(route) {
39
48
  return (route["$HEAD"] ||
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
1
+ declare const _default: import("vinxi/http").EventHandler<import("vinxi/http").EventHandlerRequest, Promise<unknown>>;
2
2
  export default _default;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="vinxi/types/server" />
2
+ import { parseSetCookie } from "cookie-es";
2
3
  import { crossSerializeStream, fromJSON, getCrossReferenceHeader } from "seroval";
3
4
  // @ts-ignore
4
5
  import { CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLPlugin, URLSearchParamsPlugin } from "seroval-plugins/web";
@@ -275,9 +276,16 @@ function createSingleFlightHeaders(sourceEvent) {
275
276
  SetCookies.forEach(cookie => {
276
277
  if (!cookie)
277
278
  return;
278
- const keyValue = cookie.split(";")[0];
279
- const [key, value] = keyValue.split("=");
280
- key && value && (cookies[key] = value);
279
+ const { maxAge, expires, name, value } = parseSetCookie(cookie);
280
+ if (maxAge != null && maxAge <= 0) {
281
+ delete cookies[name];
282
+ return;
283
+ }
284
+ if (expires != null && expires.getTime() <= Date.now()) {
285
+ delete cookies[name];
286
+ return;
287
+ }
288
+ cookies[name] = value;
281
289
  });
282
290
  Object.entries(cookies).forEach(([key, value]) => {
283
291
  headers.append("cookie", `${key}=${value}`);
@@ -36,7 +36,7 @@ class HeaderProxy {
36
36
  return Array.isArray(h) ? h.join(", ") : h || null;
37
37
  }
38
38
  has(key) {
39
- return this.get(key) !== undefined;
39
+ return this.get(key) !== null;
40
40
  }
41
41
  set(key, value) {
42
42
  return setResponseHeader(this.event, key, value);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,244 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { cloneEvent, createFetchEvent, getFetchEvent, mergeResponseHeaders } from "./fetchEvent";
3
+ vi.mock("vinxi/http", () => ({
4
+ getWebRequest: vi.fn(),
5
+ getRequestIP: vi.fn(),
6
+ getResponseStatus: vi.fn(),
7
+ setResponseStatus: vi.fn(),
8
+ getResponseStatusText: vi.fn(),
9
+ getResponseHeader: vi.fn(),
10
+ getResponseHeaders: vi.fn(),
11
+ setResponseHeader: vi.fn(),
12
+ appendResponseHeader: vi.fn(),
13
+ removeResponseHeader: vi.fn()
14
+ }));
15
+ import * as vinxiHttp from "vinxi/http";
16
+ const mockedVinxiHttp = vi.mocked(vinxiHttp);
17
+ const createMockH3Event = () => {
18
+ const mockRequest = new Request("http://localhost/test");
19
+ const mockStatus = 200;
20
+ const mockStatusText = "OK";
21
+ return {
22
+ node: {
23
+ req: {},
24
+ res: {
25
+ statusCode: mockStatus,
26
+ statusMessage: mockStatusText
27
+ }
28
+ },
29
+ context: {},
30
+ web: {
31
+ request: mockRequest
32
+ }
33
+ };
34
+ };
35
+ describe("fetchEvent", () => {
36
+ let mockH3Event;
37
+ beforeEach(() => {
38
+ mockH3Event = createMockH3Event();
39
+ vi.clearAllMocks();
40
+ mockedVinxiHttp.getWebRequest.mockReturnValue(mockH3Event.web?.request);
41
+ mockedVinxiHttp.getRequestIP.mockReturnValue("127.0.0.1");
42
+ mockedVinxiHttp.getResponseStatus.mockReturnValue(200);
43
+ mockedVinxiHttp.setResponseStatus.mockImplementation(() => { });
44
+ mockedVinxiHttp.getResponseStatusText.mockReturnValue("OK");
45
+ mockedVinxiHttp.getResponseHeader.mockReturnValue(undefined);
46
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({});
47
+ mockedVinxiHttp.setResponseHeader.mockImplementation(() => { });
48
+ mockedVinxiHttp.appendResponseHeader.mockImplementation(() => { });
49
+ mockedVinxiHttp.removeResponseHeader.mockImplementation(() => { });
50
+ });
51
+ describe("createFetchEvent", () => {
52
+ it("should create a FetchEvent from H3Event", () => {
53
+ const fetchEvent = createFetchEvent(mockH3Event);
54
+ expect(fetchEvent).toEqual({
55
+ request: mockH3Event.web?.request,
56
+ response: expect.any(Object),
57
+ clientAddress: "127.0.0.1",
58
+ locals: {},
59
+ nativeEvent: mockH3Event
60
+ });
61
+ });
62
+ it("should create response stub with correct properties", () => {
63
+ const fetchEvent = createFetchEvent(mockH3Event);
64
+ expect(fetchEvent.response).toHaveProperty("status");
65
+ expect(fetchEvent.response).toHaveProperty("statusText");
66
+ expect(fetchEvent.response).toHaveProperty("headers");
67
+ });
68
+ });
69
+ describe("cloneEvent", () => {
70
+ it("should create a shallow copy of FetchEvent", () => {
71
+ const original = createFetchEvent(mockH3Event);
72
+ const cloned = cloneEvent(original);
73
+ expect(cloned).toEqual(original);
74
+ expect(cloned).not.toBe(original);
75
+ expect(cloned.request).toBe(original.request);
76
+ expect(cloned.response).toBe(original.response);
77
+ });
78
+ });
79
+ describe("getFetchEvent", () => {
80
+ it("should create and cache FetchEvent on first call", () => {
81
+ const fetchEvent = getFetchEvent(mockH3Event);
82
+ expect(mockH3Event.context.solidFetchEvent).toBe(fetchEvent);
83
+ expect(fetchEvent.nativeEvent).toBe(mockH3Event);
84
+ });
85
+ it("should return cached FetchEvent on subsequent calls", () => {
86
+ const firstCall = getFetchEvent(mockH3Event);
87
+ const secondCall = getFetchEvent(mockH3Event);
88
+ expect(firstCall).toBe(secondCall);
89
+ });
90
+ });
91
+ describe("mergeResponseHeaders", () => {
92
+ it("should merge headers from Headers object to H3Event", () => {
93
+ const headers = new Headers({
94
+ "content-type": "application/json",
95
+ "x-custom": "value"
96
+ });
97
+ mergeResponseHeaders(mockH3Event, headers);
98
+ expect(mockedVinxiHttp.appendResponseHeader).toHaveBeenCalledWith(mockH3Event, "content-type", "application/json");
99
+ expect(mockedVinxiHttp.appendResponseHeader).toHaveBeenCalledWith(mockH3Event, "x-custom", "value");
100
+ });
101
+ });
102
+ describe("ResponseStub", () => {
103
+ let fetchEvent;
104
+ beforeEach(() => {
105
+ fetchEvent = createFetchEvent(mockH3Event);
106
+ });
107
+ describe("status", () => {
108
+ it("should get status from H3Event", () => {
109
+ expect(fetchEvent.response.status).toBe(200);
110
+ });
111
+ it("should set status on H3Event", () => {
112
+ fetchEvent.response.status = 404;
113
+ expect(mockedVinxiHttp.setResponseStatus).toHaveBeenCalledWith(mockH3Event, 404);
114
+ });
115
+ });
116
+ describe("statusText", () => {
117
+ it("should get statusText from H3Event", () => {
118
+ expect(fetchEvent.response.statusText).toBe("OK");
119
+ });
120
+ it("should set statusText on H3Event", () => {
121
+ fetchEvent.response.statusText = "Not Found";
122
+ expect(mockedVinxiHttp.setResponseStatus).toHaveBeenCalledWith(mockH3Event, 200, "Not Found");
123
+ });
124
+ });
125
+ });
126
+ describe("HeaderProxy", () => {
127
+ let fetchEvent;
128
+ beforeEach(() => {
129
+ fetchEvent = createFetchEvent(mockH3Event);
130
+ });
131
+ describe("get", () => {
132
+ it("should return null for non-existent header", () => {
133
+ expect(fetchEvent.response.headers.get("non-existent")).toBe(null);
134
+ });
135
+ it("should return string value for single header", () => {
136
+ mockedVinxiHttp.getResponseHeader.mockReturnValue("application/json");
137
+ expect(fetchEvent.response.headers.get("content-type")).toBe("application/json");
138
+ });
139
+ it("should join array values with comma", () => {
140
+ mockedVinxiHttp.getResponseHeader.mockReturnValue(["text/html", "application/json"]);
141
+ expect(fetchEvent.response.headers.get("accept")).toBe("text/html, application/json");
142
+ });
143
+ });
144
+ describe("has", () => {
145
+ it("should return false for non-existent header", () => {
146
+ mockedVinxiHttp.getResponseHeader.mockReturnValue(undefined);
147
+ expect(fetchEvent.response.headers.has("non-existent")).toBe(false);
148
+ });
149
+ it("should return true for existing header", () => {
150
+ mockedVinxiHttp.getResponseHeader.mockReturnValue("application/json");
151
+ expect(fetchEvent.response.headers.has("content-type")).toBe(true);
152
+ });
153
+ });
154
+ describe("set", () => {
155
+ it("should set header value", () => {
156
+ fetchEvent.response.headers.set("content-type", "application/json");
157
+ expect(mockedVinxiHttp.setResponseHeader).toHaveBeenCalledWith(mockH3Event, "content-type", "application/json");
158
+ });
159
+ });
160
+ describe("delete", () => {
161
+ it("should remove header", () => {
162
+ fetchEvent.response.headers.delete("content-type");
163
+ expect(mockedVinxiHttp.removeResponseHeader).toHaveBeenCalledWith(mockH3Event, "content-type");
164
+ });
165
+ });
166
+ describe("append", () => {
167
+ it("should append header value", () => {
168
+ fetchEvent.response.headers.append("x-custom", "value");
169
+ expect(mockedVinxiHttp.appendResponseHeader).toHaveBeenCalledWith(mockH3Event, "x-custom", "value");
170
+ });
171
+ });
172
+ describe("getSetCookie", () => {
173
+ it("should return array for single cookie", () => {
174
+ mockedVinxiHttp.getResponseHeader.mockReturnValue("session=abc123");
175
+ expect(fetchEvent.response.headers.getSetCookie()).toEqual(["session=abc123"]);
176
+ });
177
+ it("should return array for multiple cookies", () => {
178
+ mockedVinxiHttp.getResponseHeader.mockReturnValue(["session=abc123", "theme=dark"]);
179
+ expect(fetchEvent.response.headers.getSetCookie()).toEqual([
180
+ "session=abc123",
181
+ "theme=dark"
182
+ ]);
183
+ });
184
+ });
185
+ describe("forEach", () => {
186
+ it("should iterate over headers", () => {
187
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({
188
+ "content-type": "application/json",
189
+ "x-custom": ["value1", "value2"]
190
+ });
191
+ const callback = vi.fn();
192
+ fetchEvent.response.headers.forEach(callback);
193
+ expect(callback).toHaveBeenCalledWith("application/json", "content-type", expect.any(Object));
194
+ expect(callback).toHaveBeenCalledWith("value1, value2", "x-custom", expect.any(Object));
195
+ });
196
+ });
197
+ describe("entries", () => {
198
+ it("should return iterator of header entries", () => {
199
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({
200
+ "content-type": "application/json",
201
+ "x-custom": ["value1", "value2"]
202
+ });
203
+ const entries = Array.from(fetchEvent.response.headers.entries());
204
+ expect(entries).toEqual([
205
+ ["content-type", "application/json"],
206
+ ["x-custom", "value1, value2"]
207
+ ]);
208
+ });
209
+ });
210
+ describe("keys", () => {
211
+ it("should return iterator of header keys", () => {
212
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({
213
+ "content-type": "application/json",
214
+ "x-custom": "value"
215
+ });
216
+ const keys = Array.from(fetchEvent.response.headers.keys());
217
+ expect(keys).toEqual(["content-type", "x-custom"]);
218
+ });
219
+ });
220
+ describe("values", () => {
221
+ it("should return iterator of header values", () => {
222
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({
223
+ "content-type": "application/json",
224
+ "x-custom": ["value1", "value2"]
225
+ });
226
+ const values = Array.from(fetchEvent.response.headers.values());
227
+ expect(values).toEqual(["application/json", "value1, value2"]);
228
+ });
229
+ });
230
+ describe("Symbol.iterator", () => {
231
+ it("should be iterable", () => {
232
+ mockedVinxiHttp.getResponseHeaders.mockReturnValue({
233
+ "content-type": "application/json",
234
+ "x-custom": "value"
235
+ });
236
+ const entries = Array.from(fetchEvent.response.headers);
237
+ expect(entries).toEqual([
238
+ ["content-type", "application/json"],
239
+ ["x-custom", "value"]
240
+ ]);
241
+ });
242
+ });
243
+ });
244
+ });
@@ -4,9 +4,9 @@ import type { FetchEvent, HandlerOptions, PageEvent, ResponseStub } from "./type
4
4
  * If not, falls back to the 302 (temporary redirect)
5
5
  */
6
6
  export declare function getExpectedRedirectStatus(response: ResponseStub): number;
7
- export declare function createBaseHandler(fn: (context: PageEvent) => unknown, createPageEvent: (event: FetchEvent) => Promise<PageEvent>, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
7
+ export declare function createBaseHandler(fn: (context: PageEvent) => unknown, createPageEvent: (event: FetchEvent) => Promise<PageEvent>, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): import("vinxi/http").EventHandler<import("vinxi/http").EventHandlerRequest, Promise<any>>;
8
8
  /**
9
9
  *
10
10
  * Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
11
11
  */
12
- export declare function createHandler(fn: (context: PageEvent) => unknown, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
12
+ export declare function createHandler(fn: (context: PageEvent) => unknown, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): import("vinxi/http").EventHandler<import("vinxi/http").EventHandlerRequest, Promise<any>>;
@@ -39,6 +39,8 @@ export function createBaseHandler(fn, createPageEvent, options = {}, routerLoad)
39
39
  if (event.request.method !== "GET") {
40
40
  throw new Error(`API handler for ${event.request.method} "${event.request.url}" did not return a response.`);
41
41
  }
42
+ if (!match.isPage)
43
+ return;
42
44
  }
43
45
  // render
44
46
  const context = await createPageEvent(event);
@@ -3,5 +3,5 @@ import { FetchEvent, HandlerOptions, PageEvent } from "../types";
3
3
  *
4
4
  * Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
5
5
  */
6
- export declare function createHandler(fn: (context: PageEvent) => unknown, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions), routerLoad?: (event: FetchEvent) => Promise<void>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
6
+ export declare function createHandler(fn: (context: PageEvent) => unknown, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions), routerLoad?: (event: FetchEvent) => Promise<void>): import("vinxi/http").EventHandler<import("vinxi/http").EventHandlerRequest, Promise<any>>;
7
7
  export declare function createPageEvent(ctx: FetchEvent): Promise<PageEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "1.1.7",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
@@ -56,18 +56,20 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "solid-js": "^1.9.5",
59
- "vinxi": "^0.5.7"
59
+ "vinxi": "^0.5.7",
60
+ "vitest": "3.0.5"
60
61
  },
61
62
  "dependencies": {
62
63
  "@tanstack/server-functions-plugin": "1.121.21",
63
64
  "@vinxi/plugin-directives": "^0.5.0",
64
65
  "@vinxi/server-components": "^0.5.0",
66
+ "cookie-es": "^2.0.0",
65
67
  "defu": "^6.1.2",
66
68
  "error-stack-parser": "^2.1.4",
67
69
  "html-to-image": "^1.11.11",
68
70
  "radix3": "^1.1.0",
69
- "seroval": "^1.0.2",
70
- "seroval-plugins": "^1.0.2",
71
+ "seroval": "^1.4.1",
72
+ "seroval-plugins": "^1.4.0",
71
73
  "shiki": "^1.26.1",
72
74
  "source-map-js": "^1.0.2",
73
75
  "terracotta": "^1.0.4",
@@ -79,6 +81,8 @@
79
81
  },
80
82
  "scripts": {
81
83
  "typecheck": "tsc --noEmit",
82
- "build": "node build && pnpm tsc"
84
+ "build": "node build && pnpm tsc",
85
+ "test": "vitest",
86
+ "test:ci": "vitest run"
83
87
  }
84
88
  }