-
Notifications
You must be signed in to change notification settings - Fork 425
feat(2.0): server function inspector #2049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lxsmnsyc
wants to merge
24
commits into
main
Choose a base branch
from
feat-server-function-inspector
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
f234135
add seroval json mode
lxsmnsyc f32ebb2
Fix client-server comms
lxsmnsyc 45d24aa
Update server-functions-handler.ts
lxsmnsyc 551455e
Add server function inspector
lxsmnsyc 85b7f89
Fix styling
lxsmnsyc 5ed6ddb
Fix new lines
lxsmnsyc f486220
Create HexViewer.tsx
lxsmnsyc 030cedb
Add `FormDataViewer`
lxsmnsyc 2c0c3da
add the remaining viewers
lxsmnsyc d42d7c5
Add plugin and sequence renderer
lxsmnsyc 0b779c1
add more tests
lxsmnsyc a235864
final output
lxsmnsyc b2a40ed
fix paths
lxsmnsyc c456cbe
Fix paths
lxsmnsyc 1f602ec
move dev overlay
lxsmnsyc 250f1f8
Update icons.tsx
lxsmnsyc bd91716
Update terracotta
lxsmnsyc ae98bfd
Move server-function-inspector
lxsmnsyc 3167556
Update tracker.ts
lxsmnsyc 14d8fbc
initial rework for the dev toolbar
lxsmnsyc 8c5b3ef
Update (no-side-effects).tsx
lxsmnsyc 54c706c
fix build
lxsmnsyc 7ced71c
fix styles
lxsmnsyc fca0400
fix border colors
lxsmnsyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { createEffect, createSignal } from "solid-js"; | ||
|
|
||
| async function ping(file: File) { | ||
| "use server"; | ||
| return await file.text(); | ||
| } | ||
|
|
||
| export default function App() { | ||
| const [output, setOutput] = createSignal<{ result?: boolean }>({}); | ||
|
|
||
| createEffect(async () => { | ||
| const file = new File(['Hello, World!'], 'hello-world.txt'); | ||
| const result = await ping(file); | ||
| const value = await file.text(); | ||
| setOutput(prev => ({ ...prev, result: value === result })); | ||
| }); | ||
|
|
||
| return ( | ||
| <main> | ||
| <span id="server-fn-test">{JSON.stringify(output())}</span> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { createEffect, createSignal } from "solid-js"; | ||
|
|
||
| async function ping(value: Date) { | ||
| "use server"; | ||
|
|
||
| const current = [ | ||
| value, | ||
| { | ||
| name: 'example', | ||
| *[Symbol.iterator]() { | ||
| yield 'foo'; | ||
| yield 'bar'; | ||
| yield 'baz'; | ||
| } | ||
| } | ||
| ]; | ||
|
|
||
| return current; | ||
| } | ||
|
|
||
| export default function App() { | ||
| const [output, setOutput] = createSignal<{ result?: boolean }>({}); | ||
|
|
||
| createEffect(async () => { | ||
| const value = new Date(); | ||
| const result = await ping(value); | ||
| setOutput((prev) => ({ ...prev, result: value.toString() === result[0].toString() })); | ||
| }); | ||
|
|
||
| return ( | ||
| <main> | ||
| <span id="server-fn-test">{JSON.stringify(output())}</span> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { createEffect, createSignal } from "solid-js"; | ||
|
|
||
| async function sleep(value: unknown, ms: number) { | ||
| return new Promise((res) => { | ||
| setTimeout(res, ms, value); | ||
| }) | ||
| } | ||
|
|
||
| async function ping(value: URLSearchParams, clone: URLSearchParams) { | ||
| "use server"; | ||
|
|
||
| const current = [ | ||
| value.toString() === clone.toString(), | ||
| value, | ||
| clone, | ||
| ] as const; | ||
|
|
||
| return current; | ||
| } | ||
|
|
||
| export default function App() { | ||
| const [output, setOutput] = createSignal<{ result?: boolean }>({}); | ||
|
|
||
| createEffect(async () => { | ||
| const value = new URLSearchParams([ | ||
| ['foo', 'bar'], | ||
| ['hello', 'world'], | ||
| ]); | ||
| const result = await ping(value, value); | ||
| setOutput((prev) => ({ ...prev, result: result[0] })); | ||
| }); | ||
|
|
||
| return ( | ||
| <main> | ||
| <span id="server-fn-test">{JSON.stringify(output())}</span> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { createEffect, createSignal } from "solid-js"; | ||
|
|
||
| async function sleep<T>(value: T, ms: number) { | ||
| return new Promise<T>((res) => { | ||
| setTimeout(res, ms, value); | ||
| }) | ||
| } | ||
|
|
||
| async function ping(value: ReadableStream<string>) { | ||
| "use server"; | ||
| return value; | ||
| } | ||
|
|
||
| export default function App() { | ||
| const [output, setOutput] = createSignal<{ result?: boolean }>({}); | ||
|
|
||
| createEffect(async () => { | ||
| const result = await ping( | ||
| new ReadableStream({ | ||
| async start(controller) { | ||
| controller.enqueue(await sleep('foo', 100)); | ||
| controller.enqueue(await sleep('bar', 100)); | ||
| controller.enqueue(await sleep('baz', 100)); | ||
| controller.close(); | ||
| }, | ||
| }) | ||
| ); | ||
|
|
||
| const reader = result.getReader(); | ||
| const first = await reader.read(); | ||
| setOutput((prev) => ({ ...prev, result: first.value === 'foo' })); | ||
| }); | ||
|
|
||
| return ( | ||
| <main> | ||
| <span id="server-fn-test">{JSON.stringify(output())}</span> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have to stay but you want to watch the inspector track streams, then enjoy