astro 5.16.6 → 5.16.7

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 (77) hide show
  1. package/components/Code.astro +2 -2
  2. package/components/Image.astro +2 -2
  3. package/components/Picture.astro +1 -1
  4. package/dist/assets/build/remote.js +1 -1
  5. package/dist/assets/endpoint/dev.js +44 -16
  6. package/dist/assets/fonts/config.d.ts +3 -0
  7. package/dist/assets/fonts/config.js +3 -2
  8. package/dist/assets/fonts/constants.js +2 -1
  9. package/dist/assets/fonts/core/resolve-families.js +1 -0
  10. package/dist/assets/fonts/definitions.d.ts +10 -2
  11. package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +2 -2
  12. package/dist/assets/fonts/infra/unifont-font-resolver.d.ts +24 -0
  13. package/dist/assets/fonts/infra/unifont-font-resolver.js +59 -0
  14. package/dist/assets/fonts/orchestrate.d.ts +6 -4
  15. package/dist/assets/fonts/orchestrate.js +16 -32
  16. package/dist/assets/fonts/providers/entrypoints/bunny.d.ts +1 -1
  17. package/dist/assets/fonts/providers/entrypoints/fontshare.d.ts +1 -1
  18. package/dist/assets/fonts/providers/entrypoints/fontsource.d.ts +1 -1
  19. package/dist/assets/fonts/providers/index.d.ts +6 -8
  20. package/dist/assets/fonts/providers/index.js +10 -14
  21. package/dist/assets/fonts/types.d.ts +17 -4
  22. package/dist/assets/fonts/vite-plugin-fonts.js +6 -1
  23. package/dist/assets/utils/index.d.ts +1 -1
  24. package/dist/assets/utils/index.js +8 -8
  25. package/dist/assets/utils/vendor/image-size/detector.d.ts +1 -1
  26. package/dist/assets/utils/vendor/image-size/detector.js +2 -1
  27. package/dist/assets/utils/vendor/image-size/types/bmp.js +1 -1
  28. package/dist/assets/utils/vendor/image-size/types/gif.js +1 -1
  29. package/dist/assets/utils/vendor/image-size/types/heif.js +51 -29
  30. package/dist/assets/utils/vendor/image-size/types/icns.js +13 -14
  31. package/dist/assets/utils/vendor/image-size/types/ico.js +5 -5
  32. package/dist/assets/utils/vendor/image-size/types/index.d.ts +3 -3
  33. package/dist/assets/utils/vendor/image-size/types/index.js +4 -0
  34. package/dist/assets/utils/vendor/image-size/types/interface.d.ts +6 -6
  35. package/dist/assets/utils/vendor/image-size/types/j2c.js +2 -2
  36. package/dist/assets/utils/vendor/image-size/types/jp2.js +5 -3
  37. package/dist/assets/utils/vendor/image-size/types/jpg.js +4 -4
  38. package/dist/assets/utils/vendor/image-size/types/jxl-stream.d.ts +2 -0
  39. package/dist/assets/utils/vendor/image-size/types/jxl-stream.js +36 -0
  40. package/dist/assets/utils/vendor/image-size/types/jxl.d.ts +2 -0
  41. package/dist/assets/utils/vendor/image-size/types/jxl.js +57 -0
  42. package/dist/assets/utils/vendor/image-size/types/ktx.js +1 -1
  43. package/dist/assets/utils/vendor/image-size/types/png.js +1 -1
  44. package/dist/assets/utils/vendor/image-size/types/pnm.js +5 -7
  45. package/dist/assets/utils/vendor/image-size/types/psd.js +1 -1
  46. package/dist/assets/utils/vendor/image-size/types/tiff.js +93 -40
  47. package/dist/assets/utils/vendor/image-size/types/utils.d.ts +3 -2
  48. package/dist/assets/utils/vendor/image-size/types/utils.js +24 -22
  49. package/dist/assets/utils/vendor/image-size/types/webp.js +5 -6
  50. package/dist/assets/utils/vendor/image-size/utils/bit-reader.d.ts +10 -0
  51. package/dist/assets/utils/vendor/image-size/utils/bit-reader.js +41 -0
  52. package/dist/assets/vite-plugin-assets.js +7 -0
  53. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  54. package/dist/config/entrypoint.d.ts +1 -2
  55. package/dist/config/entrypoint.js +1 -2
  56. package/dist/content/content-layer.js +3 -3
  57. package/dist/content/utils.js +9 -2
  58. package/dist/core/app/index.d.ts +1 -1
  59. package/dist/core/app/index.js +1 -1
  60. package/dist/core/config/schemas/base.d.ts +7 -0
  61. package/dist/core/config/schemas/relative.d.ts +9 -0
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/dev/dev.js +1 -1
  64. package/dist/core/messages.js +2 -2
  65. package/dist/runtime/server/render/astro/render.js +26 -3
  66. package/dist/runtime/server/render/common.d.ts +1 -0
  67. package/dist/runtime/server/render/common.js +8 -0
  68. package/dist/transitions/router.js +2 -0
  69. package/dist/types/public/config.d.ts +2 -2
  70. package/dist/types/public/context.d.ts +303 -284
  71. package/package.json +18 -18
  72. package/dist/assets/fonts/core/dedupe-font-faces.d.ts +0 -2
  73. package/dist/assets/fonts/core/dedupe-font-faces.js +0 -30
  74. package/dist/assets/fonts/core/extract-unifont-providers.d.ts +0 -10
  75. package/dist/assets/fonts/core/extract-unifont-providers.js +0 -28
  76. package/dist/assets/utils/remotePattern.d.ts +0 -1
  77. package/dist/assets/utils/remotePattern.js +0 -16
@@ -1,44 +1,45 @@
1
1
  const decoder = new TextDecoder();
2
2
  const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
3
- const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
4
- const readInt16LE = (input, offset = 0) => {
5
- const val = input[offset] + input[offset + 1] * 2 ** 8;
6
- return val | (val & 2 ** 15) * 131070;
3
+ const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + `0${i.toString(16)}`.slice(-2), "");
4
+ const getView = (input, offset) => new DataView(input.buffer, input.byteOffset + offset);
5
+ const readInt16LE = (input, offset = 0) => getView(input, offset).getInt16(0, true);
6
+ const readUInt16BE = (input, offset = 0) => getView(input, offset).getUint16(0, false);
7
+ const readUInt16LE = (input, offset = 0) => getView(input, offset).getUint16(0, true);
8
+ const readUInt24LE = (input, offset = 0) => {
9
+ const view = getView(input, offset);
10
+ return view.getUint16(0, true) + (view.getUint8(2) << 16);
7
11
  };
8
- const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
9
- const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
10
- const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
11
- const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
12
- const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
13
- const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
12
+ const readInt32LE = (input, offset = 0) => getView(input, offset).getInt32(0, true);
13
+ const readUInt32BE = (input, offset = 0) => getView(input, offset).getUint32(0, false);
14
+ const readUInt32LE = (input, offset = 0) => getView(input, offset).getUint32(0, true);
15
+ const readUInt64 = (input, offset, isBigEndian) => getView(input, offset).getBigUint64(0, !isBigEndian);
14
16
  const methods = {
15
17
  readUInt16BE,
16
18
  readUInt16LE,
17
19
  readUInt32BE,
18
20
  readUInt32LE
19
21
  };
20
- function readUInt(input, bits, offset, isBigEndian) {
21
- offset = offset || 0;
22
+ function readUInt(input, bits, offset = 0, isBigEndian = false) {
22
23
  const endian = isBigEndian ? "BE" : "LE";
23
- const methodName = "readUInt" + bits + endian;
24
+ const methodName = `readUInt${bits}${endian}`;
24
25
  return methods[methodName](input, offset);
25
26
  }
26
- function readBox(buffer, offset) {
27
- if (buffer.length - offset < 4) return;
28
- const boxSize = readUInt32BE(buffer, offset);
29
- if (buffer.length - offset < boxSize) return;
27
+ function readBox(input, offset) {
28
+ if (input.length - offset < 4) return;
29
+ const boxSize = readUInt32BE(input, offset);
30
+ if (input.length - offset < boxSize) return;
30
31
  return {
31
- name: toUTF8String(buffer, 4 + offset, 8 + offset),
32
+ name: toUTF8String(input, 4 + offset, 8 + offset),
32
33
  offset,
33
34
  size: boxSize
34
35
  };
35
36
  }
36
- function findBox(buffer, boxName, offset) {
37
- while (offset < buffer.length) {
38
- const box = readBox(buffer, offset);
37
+ function findBox(input, boxName, currentOffset) {
38
+ while (currentOffset < input.length) {
39
+ const box = readBox(input, currentOffset);
39
40
  if (!box) break;
40
41
  if (box.name === boxName) return box;
41
- offset += box.size;
42
+ currentOffset += box.size > 0 ? box.size : 8;
42
43
  }
43
44
  }
44
45
  export {
@@ -51,6 +52,7 @@ export {
51
52
  readUInt24LE,
52
53
  readUInt32BE,
53
54
  readUInt32LE,
55
+ readUInt64,
54
56
  toHexString,
55
57
  toUTF8String
56
58
  };
@@ -1,4 +1,4 @@
1
- import { toHexString, toUTF8String, readInt16LE, readUInt24LE } from "./utils.js";
1
+ import { readInt16LE, readUInt24LE, toHexString, toUTF8String } from "./utils.js";
2
2
  function calculateExtended(input) {
3
3
  return {
4
4
  height: 1 + readUInt24LE(input, 7),
@@ -24,18 +24,17 @@ const WEBP = {
24
24
  const vp8Header = "VP8" === toUTF8String(input, 12, 15);
25
25
  return riffHeader && webpHeader && vp8Header;
26
26
  },
27
- calculate(input) {
28
- const chunkHeader = toUTF8String(input, 12, 16);
29
- input = input.slice(20, 30);
27
+ calculate(_input) {
28
+ const chunkHeader = toUTF8String(_input, 12, 16);
29
+ const input = _input.slice(20, 30);
30
30
  if (chunkHeader === "VP8X") {
31
31
  const extendedHeader = input[0];
32
32
  const validStart = (extendedHeader & 192) === 0;
33
33
  const validEnd = (extendedHeader & 1) === 0;
34
34
  if (validStart && validEnd) {
35
35
  return calculateExtended(input);
36
- } else {
37
- throw new TypeError("Invalid WebP");
38
36
  }
37
+ throw new TypeError("Invalid WebP");
39
38
  }
40
39
  if (chunkHeader === "VP8 " && input[0] !== 47) {
41
40
  return calculateLossy(input);
@@ -0,0 +1,10 @@
1
+ /** This class helps read Uint8Array bit-by-bit */
2
+ export declare class BitReader {
3
+ private readonly input;
4
+ private readonly endianness;
5
+ private byteOffset;
6
+ private bitOffset;
7
+ constructor(input: Uint8Array, endianness: 'big-endian' | 'little-endian');
8
+ /** Reads a specified number of bits, and move the offset */
9
+ getBits(length?: number): number;
10
+ }
@@ -0,0 +1,41 @@
1
+ class BitReader {
2
+ constructor(input, endianness) {
3
+ this.input = input;
4
+ this.endianness = endianness;
5
+ }
6
+ // Skip the first 16 bits (2 bytes) of signature
7
+ byteOffset = 2;
8
+ bitOffset = 0;
9
+ /** Reads a specified number of bits, and move the offset */
10
+ getBits(length = 1) {
11
+ let result = 0;
12
+ let bitsRead = 0;
13
+ while (bitsRead < length) {
14
+ if (this.byteOffset >= this.input.length) {
15
+ throw new Error("Reached end of input");
16
+ }
17
+ const currentByte = this.input[this.byteOffset];
18
+ const bitsLeft = 8 - this.bitOffset;
19
+ const bitsToRead = Math.min(length - bitsRead, bitsLeft);
20
+ if (this.endianness === "little-endian") {
21
+ const mask = (1 << bitsToRead) - 1;
22
+ const bits = currentByte >> this.bitOffset & mask;
23
+ result |= bits << bitsRead;
24
+ } else {
25
+ const mask = (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead;
26
+ const bits = (currentByte & mask) >> 8 - this.bitOffset - bitsToRead;
27
+ result = result << bitsToRead | bits;
28
+ }
29
+ bitsRead += bitsToRead;
30
+ this.bitOffset += bitsToRead;
31
+ if (this.bitOffset === 8) {
32
+ this.byteOffset++;
33
+ this.bitOffset = 0;
34
+ }
35
+ }
36
+ return result;
37
+ }
38
+ }
39
+ export {
40
+ BitReader
41
+ };
@@ -109,6 +109,13 @@ function assets({ fs, settings, sync, logger }) {
109
109
  export { default as Font } from "astro/components/Font.astro";
110
110
  import * as fontsMod from 'virtual:astro:assets/fonts/internal';
111
111
  import { createGetFontData } from "astro/assets/fonts/runtime";
112
+
113
+ export const viteFSConfig = ${JSON.stringify(resolvedConfig.server.fs)} ?? {};
114
+
115
+ export const safeModulePaths = new Set(${JSON.stringify(
116
+ // @ts-expect-error safeModulePaths is internal to Vite
117
+ Array.from(resolvedConfig.safeModulePaths)
118
+ )} ?? []);
112
119
 
113
120
  const assetQueryParams = ${settings.adapter?.client?.assetQueryParams ? `new URLSearchParams(${JSON.stringify(
114
121
  Array.from(settings.adapter.client.assetQueryParams.entries())
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "5.16.6";
3
+ version = "5.16.7";
4
4
  }
5
5
  export {
6
6
  BuildTimeAstroVersionProvider
@@ -1,7 +1,6 @@
1
1
  import type { SharpImageServiceConfig } from '../assets/services/sharp.js';
2
2
  import type { ImageServiceConfig } from '../types/public/index.js';
3
- export { defineAstroFontProvider, fontProviders } from '../assets/fonts/providers/index.js';
4
- export type { AstroFontProvider } from '../assets/fonts/types.js';
3
+ export { fontProviders } from '../assets/fonts/providers/index.js';
5
4
  export { mergeConfig } from '../core/config/merge.js';
6
5
  export { validateConfig } from '../core/config/validate.js';
7
6
  export { envField } from '../env/config.js';
@@ -1,4 +1,4 @@
1
- import { defineAstroFontProvider, fontProviders } from "../assets/fonts/providers/index.js";
1
+ import { fontProviders } from "../assets/fonts/providers/index.js";
2
2
  import { mergeConfig } from "../core/config/merge.js";
3
3
  import { validateConfig } from "../core/config/validate.js";
4
4
  import { envField } from "../env/config.js";
@@ -16,7 +16,6 @@ function passthroughImageService() {
16
16
  };
17
17
  }
18
18
  export {
19
- defineAstroFontProvider,
20
19
  defineConfig,
21
20
  envField,
22
21
  fontProviders,
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
164
164
  logger.info("Content config changed");
165
165
  shouldClear = true;
166
166
  }
167
- if (previousAstroVersion && previousAstroVersion !== "5.16.6") {
167
+ if (previousAstroVersion && previousAstroVersion !== "5.16.7") {
168
168
  logger.info("Astro version changed");
169
169
  shouldClear = true;
170
170
  }
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
172
172
  logger.info("Clearing content store");
173
173
  this.#store.clearAll();
174
174
  }
175
- if ("5.16.6") {
176
- await this.#store.metaStore().set("astro-version", "5.16.6");
175
+ if ("5.16.7") {
176
+ await this.#store.metaStore().set("astro-version", "5.16.7");
177
177
  }
178
178
  if (currentConfigDigest) {
179
179
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -128,8 +128,15 @@ async function getEntryDataAndImages(entry, collectionConfig, shouldEmitFile, ex
128
128
  schema = schema({
129
129
  image: () => z.string().transform((val) => {
130
130
  let normalizedPath = val;
131
- if (val && !val.startsWith("./") && !val.startsWith("../") && !val.startsWith("/") && !val.startsWith("~") && !val.startsWith("@") && !val.includes("://")) {
132
- normalizedPath = `./${val}`;
131
+ const isUrl = val.includes("://");
132
+ const isAbsolute = val.startsWith("/");
133
+ const isRelative = val.startsWith(".");
134
+ if (val && !isUrl && !isAbsolute && !isRelative) {
135
+ const entryDir = path.dirname(entry._internal.filePath);
136
+ const resolvedPath = path.resolve(entryDir, val);
137
+ if (fsMod.existsSync(resolvedPath)) {
138
+ normalizedPath = `./${val}`;
139
+ }
133
140
  }
134
141
  imageImports.add(normalizedPath);
135
142
  return `${IMAGE_IMPORT_PREFIX}${normalizedPath}`;
@@ -1,4 +1,4 @@
1
- import { type RemotePattern } from '../../assets/utils/remotePattern.js';
1
+ import { type RemotePattern } from '@astrojs/internal-helpers/remote';
2
2
  import type { RoutesList } from '../../types/astro.js';
3
3
  import type { RouteData, SSRManifest } from '../../types/public/internal.js';
4
4
  import { getSetCookiesFromResponse } from '../cookies/index.js';
@@ -3,7 +3,7 @@ import {
3
3
  hasFileExtension,
4
4
  isInternalPath
5
5
  } from "@astrojs/internal-helpers/path";
6
- import { matchPattern } from "../../assets/utils/remotePattern.js";
6
+ import { matchPattern } from "@astrojs/internal-helpers/remote";
7
7
  import { normalizeTheLocale } from "../../i18n/index.js";
8
8
  import {
9
9
  clientAddressSymbol,
@@ -900,6 +900,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
900
900
  weights: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "atleastone">>;
901
901
  styles: z.ZodOptional<z.ZodArray<z.ZodEnum<["normal", "italic", "oblique"]>, "atleastone">>;
902
902
  subsets: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
903
+ formats: z.ZodOptional<z.ZodArray<z.ZodEnum<["woff2", "woff", "otf", "ttf", "eot"]>, "atleastone">>;
903
904
  display: z.ZodOptional<z.ZodEnum<["auto", "block", "swap", "fallback", "optional"]>>;
904
905
  stretch: z.ZodOptional<z.ZodString>;
905
906
  featureSettings: z.ZodOptional<z.ZodString>;
@@ -921,6 +922,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
921
922
  subsets?: [string, ...string[]] | undefined;
922
923
  fallbacks?: string[] | undefined;
923
924
  optimizedFallbacks?: boolean | undefined;
925
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
924
926
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
925
927
  stretch?: string | undefined;
926
928
  featureSettings?: string | undefined;
@@ -938,6 +940,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
938
940
  subsets?: [string, ...string[]] | undefined;
939
941
  fallbacks?: string[] | undefined;
940
942
  optimizedFallbacks?: boolean | undefined;
943
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
941
944
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
942
945
  stretch?: string | undefined;
943
946
  featureSettings?: string | undefined;
@@ -1072,6 +1075,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1072
1075
  subsets?: [string, ...string[]] | undefined;
1073
1076
  fallbacks?: string[] | undefined;
1074
1077
  optimizedFallbacks?: boolean | undefined;
1078
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1075
1079
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1076
1080
  stretch?: string | undefined;
1077
1081
  featureSettings?: string | undefined;
@@ -1128,6 +1132,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1128
1132
  subsets?: [string, ...string[]] | undefined;
1129
1133
  fallbacks?: string[] | undefined;
1130
1134
  optimizedFallbacks?: boolean | undefined;
1135
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1131
1136
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1132
1137
  stretch?: string | undefined;
1133
1138
  featureSettings?: string | undefined;
@@ -1373,6 +1378,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1373
1378
  subsets?: [string, ...string[]] | undefined;
1374
1379
  fallbacks?: string[] | undefined;
1375
1380
  optimizedFallbacks?: boolean | undefined;
1381
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1376
1382
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1377
1383
  stretch?: string | undefined;
1378
1384
  featureSettings?: string | undefined;
@@ -1633,6 +1639,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1633
1639
  subsets?: [string, ...string[]] | undefined;
1634
1640
  fallbacks?: string[] | undefined;
1635
1641
  optimizedFallbacks?: boolean | undefined;
1642
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1636
1643
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1637
1644
  stretch?: string | undefined;
1638
1645
  featureSettings?: string | undefined;
@@ -745,6 +745,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
745
745
  weights: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "atleastone">>;
746
746
  styles: z.ZodOptional<z.ZodArray<z.ZodEnum<["normal", "italic", "oblique"]>, "atleastone">>;
747
747
  subsets: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
748
+ formats: z.ZodOptional<z.ZodArray<z.ZodEnum<["woff2", "woff", "otf", "ttf", "eot"]>, "atleastone">>;
748
749
  display: z.ZodOptional<z.ZodEnum<["auto", "block", "swap", "fallback", "optional"]>>;
749
750
  stretch: z.ZodOptional<z.ZodString>;
750
751
  featureSettings: z.ZodOptional<z.ZodString>;
@@ -766,6 +767,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
766
767
  subsets?: [string, ...string[]] | undefined;
767
768
  fallbacks?: string[] | undefined;
768
769
  optimizedFallbacks?: boolean | undefined;
770
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
769
771
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
770
772
  stretch?: string | undefined;
771
773
  featureSettings?: string | undefined;
@@ -783,6 +785,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
783
785
  subsets?: [string, ...string[]] | undefined;
784
786
  fallbacks?: string[] | undefined;
785
787
  optimizedFallbacks?: boolean | undefined;
788
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
786
789
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
787
790
  stretch?: string | undefined;
788
791
  featureSettings?: string | undefined;
@@ -917,6 +920,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
917
920
  subsets?: [string, ...string[]] | undefined;
918
921
  fallbacks?: string[] | undefined;
919
922
  optimizedFallbacks?: boolean | undefined;
923
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
920
924
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
921
925
  stretch?: string | undefined;
922
926
  featureSettings?: string | undefined;
@@ -973,6 +977,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
973
977
  subsets?: [string, ...string[]] | undefined;
974
978
  fallbacks?: string[] | undefined;
975
979
  optimizedFallbacks?: boolean | undefined;
980
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
976
981
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
977
982
  stretch?: string | undefined;
978
983
  featureSettings?: string | undefined;
@@ -1296,6 +1301,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1296
1301
  subsets?: [string, ...string[]] | undefined;
1297
1302
  fallbacks?: string[] | undefined;
1298
1303
  optimizedFallbacks?: boolean | undefined;
1304
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1299
1305
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1300
1306
  stretch?: string | undefined;
1301
1307
  featureSettings?: string | undefined;
@@ -1556,6 +1562,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1556
1562
  subsets?: [string, ...string[]] | undefined;
1557
1563
  fallbacks?: string[] | undefined;
1558
1564
  optimizedFallbacks?: boolean | undefined;
1565
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1559
1566
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1560
1567
  stretch?: string | undefined;
1561
1568
  featureSettings?: string | undefined;
@@ -1798,6 +1805,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1798
1805
  subsets?: [string, ...string[]] | undefined;
1799
1806
  fallbacks?: string[] | undefined;
1800
1807
  optimizedFallbacks?: boolean | undefined;
1808
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
1801
1809
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
1802
1810
  stretch?: string | undefined;
1803
1811
  featureSettings?: string | undefined;
@@ -2058,6 +2066,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2058
2066
  subsets?: [string, ...string[]] | undefined;
2059
2067
  fallbacks?: string[] | undefined;
2060
2068
  optimizedFallbacks?: boolean | undefined;
2069
+ formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
2061
2070
  display?: "auto" | "block" | "swap" | "fallback" | "optional" | undefined;
2062
2071
  stretch?: string | undefined;
2063
2072
  featureSettings?: string | undefined;
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.16.6";
1
+ const ASTRO_VERSION = "5.16.7";
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.16.6";
25
+ const currentVersion = "5.16.7";
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.16.6";
41
+ const version = "5.16.7";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -275,7 +275,7 @@ function printHelp({
275
275
  message.push(
276
276
  linebreak(),
277
277
  ` ${bgGreen(black(` ${commandName} `))} ${green(
278
- `v${"5.16.6"}`
278
+ `v${"5.16.7"}`
279
279
  )} ${headline}`
280
280
  );
281
281
  }
@@ -1,6 +1,11 @@
1
1
  import { AstroError, AstroErrorData } from "../../../../core/errors/index.js";
2
2
  import { isPromise } from "../../util.js";
3
- import { chunkToByteArray, chunkToString, encoder } from "../common.js";
3
+ import {
4
+ chunkToByteArray,
5
+ chunkToByteArrayOrString,
6
+ chunkToString,
7
+ encoder
8
+ } from "../common.js";
4
9
  import { promiseWithResolvers } from "../util.js";
5
10
  import { isHeadAndContent } from "./head-and-content.js";
6
11
  import { isRenderTemplateResult } from "./render-template.js";
@@ -162,13 +167,31 @@ async function renderToAsyncIterable(result, componentFactory, props, children,
162
167
  throw error;
163
168
  }
164
169
  let length = 0;
170
+ let stringToEncode = "";
165
171
  for (let i = 0, len = buffer.length; i < len; i++) {
166
- length += buffer[i].length;
172
+ const bufferEntry = buffer[i];
173
+ if (typeof bufferEntry === "string") {
174
+ const nextIsString = i + 1 < len && typeof buffer[i + 1] === "string";
175
+ stringToEncode += bufferEntry;
176
+ if (!nextIsString) {
177
+ const encoded = encoder.encode(stringToEncode);
178
+ length += encoded.length;
179
+ stringToEncode = "";
180
+ buffer[i] = encoded;
181
+ } else {
182
+ buffer[i] = "";
183
+ }
184
+ } else {
185
+ length += bufferEntry.length;
186
+ }
167
187
  }
168
188
  let mergedArray = new Uint8Array(length);
169
189
  let offset = 0;
170
190
  for (let i = 0, len = buffer.length; i < len; i++) {
171
191
  const item = buffer[i];
192
+ if (item === "") {
193
+ continue;
194
+ }
172
195
  mergedArray.set(item, offset);
173
196
  offset += item.length;
174
197
  }
@@ -198,7 +221,7 @@ async function renderToAsyncIterable(result, componentFactory, props, children,
198
221
  if (chunk instanceof Response) {
199
222
  throw new AstroError(AstroErrorData.ResponseSentError);
200
223
  }
201
- const bytes = chunkToByteArray(result, chunk);
224
+ const bytes = chunkToByteArrayOrString(result, chunk);
202
225
  if (bytes.length > 0) {
203
226
  buffer.push(bytes);
204
227
  next?.resolve();
@@ -27,4 +27,5 @@ export declare const encoder: TextEncoder;
27
27
  export declare const decoder: TextDecoder;
28
28
  export declare function chunkToString(result: SSRResult, chunk: Exclude<RenderDestinationChunk, Response>): string;
29
29
  export declare function chunkToByteArray(result: SSRResult, chunk: Exclude<RenderDestinationChunk, Response>): Uint8Array;
30
+ export declare function chunkToByteArrayOrString(result: SSRResult, chunk: Exclude<RenderDestinationChunk, Response>): Uint8Array | string;
30
31
  export declare function isRenderInstance(obj: unknown): obj is RenderInstance;
@@ -92,6 +92,13 @@ function chunkToByteArray(result, chunk) {
92
92
  return encoder.encode(stringified.toString());
93
93
  }
94
94
  }
95
+ function chunkToByteArrayOrString(result, chunk) {
96
+ if (ArrayBuffer.isView(chunk)) {
97
+ return chunk;
98
+ } else {
99
+ return stringifyChunk(result, chunk).toString();
100
+ }
101
+ }
95
102
  function isRenderInstance(obj) {
96
103
  return !!obj && typeof obj === "object" && "render" in obj && typeof obj.render === "function";
97
104
  }
@@ -99,6 +106,7 @@ export {
99
106
  Fragment,
100
107
  Renderer,
101
108
  chunkToByteArray,
109
+ chunkToByteArrayOrString,
102
110
  chunkToString,
103
111
  decoder,
104
112
  encoder,
@@ -283,7 +283,9 @@ async function transition(direction, from, to, options, historyState) {
283
283
  preparationEvent.preventDefault();
284
284
  return;
285
285
  }
286
+ const fragment = preparationEvent.to.hash;
286
287
  preparationEvent.to = redirectedTo;
288
+ preparationEvent.to.hash = fragment;
287
289
  }
288
290
  parser ??= new DOMParser();
289
291
  preparationEvent.newDocument = parser.parseFromString(response.html, response.mediaType);
@@ -4,7 +4,7 @@ import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig, SyntaxHig
4
4
  import type { Config as SvgoConfig } from 'svgo';
5
5
  import type { BuiltinDriverName, BuiltinDriverOptions, Driver, Storage } from 'unstorage';
6
6
  import type { UserConfig as OriginalViteUserConfig, SSROptions as ViteSSROptions } from 'vite';
7
- import type { AstroFontProvider, FontFamily } from '../../assets/fonts/types.js';
7
+ import type { FontFamily, FontProvider } from '../../assets/fonts/types.js';
8
8
  import type { ImageFit, ImageLayout } from '../../assets/types.js';
9
9
  import type { AssetsPrefix } from '../../core/app/types.js';
10
10
  import type { AstroConfigType } from '../../core/config/schemas/index.js';
@@ -18,7 +18,7 @@ export type Locales = (string | {
18
18
  codes: [string, ...string[]];
19
19
  path: string;
20
20
  })[];
21
- export type { AstroFontProvider as FontProvider };
21
+ export type { FontProvider };
22
22
  export type { CspAlgorithm };
23
23
  export type { RemotePattern };
24
24
  type NormalizeLocales<T extends Locales> = {