diff --git a/.changeset/eight-games-explode.md b/.changeset/eight-games-explode.md new file mode 100644 index 0000000..01db038 --- /dev/null +++ b/.changeset/eight-games-explode.md @@ -0,0 +1,5 @@ +--- +'prettier-plugin-astro': patch +--- + +Fixes an issue where style and script tags would sometimes get moved to other tags diff --git a/package.json b/package.json index b65824a..8305c5e 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "release": "pnpm build && changeset publish" }, "dependencies": { - "@astrojs/compiler": "^1.5.5", + "@astrojs/compiler": "^2.9.1", "prettier": "^3.0.0", "sass-formatter": "^0.7.6" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5eaef5b..0884bd6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@astrojs/compiler': - specifier: ^1.5.5 - version: 1.5.5 + specifier: ^2.9.1 + version: 2.9.1 prettier: specifier: ^3.0.0 version: 3.0.0 @@ -72,8 +72,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /@astrojs/compiler@1.5.5: - resolution: {integrity: sha512-8LEj9nUr5+92ms8/ZUyajcLYqurhXHTNMERctsHZ1JyRrnjseheUHCM+MC34bMP0uOou2JXJFWVJudDTTe4S/A==} + /@astrojs/compiler@2.9.1: + resolution: {integrity: sha512-s8Ge2lWHx/s3kl4UoerjL/iPtwdtogNM/BLOaGCwQA6crMOVYpphy5wUkYlKyuh8GAeGYH/5haLAFBsgNy9AQQ==} dev: false /@babel/code-frame@7.22.5: diff --git a/test/fixtures/styles/with-styles-and-body-tag-complex/input.astro b/test/fixtures/styles/with-styles-and-body-tag-complex/input.astro new file mode 100644 index 0000000..15870ae --- /dev/null +++ b/test/fixtures/styles/with-styles-and-body-tag-complex/input.astro @@ -0,0 +1,2 @@ + + diff --git a/test/fixtures/styles/with-styles-and-body-tag-complex/output.astro b/test/fixtures/styles/with-styles-and-body-tag-complex/output.astro new file mode 100644 index 0000000..b72b18a --- /dev/null +++ b/test/fixtures/styles/with-styles-and-body-tag-complex/output.astro @@ -0,0 +1,4 @@ + + diff --git a/test/tests/styles.test.ts b/test/tests/styles.test.ts index 4c81efa..fca7e21 100644 --- a/test/tests/styles.test.ts +++ b/test/tests/styles.test.ts @@ -37,6 +37,12 @@ test( 'styles/with-styles-and-body-tag' ); +test( + 'Can format a basic Astro file with styles and a body tag II', + files, + 'styles/with-styles-and-body-tag-complex' +); + test('Can format .less styles', files, 'styles/with-less'); test('does not format unknown CSS languages', files, 'styles/with-unknown');