astro 4.13.1 → 4.13.2

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 (65) 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/actions/runtime/middleware.d.ts +3 -4
  8. package/dist/actions/runtime/middleware.js +20 -64
  9. package/dist/actions/runtime/route.js +12 -19
  10. package/dist/actions/runtime/utils.d.ts +0 -8
  11. package/dist/actions/runtime/utils.js +0 -15
  12. package/dist/actions/runtime/virtual/get-action.d.ts +8 -0
  13. package/dist/actions/runtime/virtual/get-action.js +17 -0
  14. package/dist/actions/runtime/virtual/shared.d.ts +18 -1
  15. package/dist/actions/runtime/virtual/shared.js +56 -8
  16. package/dist/actions/utils.d.ts +2 -1
  17. package/dist/actions/utils.js +10 -17
  18. package/dist/assets/build/generate.js +1 -1
  19. package/dist/assets/endpoint/generic.js +1 -1
  20. package/dist/assets/endpoint/node.js +3 -3
  21. package/dist/assets/services/sharp.js +1 -1
  22. package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +1 -1
  23. package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +1 -1
  24. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +1 -1
  25. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +1 -1
  26. package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +1 -1
  27. package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +1 -1
  28. package/dist/assets/utils/metadata.js +1 -1
  29. package/dist/assets/utils/node/emitAsset.js +1 -1
  30. package/dist/assets/utils/remoteProbe.js +1 -1
  31. package/dist/assets/utils/vendor/image-size/lookup.js +1 -1
  32. package/dist/assets/utils/vendor/image-size/types/svg.js +4 -4
  33. package/dist/cli/info/index.js +2 -2
  34. package/dist/cli/install-package.js +2 -2
  35. package/dist/core/app/index.js +1 -1
  36. package/dist/core/build/css-asset-name.d.ts +3 -3
  37. package/dist/core/build/css-asset-name.js +15 -8
  38. package/dist/core/build/generate.js +3 -3
  39. package/dist/core/build/index.js +7 -1
  40. package/dist/core/build/plugins/plugin-css.js +2 -2
  41. package/dist/core/config/schema.d.ts +55 -55
  42. package/dist/core/config/tsconfig.d.ts +1 -1
  43. package/dist/core/constants.js +1 -1
  44. package/dist/core/dev/dev.js +2 -2
  45. package/dist/core/errors/dev/vite.js +4 -4
  46. package/dist/core/errors/errors-data.d.ts +5 -0
  47. package/dist/core/messages.js +2 -2
  48. package/dist/core/middleware/index.js +1 -1
  49. package/dist/core/render-context.js +7 -4
  50. package/dist/core/routing/manifest/create.js +2 -2
  51. package/dist/events/error.js +1 -1
  52. package/dist/runtime/client/dev-toolbar/apps/audit/index.js +1 -1
  53. package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +4 -2
  54. package/dist/runtime/server/render/component.js +1 -3
  55. package/dist/transitions/router.js +2 -2
  56. package/dist/type-utils.d.ts +1 -1
  57. package/dist/vite-plugin-astro-server/vite.js +1 -2
  58. package/dist/vite-plugin-env/index.js +0 -1
  59. package/dist/vite-plugin-load-fallback/index.js +3 -3
  60. package/dist/vite-plugin-scanner/index.js +1 -1
  61. package/dist/vite-plugin-scripts/page-ssr.js +1 -1
  62. package/package.json +8 -11
  63. package/templates/actions.mjs +23 -19
  64. package/templates/content/types.d.ts +12 -10
  65. package/types/content.d.ts +1 -1
@@ -6,7 +6,7 @@ const globalOptions = {
6
6
  function lookup(input) {
7
7
  const type = detector(input);
8
8
  if (typeof type !== "undefined") {
9
- if (globalOptions.disabledTypes.indexOf(type) > -1) {
9
+ if (globalOptions.disabledTypes.includes(type)) {
10
10
  throw new TypeError("disabled file type: " + type);
11
11
  }
12
12
  const size = typeHandlers.get(type).calculate(input);
@@ -36,9 +36,9 @@ function parseViewbox(viewbox) {
36
36
  };
37
37
  }
38
38
  function parseAttributes(root) {
39
- const width = root.match(extractorRegExps.width);
40
- const height = root.match(extractorRegExps.height);
41
- const viewbox = root.match(extractorRegExps.viewbox);
39
+ const width = extractorRegExps.width.exec(root);
40
+ const height = extractorRegExps.height.exec(root);
41
+ const viewbox = extractorRegExps.viewbox.exec(root);
42
42
  return {
43
43
  height: height && parseLength(height[2]),
44
44
  viewbox: viewbox && parseViewbox(viewbox[2]),
@@ -74,7 +74,7 @@ const SVG = {
74
74
  // Scan only the first kilo-byte to speed up the check on larger files
75
75
  validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
76
76
  calculate(input) {
77
- const root = toUTF8String(input).match(extractorRegExps.root);
77
+ const root = extractorRegExps.root.exec(toUTF8String(input));
78
78
  if (root) {
79
79
  const attrs = parseAttributes(root[0]);
80
80
  if (attrs.width && attrs.height) {
@@ -49,7 +49,7 @@ async function copyToClipboard(text) {
49
49
  return;
50
50
  }
51
51
  command = "xclip -sel clipboard -l 1";
52
- } catch (e) {
52
+ } catch {
53
53
  return;
54
54
  }
55
55
  }
@@ -66,7 +66,7 @@ async function copyToClipboard(text) {
66
66
  input: text.trim(),
67
67
  encoding: "utf8"
68
68
  });
69
- } catch (e) {
69
+ } catch {
70
70
  console.error(
71
71
  colors.red(`
72
72
  Sorry, something went wrong!`) + ` Please copy the text above manually.`
@@ -13,7 +13,7 @@ async function getPackage(packageName, logger, options, otherDeps = []) {
13
13
  require2.resolve(packageName, { paths: [options.cwd ?? process.cwd()] });
14
14
  const packageImport = await import(packageName);
15
15
  return packageImport;
16
- } catch (e) {
16
+ } catch {
17
17
  if (options.optional) return void 0;
18
18
  let message = `To continue, Astro requires the following dependency to be installed: ${bold(
19
19
  packageName
@@ -156,7 +156,7 @@ async function getRegistry() {
156
156
  const { stdout } = await execa(packageManager, ["config", "get", "registry"]);
157
157
  _registry = stdout?.trim()?.replace(/\/$/, "") || fallback;
158
158
  if (!new URL(_registry).host) _registry = fallback;
159
- } catch (e) {
159
+ } catch {
160
160
  _registry = fallback;
161
161
  }
162
162
  return _registry;
@@ -362,7 +362,7 @@ class App {
362
362
  });
363
363
  }
364
364
  #getDefaultStatusCode(routeData, pathname) {
365
- if (!routeData.pattern.exec(pathname)) {
365
+ if (!routeData.pattern.test(pathname)) {
366
366
  for (const fallbackRoute of routeData.fallbackRoutes) {
367
367
  if (fallbackRoute.pattern.test(pathname)) {
368
368
  return 302;
@@ -1,9 +1,9 @@
1
1
  import type { GetModuleInfo } from 'rollup';
2
2
  import type { AstroSettings } from '../../@types/astro.js';
3
- export declare function shortHashedName(id: string, ctx: {
3
+ export declare function shortHashedName(settings: AstroSettings): (id: string, ctx: {
4
4
  getModuleInfo: GetModuleInfo;
5
- }): string;
6
- export declare function createNameHash(baseId: string | undefined, hashIds: string[]): string;
5
+ }) => string;
6
+ export declare function createNameHash(baseId: string | undefined, hashIds: string[], settings: AstroSettings): string;
7
7
  export declare function createSlugger(settings: AstroSettings): (id: string, ctx: {
8
8
  getModuleInfo: GetModuleInfo;
9
9
  }) => string;
@@ -1,20 +1,27 @@
1
1
  import crypto from "node:crypto";
2
2
  import npath from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { normalizePath } from "vite";
3
5
  import { viteID } from "../util.js";
4
6
  import { getTopLevelPageModuleInfos } from "./graph.js";
5
7
  const confusingBaseNames = ["404", "500"];
6
- function shortHashedName(id, ctx) {
7
- const parents = getTopLevelPageModuleInfos(id, ctx);
8
- return createNameHash(
9
- getFirstParentId(parents),
10
- parents.map((page) => page.id)
11
- );
8
+ function shortHashedName(settings) {
9
+ return function(id, ctx) {
10
+ const parents = getTopLevelPageModuleInfos(id, ctx);
11
+ return createNameHash(
12
+ getFirstParentId(parents),
13
+ parents.map((page) => page.id),
14
+ settings
15
+ );
16
+ };
12
17
  }
13
- function createNameHash(baseId, hashIds) {
18
+ function createNameHash(baseId, hashIds, settings) {
14
19
  const baseName = baseId ? prettifyBaseName(npath.parse(baseId).name) : "index";
15
20
  const hash = crypto.createHash("sha256");
21
+ const root = fileURLToPath(settings.config.root);
16
22
  for (const id of hashIds) {
17
- hash.update(id, "utf-8");
23
+ const relativePath = npath.relative(root, id);
24
+ hash.update(normalizePath(relativePath), "utf-8");
18
25
  }
19
26
  const h = hash.digest("hex").slice(0, 8);
20
27
  const proposedName = baseName + "." + h;
@@ -223,7 +223,7 @@ async function getPathsForRoute(route, mod, pipeline, builtPaths) {
223
223
  return paths;
224
224
  }
225
225
  function getInvalidRouteSegmentError(e, route, staticPath) {
226
- const invalidParam = e.message.match(/^Expected "([^"]+)"/)?.[1];
226
+ const invalidParam = /^Expected "([^"]+)"/.exec(e.message)?.[1];
227
227
  const received = invalidParam ? staticPath.params[invalidParam] : void 0;
228
228
  let hint = "Learn about dynamic routes at https://docs.astro.build/en/core-concepts/routing/#dynamic-routes";
229
229
  if (invalidParam && typeof received === "string") {
@@ -287,7 +287,7 @@ async function generatePath(pathname, pipeline, gopts, route) {
287
287
  if (route.type === "fallback" && // If route is index page, continue rendering. The index page should
288
288
  // always be rendered
289
289
  route.pathname !== "/" && // Check if there is a translated page with the same path
290
- Object.values(options.allPages).some((val) => pathname.match(val.route.pattern))) {
290
+ Object.values(options.allPages).some((val) => val.route.pattern.test(pathname))) {
291
291
  return;
292
292
  }
293
293
  const url = getUrlForPath(
@@ -353,7 +353,7 @@ function getPrettyRouteName(route) {
353
353
  if (isRelativePath(route.component)) {
354
354
  return route.route;
355
355
  } else if (route.component.includes("node_modules/")) {
356
- return route.component.match(/.*node_modules\/(.+)/)?.[1] ?? route.component;
356
+ return /.*node_modules\/(.+)/.exec(route.component)?.[1] ?? route.component;
357
357
  } else {
358
358
  return route.component;
359
359
  }
@@ -86,7 +86,13 @@ class AstroBuilder {
86
86
  middlewareMode: true
87
87
  }
88
88
  },
89
- { settings: this.settings, logger: this.logger, mode: "build", command: "build", sync: false }
89
+ {
90
+ settings: this.settings,
91
+ logger: this.logger,
92
+ mode: "build",
93
+ command: "build",
94
+ sync: false
95
+ }
90
96
  );
91
97
  await runHookConfigDone({ settings: this.settings, logger });
92
98
  const { syncInternal } = await import("../sync/index.js");
@@ -40,7 +40,7 @@ function rollupPluginAstroBuildCSS(options) {
40
40
  outputOptions(outputOptions) {
41
41
  const assetFileNames = outputOptions.assetFileNames;
42
42
  const namingIncludesHash = assetFileNames?.toString().includes("[hash]");
43
- const createNameForParentPages = namingIncludesHash ? assetName.shortHashedName : assetName.createSlugger(settings);
43
+ const createNameForParentPages = namingIncludesHash ? assetName.shortHashedName(settings) : assetName.createSlugger(settings);
44
44
  extendManualChunks(outputOptions, {
45
45
  after(id, meta) {
46
46
  if (isBuildableCSSRequest(id)) {
@@ -50,7 +50,7 @@ function rollupPluginAstroBuildCSS(options) {
50
50
  const ctx = { getModuleInfo: meta.getModuleInfo };
51
51
  for (const pageInfo of getParentModuleInfos(id, ctx)) {
52
52
  if (hasAssetPropagationFlag(pageInfo.id)) {
53
- const chunkId2 = assetName.createNameHash(id, [id]);
53
+ const chunkId2 = assetName.createNameHash(id, [id], settings);
54
54
  internals.cssModuleToChunkIdMap.set(id, chunkId2);
55
55
  return chunkId2;
56
56
  }
@@ -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.2";
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.2";
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.2";
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.2"}`
274
274
  )} ${headline}`
275
275
  );
276
276
  }