diff --git a/packages/migrate/package.json b/packages/migrate/package.json index 863a91b01..08e903893 100644 --- a/packages/migrate/package.json +++ b/packages/migrate/package.json @@ -43,7 +43,7 @@ "@types/node": "^20.14.8", "@types/prompts": "^2.4.9", "@types/semver": "^7.7.1", - "svelte": "^5.45.10" + "svelte": "^5.48.0" }, "keywords": [ "migration", diff --git a/packages/sv/lib/cli/tests/snapshots/create-with-all-addons/src/app.html b/packages/sv/lib/cli/tests/snapshots/create-with-all-addons/src/app.html index e3af97958..8bf98e7ee 100644 --- a/packages/sv/lib/cli/tests/snapshots/create-with-all-addons/src/app.html +++ b/packages/sv/lib/cli/tests/snapshots/create-with-all-addons/src/app.html @@ -12,7 +12,5 @@ %sveltekit.head% - -
%sveltekit.body%
- +
%sveltekit.body%
diff --git a/packages/sv/lib/core/tests/svelte/common/ensure-script/output.svelte b/packages/sv/lib/core/tests/svelte/common/ensure-script/output.svelte index c0e89bbf3..90e052fa3 100644 --- a/packages/sv/lib/core/tests/svelte/common/ensure-script/output.svelte +++ b/packages/sv/lib/core/tests/svelte/common/ensure-script/output.svelte @@ -1,5 +1,3 @@ -
-

This is a Svelte component without script block

-
+

This is a Svelte component without script block

diff --git a/packages/sv/lib/core/tooling/css/index.ts b/packages/sv/lib/core/tooling/css/index.ts index ec2a3b734..5361fca83 100644 --- a/packages/sv/lib/core/tooling/css/index.ts +++ b/packages/sv/lib/core/tooling/css/index.ts @@ -1,7 +1,7 @@ import type { SvelteAst } from '../index.ts'; export function addRule( - node: SvelteAst.CSS.StyleSheet, + node: SvelteAst.CSS.StyleSheetRules, options: { selector: string } ): SvelteAst.CSS.Rule { // we do not check for existing rules here, as the selector AST from svelte is really complex @@ -73,7 +73,10 @@ export function addDeclaration( } } -export function addImports(node: SvelteAst.CSS.StyleSheet, options: { imports: string[] }): void { +export function addImports( + node: SvelteAst.CSS.StyleSheetRules, + options: { imports: string[] } +): void { let lastImportIndex = -1; // Find the last existing @import to insert after it @@ -113,7 +116,7 @@ export function addImports(node: SvelteAst.CSS.StyleSheet, options: { imports: s } export function addAtRule( - node: SvelteAst.CSS.StyleSheet, + node: SvelteAst.CSS.StyleSheetRules, options: { name: string; params: string; append: boolean } ): SvelteAst.CSS.Atrule { const atRules = node.children.filter((x) => x.type === 'Atrule'); diff --git a/packages/sv/lib/core/tooling/index.ts b/packages/sv/lib/core/tooling/index.ts index 7cd4e18a0..87bcdf9b3 100644 --- a/packages/sv/lib/core/tooling/index.ts +++ b/packages/sv/lib/core/tooling/index.ts @@ -2,7 +2,12 @@ import { print as esrapPrint } from 'esrap'; import ts from 'esrap/languages/ts'; import type { BaseNode } from 'estree'; import * as fleece from 'silver-fleece'; -import { type AST as SvelteAst, parse as svelteParse, print as sveltePrint } from 'svelte/compiler'; +import { + type AST as SvelteAst, + parse as svelteParse, + print as sveltePrint, + parseCss as svelteParseCss +} from 'svelte/compiler'; import * as yaml from 'yaml'; import * as toml from 'smol-toml'; import { ensureScript } from './svelte/index.ts'; @@ -62,12 +67,11 @@ export function serializeScript( return code; } -export function parseCss(content: string): SvelteAst.CSS.StyleSheet { - const ast = parseSvelte(``); - return ast.css!; +export function parseCss(content: string): SvelteAst.CSS.StyleSheetRules { + return svelteParseCss(content); } -export function serializeCss(ast: SvelteAst.CSS.StyleSheet): string { +export function serializeCss(ast: SvelteAst.CSS.StyleSheetRules): string { // `svelte` can print the stylesheet directly. But this adds the style tags (