diff options
-rw-r--r-- | packages/astro/src/core/config/schema.ts | 7 | ||||
-rw-r--r-- | packages/astro/src/types/public/config.ts | 18 | ||||
-rw-r--r-- | packages/astro/test/css-order.test.js | 11 |
3 files changed, 18 insertions, 18 deletions
diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index 690e57c99..45a94a6f9 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -102,7 +102,7 @@ export const ASTRO_CONFIG_DEFAULTS = { serializeConfig: false, session: false, headingIdCompat: false, - preserveScriptOrder: false + preserveScriptOrder: false, }, } satisfies AstroUserConfig & { server: { open: boolean } }; @@ -622,7 +622,10 @@ export const AstroConfigSchema = z.object({ .boolean() .optional() .default(ASTRO_CONFIG_DEFAULTS.experimental.headingIdCompat), - preserveScriptOrder: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.preserveScriptOrder), + preserveScriptOrder: z + .boolean() + .optional() + .default(ASTRO_CONFIG_DEFAULTS.experimental.preserveScriptOrder), }) .strict( `Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/experimental-flags/ for a list of all current experiments.`, diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts index 74fc03274..35cfa83b3 100644 --- a/packages/astro/src/types/public/config.ts +++ b/packages/astro/src/types/public/config.ts @@ -2176,13 +2176,13 @@ export interface ViteUserConfig extends OriginalViteUserConfig { * @default `false` * @version 5.5 * @description - * + * * When enabled, `<script>` and `<style>` tags are rendered in the same order as they are defined. - * + * * ## Example - * + * * Consider the following component: - * + * * ```html * <p>I am a component</p> * <style> @@ -2196,19 +2196,19 @@ export interface ViteUserConfig extends OriginalViteUserConfig { * } * </style> * ``` - * + * * By default, it will generate a CSS style where `red` will be applied: - * + * * ```css * body {background:#ff0} body {background:red} * ``` - * + * * When this new option is set to `true`, the generated CSS style will apply `yellow`: - * + * * ```css * body {background:red} body {background:#ff0} * ``` - * + * */ preserveScriptOrder: boolean; }; diff --git a/packages/astro/test/css-order.test.js b/packages/astro/test/css-order.test.js index 74e58b34e..552dae3e1 100644 --- a/packages/astro/test/css-order.test.js +++ b/packages/astro/test/css-order.test.js @@ -111,12 +111,11 @@ describe('CSS production ordering', () => { } }); }); - - - describe("Changes order when transparentScriptOrder is enabled", () => { + + describe('Changes order when transparentScriptOrder is enabled', () => { /** @type {import('./test-utils').Fixture} */ let fixture; - + before(async () => { fixture = await loadFixture({ root: './fixtures/css-order-transparent/', @@ -124,13 +123,11 @@ describe('CSS production ordering', () => { await fixture.build(); }); - it('should compile styles in the same order as they are found', async () => { const html = await fixture.readFile('/index.html'); // The component declares red background first, then yellow assert.match(html, /body\{background:red\}body\{background:#ff0/); }); - - }) + }); }); |