-
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
21
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
21 commits
Select commit
Hold shift + click to select a range
ea35150
add seroval json mode
lxsmnsyc 8218d76
Fix client-server comms
lxsmnsyc 27f8ef1
Update server-functions-handler.ts
lxsmnsyc 558ee64
Add server function inspector
lxsmnsyc c7014ed
Fix styling
lxsmnsyc e1da677
Fix new lines
lxsmnsyc d9f1ec4
Create HexViewer.tsx
lxsmnsyc d323b79
Add `FormDataViewer`
lxsmnsyc 4977c80
add the remaining viewers
lxsmnsyc e4cad18
Add plugin and sequence renderer
lxsmnsyc 346f667
add more tests
lxsmnsyc 4939f12
final output
lxsmnsyc bb7386c
fix paths
lxsmnsyc d8baca2
Fix paths
lxsmnsyc 2f95091
move dev overlay
lxsmnsyc 1a5feaa
Update icons.tsx
lxsmnsyc 2f071d4
Update terracotta
lxsmnsyc 3fdd27c
Move server-function-inspector
lxsmnsyc 0af53d8
Update tracker.ts
lxsmnsyc 2406eb5
initial rework for the dev toolbar
lxsmnsyc 518af61
Update (no-side-effects).tsx
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