Skip to content

Commit 3793427

Browse files
committed
bundle solid-start/entry-client
1 parent 8f550a6 commit 3793427

File tree

11 files changed

+80
-11
lines changed

11 files changed

+80
-11
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "solid-start/entry-client",
3+
"module": "./dist/index.js",
4+
"types": "./dist/index.d.ts",
5+
"type": "module",
6+
"sideEffects": false
7+
}

packages/start/entry-client/StartClient.tsx renamed to packages/start/entry-client/src/StartClient.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { MetaProvider } from "@solidjs/meta";
22
import { Router, RouterProps } from "@solidjs/router";
33
// @ts-ignore
44
import Root from "~start/root";
5-
import { ServerContext } from "../server/ServerContext";
6-
import { FETCH_EVENT, PageEvent } from "../server/types";
5+
import { ServerContext } from "solid-start/server/ServerContext";
6+
import { FETCH_EVENT, PageEvent } from "solid-start/server/types";
77

88
const rootData: { default: <T>() => Promise<T> } = Object.values(
99
import.meta.glob("/src/root.data.(js|ts)", { eager: true })

packages/start/entry-client/mount.tsx renamed to packages/start/entry-client/src/mount.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { JSX } from "solid-js";
22
import { hydrate, render } from "solid-js/web";
33

4-
import { hydrateServerRouter } from "../islands/mount";
5-
import mountRouter from "../islands/router";
4+
import { hydrateServerRouter } from "solid-start/islands/mount";
5+
import mountRouter from "solid-start/islands/router";
66

77
declare global {
88
interface Window {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"emitDeclarationOnly": false,
6+
"outDir": "./dist",
7+
"types": ["../env", "solid-start/vite/plugin", "solid-start/router"],
8+
"paths": {
9+
"solid-start/islands": ["../islands"],
10+
"solid-start/server": ["../server"]
11+
}
12+
},
13+
"include": ["./src"],
14+
"exclude": []
15+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import StartClient from "../entry-client/StartClient";
1+
import StartClient from "../entry-client/src/StartClient";
22

33
StartClient();

packages/start/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
"./api": "./api/index.ts",
2424
"./api/*": "./api/*",
2525
"./durable-object": "./durable-object/index.ts",
26-
"./entry-client": "./entry-client/index.tsx",
27-
"./entry-client/*": "./entry-client/*",
26+
"./entry-client": {
27+
"types": "./entry-client/dist/index.d.ts",
28+
"import": "./entry-client/dist/index.jsx"
29+
},
30+
"./entry-client/dist/*": "./entry-client/dist/*",
2831
"./entry-server": "./entry-server/index.ts",
2932
"./entry-server/*": "./entry-server/*",
3033
"./error-boundary": "./error-boundary/index.tsx",
@@ -62,7 +65,8 @@
6265
"data",
6366
"dev",
6467
"durable-object",
65-
"entry-client",
68+
"entry-client/dist",
69+
"entry-client/package.json",
6670
"entry-server",
6771
"error-boundary",
6872
"fs-router",

packages/start/router.d.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { A as BaseA, Location, NavigateOptions, Navigator, RouteDataFunc } from "@solidjs/router";
2+
import { JSX } from "solid-js";
3+
import { LocationEntry, useSearchParams as useIslandsSearchParams } from "./islands/router";
4+
export type RouteParams<T extends string> = Record<T, string>;
5+
export type RouteDataArgs<T extends keyof StartRoutes = "$"> = {
6+
data: StartRoutes[T]["data"];
7+
params: RouteParams<StartRoutes[T]["params"]>;
8+
location: Location;
9+
navigate: Navigator;
10+
};
11+
declare const A: typeof BaseA;
12+
declare const Routes: (props: import("@solidjs/router").RoutesProps) => JSX.Element;
13+
declare const Outlet: () => JSX.Element;
14+
declare const useNavigate: () => Navigator;
15+
declare const useSearchParams: typeof useIslandsSearchParams | (<T extends import("@solidjs/router").Params>() => [T, (params: import("@solidjs/router").SetParams, options?: Partial<NavigateOptions<unknown>> | undefined) => void]);
16+
declare global {
17+
interface Window {
18+
router: {
19+
navigate: (to: string, options?: Partial<NavigateOptions>) => Promise<boolean>;
20+
push: (to: string | URL, options: Partial<NavigateOptions>) => void;
21+
update: (body: string) => Promise<boolean>;
22+
router: EventTarget;
23+
location: () => LocationEntry;
24+
};
25+
}
26+
interface StartRoutes {
27+
$: {
28+
params: any;
29+
data: any;
30+
};
31+
}
32+
interface Route {
33+
"/notes/[note]": "/notes/[note]";
34+
}
35+
}
36+
export declare function useRouteData<T extends keyof StartRoutes>(): ReturnType<StartRoutes[T]["data"]>;
37+
export declare function useRouteData<T extends (...args: any[]) => any>(): T extends RouteDataFunc<infer _, infer R> ? R : ReturnType<T>;
38+
export { useLocation } from "./islands/useLocation";
39+
export { A, Outlet, Routes, useNavigate, useSearchParams };

packages/start/tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
"target": "ESNext",
66
"allowJs": true,
77
"noEmit": true,
8-
"checkJs": true,
8+
"declaration": true,
9+
"checkJs": false,
910
"module": "ESNext",
1011
"moduleResolution": "node",
1112
"jsxImportSource": "solid-js",
1213
"jsx": "preserve",
1314
"types": ["./env"],
1415
"strict": true,
16+
"skipLibCheck": true,
1517
"lib": ["DOM", "DOM.Iterable", "ESNext"],
1618
"paths": {
1719
"vite": ["./node_modules/vite"]
1820
},
1921
"baseUrl": "./"
2022
},
2123
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.js", "./**/*.jsx"],
22-
"exclude": ["node_modules", "**/node_modules/*"]
24+
"exclude": ["node_modules", "**/node_modules/*", "entry-client"]
2325
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { mount, StartClient } from "../entry-client";
1+
import { mount, StartClient } from "../entry-client/src";
22

33
mount(() => <StartClient />, document);

0 commit comments

Comments
 (0)