Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Sep 18, 2024
1 parent 4dc9f6b commit 87c8cf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/migrate/migrations/svelte-5/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
import prompts from 'prompts';
import semver from 'semver';
import glob from 'tiny-glob/sync.js';
import { bail, check_git, update_js_file } from '../../utils.js';
import { bail, check_git, update_js_file, update_svelte_file } from '../../utils.js';
import { migrate as migrate_svelte_4 } from '../svelte-4/index.js';
import { transform_module_code, transform_svelte_code, update_pkg_json } from './migrate.js';

Expand Down Expand Up @@ -138,7 +138,9 @@ export async function migrate() {
for (const file of files) {
if (extensions.some((ext) => file.endsWith(ext))) {
if (svelte_extensions.some((ext) => file.endsWith(ext))) {
update_js_file(file, (code) => transform_svelte_code(code, migrate));
update_svelte_file(file, transform_module_code, (code) =>
transform_svelte_code(code, migrate)
);
} else {
update_js_file(file, transform_module_code);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/migrate/migrations/svelte-5/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export function transform_module_code(code) {
* @param {(source: code) => { code: string }} transform_code
*/
export function transform_svelte_code(code, transform_code) {
// reuse component instantiation migration from module code
return transform_module_code(transform_code(code).code);
return transform_code(code).code;
}

/**
Expand Down

0 comments on commit 87c8cf6

Please sign in to comment.