-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: allow serialization/deserialization of custom data types #13125
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
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9c5aa14
feat: allow serialization/deserialization of custom data types
trueadm d20bf5d
feat: allow serialization/deserialization of custom data types
trueadm 71abcac
feat: allow serialization/deserialization of custom data types
trueadm c74e6af
feat: allow serialization/deserialization of custom data types
trueadm 5a08ec0
feat: allow serialization/deserialization of custom data types
trueadm 1e78784
add test
trueadm c3eea41
fix bugs
trueadm 79617ca
lint
trueadm 6c31b80
improve test name
trueadm 3b4fa6d
lint
trueadm 97e1bb2
alternative approach
trueadm 65324a6
tweak
trueadm 64db6fe
added more tests and moved to basics
trueadm c478485
lint
trueadm 005222c
fix typo
trueadm 755886c
fix test
trueadm 750d3b7
address feedback
trueadm bae67b0
comment
trueadm 1f7b31a
Merge branch 'main' into serialize-deserialize-non-pojo
dummdidumm 8389b7b
make it work
Rich-Harris 66e6b2e
Update packages/kit/src/core/sync/write_client_manifest.js
trueadm 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export class Foo { | ||
| bar() { | ||
| return 'It works!'; | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/kit/test/apps/basics/src/routes/serialization-basic/+page.server.js
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,5 @@ | ||
| import { Foo } from '../../lib'; | ||
|
|
||
| export function load() { | ||
| return { foo: new Foo() }; | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/kit/test/apps/basics/src/routes/serialization-basic/+page.svelte
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,7 @@ | ||
| <script lang="ts"> | ||
| import type { PageData } from './$types'; | ||
|
|
||
| let { data }: { data: PageData } = $props(); | ||
| </script> | ||
|
|
||
| <h1>{data.foo.bar()}</h1> |
8 changes: 8 additions & 0 deletions
8
packages/kit/test/apps/basics/src/routes/serialization-form/+page.server.js
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,8 @@ | ||
| import { Foo } from '../../lib'; | ||
|
|
||
| /** @satisfies {import('./$types').Actions} */ | ||
| export const actions = { | ||
| default: async () => { | ||
| return { foo: new Foo() }; | ||
| } | ||
| }; |
9 changes: 9 additions & 0 deletions
9
packages/kit/test/apps/basics/src/routes/serialization-form/+page.svelte
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,9 @@ | ||
| <script lang="ts"> | ||
| let { form } = $props(); | ||
| </script> | ||
|
|
||
| <form method="POST"> | ||
| <button type="submit">submit</button> | ||
| </form> | ||
|
|
||
| <h1>{form?.foo?.bar()}</h1> |
8 changes: 8 additions & 0 deletions
8
packages/kit/test/apps/basics/src/routes/serialization-form2/+page.server.js
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,8 @@ | ||
| import { Foo } from '../../lib'; | ||
|
|
||
| /** @satisfies {import('./$types').Actions} */ | ||
| export const actions = { | ||
| default: async () => { | ||
| return { foo: new Foo() }; | ||
| } | ||
| }; |
15 changes: 15 additions & 0 deletions
15
packages/kit/test/apps/basics/src/routes/serialization-form2/+page.svelte
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,15 @@ | ||
| <script lang="ts"> | ||
| import { enhance } from '$app/forms'; | ||
|
|
||
| let { form } = $props(); | ||
| </script> | ||
|
|
||
| <form method="POST" use:enhance> | ||
| <button type="submit">submit</button> | ||
| </form> | ||
|
|
||
| {#if form} | ||
| <h1>{form?.foo?.bar()}</h1> | ||
| {/if} | ||
|
|
||
| <a href="/serialization-basic">To basic form</a> |
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.
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.
was is necessary after all due to the dynamic imports? If so we should add a comment here stating why this is necessary.
Uh oh!
There was an error while loading. Please reload this page.
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 feels suuuuuper hacky, surely we can find another approach?