astro 4.13.1 → 4.13.3

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.
Files changed (69) hide show
  1. package/astro-jsx.d.ts +0 -1
  2. package/astro.js +2 -1
  3. package/client.d.ts +1 -1
  4. package/components/Picture.astro +2 -2
  5. package/components/ViewTransitions.astro +1 -1
  6. package/config.d.ts +1 -1
  7. package/dist/@types/astro.d.ts +12 -8
  8. package/dist/actions/consts.d.ts +5 -0
  9. package/dist/actions/consts.js +6 -0
  10. package/dist/actions/runtime/middleware.d.ts +6 -6
  11. package/dist/actions/runtime/middleware.js +71 -77
  12. package/dist/actions/runtime/route.js +12 -19
  13. package/dist/actions/runtime/utils.d.ts +0 -8
  14. package/dist/actions/runtime/utils.js +0 -15
  15. package/dist/actions/runtime/virtual/get-action.d.ts +8 -0
  16. package/dist/actions/runtime/virtual/get-action.js +17 -0
  17. package/dist/actions/runtime/virtual/server.d.ts +1 -1
  18. package/dist/actions/runtime/virtual/shared.d.ts +23 -1
  19. package/dist/actions/runtime/virtual/shared.js +60 -9
  20. package/dist/actions/utils.d.ts +3 -2
  21. package/dist/actions/utils.js +13 -20
  22. package/dist/assets/build/generate.js +1 -1
  23. package/dist/assets/endpoint/generic.js +1 -1
  24. package/dist/assets/endpoint/node.js +3 -3
  25. package/dist/assets/services/sharp.js +1 -1
  26. package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +1 -1
  27. package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +1 -1
  28. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +1 -1
  29. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +1 -1
  30. package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +1 -1
  31. package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +1 -1
  32. package/dist/assets/utils/metadata.js +1 -1
  33. package/dist/assets/utils/node/emitAsset.js +1 -1
  34. package/dist/assets/utils/remoteProbe.js +1 -1
  35. package/dist/assets/utils/vendor/image-size/lookup.js +1 -1
  36. package/dist/assets/utils/vendor/image-size/types/svg.js +4 -4
  37. package/dist/cli/info/index.js +2 -2
  38. package/dist/cli/install-package.js +2 -2
  39. package/dist/core/app/index.js +1 -1
  40. package/dist/core/build/css-asset-name.d.ts +3 -3
  41. package/dist/core/build/css-asset-name.js +15 -8
  42. package/dist/core/build/generate.js +3 -3
  43. package/dist/core/build/index.js +7 -1
  44. package/dist/core/build/plugins/plugin-css.js +2 -2
  45. package/dist/core/config/schema.d.ts +55 -55
  46. package/dist/core/config/tsconfig.d.ts +1 -1
  47. package/dist/core/constants.js +1 -1
  48. package/dist/core/dev/dev.js +2 -2
  49. package/dist/core/errors/dev/vite.js +4 -4
  50. package/dist/core/errors/errors-data.d.ts +5 -0
  51. package/dist/core/messages.js +2 -2
  52. package/dist/core/middleware/index.js +1 -1
  53. package/dist/core/render-context.js +8 -5
  54. package/dist/core/routing/manifest/create.js +2 -2
  55. package/dist/events/error.js +1 -1
  56. package/dist/runtime/client/dev-toolbar/apps/audit/index.js +1 -1
  57. package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +4 -2
  58. package/dist/runtime/server/render/component.js +1 -3
  59. package/dist/transitions/router.js +2 -2
  60. package/dist/type-utils.d.ts +1 -1
  61. package/dist/vite-plugin-astro-server/vite.js +1 -2
  62. package/dist/vite-plugin-env/index.js +0 -1
  63. package/dist/vite-plugin-load-fallback/index.js +3 -3
  64. package/dist/vite-plugin-scanner/index.js +1 -1
  65. package/dist/vite-plugin-scripts/page-ssr.js +1 -1
  66. package/package.json +6 -9
  67. package/templates/actions.mjs +34 -20
  68. package/templates/content/types.d.ts +12 -10
  69. package/types/content.d.ts +1 -1
@@ -123,9 +123,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
123
123
  redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
124
124
  inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
125
125
  }, "strip", z.ZodTypeAny, {
126
- server: URL;
127
126
  format: "file" | "directory" | "preserve";
128
127
  client: URL;
128
+ server: URL;
129
129
  assets: string;
130
130
  serverEntry: string;
131
131
  redirects: boolean;
@@ -134,9 +134,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
134
134
  fallback: string;
135
135
  } & Record<string, string>) | undefined;
136
136
  }, {
137
- server?: string | undefined;
138
137
  format?: "file" | "directory" | "preserve" | undefined;
139
138
  client?: string | undefined;
139
+ server?: string | undefined;
140
140
  assets?: string | undefined;
141
141
  serverEntry?: string | undefined;
142
142
  redirects?: boolean | undefined;
@@ -714,12 +714,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
714
714
  }>>;
715
715
  legacy: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
716
716
  }, "strip", z.ZodTypeAny, {
717
- server: {
718
- host: string | boolean;
719
- port: number;
720
- open: string | boolean;
721
- headers?: OutgoingHttpHeaders | undefined;
722
- };
723
717
  image: {
724
718
  service: {
725
719
  entrypoint: string;
@@ -734,6 +728,12 @@ export declare const AstroConfigSchema: z.ZodObject<{
734
728
  }[];
735
729
  endpoint?: string | undefined;
736
730
  };
731
+ server: {
732
+ host: string | boolean;
733
+ port: number;
734
+ open: string | boolean;
735
+ headers?: OutgoingHttpHeaders | undefined;
736
+ };
737
737
  redirects: Record<string, string | {
738
738
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
739
739
  destination: string;
@@ -755,9 +755,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
755
755
  };
756
756
  }[];
757
757
  build: {
758
- server: URL;
759
758
  format: "file" | "directory" | "preserve";
760
759
  client: URL;
760
+ server: URL;
761
761
  assets: string;
762
762
  serverEntry: string;
763
763
  redirects: boolean;
@@ -866,7 +866,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
866
866
  } | undefined;
867
867
  }, {
868
868
  site?: string | undefined;
869
- server?: unknown;
870
869
  image?: {
871
870
  endpoint?: string | undefined;
872
871
  service?: {
@@ -881,6 +880,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
881
880
  pathname?: string | undefined;
882
881
  }[] | undefined;
883
882
  } | undefined;
883
+ server?: unknown;
884
884
  redirects?: Record<string, string | {
885
885
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
886
886
  destination: string;
@@ -901,9 +901,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
901
901
  } | undefined;
902
902
  integrations?: unknown;
903
903
  build?: {
904
- server?: string | undefined;
905
904
  format?: "file" | "directory" | "preserve" | undefined;
906
905
  client?: string | undefined;
906
+ server?: string | undefined;
907
907
  assets?: string | undefined;
908
908
  serverEntry?: string | undefined;
909
909
  redirects?: boolean | undefined;
@@ -1066,9 +1066,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1066
1066
  redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1067
1067
  inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
1068
1068
  }, "strip", z.ZodTypeAny, {
1069
- server: URL;
1070
1069
  format: "file" | "directory" | "preserve";
1071
1070
  client: URL;
1071
+ server: URL;
1072
1072
  assets: string;
1073
1073
  serverEntry: string;
1074
1074
  redirects: boolean;
@@ -1077,9 +1077,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1077
1077
  fallback: string;
1078
1078
  } & Record<string, string>) | undefined;
1079
1079
  }, {
1080
- server?: string | undefined;
1081
1080
  format?: "file" | "directory" | "preserve" | undefined;
1082
1081
  client?: string | undefined;
1082
+ server?: string | undefined;
1083
1083
  assets?: string | undefined;
1084
1084
  serverEntry?: string | undefined;
1085
1085
  redirects?: boolean | undefined;
@@ -1683,9 +1683,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1683
1683
  redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1684
1684
  inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
1685
1685
  }, "strip", z.ZodTypeAny, {
1686
- server: import("url").URL;
1687
1686
  format: "file" | "directory" | "preserve";
1688
1687
  client: import("url").URL;
1688
+ server: import("url").URL;
1689
1689
  assets: string;
1690
1690
  serverEntry: string;
1691
1691
  redirects: boolean;
@@ -1694,9 +1694,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1694
1694
  fallback: string;
1695
1695
  } & Record<string, string>) | undefined;
1696
1696
  }, {
1697
- server?: string | undefined;
1698
1697
  format?: "file" | "directory" | "preserve" | undefined;
1699
1698
  client?: string | undefined;
1699
+ server?: string | undefined;
1700
1700
  assets?: string | undefined;
1701
1701
  serverEntry?: string | undefined;
1702
1702
  redirects?: boolean | undefined;
@@ -1731,13 +1731,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1731
1731
  headers?: OutgoingHttpHeaders | undefined;
1732
1732
  }, unknown>;
1733
1733
  }>, "strip", z.ZodTypeAny, {
1734
- server: {
1735
- host: string | boolean;
1736
- port: number;
1737
- open: string | boolean;
1738
- streaming: boolean;
1739
- headers?: OutgoingHttpHeaders | undefined;
1740
- };
1741
1734
  image: {
1742
1735
  service: {
1743
1736
  entrypoint: string;
@@ -1752,6 +1745,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1752
1745
  }[];
1753
1746
  endpoint?: string | undefined;
1754
1747
  };
1748
+ server: {
1749
+ host: string | boolean;
1750
+ port: number;
1751
+ open: string | boolean;
1752
+ streaming: boolean;
1753
+ headers?: OutgoingHttpHeaders | undefined;
1754
+ };
1755
1755
  redirects: Record<string, string | {
1756
1756
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
1757
1757
  destination: string;
@@ -1773,9 +1773,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1773
1773
  };
1774
1774
  }[];
1775
1775
  build: {
1776
- server: import("url").URL;
1777
1776
  format: "file" | "directory" | "preserve";
1778
1777
  client: import("url").URL;
1778
+ server: import("url").URL;
1779
1779
  assets: string;
1780
1780
  serverEntry: string;
1781
1781
  redirects: boolean;
@@ -1884,7 +1884,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1884
1884
  } | undefined;
1885
1885
  }, {
1886
1886
  site?: string | undefined;
1887
- server?: unknown;
1888
1887
  image?: {
1889
1888
  endpoint?: string | undefined;
1890
1889
  service?: {
@@ -1899,6 +1898,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1899
1898
  pathname?: string | undefined;
1900
1899
  }[] | undefined;
1901
1900
  } | undefined;
1901
+ server?: unknown;
1902
1902
  redirects?: Record<string, string | {
1903
1903
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
1904
1904
  destination: string;
@@ -1919,9 +1919,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1919
1919
  } | undefined;
1920
1920
  integrations?: unknown;
1921
1921
  build?: {
1922
- server?: string | undefined;
1923
1922
  format?: "file" | "directory" | "preserve" | undefined;
1924
1923
  client?: string | undefined;
1924
+ server?: string | undefined;
1925
1925
  assets?: string | undefined;
1926
1926
  serverEntry?: string | undefined;
1927
1927
  redirects?: boolean | undefined;
@@ -2022,13 +2022,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2022
2022
  } | undefined;
2023
2023
  legacy?: {} | undefined;
2024
2024
  }>, {
2025
- server: {
2026
- host: string | boolean;
2027
- port: number;
2028
- open: string | boolean;
2029
- streaming: boolean;
2030
- headers?: OutgoingHttpHeaders | undefined;
2031
- };
2032
2025
  image: {
2033
2026
  service: {
2034
2027
  entrypoint: string;
@@ -2043,6 +2036,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2043
2036
  }[];
2044
2037
  endpoint?: string | undefined;
2045
2038
  };
2039
+ server: {
2040
+ host: string | boolean;
2041
+ port: number;
2042
+ open: string | boolean;
2043
+ streaming: boolean;
2044
+ headers?: OutgoingHttpHeaders | undefined;
2045
+ };
2046
2046
  redirects: Record<string, string | {
2047
2047
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2048
2048
  destination: string;
@@ -2064,9 +2064,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2064
2064
  };
2065
2065
  }[];
2066
2066
  build: {
2067
- server: import("url").URL;
2068
2067
  format: "file" | "directory" | "preserve";
2069
2068
  client: import("url").URL;
2069
+ server: import("url").URL;
2070
2070
  assets: string;
2071
2071
  serverEntry: string;
2072
2072
  redirects: boolean;
@@ -2175,7 +2175,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2175
2175
  } | undefined;
2176
2176
  }, {
2177
2177
  site?: string | undefined;
2178
- server?: unknown;
2179
2178
  image?: {
2180
2179
  endpoint?: string | undefined;
2181
2180
  service?: {
@@ -2190,6 +2189,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2190
2189
  pathname?: string | undefined;
2191
2190
  }[] | undefined;
2192
2191
  } | undefined;
2192
+ server?: unknown;
2193
2193
  redirects?: Record<string, string | {
2194
2194
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2195
2195
  destination: string;
@@ -2210,9 +2210,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2210
2210
  } | undefined;
2211
2211
  integrations?: unknown;
2212
2212
  build?: {
2213
- server?: string | undefined;
2214
2213
  format?: "file" | "directory" | "preserve" | undefined;
2215
2214
  client?: string | undefined;
2215
+ server?: string | undefined;
2216
2216
  assets?: string | undefined;
2217
2217
  serverEntry?: string | undefined;
2218
2218
  redirects?: boolean | undefined;
@@ -2313,13 +2313,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2313
2313
  } | undefined;
2314
2314
  legacy?: {} | undefined;
2315
2315
  }>, {
2316
- server: {
2317
- host: string | boolean;
2318
- port: number;
2319
- open: string | boolean;
2320
- streaming: boolean;
2321
- headers?: OutgoingHttpHeaders | undefined;
2322
- };
2323
2316
  image: {
2324
2317
  service: {
2325
2318
  entrypoint: string;
@@ -2334,6 +2327,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2334
2327
  }[];
2335
2328
  endpoint?: string | undefined;
2336
2329
  };
2330
+ server: {
2331
+ host: string | boolean;
2332
+ port: number;
2333
+ open: string | boolean;
2334
+ streaming: boolean;
2335
+ headers?: OutgoingHttpHeaders | undefined;
2336
+ };
2337
2337
  redirects: Record<string, string | {
2338
2338
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2339
2339
  destination: string;
@@ -2355,9 +2355,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2355
2355
  };
2356
2356
  }[];
2357
2357
  build: {
2358
- server: import("url").URL;
2359
2358
  format: "file" | "directory" | "preserve";
2360
2359
  client: import("url").URL;
2360
+ server: import("url").URL;
2361
2361
  assets: string;
2362
2362
  serverEntry: string;
2363
2363
  redirects: boolean;
@@ -2466,7 +2466,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2466
2466
  } | undefined;
2467
2467
  }, {
2468
2468
  site?: string | undefined;
2469
- server?: unknown;
2470
2469
  image?: {
2471
2470
  endpoint?: string | undefined;
2472
2471
  service?: {
@@ -2481,6 +2480,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2481
2480
  pathname?: string | undefined;
2482
2481
  }[] | undefined;
2483
2482
  } | undefined;
2483
+ server?: unknown;
2484
2484
  redirects?: Record<string, string | {
2485
2485
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2486
2486
  destination: string;
@@ -2501,9 +2501,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2501
2501
  } | undefined;
2502
2502
  integrations?: unknown;
2503
2503
  build?: {
2504
- server?: string | undefined;
2505
2504
  format?: "file" | "directory" | "preserve" | undefined;
2506
2505
  client?: string | undefined;
2506
+ server?: string | undefined;
2507
2507
  assets?: string | undefined;
2508
2508
  serverEntry?: string | undefined;
2509
2509
  redirects?: boolean | undefined;
@@ -2604,13 +2604,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2604
2604
  } | undefined;
2605
2605
  legacy?: {} | undefined;
2606
2606
  }>, {
2607
- server: {
2608
- host: string | boolean;
2609
- port: number;
2610
- open: string | boolean;
2611
- streaming: boolean;
2612
- headers?: OutgoingHttpHeaders | undefined;
2613
- };
2614
2607
  image: {
2615
2608
  service: {
2616
2609
  entrypoint: string;
@@ -2625,6 +2618,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2625
2618
  }[];
2626
2619
  endpoint?: string | undefined;
2627
2620
  };
2621
+ server: {
2622
+ host: string | boolean;
2623
+ port: number;
2624
+ open: string | boolean;
2625
+ streaming: boolean;
2626
+ headers?: OutgoingHttpHeaders | undefined;
2627
+ };
2628
2628
  redirects: Record<string, string | {
2629
2629
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2630
2630
  destination: string;
@@ -2646,9 +2646,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2646
2646
  };
2647
2647
  }[];
2648
2648
  build: {
2649
- server: import("url").URL;
2650
2649
  format: "file" | "directory" | "preserve";
2651
2650
  client: import("url").URL;
2651
+ server: import("url").URL;
2652
2652
  assets: string;
2653
2653
  serverEntry: string;
2654
2654
  redirects: boolean;
@@ -2757,7 +2757,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2757
2757
  } | undefined;
2758
2758
  }, {
2759
2759
  site?: string | undefined;
2760
- server?: unknown;
2761
2760
  image?: {
2762
2761
  endpoint?: string | undefined;
2763
2762
  service?: {
@@ -2772,6 +2771,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2772
2771
  pathname?: string | undefined;
2773
2772
  }[] | undefined;
2774
2773
  } | undefined;
2774
+ server?: unknown;
2775
2775
  redirects?: Record<string, string | {
2776
2776
  status: 300 | 301 | 302 | 303 | 304 | 307 | 308;
2777
2777
  destination: string;
@@ -2792,9 +2792,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2792
2792
  } | undefined;
2793
2793
  integrations?: unknown;
2794
2794
  build?: {
2795
- server?: string | undefined;
2796
2795
  format?: "file" | "directory" | "preserve" | undefined;
2797
2796
  client?: string | undefined;
2797
+ server?: string | undefined;
2798
2798
  assets?: string | undefined;
2799
2799
  serverEntry?: string | undefined;
2800
2800
  redirects?: boolean | undefined;
@@ -3,7 +3,7 @@ import type { CompilerOptions, TypeAcquisition } from 'typescript';
3
3
  export declare const defaultTSConfig: TSConfig;
4
4
  export type frameworkWithTSSettings = 'vue' | 'react' | 'preact' | 'solid-js';
5
5
  export declare const presets: Map<frameworkWithTSSettings, TSConfig>;
6
- type TSConfigResult<T = {}> = Promise<(TSConfckParseResult & T) | 'invalid-config' | 'missing-config' | 'unknown-error'>;
6
+ type TSConfigResult<T = object> = Promise<(TSConfckParseResult & T) | 'invalid-config' | 'missing-config' | 'unknown-error'>;
7
7
  /**
8
8
  * Load a tsconfig.json or jsconfig.json is the former is not found
9
9
  * @param root The root directory to search in, defaults to `process.cwd()`.
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.13.1";
1
+ const ASTRO_VERSION = "4.13.3";
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";
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
19
19
  await telemetry.record([]);
20
20
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
21
21
  const logger = restart.container.logger;
22
- const currentVersion = "4.13.1";
22
+ const currentVersion = "4.13.3";
23
23
  const isPrerelease = currentVersion.includes("-");
24
24
  if (!isPrerelease) {
25
25
  try {
@@ -44,7 +44,7 @@ async function dev(inlineConfig) {
44
44
  }
45
45
  }).catch(() => {
46
46
  });
47
- } catch (e) {
47
+ } catch {
48
48
  }
49
49
  }
50
50
  const devServerAddressInfo = await startContainer(restart.container);
@@ -23,7 +23,7 @@ function enhanceViteSSRError({
23
23
  const content = fs.readFileSync(path).toString();
24
24
  const lns = content.split("\n");
25
25
  let importName;
26
- if (importName = safeError.message.match(/Failed to load url (.*?) \(resolved id:/)?.[1]) {
26
+ if (importName = /Failed to load url (.*?) \(resolved id:/.exec(safeError.message)?.[1]) {
27
27
  safeError.title = FailedToLoadModuleSSR.title;
28
28
  safeError.name = "FailedToLoadModuleSSR";
29
29
  safeError.message = FailedToLoadModuleSSR.message(importName);
@@ -39,7 +39,7 @@ function enhanceViteSSRError({
39
39
  }
40
40
  }
41
41
  const fileId = safeError.id ?? safeError.loc?.file;
42
- if (!renderers?.find((r) => r.name === "@astrojs/mdx") && safeError.message.match(/Syntax error/) && fileId?.match(/\.mdx$/)) {
42
+ if (fileId && !renderers?.find((r) => r.name === "@astrojs/mdx") && safeError.message.includes("Syntax error") && /.mdx$/.test(fileId)) {
43
43
  safeError = new AstroError({
44
44
  ...MdxIntegrationMissingError,
45
45
  message: MdxIntegrationMissingError.message(JSON.stringify(fileId)),
@@ -47,8 +47,8 @@ function enhanceViteSSRError({
47
47
  stack: safeError.stack
48
48
  });
49
49
  }
50
- if (/Invalid glob/.test(safeError.message)) {
51
- const globPattern = safeError.message.match(/glob: "(.+)" \(/)?.[1];
50
+ if (safeError.message.includes("Invalid glob")) {
51
+ const globPattern = /glob: "(.+)" \(/.exec(safeError.message)?.[1];
52
52
  if (globPattern) {
53
53
  safeError.message = InvalidGlob.message(globPattern);
54
54
  safeError.name = "InvalidGlob";
@@ -1440,6 +1440,11 @@ export declare const UnsupportedConfigTransformError: {
1440
1440
  message: (parseError: string) => string;
1441
1441
  hint: string;
1442
1442
  };
1443
+ /**
1444
+ * @docs
1445
+ * @kind heading
1446
+ * @name Action Errors
1447
+ */
1443
1448
  /**
1444
1449
  * @docs
1445
1450
  * @see
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "4.13.1";
41
+ const version = "4.13.3";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -270,7 +270,7 @@ function printHelp({
270
270
  message.push(
271
271
  linebreak(),
272
272
  ` ${bgGreen(black(` ${commandName} `))} ${green(
273
- `v${"4.13.1"}`
273
+ `v${"4.13.3"}`
274
274
  )} ${headline}`
275
275
  );
276
276
  }
@@ -78,7 +78,7 @@ function createContext({
78
78
  };
79
79
  return Object.assign(context, {
80
80
  getActionResult: createGetActionResult(context.locals),
81
- callAction: createCallAction(context.locals)
81
+ callAction: createCallAction(context)
82
82
  });
83
83
  }
84
84
  function isLocalsSerializable(value) {
@@ -1,4 +1,5 @@
1
- import { createCallAction, createGetActionResult, hasActionsInternal } from "../actions/utils.js";
1
+ import { deserializeActionResult } from "../actions/runtime/virtual/shared.js";
2
+ import { createCallAction, createGetActionResult, hasActionPayload } from "../actions/utils.js";
2
3
  import {
3
4
  computeCurrentLocale,
4
5
  computePreferredLocale,
@@ -170,7 +171,7 @@ class RenderContext {
170
171
  return Object.assign(context, {
171
172
  props,
172
173
  getActionResult: createGetActionResult(context.locals),
173
- callAction: createCallAction(context.locals)
174
+ callAction: createCallAction(context)
174
175
  });
175
176
  }
176
177
  async #executeRewrite(reroutePayload) {
@@ -255,7 +256,7 @@ class RenderContext {
255
256
  throw new AstroError(AstroErrorData.AstroResponseHeadersReassigned);
256
257
  }
257
258
  };
258
- const actionResult = hasActionsInternal(this.locals) ? this.locals._actionsInternal?.actionResult : void 0;
259
+ const actionResult = hasActionPayload(this.locals) ? deserializeActionResult(this.locals._actionPayload.actionResult) : void 0;
259
260
  const result = {
260
261
  base: manifest.base,
261
262
  cancelled: false,
@@ -370,10 +371,12 @@ class RenderContext {
370
371
  redirect,
371
372
  rewrite,
372
373
  request: this.request,
373
- getActionResult: createGetActionResult(locals),
374
- callAction: createCallAction(locals),
375
374
  response,
376
375
  site: pipeline.site,
376
+ getActionResult: createGetActionResult(locals),
377
+ get callAction() {
378
+ return createCallAction(this);
379
+ },
377
380
  url
378
381
  };
379
382
  }
@@ -42,7 +42,7 @@ function getParts(part, file) {
42
42
  }
43
43
  function validateSegment(segment, file = "") {
44
44
  if (!file) file = segment;
45
- if (/\]\[/.test(segment)) {
45
+ if (segment.includes("][")) {
46
46
  throw new Error(`Invalid route ${file} \u2014 parameters must be separated`);
47
47
  }
48
48
  if (countOccurrences("[", segment) !== countOccurrences("]", segment)) {
@@ -198,7 +198,7 @@ function createInjectedRoutes({ settings, cwd }) {
198
198
  let resolved;
199
199
  try {
200
200
  resolved = require2.resolve(entrypoint, { paths: [cwd || fileURLToPath(config.root)] });
201
- } catch (e) {
201
+ } catch {
202
202
  resolved = fileURLToPath(new URL(entrypoint, config.root));
203
203
  }
204
204
  const component = slash(path.relative(cwd || fileURLToPath(config.root), resolved));
@@ -2,7 +2,7 @@ import { AstroError, AstroErrorData } from "../core/errors/index.js";
2
2
  const EVENT_ERROR = "ASTRO_CLI_ERROR";
3
3
  const ANONYMIZE_MESSAGE_REGEX = /^(?:\w| )+/;
4
4
  function anonymizeErrorMessage(msg) {
5
- const matchedMessage = msg.match(ANONYMIZE_MESSAGE_REGEX);
5
+ const matchedMessage = ANONYMIZE_MESSAGE_REGEX.exec(msg);
6
6
  if (!matchedMessage?.[0]) {
7
7
  return void 0;
8
8
  }
@@ -9,7 +9,7 @@ const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 1 2
9
9
  try {
10
10
  customElements.define("astro-dev-toolbar-audit-window", DevToolbarAuditListWindow);
11
11
  customElements.define("astro-dev-toolbar-audit-list-item", DevToolbarAuditListItem);
12
- } catch (e) {
12
+ } catch {
13
13
  }
14
14
  let showState = false;
15
15
  var audit_default = {
@@ -23,7 +23,8 @@ const perf = [
23
23
  selector: 'img:not([loading]), img[loading="eager"], iframe:not([loading]), iframe[loading="eager"]',
24
24
  match(element) {
25
25
  const htmlElement = element;
26
- if (htmlElement.offsetTop < window.innerHeight) return false;
26
+ const elementYPosition = htmlElement.getBoundingClientRect().y + window.scrollY;
27
+ if (elementYPosition < window.innerHeight) return false;
27
28
  if (htmlElement.src.startsWith("data:")) return false;
28
29
  return true;
29
30
  }
@@ -35,7 +36,8 @@ const perf = [
35
36
  selector: 'img[loading="lazy"], iframe[loading="lazy"]',
36
37
  match(element) {
37
38
  const htmlElement = element;
38
- if (htmlElement.offsetTop > window.innerHeight) return false;
39
+ const elementYPosition = htmlElement.getBoundingClientRect().y + window.scrollY;
40
+ if (elementYPosition > window.innerHeight) return false;
39
41
  if (htmlElement.src.startsWith("data:")) return false;
40
42
  return true;
41
43
  }
@@ -136,9 +136,7 @@ Did you forget to import the component or is it possible there is a typo?`
136
136
  }
137
137
  if (!renderer) {
138
138
  const extname = metadata.componentUrl?.split(".").pop();
139
- renderer = renderers.filter(
140
- ({ name }) => name === `@astrojs/${extname}` || name === extname
141
- )[0];
139
+ renderer = renderers.find(({ name }) => name === `@astrojs/${extname}` || name === extname);
142
140
  }
143
141
  }
144
142
  let componentServerRenderEndTime;
@@ -62,7 +62,7 @@ async function fetchHTML(href, init) {
62
62
  redirected: res.redirected ? res.url : void 0,
63
63
  mediaType
64
64
  };
65
- } catch (err) {
65
+ } catch {
66
66
  return null;
67
67
  }
68
68
  }
@@ -189,7 +189,7 @@ async function updateDOM(preparationEvent, options, currentTransition, historySt
189
189
  if (fallback === "animate" && !currentTransition.transitionSkipped && !preparationEvent.signal.aborted) {
190
190
  try {
191
191
  await animate("old");
192
- } catch (err) {
192
+ } catch {
193
193
  }
194
194
  }
195
195
  const pageTitleForBrowserHistory = document.title;
@@ -5,7 +5,7 @@ export type WithRequired<T, K extends keyof T> = T & {
5
5
  [P in K]-?: T[P];
6
6
  };
7
7
  export type OmitIndexSignature<ObjectType> = {
8
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
8
+ [KeyType in keyof ObjectType as object extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
9
9
  };
10
10
  export type Kebab<T extends string, A extends string = ''> = T extends `${infer F}${infer R}` ? Kebab<R, `${A}${F extends Lowercase<F> ? '' : '-'}${Lowercase<F>}`> : A;
11
11
  export type KebabKeys<T> = {
@@ -5,7 +5,6 @@ import { hasSpecialQueries } from "../vite-plugin-utils/index.js";
5
5
  import { isCSSRequest } from "./util.js";
6
6
  const fileExtensionsToSSR = /* @__PURE__ */ new Set([".astro", ".mdoc", ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS]);
7
7
  const STRIP_QUERY_PARAMS_REGEX = /\?.*$/;
8
- const ASTRO_PROPAGATED_ASSET_REGEX = /\?astroPropagatedAssets/;
9
8
  async function* crawlGraph(loader, _id, isRootFile, scanned = /* @__PURE__ */ new Set()) {
10
9
  const id = unwrapId(_id);
11
10
  const importedModules = /* @__PURE__ */ new Set();
@@ -35,7 +34,7 @@ async function* crawlGraph(loader, _id, isRootFile, scanned = /* @__PURE__ */ ne
35
34
  if (!importedModule.id) continue;
36
35
  const importedModulePathname = importedModule.id.replace(STRIP_QUERY_PARAMS_REGEX, "");
37
36
  const isFileTypeNeedingSSR = fileExtensionsToSSR.has(npath.extname(importedModulePathname));
38
- const isPropagationStoppingPoint = ASTRO_PROPAGATED_ASSET_REGEX.test(importedModule.id);
37
+ const isPropagationStoppingPoint = importedModule.id.includes("?astroPropagatedAssets");
39
38
  if (isFileTypeNeedingSSR && // Should not SSR a module with ?astroPropagatedAssets
40
39
  !isPropagationStoppingPoint) {
41
40
  const mod = loader.getModuleById(importedModule.id);
@@ -50,7 +50,6 @@ async function replaceDefine(code, id, define, config) {
50
50
  if (env) {
51
51
  const marker = `__astro_import_meta_env${"_".repeat(
52
52
  env.length - 23
53
- /* length of preceding string */
54
53
  )}`;
55
54
  replacementMarkers[marker] = env;
56
55
  define = { ...define, "import.meta.env": marker };
@@ -12,14 +12,14 @@ function loadFallbackPlugin({
12
12
  const tryLoadModule = async (id) => {
13
13
  try {
14
14
  return await fs.promises.readFile(cleanUrl(id), "utf-8");
15
- } catch (e) {
15
+ } catch {
16
16
  try {
17
17
  return await fs.promises.readFile(id, "utf-8");
18
- } catch (e2) {
18
+ } catch {
19
19
  try {
20
20
  const fullpath = new URL("." + id, root);
21
21
  return await fs.promises.readFile(fullpath, "utf-8");
22
- } catch (e3) {
22
+ } catch {
23
23
  }
24
24
  }
25
25
  }