Skip to content

Commit

Permalink
Merge branch 'main' into tanstack-server-fn-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
brenelz committed Jan 23, 2025
2 parents 458931d + 600c115 commit db8af09
Show file tree
Hide file tree
Showing 28 changed files with 3,658 additions and 347 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-singers-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": minor
---

move the RequestEventLocals definition into the App namespace for easier end user retyping
50 changes: 50 additions & 0 deletions .github/workflows/server-function.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: ci

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:

e2e-tests:
name: "E2E tests using ${{ matrix.browser }}"
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox]

runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Install project dependencies
run: pnpm i

- name: Install project dependencies
run: pnpm run build

- name: Install dependencies
uses: cypress-io/github-action@v6
with:
working-directory: .
runTests: false

- name: Cypress test
uses: cypress-io/github-action@v6
with:
install: false
working-directory: tests/server-function
build: pnpm run build
start: pnpm run start
browser: ${{ matrix.browser }}

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.5.0
8 changes: 7 additions & 1 deletion examples/todomvc/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/// <reference types="@solidjs/start/env" />
declare module App {
interface RequestEventLocals {
/**
* Declare your getRequestEvent().locals here
*/
}
}
8 changes: 5 additions & 3 deletions examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
"dependencies": {
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.11",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"solid-js": "^1.9.2",
"tailwindcss": "^3.4.3",
"vinxi": "^0.4.3"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3"
},
"overrides": {
"vite": "5.4.10"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"vinxi": "^0.4.3",
"vite": "^5.4.10",
"vite-plugin-solid": "^2.10.2",
"vitest": "^2.1.4"
"vitest": "^3.0.2"
},
"overrides": {
"vite": "5.4.10"
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
"@cloudflare/kv-asset-handler": "^0.2.0",
"citty": "^0.1.5",
"coveralls": "^3.1.1",
"cypress": "^14.0.0",
"debug": "^4.3.4",
"rimraf": "^3.0.2",
"tinyglobby": "^0.2.2",
"tippy.js": "^6.3.7",
"typescript": "5.3.3",
"typescript": "catalog:",
"valibot": "~0.29.0"
},
"dependencies": {
"cross-env": "^7.0.3",
"wrangler": "3.22.1"
},
"engines": {
"pnpm": "^9.0.0",
"node": "^20.5.0"
}
}
6 changes: 6 additions & 0 deletions packages/start/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

/* eslint-disable @typescript-eslint/consistent-type-imports */

declare namespace App {
export interface RequestEventLocals {
[key: string | symbol]: any;
}
}

interface ImportMetaEnv extends Record<`VITE_${string}`, any>, SolidStartMetaEnv {
BASE_URL: string;
MODE: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
}
},
"devDependencies": {
"solid-js": "^1.9.2",
"typescript": "^5.4.2",
"vinxi": "^0.4.3"
"solid-js": "catalog:",
"typescript": "catalog:",
"vinxi": "catalog:"
},
"dependencies": {
"@vinxi/plugin-directives": "^0.4.3",
Expand Down
11 changes: 1 addition & 10 deletions packages/start/src/server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ export { StartServer } from "./StartServer";
export { createHandler } from "./handler";
export { getServerFunctionMeta } from "./serverFunction";
export type {
DocumentComponentProps,
Asset,
HandlerOptions,
ContextMatches,
ResponseStub,
FetchEvent,
RequestEventLocals,
PageEvent,
APIEvent,
APIHandler,
ServerFunctionMeta
APIHandler, Asset, ContextMatches, DocumentComponentProps, FetchEvent, HandlerOptions, PageEvent, ResponseStub, ServerFunctionMeta
} from "./types";

7 changes: 3 additions & 4 deletions packages/start/src/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ export interface ResponseStub {
statusText?: string;
headers: Headers;
}

export interface FetchEvent {
request: Request;
response: ResponseStub;
clientAddress?: string;
locals: RequestEventLocals;
locals: App.RequestEventLocals;
nativeEvent: HTTPEvent;
}
export interface RequestEventLocals {
[key: string | symbol]: any;
}

export interface PageEvent extends RequestEvent {
manifest: any;
assets: any;
Expand Down
Loading

0 comments on commit db8af09

Please sign in to comment.