-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: migrate svelte:self
#13504
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
Merged
Merged
feat: migrate svelte:self
#13504
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fbe46ec
feat: migrate `svelte:self`
paoloricciuti ae4eed9
chore: regenerate types
paoloricciuti b2071e3
fix: special case `<svelte:self></svelte:self>`
paoloricciuti 9a0b009
chore: add special case to tests
paoloricciuti be0a6a7
chore: add no filename test
paoloricciuti d29c478
Merge branch 'main' into migrate-svelte-self
paoloricciuti d08b0e4
chore: better migration task message
paoloricciuti cfded97
chore: make filename an options object to futureproof it
paoloricciuti 7970ce3
chore: simplify open tag `svelte:self`
paoloricciuti 83e77ff
chore: simplify migration comment test
paoloricciuti 727839b
chore: generate types
paoloricciuti 13da930
chore: apply smart suggestion
paoloricciuti d1ffa69
chore: changeset
paoloricciuti 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,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
feat: support migrating `svelte:self` |
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
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/migrate/samples/svelte-self-name-conflict/input.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,19 @@ | ||
<script> | ||
let SvelteSelf; | ||
</script> | ||
|
||
{#if false} | ||
<svelte:self /> | ||
<svelte:self with_attributes/> | ||
<svelte:self count={count+1}/> | ||
<svelte:self> | ||
child | ||
</svelte:self> | ||
<svelte:self count={count+1}> | ||
child | ||
</svelte:self> | ||
<svelte:self count={$$props.count} > | ||
child | ||
</svelte:self> | ||
<svelte:self></svelte:self> | ||
{/if} |
22 changes: 22 additions & 0 deletions
22
packages/svelte/tests/migrate/samples/svelte-self-name-conflict/output.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,22 @@ | ||
<script> | ||
import SvelteSelf_1 from './output.svelte'; | ||
/** @type {Record<string, any>} */ | ||
let { ...props } = $props(); | ||
let SvelteSelf; | ||
</script> | ||
|
||
{#if false} | ||
<SvelteSelf_1 /> | ||
<SvelteSelf_1 with_attributes/> | ||
<SvelteSelf_1 count={count+1}/> | ||
<SvelteSelf_1> | ||
child | ||
</SvelteSelf_1> | ||
<SvelteSelf_1 count={count+1}> | ||
child | ||
</SvelteSelf_1> | ||
<SvelteSelf_1 count={props.count} > | ||
child | ||
</SvelteSelf_1> | ||
<SvelteSelf_1></SvelteSelf_1> | ||
{/if} |
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/migrate/samples/svelte-self-skip-filename/_config.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 { test } from '../../test'; | ||
|
||
export default test({ | ||
skip_filename: true | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/svelte/tests/migrate/samples/svelte-self-skip-filename/input.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,3 @@ | ||
{#if false} | ||
<svelte:self /> | ||
{/if} |
4 changes: 4 additions & 0 deletions
4
packages/svelte/tests/migrate/samples/svelte-self-skip-filename/output.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,4 @@ | ||
{#if false} | ||
<!-- @migration-task: svelte:self is deprecated, import this Svelte file into itself instead --> | ||
<svelte:self /> | ||
{/if} |
15 changes: 15 additions & 0 deletions
15
packages/svelte/tests/migrate/samples/svelte-self/input.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 @@ | ||
{#if false} | ||
<svelte:self /> | ||
<svelte:self with_attributes/> | ||
<svelte:self count={count+1}/> | ||
<svelte:self> | ||
child | ||
</svelte:self> | ||
<svelte:self count={count+1}> | ||
child | ||
</svelte:self> | ||
<svelte:self count={$$props.count} > | ||
child | ||
</svelte:self> | ||
<svelte:self></svelte:self> | ||
{/if} |
21 changes: 21 additions & 0 deletions
21
packages/svelte/tests/migrate/samples/svelte-self/output.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,21 @@ | ||
<script> | ||
import SvelteSelf from './output.svelte'; | ||
/** @type {Record<string, any>} */ | ||
let { ...props } = $props(); | ||
</script> | ||
|
||
{#if false} | ||
<SvelteSelf /> | ||
<SvelteSelf with_attributes/> | ||
<SvelteSelf count={count+1}/> | ||
<SvelteSelf> | ||
child | ||
</SvelteSelf> | ||
<SvelteSelf count={count+1}> | ||
child | ||
</SvelteSelf> | ||
<SvelteSelf count={props.count} > | ||
child | ||
</SvelteSelf> | ||
<SvelteSelf></SvelteSelf> | ||
{/if} |
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
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.
I think it's fine to just have this as a single test, no need to check all variants for a successful addition of a comment