astro 5.4.3 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,6 +170,9 @@ async function generateImagesForPath(originalFilePath, transformsAndPath, env) {
170
170
  env.imageConfig
171
171
  )).data;
172
172
  } catch (e) {
173
+ if (AstroError.is(e)) {
174
+ throw e;
175
+ }
173
176
  const error = new AstroError(
174
177
  {
175
178
  ...AstroErrorData.CouldNotTransformImage,
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
153
153
  logger.info("Content config changed");
154
154
  shouldClear = true;
155
155
  }
156
- if (previousAstroVersion && previousAstroVersion !== "5.4.3") {
156
+ if (previousAstroVersion && previousAstroVersion !== "5.5.1") {
157
157
  logger.info("Astro version changed");
158
158
  shouldClear = true;
159
159
  }
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
161
161
  logger.info("Clearing content store");
162
162
  this.#store.clearAll();
163
163
  }
164
- if ("5.4.3") {
165
- await this.#store.metaStore().set("astro-version", "5.4.3");
164
+ if ("5.5.1") {
165
+ await this.#store.metaStore().set("astro-version", "5.5.1");
166
166
  }
167
167
  if (currentConfigDigest) {
168
168
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -35,6 +35,7 @@ async function compile({
35
35
  cssPartialCompileResults,
36
36
  cssTransformErrors
37
37
  }),
38
+ experimentalScriptOrder: astroConfig.experimental.preserveScriptOrder ?? false,
38
39
  async resolvePath(specifier) {
39
40
  return resolvePath(specifier, filename);
40
41
  }
@@ -72,6 +72,8 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
72
72
  svg: false;
73
73
  serializeConfig: false;
74
74
  session: false;
75
+ headingIdCompat: false;
76
+ preserveScriptOrder: false;
75
77
  };
76
78
  };
77
79
  export declare const AstroConfigSchema: z.ZodObject<{
@@ -296,7 +298,16 @@ export declare const AstroConfigSchema: z.ZodObject<{
296
298
  enabled?: boolean | undefined;
297
299
  }>>;
298
300
  markdown: z.ZodDefault<z.ZodObject<{
299
- syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
301
+ syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodDefault<z.ZodObject<{
302
+ type: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">]>>;
303
+ excludeLangs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
304
+ }, "strip", z.ZodTypeAny, {
305
+ type: "shiki" | "prism";
306
+ excludeLangs: string[];
307
+ }, {
308
+ type?: "shiki" | "prism" | undefined;
309
+ excludeLangs?: string[] | undefined;
310
+ }>>, z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">]>>, z.ZodLiteral<false>]>>;
300
311
  shikiConfig: z.ZodDefault<z.ZodObject<{
301
312
  langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
302
313
  langAlias: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
@@ -328,7 +339,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
328
339
  gfm: z.ZodDefault<z.ZodBoolean>;
329
340
  smartypants: z.ZodDefault<z.ZodBoolean>;
330
341
  }, "strip", z.ZodTypeAny, {
331
- syntaxHighlight: false | "shiki" | "prism";
342
+ syntaxHighlight: false | "shiki" | "prism" | {
343
+ type: "shiki" | "prism";
344
+ excludeLangs: string[];
345
+ };
332
346
  shikiConfig: {
333
347
  langs: ShikiLang[];
334
348
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -344,7 +358,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
344
358
  gfm: boolean;
345
359
  smartypants: boolean;
346
360
  }, {
347
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
361
+ syntaxHighlight?: false | "shiki" | "prism" | {
362
+ type?: "shiki" | "prism" | undefined;
363
+ excludeLangs?: string[] | undefined;
364
+ } | undefined;
348
365
  shikiConfig?: {
349
366
  langs?: ShikiLang[] | undefined;
350
367
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -757,11 +774,15 @@ export declare const AstroConfigSchema: z.ZodObject<{
757
774
  mode?: "inline" | "sprite" | undefined;
758
775
  } | undefined>;
759
776
  serializeConfig: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
777
+ headingIdCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
778
+ preserveScriptOrder: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
760
779
  }, "strict", z.ZodTypeAny, {
761
780
  clientPrerender: boolean;
762
781
  contentIntellisense: boolean;
763
782
  responsiveImages: boolean;
764
783
  serializeConfig: boolean;
784
+ headingIdCompat: boolean;
785
+ preserveScriptOrder: boolean;
765
786
  svg?: {
766
787
  mode?: "inline" | "sprite" | undefined;
767
788
  } | undefined;
@@ -775,6 +796,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
775
796
  } | undefined;
776
797
  serializeConfig?: boolean | undefined;
777
798
  session?: boolean | undefined;
799
+ headingIdCompat?: boolean | undefined;
800
+ preserveScriptOrder?: boolean | undefined;
778
801
  }>>;
779
802
  legacy: z.ZodDefault<z.ZodObject<{
780
803
  collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -849,7 +872,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
849
872
  enabled: boolean;
850
873
  };
851
874
  markdown: {
852
- syntaxHighlight: false | "shiki" | "prism";
875
+ syntaxHighlight: false | "shiki" | "prism" | {
876
+ type: "shiki" | "prism";
877
+ excludeLangs: string[];
878
+ };
853
879
  shikiConfig: {
854
880
  langs: ShikiLang[];
855
881
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -916,6 +942,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
916
942
  contentIntellisense: boolean;
917
943
  responsiveImages: boolean;
918
944
  serializeConfig: boolean;
945
+ headingIdCompat: boolean;
946
+ preserveScriptOrder: boolean;
919
947
  svg?: {
920
948
  mode?: "inline" | "sprite" | undefined;
921
949
  } | undefined;
@@ -1039,7 +1067,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
1039
1067
  enabled?: boolean | undefined;
1040
1068
  } | undefined;
1041
1069
  markdown?: {
1042
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
1070
+ syntaxHighlight?: false | "shiki" | "prism" | {
1071
+ type?: "shiki" | "prism" | undefined;
1072
+ excludeLangs?: string[] | undefined;
1073
+ } | undefined;
1043
1074
  shikiConfig?: {
1044
1075
  langs?: ShikiLang[] | undefined;
1045
1076
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -1124,6 +1155,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
1124
1155
  } | undefined;
1125
1156
  serializeConfig?: boolean | undefined;
1126
1157
  session?: boolean | undefined;
1158
+ headingIdCompat?: boolean | undefined;
1159
+ preserveScriptOrder?: boolean | undefined;
1127
1160
  } | undefined;
1128
1161
  legacy?: {
1129
1162
  collections?: boolean | undefined;
@@ -1352,7 +1385,16 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1352
1385
  enabled?: boolean | undefined;
1353
1386
  }>>;
1354
1387
  markdown: z.ZodDefault<z.ZodObject<{
1355
- syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
1388
+ syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodDefault<z.ZodObject<{
1389
+ type: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">]>>;
1390
+ excludeLangs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1391
+ }, "strip", z.ZodTypeAny, {
1392
+ type: "shiki" | "prism";
1393
+ excludeLangs: string[];
1394
+ }, {
1395
+ type?: "shiki" | "prism" | undefined;
1396
+ excludeLangs?: string[] | undefined;
1397
+ }>>, z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">]>>, z.ZodLiteral<false>]>>;
1356
1398
  shikiConfig: z.ZodDefault<z.ZodObject<{
1357
1399
  langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
1358
1400
  langAlias: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
@@ -1384,7 +1426,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1384
1426
  gfm: z.ZodDefault<z.ZodBoolean>;
1385
1427
  smartypants: z.ZodDefault<z.ZodBoolean>;
1386
1428
  }, "strip", z.ZodTypeAny, {
1387
- syntaxHighlight: false | "shiki" | "prism";
1429
+ syntaxHighlight: false | "shiki" | "prism" | {
1430
+ type: "shiki" | "prism";
1431
+ excludeLangs: string[];
1432
+ };
1388
1433
  shikiConfig: {
1389
1434
  langs: ShikiLang[];
1390
1435
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -1400,7 +1445,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1400
1445
  gfm: boolean;
1401
1446
  smartypants: boolean;
1402
1447
  }, {
1403
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
1448
+ syntaxHighlight?: false | "shiki" | "prism" | {
1449
+ type?: "shiki" | "prism" | undefined;
1450
+ excludeLangs?: string[] | undefined;
1451
+ } | undefined;
1404
1452
  shikiConfig?: {
1405
1453
  langs?: ShikiLang[] | undefined;
1406
1454
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -1813,11 +1861,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1813
1861
  mode?: "inline" | "sprite" | undefined;
1814
1862
  } | undefined>;
1815
1863
  serializeConfig: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1864
+ headingIdCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1865
+ preserveScriptOrder: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1816
1866
  }, "strict", z.ZodTypeAny, {
1817
1867
  clientPrerender: boolean;
1818
1868
  contentIntellisense: boolean;
1819
1869
  responsiveImages: boolean;
1820
1870
  serializeConfig: boolean;
1871
+ headingIdCompat: boolean;
1872
+ preserveScriptOrder: boolean;
1821
1873
  svg?: {
1822
1874
  mode?: "inline" | "sprite" | undefined;
1823
1875
  } | undefined;
@@ -1831,6 +1883,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1831
1883
  } | undefined;
1832
1884
  serializeConfig?: boolean | undefined;
1833
1885
  session?: boolean | undefined;
1886
+ headingIdCompat?: boolean | undefined;
1887
+ preserveScriptOrder?: boolean | undefined;
1834
1888
  }>>;
1835
1889
  legacy: z.ZodDefault<z.ZodObject<{
1836
1890
  collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1987,7 +2041,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1987
2041
  enabled: boolean;
1988
2042
  };
1989
2043
  markdown: {
1990
- syntaxHighlight: false | "shiki" | "prism";
2044
+ syntaxHighlight: false | "shiki" | "prism" | {
2045
+ type: "shiki" | "prism";
2046
+ excludeLangs: string[];
2047
+ };
1991
2048
  shikiConfig: {
1992
2049
  langs: ShikiLang[];
1993
2050
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -2054,6 +2111,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2054
2111
  contentIntellisense: boolean;
2055
2112
  responsiveImages: boolean;
2056
2113
  serializeConfig: boolean;
2114
+ headingIdCompat: boolean;
2115
+ preserveScriptOrder: boolean;
2057
2116
  svg?: {
2058
2117
  mode?: "inline" | "sprite" | undefined;
2059
2118
  } | undefined;
@@ -2177,7 +2236,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2177
2236
  enabled?: boolean | undefined;
2178
2237
  } | undefined;
2179
2238
  markdown?: {
2180
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
2239
+ syntaxHighlight?: false | "shiki" | "prism" | {
2240
+ type?: "shiki" | "prism" | undefined;
2241
+ excludeLangs?: string[] | undefined;
2242
+ } | undefined;
2181
2243
  shikiConfig?: {
2182
2244
  langs?: ShikiLang[] | undefined;
2183
2245
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -2262,6 +2324,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2262
2324
  } | undefined;
2263
2325
  serializeConfig?: boolean | undefined;
2264
2326
  session?: boolean | undefined;
2327
+ headingIdCompat?: boolean | undefined;
2328
+ preserveScriptOrder?: boolean | undefined;
2265
2329
  } | undefined;
2266
2330
  legacy?: {
2267
2331
  collections?: boolean | undefined;
@@ -2333,7 +2397,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2333
2397
  enabled: boolean;
2334
2398
  };
2335
2399
  markdown: {
2336
- syntaxHighlight: false | "shiki" | "prism";
2400
+ syntaxHighlight: false | "shiki" | "prism" | {
2401
+ type: "shiki" | "prism";
2402
+ excludeLangs: string[];
2403
+ };
2337
2404
  shikiConfig: {
2338
2405
  langs: ShikiLang[];
2339
2406
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -2400,6 +2467,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2400
2467
  contentIntellisense: boolean;
2401
2468
  responsiveImages: boolean;
2402
2469
  serializeConfig: boolean;
2470
+ headingIdCompat: boolean;
2471
+ preserveScriptOrder: boolean;
2403
2472
  svg?: {
2404
2473
  mode?: "inline" | "sprite" | undefined;
2405
2474
  } | undefined;
@@ -2523,7 +2592,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2523
2592
  enabled?: boolean | undefined;
2524
2593
  } | undefined;
2525
2594
  markdown?: {
2526
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
2595
+ syntaxHighlight?: false | "shiki" | "prism" | {
2596
+ type?: "shiki" | "prism" | undefined;
2597
+ excludeLangs?: string[] | undefined;
2598
+ } | undefined;
2527
2599
  shikiConfig?: {
2528
2600
  langs?: ShikiLang[] | undefined;
2529
2601
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -2608,6 +2680,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2608
2680
  } | undefined;
2609
2681
  serializeConfig?: boolean | undefined;
2610
2682
  session?: boolean | undefined;
2683
+ headingIdCompat?: boolean | undefined;
2684
+ preserveScriptOrder?: boolean | undefined;
2611
2685
  } | undefined;
2612
2686
  legacy?: {
2613
2687
  collections?: boolean | undefined;
@@ -2679,7 +2753,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2679
2753
  enabled: boolean;
2680
2754
  };
2681
2755
  markdown: {
2682
- syntaxHighlight: false | "shiki" | "prism";
2756
+ syntaxHighlight: false | "shiki" | "prism" | {
2757
+ type: "shiki" | "prism";
2758
+ excludeLangs: string[];
2759
+ };
2683
2760
  shikiConfig: {
2684
2761
  langs: ShikiLang[];
2685
2762
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -2746,6 +2823,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2746
2823
  contentIntellisense: boolean;
2747
2824
  responsiveImages: boolean;
2748
2825
  serializeConfig: boolean;
2826
+ headingIdCompat: boolean;
2827
+ preserveScriptOrder: boolean;
2749
2828
  svg?: {
2750
2829
  mode?: "inline" | "sprite" | undefined;
2751
2830
  } | undefined;
@@ -2869,7 +2948,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2869
2948
  enabled?: boolean | undefined;
2870
2949
  } | undefined;
2871
2950
  markdown?: {
2872
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
2951
+ syntaxHighlight?: false | "shiki" | "prism" | {
2952
+ type?: "shiki" | "prism" | undefined;
2953
+ excludeLangs?: string[] | undefined;
2954
+ } | undefined;
2873
2955
  shikiConfig?: {
2874
2956
  langs?: ShikiLang[] | undefined;
2875
2957
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -2954,6 +3036,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2954
3036
  } | undefined;
2955
3037
  serializeConfig?: boolean | undefined;
2956
3038
  session?: boolean | undefined;
3039
+ headingIdCompat?: boolean | undefined;
3040
+ preserveScriptOrder?: boolean | undefined;
2957
3041
  } | undefined;
2958
3042
  legacy?: {
2959
3043
  collections?: boolean | undefined;
@@ -3025,7 +3109,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
3025
3109
  enabled: boolean;
3026
3110
  };
3027
3111
  markdown: {
3028
- syntaxHighlight: false | "shiki" | "prism";
3112
+ syntaxHighlight: false | "shiki" | "prism" | {
3113
+ type: "shiki" | "prism";
3114
+ excludeLangs: string[];
3115
+ };
3029
3116
  shikiConfig: {
3030
3117
  langs: ShikiLang[];
3031
3118
  theme: import("shiki").BundledTheme | ShikiTheme;
@@ -3092,6 +3179,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
3092
3179
  contentIntellisense: boolean;
3093
3180
  responsiveImages: boolean;
3094
3181
  serializeConfig: boolean;
3182
+ headingIdCompat: boolean;
3183
+ preserveScriptOrder: boolean;
3095
3184
  svg?: {
3096
3185
  mode?: "inline" | "sprite" | undefined;
3097
3186
  } | undefined;
@@ -3215,7 +3304,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
3215
3304
  enabled?: boolean | undefined;
3216
3305
  } | undefined;
3217
3306
  markdown?: {
3218
- syntaxHighlight?: false | "shiki" | "prism" | undefined;
3307
+ syntaxHighlight?: false | "shiki" | "prism" | {
3308
+ type?: "shiki" | "prism" | undefined;
3309
+ excludeLangs?: string[] | undefined;
3310
+ } | undefined;
3219
3311
  shikiConfig?: {
3220
3312
  langs?: ShikiLang[] | undefined;
3221
3313
  theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
@@ -3300,6 +3392,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
3300
3392
  } | undefined;
3301
3393
  serializeConfig?: boolean | undefined;
3302
3394
  session?: boolean | undefined;
3395
+ headingIdCompat?: boolean | undefined;
3396
+ preserveScriptOrder?: boolean | undefined;
3303
3397
  } | undefined;
3304
3398
  legacy?: {
3305
3399
  collections?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath, pathToFileURL } from "node:url";
3
- import { markdownConfigDefaults } from "@astrojs/markdown-remark";
3
+ import { markdownConfigDefaults, syntaxHighlightDefaults } from "@astrojs/markdown-remark";
4
4
  import { bundledThemes } from "shiki";
5
5
  import { z } from "zod";
6
6
  import { EnvSchema } from "../../env/schema.js";
@@ -58,9 +58,12 @@ const ASTRO_CONFIG_DEFAULTS = {
58
58
  responsiveImages: false,
59
59
  svg: false,
60
60
  serializeConfig: false,
61
- session: false
61
+ session: false,
62
+ headingIdCompat: false,
63
+ preserveScriptOrder: false
62
64
  }
63
65
  };
66
+ const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type);
64
67
  const AstroConfigSchema = z.object({
65
68
  root: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.root).transform((val) => new URL(val)),
66
69
  srcDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.srcDir).transform((val) => new URL(val)),
@@ -176,7 +179,14 @@ const AstroConfigSchema = z.object({
176
179
  enabled: z.boolean().default(ASTRO_CONFIG_DEFAULTS.devToolbar.enabled)
177
180
  }).default(ASTRO_CONFIG_DEFAULTS.devToolbar),
178
181
  markdown: z.object({
179
- syntaxHighlight: z.union([z.literal("shiki"), z.literal("prism"), z.literal(false)]).default(ASTRO_CONFIG_DEFAULTS.markdown.syntaxHighlight),
182
+ syntaxHighlight: z.union([
183
+ z.object({
184
+ type: highlighterTypesSchema,
185
+ excludeLangs: z.array(z.string()).optional().default(syntaxHighlightDefaults.excludeLangs)
186
+ }).default(syntaxHighlightDefaults),
187
+ highlighterTypesSchema,
188
+ z.literal(false)
189
+ ]).default(ASTRO_CONFIG_DEFAULTS.markdown.syntaxHighlight),
180
190
  shikiConfig: z.object({
181
191
  langs: z.custom().array().transform((langs) => {
182
192
  for (const lang of langs) {
@@ -377,7 +387,9 @@ const AstroConfigSchema = z.object({
377
387
  }
378
388
  return svgConfig;
379
389
  }),
380
- serializeConfig: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.serializeConfig)
390
+ serializeConfig: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.serializeConfig),
391
+ headingIdCompat: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.headingIdCompat),
392
+ preserveScriptOrder: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.preserveScriptOrder)
381
393
  }).strict(
382
394
  `Invalid or outdated experimental feature.
383
395
  Check for incorrect spelling or outdated Astro version.
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.4.3";
1
+ const ASTRO_VERSION = "5.5.1";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "5.4.3";
25
+ const currentVersion = "5.5.1";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "5.4.3";
41
+ const version = "5.5.1";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -282,7 +282,7 @@ function printHelp({
282
282
  message.push(
283
283
  linebreak(),
284
284
  ` ${bgGreen(black(` ${commandName} `))} ${green(
285
- `v${"5.4.3"}`
285
+ `v${"5.5.1"}`
286
286
  )} ${headline}`
287
287
  );
288
288
  }
@@ -53,7 +53,9 @@ function createAnonymousConfigInfo(userConfig) {
53
53
  vite: userConfig.vite ? sanitizeConfigInfo(userConfig.vite, Object.keys(userConfig.vite)) : void 0
54
54
  };
55
55
  configInfo.build.format = measureStringLiteral(userConfig.build?.format);
56
- configInfo.markdown.syntaxHighlight = measureStringLiteral(userConfig.markdown?.syntaxHighlight);
56
+ const syntaxHighlight = userConfig.markdown?.syntaxHighlight;
57
+ const syntaxHighlightType = typeof syntaxHighlight === "object" ? syntaxHighlight.type : syntaxHighlight;
58
+ configInfo.markdown.syntaxHighlight = measureStringLiteral(syntaxHighlightType);
57
59
  configInfo.output = measureStringLiteral(userConfig.output);
58
60
  configInfo.scopedStyleStrategy = measureStringLiteral(userConfig.scopedStyleStrategy);
59
61
  configInfo.trailingSlash = measureStringLiteral(userConfig.trailingSlash);
@@ -76,6 +76,14 @@ function getFallback() {
76
76
  }
77
77
  function runScripts() {
78
78
  let wait = Promise.resolve();
79
+ let needsWaitForInlineModuleScript = false;
80
+ for (const script of document.getElementsByTagName("script")) {
81
+ script.dataset.astroExec === void 0 && script.getAttribute("type") === "module" && (needsWaitForInlineModuleScript = script.getAttribute("src") === null);
82
+ }
83
+ needsWaitForInlineModuleScript && document.body.insertAdjacentHTML(
84
+ "beforeend",
85
+ `<script type="module" src="data:application/javascript,"/>`
86
+ );
79
87
  for (const script of document.getElementsByTagName("script")) {
80
88
  if (script.dataset.astroExec === "") continue;
81
89
  const type = script.getAttribute("type");
@@ -421,6 +429,7 @@ if (inBrowser) {
421
429
  }
422
430
  for (const script of document.getElementsByTagName("script")) {
423
431
  detectScriptExecuted(script);
432
+ script.dataset.astroExec = "";
424
433
  }
425
434
  }
426
435
  async function prepareForClientOnlyComponents(newDocument, toLocation, signal) {
@@ -1,6 +1,6 @@
1
1
  import type { OutgoingHttpHeaders } from 'node:http';
2
2
  import type { RemotePattern } from '@astrojs/internal-helpers/remote';
3
- import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig } from '@astrojs/markdown-remark';
3
+ import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig, SyntaxHighlightConfigType } from '@astrojs/markdown-remark';
4
4
  import type { BuiltinDriverName, BuiltinDriverOptions, Driver, Storage } from 'unstorage';
5
5
  import type { UserConfig as OriginalViteUserConfig, SSROptions as ViteSSROptions } from 'vite';
6
6
  import type { ImageFit, ImageLayout } from '../../assets/types.js';
@@ -220,7 +220,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
220
220
  * When redirects occur in production for GET requests, the redirect will be a 301 (permanent) redirect. For all other request methods, it will be a 308 (permanent, and preserve the request method) redirect.
221
221
  *
222
222
  * Trailing slashes on prerendered pages are handled by the hosting platform, and may not respect your chosen configuration.
223
- * See your hosting platform's documentation for more information.
223
+ * See your hosting platform's documentation for more information. You cannot use Astro [redirects](#redirects) for this use case at this point.
224
224
  *
225
225
  * ```js
226
226
  * {
@@ -252,7 +252,8 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
252
252
  * '/news': {
253
253
  * status: 302,
254
254
  * destination: 'https://example.com/news'
255
- * }
255
+ * },
256
+ * // '/product1/', '/product1' // Note, this is not supported
256
257
  * }
257
258
  * })
258
259
  * ```
@@ -276,6 +277,8 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
276
277
  * },
277
278
  * }
278
279
  * })
280
+ *
281
+ *
279
282
  * ```
280
283
  */
281
284
  redirects?: Record<string, RedirectConfig>;
@@ -1048,7 +1051,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1048
1051
  * @docs
1049
1052
  * @name image.domains
1050
1053
  * @type {string[]}
1051
- * @default `{domains: []}`
1054
+ * @default `[]`
1052
1055
  * @version 2.10.10
1053
1056
  * @description
1054
1057
  * Defines a list of permitted image source domains for remote image optimization. No other remote images will be optimized by Astro.
@@ -1070,7 +1073,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1070
1073
  * @docs
1071
1074
  * @name image.remotePatterns
1072
1075
  * @type {RemotePattern[]}
1073
- * @default `{remotePatterns: []}`
1076
+ * @default `[]`
1074
1077
  * @version 2.10.10
1075
1078
  * @description
1076
1079
  * Defines a list of permitted image source URL patterns for remote image optimization.
@@ -1208,14 +1211,15 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1208
1211
  /**
1209
1212
  * @docs
1210
1213
  * @name markdown.syntaxHighlight
1211
- * @type {'shiki' | 'prism' | false}
1212
- * @default `shiki`
1214
+ * @type {SyntaxHighlightConfig | SyntaxHighlightConfigType | false}
1215
+ * @default `{ type: 'shiki', excludeLangs: ['math'] }`
1213
1216
  * @description
1214
1217
  * Which syntax highlighter to use for Markdown code blocks (\`\`\`), if any. This determines the CSS classes that Astro will apply to your Markdown code blocks.
1218
+ *
1215
1219
  * - `shiki` - use the [Shiki](https://shiki.style) highlighter (`github-dark` theme configured by default)
1216
1220
  * - `prism` - use the [Prism](https://prismjs.com/) highlighter and [provide your own Prism stylesheet](/en/guides/syntax-highlighting/#add-a-prism-stylesheet)
1217
1221
  * - `false` - do not apply syntax highlighting.
1218
- *
1222
+
1219
1223
  * ```js
1220
1224
  * {
1221
1225
  * markdown: {
@@ -1224,8 +1228,52 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1224
1228
  * }
1225
1229
  * }
1226
1230
  * ```
1231
+ *
1232
+ * For more control over syntax highlighting, you can instead specify a configuration object with the properties listed below.
1227
1233
  */
1228
- syntaxHighlight?: 'shiki' | 'prism' | false;
1234
+ syntaxHighlight?: {
1235
+ /**
1236
+ * @docs
1237
+ * @name markdown.syntaxHighlight.type
1238
+ * @kind h4
1239
+ * @type {'shiki' | 'prism'}
1240
+ * @default `'shiki'`
1241
+ * @version 5.5.0
1242
+ * @description
1243
+ *
1244
+ * The default CSS classes to apply to Markdown code blocks.
1245
+ * (If no other syntax highlighting configuration is needed, you can instead set `markdown.syntaxHighlight` directly to `shiki`, `prism`, or `false`.)
1246
+ *
1247
+ */
1248
+ type?: SyntaxHighlightConfigType;
1249
+ /**
1250
+ * @docs
1251
+ * @name markdown.syntaxHighlight.excludeLangs
1252
+ * @kind h4
1253
+ * @type {string[]}
1254
+ * @default `['math']`
1255
+ * @version 5.5.0
1256
+ * @description
1257
+ *
1258
+ * An array of languages to exclude from the default syntax highlighting specified in `markdown.syntaxHighlight.type`.
1259
+ * This can be useful when using tools that create diagrams from Markdown code blocks, such as Mermaid.js and D2.
1260
+ *
1261
+ * ```js title="astro.config.mjs"
1262
+ * import { defineConfig } from 'astro/config';
1263
+ *
1264
+ * export default defineConfig({
1265
+ * markdown: {
1266
+ * syntaxHighlight: {
1267
+ * type: 'shiki',
1268
+ * excludeLangs: ['mermaid', 'math'],
1269
+ * },
1270
+ * },
1271
+ * });
1272
+ * ```
1273
+ *
1274
+ * */
1275
+ excludeLangs?: string[];
1276
+ } | SyntaxHighlightConfigType | false;
1229
1277
  /**
1230
1278
  * @docs
1231
1279
  * @name markdown.remarkPlugins
@@ -1320,7 +1368,6 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1320
1368
  * @name i18n
1321
1369
  * @type {object}
1322
1370
  * @version 3.5.0
1323
- * @type {object}
1324
1371
  * @description
1325
1372
  *
1326
1373
  * Configures i18n routing and allows you to specify some customization options.
@@ -1388,12 +1435,39 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1388
1435
  /**
1389
1436
  * @docs
1390
1437
  * @name i18n.routing
1391
- * @type {Routing}
1438
+ * @type {object | "manual"}
1439
+ * @default `object`
1392
1440
  * @version 3.7.0
1393
1441
  * @description
1394
1442
  *
1395
1443
  * Controls the routing strategy to determine your site URLs. Set this based on your folder/URL path configuration for your default language.
1396
1444
  *
1445
+ * ```js
1446
+ * export default defineConfig({
1447
+ * i18n: {
1448
+ * defaultLocale: "en",
1449
+ * locales: ["en", "fr"],
1450
+ * routing: {
1451
+ * prefixDefaultLocale: false,
1452
+ * redirectToDefaultLocale: true,
1453
+ * fallbackType: "redirect",
1454
+ * }
1455
+ * }
1456
+ * })
1457
+ * ```
1458
+ *
1459
+ * Since 4.6.0, this option can also be set to `manual`. When this routing strategy is enabled, Astro will **disable** its i18n middleware and no other `routing` options (e.g. `prefixDefaultLocale`) may be configured. You will be responsible for writing your own routing logic, or executing Astro's i18n middleware manually alongside your own.
1460
+ *
1461
+ * ```js
1462
+ * export default defineConfig({
1463
+ * i18n: {
1464
+ * defaultLocale: "en",
1465
+ * locales: ["en", "fr"],
1466
+ * routing: "manual"
1467
+ * }
1468
+ * })
1469
+ * ```
1470
+ *
1397
1471
  */
1398
1472
  routing?: {
1399
1473
  /**
@@ -1490,46 +1564,12 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1490
1564
  * ```
1491
1565
  */
1492
1566
  fallbackType?: 'redirect' | 'rewrite';
1493
- /**
1494
- * @name i18n.routing.strategy
1495
- * @type {"pathname"}
1496
- * @default `"pathname"`
1497
- * @version 3.7.0
1498
- * @description
1499
- *
1500
- * - `"pathname": The strategy is applied to the pathname of the URLs
1501
- */
1502
- strategy?: 'pathname';
1503
- }
1567
+ } | 'manual';
1504
1568
  /**
1505
- *
1506
1569
  * @docs
1507
- * @name i18n.routing.manual
1508
- * @kind h4
1509
- * @type {string}
1510
- * @version 4.6.0
1511
- * @description
1512
- * When this option is enabled, Astro will **disable** its i18n middleware so that you can implement your own custom logic. No other `routing` options (e.g. `prefixDefaultLocale`) may be configured with `routing: "manual"`.
1513
- *
1514
- * You will be responsible for writing your own routing logic, or executing Astro's i18n middleware manually alongside your own.
1515
- *
1516
- * ```js
1517
- * export default defineConfig({
1518
- * i18n: {
1519
- * defaultLocale: "en",
1520
- * locales: ["en", "fr", "pt-br", "es"],
1521
- * routing: {
1522
- * prefixDefaultLocale: true,
1523
- * }
1524
- * }
1525
- * })
1526
- * ```
1527
- */
1528
- | 'manual';
1529
- /**
1530
1570
  * @name i18n.domains
1531
1571
  * @type {Record<string, string> }
1532
- * @default '{}'
1572
+ * @default `{}`
1533
1573
  * @version 4.3.0
1534
1574
  * @description
1535
1575
  *
@@ -1545,9 +1585,9 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1545
1585
  * export default defineConfig({
1546
1586
  * site: "https://example.com",
1547
1587
  * output: "server", // required, with no prerendered pages
1548
- * adapter: node({
1549
- * mode: 'standalone',
1550
- * }),
1588
+ * adapter: node({
1589
+ * mode: 'standalone',
1590
+ * }),
1551
1591
  * i18n: {
1552
1592
  * defaultLocale: "en",
1553
1593
  * locales: ["en", "fr", "pt-br", "es"],
@@ -1560,7 +1600,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1560
1600
  * })
1561
1601
  * ```
1562
1602
  *
1563
- * Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/reference/api-reference/#getabsolutelocaleurl) and [`getAbsoluteLocaleUrlList()`](https://docs.astro.build/en/reference/api-reference/#getabsolutelocaleurllist) will use the options set in `i18n.domains`.
1603
+ * Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/reference/modules/astro-i18n/#getabsolutelocaleurl) and [`getAbsoluteLocaleUrlList()`](https://docs.astro.build/en/reference/modules/astro-i18n/#getabsolutelocaleurllist) will use the options set in `i18n.domains`.
1564
1604
  *
1565
1605
  * See the [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains) for more details, including the limitations of this feature.
1566
1606
  */
@@ -2003,6 +2043,60 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
2003
2043
  * These two virtual modules contain a serializable subset of the Astro configuration.
2004
2044
  */
2005
2045
  serializeConfig?: boolean;
2046
+ /**
2047
+ * @name experimental.headingIdCompat
2048
+ * @type {boolean}
2049
+ * @default `false`
2050
+ * @version 5.5.x
2051
+ * @description
2052
+ *
2053
+ * Enables full compatibility of Markdown headings IDs with common platforms such as GitHub and npm.
2054
+ *
2055
+ * When enabled, IDs for headings ending with non-alphanumeric characters, e.g. `<Picture />`, will
2056
+ * include a trailing `-`, matching standard behavior in other Markdown tooling.
2057
+ */
2058
+ headingIdCompat?: boolean;
2059
+ /**
2060
+ * @name experimental.preserveScriptOrder
2061
+ * @type {boolean}
2062
+ * @default `false`
2063
+ * @version 5.5
2064
+ * @description
2065
+ *
2066
+ * When enabled, `<script>` and `<style>` tags are rendered in the same order as they are defined.
2067
+ *
2068
+ * ## Example
2069
+ *
2070
+ * Consider the following component:
2071
+ *
2072
+ * ```html
2073
+ * <p>I am a component</p>
2074
+ * <style>
2075
+ * body {
2076
+ * background: red;
2077
+ * }
2078
+ * </style>
2079
+ * <style>
2080
+ * body {
2081
+ * background: yellow;
2082
+ * }
2083
+ * </style>
2084
+ * ```
2085
+ *
2086
+ * By default, it will generate a CSS style where `red` will be applied:
2087
+ *
2088
+ * ```css
2089
+ * body {background:#ff0} body {background:red}
2090
+ * ```
2091
+ *
2092
+ * When this new option is set to `true`, the generated CSS style will apply `yellow`:
2093
+ *
2094
+ * ```css
2095
+ * body {background:red} body {background:#ff0}
2096
+ * ```
2097
+ *
2098
+ */
2099
+ preserveScriptOrder?: boolean;
2006
2100
  };
2007
2101
  }
2008
2102
  /**
@@ -67,7 +67,7 @@ function createVitePluginAstroServer({
67
67
  viteServer.watcher.on("unlink", rebuildManifest.bind(null, null));
68
68
  viteServer.watcher.on("change", rebuildManifest);
69
69
  function handleUnhandledRejection(rejection) {
70
- const error = new AstroError({
70
+ const error = AstroError.is(rejection) ? rejection : new AstroError({
71
71
  ...AstroErrorData.UnhandledRejection,
72
72
  message: AstroErrorData.UnhandledRejection.message(rejection?.stack || rejection)
73
73
  });
@@ -46,6 +46,7 @@ function markdown({ settings, logger }) {
46
46
  if (!processor) {
47
47
  processor = createMarkdownProcessor({
48
48
  image: settings.config.image,
49
+ experimentalHeadingIdCompat: settings.config.experimental.headingIdCompat,
49
50
  ...settings.config.markdown
50
51
  });
51
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.4.3",
3
+ "version": "5.5.1",
4
4
  "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
5
5
  "type": "module",
6
6
  "author": "withastro",
@@ -103,15 +103,15 @@
103
103
  "vendor"
104
104
  ],
105
105
  "dependencies": {
106
- "@astrojs/compiler": "^2.10.4",
106
+ "@astrojs/compiler": "^2.11.0",
107
107
  "@oslojs/encoding": "^1.1.0",
108
108
  "@rollup/pluginutils": "^5.1.4",
109
109
  "@types/cookie": "^0.6.0",
110
- "acorn": "^8.14.0",
110
+ "acorn": "^8.14.1",
111
111
  "aria-query": "^5.3.2",
112
112
  "axobject-query": "^4.1.0",
113
113
  "boxen": "8.0.1",
114
- "ci-info": "^4.1.0",
114
+ "ci-info": "^4.2.0",
115
115
  "clsx": "^2.1.1",
116
116
  "common-ancestor-path": "^1.0.1",
117
117
  "cookie": "^0.7.2",
@@ -150,7 +150,7 @@
150
150
  "unist-util-visit": "^5.0.0",
151
151
  "unstorage": "^1.15.0",
152
152
  "vfile": "^6.0.3",
153
- "vite": "^6.2.0",
153
+ "vite": "^6.2.1",
154
154
  "vitefu": "^1.0.6",
155
155
  "xxhash-wasm": "^1.1.0",
156
156
  "yargs-parser": "^21.1.1",
@@ -159,7 +159,7 @@
159
159
  "zod-to-json-schema": "^3.24.3",
160
160
  "zod-to-ts": "^1.2.0",
161
161
  "@astrojs/internal-helpers": "0.6.1",
162
- "@astrojs/markdown-remark": "6.2.1",
162
+ "@astrojs/markdown-remark": "6.3.0",
163
163
  "@astrojs/telemetry": "3.2.0"
164
164
  },
165
165
  "optionalDependencies": {
@@ -167,7 +167,7 @@
167
167
  },
168
168
  "devDependencies": {
169
169
  "@astrojs/check": "^0.9.4",
170
- "@playwright/test": "^1.50.1",
170
+ "@playwright/test": "^1.51.0",
171
171
  "@types/aria-query": "^5.0.4",
172
172
  "@types/common-ancestor-path": "^1.0.2",
173
173
  "@types/cssesc": "^3.0.2",
@@ -195,11 +195,11 @@
195
195
  "rehype-slug": "^6.0.0",
196
196
  "rehype-toc": "^3.0.2",
197
197
  "remark-code-titles": "^0.1.2",
198
- "rollup": "^4.34.9",
198
+ "rollup": "^4.35.0",
199
199
  "sass": "^1.85.1",
200
200
  "undici": "^7.4.0",
201
201
  "unified": "^11.0.5",
202
- "vitest": "^3.0.7",
202
+ "vitest": "^3.0.8",
203
203
  "astro-scripts": "0.0.14"
204
204
  },
205
205
  "engines": {