@solidjs/start 0.4.6 → 0.4.8

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/config/index.js CHANGED
@@ -104,7 +104,8 @@ export function defineConfig(baseConfig = {}) {
104
104
  "~": join(process.cwd(), start.appRoot),
105
105
  ...(!start.ssr
106
106
  ? {
107
- "@solidjs/start/server": "@solidjs/start/server/spa"
107
+ "@solidjs/start/server": "@solidjs/start/server/spa",
108
+ "@solidjs/start/entry": "@solidjs/start/entry/spa"
108
109
  }
109
110
  : {}),
110
111
  ...userConfig.resolve?.alias
@@ -12,12 +12,12 @@ import {
12
12
  setHeader,
13
13
  setResponseStatus
14
14
  } from "vinxi/server";
15
+ import { getFetchEvent } from "../server/middleware";
16
+ import { createPageEvent } from "../server/page-event";
17
+ import { APIEvent, FetchEvent, PageEvent } from "../server/types";
15
18
  import { matchAPIRoute } from "../shared/routes";
16
- import { getFetchEvent } from "./middleware";
17
- import { createPageEvent } from "./page-event";
18
- import { APIEvent, FetchEvent, PageEvent } from "./types";
19
19
 
20
- export function createHandler(
20
+ export function createBaseHandler(
21
21
  fn: (context: PageEvent) => unknown,
22
22
  options: {
23
23
  nonce?: string;
@@ -97,3 +97,10 @@ function handleStreamCompleteRedirect(context: PageEvent) {
97
97
  to && write(`<script>window.location="${to}"</script>`);
98
98
  };
99
99
  }
100
+
101
+ export function createHandler(
102
+ fn: (context: PageEvent) => unknown,
103
+ options: Parameters<typeof createBaseHandler>[1] = {}
104
+ ) {
105
+ return createBaseHandler(fn, { ...options, createPageEvent });
106
+ }
@@ -1,5 +1,5 @@
1
- import { createHandler as createBaseHandler } from "../handler";
2
- import { FetchEvent, PageEvent } from "../types";
1
+ import { createBaseHandler } from "..";
2
+ import { FetchEvent, PageEvent } from "../../server/types";
3
3
 
4
4
  export function createHandler(
5
5
  fn: (context: PageEvent) => unknown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "author": "Ryan Carniato",
6
6
  "publishConfig": {
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "client",
11
11
  "config",
12
+ "entry",
12
13
  "server",
13
14
  "shared",
14
15
  "*.d.ts"
@@ -17,11 +18,12 @@
17
18
  "exports": {
18
19
  ".": "./shared/index.tsx",
19
20
  "./config": "./config/index.js",
21
+ "./entry": "./entry/index.ts",
22
+ "./entry/spa": "./entry/spa/index.ts",
20
23
  "./server": "./server/index.tsx",
21
24
  "./server/spa": "./server/spa/index.tsx",
22
25
  "./client": "./client/index.tsx",
23
26
  "./client/islands": "./client/islands.tsx",
24
- "./middleware": "./server/middleware.ts",
25
27
  "./client/spa": "./client/spa/index.tsx"
26
28
  },
27
29
  "typesVersions": {
@@ -29,6 +31,9 @@
29
31
  ".": [
30
32
  "./shared/index.tsx"
31
33
  ],
34
+ "./entry": [
35
+ "./entry/index.ts"
36
+ ],
32
37
  "./server": [
33
38
  "./server/index.tsx"
34
39
  ],
package/server/index.tsx CHANGED
@@ -2,13 +2,3 @@ export * from "vinxi/server";
2
2
  export { StartServer } from "./StartServer";
3
3
  export * from "./middleware";
4
4
  export * from "./types";
5
- import { createHandler as createBaseHandler } from "./handler";
6
- import { createPageEvent } from "./page-event";
7
- import type { PageEvent } from "./types";
8
-
9
- export function createHandler(
10
- fn: (context: PageEvent) => unknown,
11
- options: Parameters<typeof createBaseHandler>[1] = {}
12
- ) {
13
- return createBaseHandler(fn, { ...options, createPageEvent });
14
- }
@@ -1,5 +1,4 @@
1
1
  export * from "vinxi/server";
2
- export * from "../handler";
3
2
  export * from "../middleware";
4
3
  export * from "../types";
5
4
  export { StartServer } from "./StartServer";
package/shared/routes.ts CHANGED
@@ -33,7 +33,7 @@ export const pageRoutes = defineRoutes((fileRoutes as unknown as Route[]).filter
33
33
  const apiRoutes = defineAPIRoutes((fileRoutes as unknown as Route[]).filter(o => o.type === "api"));
34
34
 
35
35
  export function matchAPIRoute(path: string, method: HTTPMethod) {
36
- const segments = path.split("/").filter(Boolean);
36
+ const segments = path.replace(import.meta.env.SERVER_BASE_URL, "").split("/").filter(Boolean);
37
37
 
38
38
  routeLoop: for (const route of apiRoutes) {
39
39
  const matchSegments = route.matchSegments;