Skip to content

Commit 82b15db

Browse files
authored
Merge branch 'main' into fixutres/private
2 parents 26ebf4d + a22b3fa commit 82b15db

File tree

26 files changed

+469
-241
lines changed

26 files changed

+469
-241
lines changed

.github/workflows/cr.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ jobs:
3232
- name: Install dependencies
3333
run: pnpm install --frozen-lockfile
3434

35-
- name: Build start
35+
- name: Build Packages
3636
run: |
3737
pnpm run build
38-
# rewrite .ts exports to .js
39-
pnpm --filter='./packages/*' -c exec "echo \$(cat package.json | jq '.exports = .publishConfig.exports') > package.json"
38+
pnpm rewrite-exports
4039
41-
- name: Release
40+
- name: Release Packages
41+
# remove the compat flag until all packages are available on npm
42+
# run: |
43+
# pnpm dlx [email protected] publish './packages/*' --template './examples/*' --compact
4244
run: |
43-
pnpm dlx [email protected] publish './packages/start' --template './examples/*' --compact
45+
pnpm dlx [email protected] publish './packages/*'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Type Check Distribution
2+
3+
on:
4+
pull_request: ~
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
typecheck-dist:
11+
name: Check ${{ matrix.package }} distributed types
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
## to add other packages from the monorepo, add them to the matrix
16+
package: [start]
17+
steps:
18+
- name: Checkout Repo
19+
uses: actions/checkout@v4
20+
21+
- uses: pnpm/action-setup@v4
22+
23+
- name: Use Node.js from nvmrc
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: ".nvmrc"
27+
registry-url: "https://registry.npmjs.org"
28+
cache: "pnpm"
29+
30+
- name: Install Dependencies
31+
run: pnpm i --frozen-lockfile
32+
33+
- name: Build ${{ matrix.package }} package and dependencies
34+
# build the package and all its dependencies
35+
run: pnpm --filter ${{ matrix.package }}... build
36+
37+
- run: pnpm rewrite-exports
38+
39+
- name: Check types with @arethetypeswrong/cli
40+
run: pnpm --filter ${{ matrix.package }} typecheck:dist

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- 1.x
7+
- main
78

89
concurrency: ${{ github.workflow }}-${{ github.ref }}
910

apps/fixtures/experiments/src/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Home() {
2323
console.log(await v.hello);
2424
});
2525
const port = isServer ? new URL(getRequestEvent()!.request.url).port: location.port;
26-
fetch(`http://localhost:${port}/${import.meta.env.SERVER_BASE_URL}/unknown`, {
26+
fetch(`http://localhost:${port}${import.meta.env.BASE_URL}/unknown`, {
2727
headers: { Accept: "application/json" }
2828
}).then(async res => console.log(await res.json()));
2929
return (

apps/fixtures/experiments/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"strict": true,
1212
"noEmit": true,
1313
"isolatedModules": true,
14+
"types": ["vite/client"],
1415
"paths": {
1516
"~/*": ["./src/*"]
1617
}

apps/tests/src/e2e/api-call.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,18 @@ test.describe("api calls", () => {
55
const response = await fetch("http://localhost:3000/api/text-plain");
66
expect(await response.text()).toBe("test");
77
});
8+
9+
test("should include headers from both event and returned request", async () => {
10+
const okResp = await fetch("http://localhost:3000/api/header-merging?status=ok");
11+
expect(okResp.headers.get("Set-Cookie")).toBeTruthy();
12+
expect(okResp.headers.get("x-event-header")).toBe("value");
13+
expect(okResp.headers.get("x-return-header")).toBe("value");
14+
expect(okResp.headers.get("x-shared-header")).toBe("event");
15+
16+
const redirectResp = await fetch("http://localhost:3000/api/header-merging?status=redirect", { redirect: "manual" });
17+
expect(redirectResp.headers.get("Set-Cookie")).toBeTruthy();
18+
expect(redirectResp.headers.get("x-event-header")).toBe("value");
19+
expect(redirectResp.headers.get("x-return-header")).toBe("value");
20+
expect(redirectResp.headers.get("x-shared-header")).toBe("event");
21+
})
822
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
test.describe("http header", () => {
4+
// couldn't get this to see the headers but verified in chrome devtools
5+
test.skip("should set http header", async ({ page }) => {
6+
const response = await page.goto("/http-header");
7+
8+
expect(response?.headers()["test-header"]).toBe("test-value");
9+
});
10+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { getRequestURL, setHeader, useSession } from "@solidjs/start/http";
2+
3+
export async function GET() {
4+
const url = getRequestURL();
5+
6+
const s = await useSession({ password: "0".repeat(32) });
7+
await s.update(d => ({count: (d.count || 0) + 1}))
8+
9+
setHeader("x-event-header", "value");
10+
setHeader("x-shared-header", "event");
11+
12+
if(url.searchParams.get("status") === "redirect") {
13+
return new Response(null, {
14+
status: 301,
15+
headers: {
16+
location: "http://::/abc",
17+
"x-return-header": "value",
18+
"x-shared-header": "return"
19+
}
20+
})
21+
} else {
22+
return new Response(null, {
23+
headers: {
24+
"x-return-header": "value",
25+
"x-shared-header": "return"
26+
}
27+
})
28+
}
29+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { HttpHeader } from "@solidjs/start";
2+
3+
export default function HttpHeaderRoute() {
4+
return (
5+
<main>
6+
<h1>Http Header</h1>
7+
<HttpHeader name="test-header" value="test-value" />
8+
</main>
9+
);
10+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"packages:build": "pnpm --filter=./packages/* build",
2525
"packages:clean": "pnpx rimraf ./packages/*/node_modules/ ./packages/*/dist/",
2626
"clean:test": "pnpx rimraf .tmp",
27-
"release": "pnpm build && changeset publish"
27+
"release": "pnpm build && changeset publish",
28+
"rewrite-exports": "pnpm --filter='./packages/*' -c exec \"echo \\$(cat package.json | jq '.exports = .publishConfig.exports') > package.json\""
2829
},
2930
"devDependencies": {
3031
"@changesets/cli": "^2.27.12",

0 commit comments

Comments
 (0)