@solidjs/start 0.6.0 → 0.6.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.
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  // @ts-ignore
2
3
  import App from "#start/app";
3
4
  import type { JSX } from "solid-js";
package/client/index.tsx CHANGED
@@ -1,3 +1,6 @@
1
+ // @refresh skip
2
+ // TODO rename to index.tsx?
1
3
  import "vinxi/client";
2
4
  export { StartClient } from "./StartClient";
3
5
  export { mount } from "./mount";
6
+
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import "vinxi/client";
2
3
  export function StartClient() {
3
4
  return null;
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import type { JSX } from "solid-js";
2
3
  import { render, type MountableElement } from "solid-js/web";
3
4
  import "vinxi/client";
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "author": "Ryan Carniato",
6
+ "license": "MIT",
6
7
  "publishConfig": {
7
8
  "access": "public"
8
9
  },
@@ -43,7 +44,7 @@
43
44
  },
44
45
  "devDependencies": {
45
46
  "solid-js": "^1.8.15",
46
- "vinxi": "^0.3.4"
47
+ "vinxi": "^0.3.9"
47
48
  },
48
49
  "dependencies": {
49
50
  "@vinxi/plugin-directives": "^0.3.0",
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  // @ts-ignore
2
3
  import App from "#start/app";
3
4
  import type { Component, JSX } from "solid-js";
package/server/index.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to index.ts?
1
3
  export { StartServer } from "./StartServer";
2
4
  export { createHandler } from "./handler";
3
5
  export * from "./types";
@@ -1,5 +1,6 @@
1
- import { type Component, type ComponentProps, lazy, sharedConfig } from "solid-js";
2
- import { getRequestEvent, Hydration, NoHydration } from "solid-js/web";
1
+ // @refresh skip
2
+ import { lazy, sharedConfig, type Component, type ComponentProps } from "solid-js";
3
+ import { Hydration, NoHydration, getRequestEvent } from "solid-js/web";
3
4
  // import { IslandManifest } from "./types";
4
5
  import { splitProps } from "./utils";
5
6
 
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to utils.ts?
1
3
  // @ts-nocheck
2
4
  import { $PROXY } from "solid-js";
3
5
 
@@ -9,13 +9,14 @@ function initFromFlash(ctx: FetchEvent) {
9
9
  const flash = getCookie(ctx, "flash");
10
10
  if (!flash) return;
11
11
  let param = JSON.parse(flash);
12
- if (!param || !param.result) return [];
12
+ if (!param || !param.result) return;
13
13
  const input = [...param.input.slice(0, -1), new Map(param.input[param.input.length - 1])];
14
14
  setCookie(ctx, "flash", "", { maxAge: 0 });
15
15
  return {
16
+ input,
16
17
  url: param.url,
18
+ pending: false,
17
19
  result: param.error ? new Error(param.result) : param.result,
18
- input
19
20
  };
20
21
  }
21
22
 
@@ -36,7 +37,7 @@ export async function createPageEvent(ctx: FetchEvent) {
36
37
  : [])
37
38
  ],
38
39
  router: {
39
- submission: initFromFlash(ctx)
40
+ submission: initFromFlash(ctx) as any
40
41
  },
41
42
  routes: createRoutes(),
42
43
  // prevUrl: prevPath || "",
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to renderAsset.ts?
1
3
  import type { JSX } from "solid-js";
2
4
  import type { Asset } from "./types";
3
5
 
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  // @ts-ignore
2
3
  import type { Component } from "solid-js";
3
4
  import { NoHydration, getRequestEvent, ssr } from "solid-js/web";
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to index.ts?
1
3
  export * from "../types";
2
4
  export { StartServer } from "./StartServer";
3
5
  export { createHandler } from "./handler";
@@ -1,23 +1,23 @@
1
+ // @refresh skip
1
2
  import { ErrorBoundary as DefaultErrorBoundary, type ParentProps } from "solid-js";
2
3
  import { isServer } from "solid-js/web";
3
4
  import { HttpStatusCode } from "./HttpStatusCode";
4
5
  import { DevOverlay } from "./dev-overlay";
5
6
 
6
- export function ErrorBoundary(props: ParentProps) {
7
- if (import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY) {
8
- return <DevOverlay>{props.children}</DevOverlay>;
9
- }
10
- const message = isServer ? "500 | Internal Server Error" : "Error | Uncaught Client Exception";
11
- return (
12
- <DefaultErrorBoundary
13
- fallback={
14
- <>
15
- <span style="font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%;">{message}</span>
16
- <HttpStatusCode code={500} />
17
- </>
18
- }
19
- >
20
- {props.children}
21
- </DefaultErrorBoundary>
22
- );
23
- }
7
+ export const ErrorBoundary = import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY
8
+ ? (props: ParentProps) => <DevOverlay>{props.children}</DevOverlay>
9
+ : (props: ParentProps) => {
10
+ const message = isServer ? "500 | Internal Server Error" : "Error | Uncaught Client Exception";
11
+ return (
12
+ <DefaultErrorBoundary
13
+ fallback={
14
+ <>
15
+ <span style="font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%;">{message}</span>
16
+ <HttpStatusCode code={500} />
17
+ </>
18
+ }
19
+ >
20
+ {props.children}
21
+ </DefaultErrorBoundary>
22
+ )
23
+ };
@@ -30,6 +30,6 @@ export function createRoutes() {
30
30
  }
31
31
 
32
32
  let routes: any[];
33
- export const FileRoutes = () => {
34
- return isServer ? (getRequestEvent() as PageEvent).routes : routes || (routes = createRoutes());
35
- };
33
+ export const FileRoutes = isServer
34
+ ? () => (getRequestEvent() as PageEvent).routes
35
+ : () => routes || (routes = createRoutes());
@@ -1,9 +1,16 @@
1
+ // @refresh skip
1
2
  import { onCleanup } from "solid-js";
2
3
  import { getRequestEvent, isServer } from "solid-js/web";
3
4
  import type { PageEvent } from "../server/types";
4
5
 
5
- export function HttpHeader(props: { name: string; value: string; append?: boolean }) {
6
- if (isServer) {
6
+ export interface HttpHeaderProps {
7
+ name: string;
8
+ value: string;
9
+ append?: boolean;
10
+ }
11
+
12
+ export const HttpHeader = isServer
13
+ ? (props: HttpHeaderProps) => {
7
14
  const event = getRequestEvent() as PageEvent;
8
15
 
9
16
  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
23
30
  if (values.length) event.response.headers.set(props.name, values.join(","));
24
31
  else event.response.headers.delete(props.name);
25
32
  });
33
+ return null;
26
34
  }
27
-
28
- return null;
29
- }
35
+ : (_props: HttpHeaderProps) => null;
@@ -1,13 +1,19 @@
1
+ // @refresh skip
1
2
  import { onCleanup } from "solid-js";
2
3
  import { getRequestEvent, isServer } from "solid-js/web";
3
4
  import type { PageEvent } from "../server/types";
4
5
 
5
- export function HttpStatusCode(props: { code: number, text?: string }) {
6
- if (isServer) {
6
+ export interface HttpStatusCodeProps {
7
+ code: number;
8
+ text?: string;
9
+ }
10
+
11
+ export const HttpStatusCode = isServer
12
+ ? (props: HttpStatusCodeProps) => {
7
13
  const event = getRequestEvent() as PageEvent;
8
14
  event.response.status = props.code;
9
15
  event.response.statusText = props.text;
10
16
  onCleanup(() => !event.nativeEvent.handled && (event.response.status = 200));
17
+ return null;
11
18
  }
12
- return null;
13
- }
19
+ : (_props: HttpStatusCodeProps) => null;
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import type { Component, ComponentProps, JSX } from "solid-js";
2
3
  import { createMemo, createSignal, onMount, sharedConfig, splitProps, untrack } from "solid-js";
3
4
  import { isServer } from "solid-js/web";
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import type { BuiltinLanguage, Highlighter } from 'shikiji';
2
3
  import { getHighlighterCore, loadWasm } from 'shikiji/core';
3
4
  import { createEffect, createResource, type JSX } from 'solid-js';
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import ErrorStackParser from 'error-stack-parser';
2
3
  import * as htmlToImage from 'html-to-image';
3
4
  import type { JSX } from 'solid-js';
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import type { JSX } from 'solid-js';
2
3
 
3
4
  export function ArrowRightIcon(
@@ -1,3 +1,4 @@
1
+ // @refresh skip
1
2
  import {
2
3
  ErrorBoundary,
3
4
  Show,
package/shared/index.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to index.ts?
1
3
  export { FileRoutes } from "./FileRoutes";
2
4
  export { GET } from "./GET";
3
5
  export { HttpHeader } from "./HttpHeader";
@@ -1,3 +1,5 @@
1
+ // @refresh skip
2
+ // TODO rename to lazyRoute.ts?
1
3
  /// <reference types="vinxi/types/client" />
2
4
  import { createComponent, lazy, onCleanup, type Component, type JSX } from "solid-js";
3
5
  import { appendStyles, cleanupStyles, preloadStyles, updateStyles } from "vinxi/css";