Skip to content

Commit 25a948b

Browse files
committed
add migration task
1 parent 4d2e5dd commit 25a948b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/migrate/migrations/app-state/migrate.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export function transform_svelte_code(code) {
3838
});
3939
let modified = code.replace('$app/stores', '$app/state');
4040

41+
let needs_navigating_migration_task = false;
42+
4143
for (const [store, alias] of stores) {
4244
// if someone uses that they're deep into stores and we better not touch this file
4345
if (store === 'getStores') return code;
@@ -68,10 +70,18 @@ export function transform_svelte_code(code) {
6870
return code;
6971
}
7072

73+
if (store === 'navigating' && after[0] !== '.') {
74+
needs_navigating_migration_task = true;
75+
}
76+
7177
modified = before.slice(0, -1) + alias + (store === 'updated' ? '.current' : '') + after;
7278
count_removed++;
7379
}
7480
}
7581

82+
if (needs_navigating_migration_task) {
83+
modified = `<!-- @migration task: review uses of \`navigating\` -->\n${modified}`;
84+
}
85+
7686
return modified;
7787
}

packages/migrate/migrations/app-state/migrate.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test('Updates $app/store #2', () => {
4040
);
4141
assert.equal(
4242
result,
43-
`<script>
43+
`<!-- @migration task: review uses of \`navigating\` -->\n<script>
4444
import { navigating, updated } from '$app/state';
4545
updated.current;
4646
updated.check();

0 commit comments

Comments
 (0)