astro 5.15.3 → 6.0.0-alpha.0

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 (111) hide show
  1. package/{astro.js → bin/astro.mjs} +7 -8
  2. package/client.d.ts +2 -4
  3. package/components/ClientRouter.astro +0 -5
  4. package/dist/actions/runtime/utils.d.ts +2 -8
  5. package/dist/assets/build/remote.js +4 -14
  6. package/dist/assets/fonts/implementations/font-metrics-resolver.js +15 -9
  7. package/dist/assets/fonts/logic/normalize-remote-font-faces.js +1 -1
  8. package/dist/assets/fonts/logic/optimize-fallbacks.js +1 -1
  9. package/dist/assets/services/sharp.js +5 -6
  10. package/dist/assets/utils/index.d.ts +1 -5
  11. package/dist/assets/utils/index.js +1 -5
  12. package/dist/assets/utils/node/emitAsset.d.ts +0 -14
  13. package/dist/assets/utils/node/emitAsset.js +0 -50
  14. package/dist/assets/vite-plugin-assets.js +3 -8
  15. package/dist/cli/add/index.js +0 -2
  16. package/dist/cli/db/index.js +0 -2
  17. package/dist/cli/info/index.js +0 -2
  18. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  19. package/dist/cli/preferences/index.js +0 -2
  20. package/dist/config/index.js +3 -12
  21. package/dist/container/index.d.ts +4 -2
  22. package/dist/container/index.js +0 -1
  23. package/dist/content/config.js +17 -13
  24. package/dist/content/content-layer.js +4 -6
  25. package/dist/content/data-store.d.ts +0 -2
  26. package/dist/content/loaders/glob.d.ts +0 -5
  27. package/dist/content/loaders/glob.js +3 -30
  28. package/dist/content/mutable-data-store.js +1 -14
  29. package/dist/content/runtime-assets.d.ts +1 -1
  30. package/dist/content/runtime-assets.js +3 -6
  31. package/dist/content/runtime.d.ts +19 -58
  32. package/dist/content/runtime.js +52 -218
  33. package/dist/content/server-listeners.js +25 -88
  34. package/dist/content/types-generator.d.ts +1 -6
  35. package/dist/content/types-generator.js +20 -116
  36. package/dist/content/utils.d.ts +31 -104
  37. package/dist/content/utils.js +48 -158
  38. package/dist/content/vite-plugin-content-imports.js +0 -4
  39. package/dist/content/vite-plugin-content-virtual-mod.js +3 -134
  40. package/dist/core/app/index.d.ts +1 -1
  41. package/dist/core/app/index.js +7 -10
  42. package/dist/core/app/node.d.ts +2 -8
  43. package/dist/core/app/node.js +4 -6
  44. package/dist/core/build/generate.js +0 -1
  45. package/dist/core/build/index.js +1 -4
  46. package/dist/core/build/internal.d.ts +1 -2
  47. package/dist/core/build/internal.js +0 -1
  48. package/dist/core/build/plugins/plugin-manifest.js +2 -4
  49. package/dist/core/compile/compile.js +0 -2
  50. package/dist/core/config/schemas/base.d.ts +4 -40
  51. package/dist/core/config/schemas/base.js +3 -16
  52. package/dist/core/config/schemas/refined.js +7 -0
  53. package/dist/core/config/schemas/relative.d.ts +5 -47
  54. package/dist/core/constants.d.ts +1 -0
  55. package/dist/core/constants.js +3 -1
  56. package/dist/core/create-vite.js +1 -4
  57. package/dist/core/dev/container.js +0 -2
  58. package/dist/core/dev/dev.js +1 -1
  59. package/dist/core/errors/dev/vite.js +1 -18
  60. package/dist/core/errors/errors-data.d.ts +71 -53
  61. package/dist/core/errors/errors-data.js +31 -25
  62. package/dist/core/errors/overlay.js +1 -1
  63. package/dist/core/messages.js +2 -2
  64. package/dist/core/middleware/index.d.ts +1 -1
  65. package/dist/core/middleware/index.js +5 -9
  66. package/dist/core/preview/index.js +0 -2
  67. package/dist/core/render/params-and-props.js +0 -1
  68. package/dist/core/render/route-cache.d.ts +1 -2
  69. package/dist/core/render/route-cache.js +1 -2
  70. package/dist/core/render-context.d.ts +3 -3
  71. package/dist/core/render-context.js +13 -27
  72. package/dist/core/routing/manifest/create.js +1 -1
  73. package/dist/core/routing/params.js +5 -6
  74. package/dist/core/routing/validation.d.ts +1 -2
  75. package/dist/core/routing/validation.js +2 -18
  76. package/dist/core/server-islands/endpoint.d.ts +1 -2
  77. package/dist/core/server-islands/endpoint.js +0 -1
  78. package/dist/core/sync/index.js +2 -10
  79. package/dist/env/env-loader.d.ts +0 -1
  80. package/dist/env/env-loader.js +4 -17
  81. package/dist/env/vite-plugin-env.js +41 -45
  82. package/dist/i18n/index.js +0 -3
  83. package/dist/integrations/hooks.d.ts +1 -2
  84. package/dist/integrations/hooks.js +0 -27
  85. package/dist/prefetch/index.d.ts +0 -10
  86. package/dist/prefetch/index.js +1 -1
  87. package/dist/runtime/server/astro-global.d.ts +2 -2
  88. package/dist/runtime/server/astro-global.js +86 -24
  89. package/dist/transitions/vite-plugin-transitions.js +1 -4
  90. package/dist/types/astro.d.ts +2 -2
  91. package/dist/types/public/common.d.ts +1 -3
  92. package/dist/types/public/config.d.ts +4 -127
  93. package/dist/types/public/context.d.ts +18 -39
  94. package/dist/types/public/integrations.d.ts +0 -17
  95. package/dist/types/public/internal.d.ts +2 -2
  96. package/dist/virtual-modules/i18n.d.ts +87 -5
  97. package/dist/virtual-modules/i18n.js +3 -1
  98. package/dist/virtual-modules/live-config.d.ts +0 -2
  99. package/dist/virtual-modules/live-config.js +0 -4
  100. package/dist/vite-plugin-markdown/index.js +0 -1
  101. package/package.json +8 -12
  102. package/templates/content/module.mjs +8 -63
  103. package/templates/content/types.d.ts +10 -69
  104. package/dist/config/vite-plugin-content-listen.d.ts +0 -17
  105. package/dist/config/vite-plugin-content-listen.js +0 -26
  106. package/dist/container/polyfill.d.ts +0 -1
  107. package/dist/container/polyfill.js +0 -2
  108. package/dist/core/polyfill.d.ts +0 -5
  109. package/dist/core/polyfill.js +0 -17
  110. package/dist/vite-plugin-astro-postprocess/index.d.ts +0 -2
  111. package/dist/vite-plugin-astro-postprocess/index.js +0 -48
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- // ISOMORPHIC FILE: NO TOP-LEVEL IMPORT/REQUIRE() ALLOWED
5
- // This file has to run as both ESM and CJS on older Node.js versions
6
-
7
4
  const CI_INSTRUCTIONS = {
8
5
  NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
9
6
  GITHUB_ACTIONS:
@@ -11,9 +8,12 @@ const CI_INSTRUCTIONS = {
11
8
  VERCEL: 'https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version',
12
9
  };
13
10
 
11
+ // TODO: remove once Stackblitz supports Node 22
12
+ const IS_STACKBLITZ = !!process.versions.webcontainer;
13
+
14
14
  // Hardcode supported Node.js version so we don't have to read differently in CJS & ESM.
15
- const engines = '>=18.20.8';
16
- const skipSemverCheckIfAbove = 19;
15
+ const engines = IS_STACKBLITZ ? '>=20.19.5' : '>=22.12.0';
16
+ const skipSemverCheckIfAbove = IS_STACKBLITZ ? 21 : 23;
17
17
 
18
18
  /** `astro *` */
19
19
  async function main() {
@@ -39,7 +39,7 @@ async function main() {
39
39
  if (correctedCwd !== cwd) process.chdir(correctedCwd);
40
40
  }
41
41
 
42
- return import('./dist/cli/index.js')
42
+ return import('../dist/cli/index.js')
43
43
  .then(({ cli }) => cli(process.argv))
44
44
  .catch((error) => {
45
45
  console.error(error);
@@ -52,8 +52,7 @@ async function errorNodeUnsupported() {
52
52
  Node.js v${process.versions.node} is not supported by Astro!
53
53
  Please upgrade Node.js to a supported version: "${engines}"\n`);
54
54
 
55
- // eslint-disable-next-line @typescript-eslint/no-require-imports
56
- const ci = typeof require !== 'undefined' ? require('ci-info') : await import('ci-info');
55
+ const ci = await import('ci-info');
57
56
 
58
57
  // Special instructions for CI environments, which may have special steps needed.
59
58
  // This is a common issue that we can help users with proactively.
package/client.d.ts CHANGED
@@ -5,8 +5,10 @@
5
5
  /// <reference path="./types/fonts.d.ts" />
6
6
 
7
7
  interface ImportMetaEnv {
8
+ // TODO: remove in Astro 7
8
9
  /**
9
10
  * The prefix for Astro-generated asset links if the build.assetsPrefix config option is set. This can be used to create asset links not handled by Astro.
11
+ * @deprecated This will be removed in a future major version of Astro. Use `build.assetsPrefix` from `astro:config/server` instead.
10
12
  */
11
13
  readonly ASSETS_PREFIX: string | Record<string, string>;
12
14
  /**
@@ -124,10 +126,6 @@ declare module 'astro:transitions' {
124
126
  export const createAnimationScope: TransitionModule['createAnimationScope'];
125
127
 
126
128
  type ClientRouterModule = typeof import('./components/ClientRouter.astro');
127
- /**
128
- * @deprecated The ViewTransitions component has been renamed to ClientRouter
129
- */
130
- export const ViewTransitions: ClientRouterModule['default'];
131
129
  export const ClientRouter: ClientRouterModule['default'];
132
130
  }
133
131
 
@@ -3,11 +3,6 @@ type Fallback = 'none' | 'animate' | 'swap';
3
3
 
4
4
  export interface Props {
5
5
  fallback?: Fallback;
6
- /** @deprecated handleForms is enabled by default in Astro 4.0
7
- *
8
- * Set `data-astro-reload` on your form to opt-out of the default behavior.
9
- */
10
- handleForms?: boolean;
11
6
  }
12
7
 
13
8
  const { fallback = 'animate' } = Astro.props;
@@ -1,4 +1,4 @@
1
- import type { APIContext, AstroSharedContext } from '../../types/public/context.js';
1
+ import type { APIContext } from '../../types/public/context.js';
2
2
  import type { SerializedActionResult } from './shared.js';
3
3
  export type ActionPayload = {
4
4
  actionResult: SerializedActionResult;
@@ -10,13 +10,7 @@ export type Locals = {
10
10
  export declare const ACTION_API_CONTEXT_SYMBOL: unique symbol;
11
11
  export declare const formContentTypes: string[];
12
12
  export declare function hasContentType(contentType: string, expected: string[]): boolean;
13
- export type ActionAPIContext = Pick<APIContext, 'rewrite' | 'request' | 'url' | 'isPrerendered' | 'locals' | 'clientAddress' | 'cookies' | 'currentLocale' | 'generator' | 'routePattern' | 'site' | 'params' | 'preferredLocale' | 'preferredLocaleList' | 'originPathname' | 'session' | 'csp'> & {
14
- /**
15
- * @deprecated
16
- * The use of `rewrite` in Actions is deprecated
17
- */
18
- rewrite: AstroSharedContext['rewrite'];
19
- };
13
+ export type ActionAPIContext = Pick<APIContext, 'request' | 'url' | 'isPrerendered' | 'locals' | 'clientAddress' | 'cookies' | 'currentLocale' | 'generator' | 'routePattern' | 'site' | 'params' | 'preferredLocale' | 'preferredLocaleList' | 'originPathname' | 'session' | 'csp'>;
20
14
  export type MaybePromise<T> = T | Promise<T>;
21
15
  /**
22
16
  * Used to preserve the input schema type in the error object.
@@ -48,27 +48,17 @@ async function revalidateRemoteImage(src, revalidationData) {
48
48
  lastModified: res.headers.get("Last-Modified") ?? (res.ok ? void 0 : revalidationData.lastModified)
49
49
  };
50
50
  }
51
- function webToCachePolicyRequest({ url, method, headers: _headers }) {
52
- let headers = {};
53
- try {
54
- headers = Object.fromEntries(_headers.entries());
55
- } catch {
56
- }
51
+ function webToCachePolicyRequest({ url, method, headers }) {
57
52
  return {
58
53
  method,
59
54
  url,
60
- headers
55
+ headers: Object.fromEntries(headers.entries())
61
56
  };
62
57
  }
63
- function webToCachePolicyResponse({ status, headers: _headers }) {
64
- let headers = {};
65
- try {
66
- headers = Object.fromEntries(_headers.entries());
67
- } catch {
68
- }
58
+ function webToCachePolicyResponse({ status, headers }) {
69
59
  return {
70
60
  status,
71
- headers
61
+ headers: Object.fromEntries(headers.entries())
72
62
  };
73
63
  }
74
64
  export {
@@ -15,9 +15,11 @@ function filterRequiredMetrics({
15
15
  xWidthAvg
16
16
  };
17
17
  }
18
- function toPercentage(value, fractionDigits = 4) {
19
- const percentage = value * 100;
20
- return `${+percentage.toFixed(fractionDigits)}%`;
18
+ function round(value) {
19
+ return parseFloat(value.toFixed(4));
20
+ }
21
+ function toPercentString(value) {
22
+ return `${round(value * 100)}%`;
21
23
  }
22
24
  function createCapsizeFontMetricsResolver({
23
25
  fontFetcher,
@@ -29,7 +31,8 @@ function createCapsizeFontMetricsResolver({
29
31
  cache[name] ??= filterRequiredMetrics(await fromBuffer(await fontFetcher.fetch(input)));
30
32
  return cache[name];
31
33
  },
32
- // Source: https://github.com/unjs/fontaine/blob/f00f84032c5d5da72c8798eae4cd68d3ddfbf340/src/css.ts#L170
34
+ // Adapted from Capsize
35
+ // Source: https://github.com/seek-oss/capsize/blob/b752693428b45994442433f7e3476ca4e3e3c507/packages/core/src/createFontStack.ts
33
36
  generateFontFace({
34
37
  metrics,
35
38
  fallbackMetrics,
@@ -39,18 +42,21 @@ function createCapsizeFontMetricsResolver({
39
42
  }) {
40
43
  const preferredFontXAvgRatio = metrics.xWidthAvg / metrics.unitsPerEm;
41
44
  const fallbackFontXAvgRatio = fallbackMetrics.xWidthAvg / fallbackMetrics.unitsPerEm;
42
- const sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
45
+ const sizeAdjust = preferredFontXAvgRatio && fallbackFontXAvgRatio ? preferredFontXAvgRatio / fallbackFontXAvgRatio : 1;
43
46
  const adjustedEmSquare = metrics.unitsPerEm * sizeAdjust;
44
47
  const ascentOverride = metrics.ascent / adjustedEmSquare;
45
48
  const descentOverride = Math.abs(metrics.descent) / adjustedEmSquare;
46
49
  const lineGapOverride = metrics.lineGap / adjustedEmSquare;
50
+ const fallbackAscentOverride = fallbackMetrics.ascent / adjustedEmSquare;
51
+ const fallbackDescentOverride = Math.abs(fallbackMetrics.descent) / adjustedEmSquare;
52
+ const fallbackLineGapOverride = fallbackMetrics.lineGap / adjustedEmSquare;
47
53
  return cssRenderer.generateFontFace(fallbackName, {
48
54
  ...properties,
49
55
  src: renderFontSrc([{ name: fallbackFontName }]),
50
- "size-adjust": toPercentage(sizeAdjust),
51
- "ascent-override": toPercentage(ascentOverride),
52
- "descent-override": toPercentage(descentOverride),
53
- "line-gap-override": toPercentage(lineGapOverride)
56
+ "size-adjust": sizeAdjust && sizeAdjust !== 1 ? toPercentString(sizeAdjust) : void 0,
57
+ "ascent-override": ascentOverride && ascentOverride !== fallbackAscentOverride ? toPercentString(ascentOverride) : void 0,
58
+ "descent-override": descentOverride && descentOverride !== fallbackDescentOverride ? toPercentString(descentOverride) : void 0,
59
+ "line-gap-override": lineGapOverride !== fallbackLineGapOverride ? toPercentString(lineGapOverride) : void 0
54
60
  });
55
61
  }
56
62
  };
@@ -4,7 +4,7 @@ function normalizeRemoteFontFaces({
4
4
  urlProxy,
5
5
  fontTypeExtractor
6
6
  }) {
7
- return fonts.filter((font) => typeof font.meta?.priority === "number" ? font.meta.priority === 0 : true).map((font) => {
7
+ return fonts.filter((font) => typeof font.meta?.priority === "number" ? font.meta.priority <= 1 : true).map((font) => {
8
8
  let index = 0;
9
9
  return {
10
10
  ...font,
@@ -24,7 +24,7 @@ async function optimizeFallbacks({
24
24
  }
25
25
  const localFontsMappings = localFonts.map((font) => ({
26
26
  font,
27
- // We must't wrap in quote because that's handled by the CSS renderer
27
+ // We mustn't wrap in quote because that's handled by the CSS renderer
28
28
  name: `${family.nameWithHash} fallback: ${font}`
29
29
  }));
30
30
  fallbacks = [...localFontsMappings.map((m) => m.name), ...fallbacks];
@@ -45,25 +45,24 @@ const sharpService = {
45
45
  limitInputPixels: config.service.config.limitInputPixels
46
46
  });
47
47
  result.rotate();
48
- const withoutEnlargement = Boolean(transform.fit);
49
- if (transform.width && transform.height && transform.fit) {
50
- const fit = fitMap[transform.fit] ?? "inside";
48
+ if (transform.width && transform.height) {
49
+ const fit = transform.fit ? fitMap[transform.fit] ?? "inside" : void 0;
51
50
  result.resize({
52
51
  width: Math.round(transform.width),
53
52
  height: Math.round(transform.height),
54
53
  fit,
55
54
  position: transform.position,
56
- withoutEnlargement
55
+ withoutEnlargement: true
57
56
  });
58
57
  } else if (transform.height && !transform.width) {
59
58
  result.resize({
60
59
  height: Math.round(transform.height),
61
- withoutEnlargement
60
+ withoutEnlargement: true
62
61
  });
63
62
  } else if (transform.width) {
64
63
  result.resize({
65
64
  width: Math.round(transform.width),
66
- withoutEnlargement
65
+ withoutEnlargement: true
67
66
  });
68
67
  }
69
68
  if (transform.format) {
@@ -6,11 +6,7 @@
6
6
  */
7
7
  export { isESMImportedImage, isRemoteImage, resolveSrc } from './imageKind.js';
8
8
  export { imageMetadata } from './metadata.js';
9
- export {
10
- /**
11
- * @deprecated
12
- */
13
- emitESMImage, emitImageMetadata, } from './node/emitAsset.js';
9
+ export { emitImageMetadata } from './node/emitAsset.js';
14
10
  export { getOrigQueryParams } from './queryParams.js';
15
11
  export { isRemoteAllowed, matchHostname, matchPathname, matchPattern, matchPort, matchProtocol, type RemotePattern, } from './remotePattern.js';
16
12
  export { inferRemoteSize } from './remoteProbe.js';
@@ -1,9 +1,6 @@
1
1
  import { isESMImportedImage, isRemoteImage, resolveSrc } from "./imageKind.js";
2
2
  import { imageMetadata } from "./metadata.js";
3
- import {
4
- emitESMImage,
5
- emitImageMetadata
6
- } from "./node/emitAsset.js";
3
+ import { emitImageMetadata } from "./node/emitAsset.js";
7
4
  import { getOrigQueryParams } from "./queryParams.js";
8
5
  import {
9
6
  isRemoteAllowed,
@@ -16,7 +13,6 @@ import {
16
13
  import { inferRemoteSize } from "./remoteProbe.js";
17
14
  import { hashTransform, propsToFilename } from "./transformToPath.js";
18
15
  export {
19
- emitESMImage,
20
16
  emitImageMetadata,
21
17
  getOrigQueryParams,
22
18
  hashTransform,
@@ -4,20 +4,6 @@ type FileEmitter = vite.Rollup.EmitFile;
4
4
  type ImageMetadataWithContents = ImageMetadata & {
5
5
  contents?: Buffer;
6
6
  };
7
- /**
8
- * Processes an image file and emits its metadata and optionally its contents. This function supports both build and development modes.
9
- *
10
- * @param {string | undefined} id - The identifier or path of the image file to process. If undefined, the function returns immediately.
11
- * @param {boolean} _watchMode - **Deprecated**: Indicates if the method is operating in watch mode. This parameter will be removed or updated in the future.
12
- * @param {boolean} _experimentalSvgEnabled - **Deprecated**: A flag to enable experimental handling of SVG files. Embeds SVG file data if set to true.
13
- * @param {FileEmitter | undefined} [fileEmitter] - Function for emitting files during the build process. May throw in certain scenarios.
14
- * @return {Promise<ImageMetadataWithContents | undefined>} Resolves to metadata with optional image contents or `undefined` if processing fails.
15
- */
16
- export declare function emitESMImage(id: string | undefined,
17
- /** @deprecated */
18
- _watchMode: boolean,
19
- /** @deprecated */
20
- _experimentalSvgEnabled: boolean, fileEmitter?: FileEmitter): Promise<ImageMetadataWithContents | undefined>;
21
7
  /**
22
8
  * Processes an image file and emits its metadata and optionally its contents. This function supports both build and development modes.
23
9
  *
@@ -35,55 +35,6 @@ async function handleSvgDeduplication(fileData, filename, fileEmitter) {
35
35
  return handle;
36
36
  }
37
37
  }
38
- async function emitESMImage(id, _watchMode, _experimentalSvgEnabled, fileEmitter) {
39
- if (!id) {
40
- return void 0;
41
- }
42
- const url = pathToFileURL(id);
43
- let fileData;
44
- try {
45
- fileData = await fs.readFile(url);
46
- } catch {
47
- return void 0;
48
- }
49
- const fileMetadata = await imageMetadata(fileData, id);
50
- const emittedImage = {
51
- src: "",
52
- ...fileMetadata
53
- };
54
- Object.defineProperty(emittedImage, "fsPath", {
55
- enumerable: false,
56
- writable: false,
57
- value: id
58
- });
59
- let isBuild = typeof fileEmitter === "function";
60
- if (isBuild) {
61
- const pathname = decodeURI(url.pathname);
62
- const filename = path.basename(pathname, path.extname(pathname) + `.${fileMetadata.format}`);
63
- try {
64
- let handle;
65
- if (fileMetadata.format === "svg") {
66
- handle = await handleSvgDeduplication(fileData, filename, fileEmitter);
67
- } else {
68
- handle = fileEmitter({
69
- name: filename,
70
- source: fileData,
71
- type: "asset"
72
- });
73
- }
74
- emittedImage.src = `__ASTRO_ASSET_IMAGE__${handle}__`;
75
- } catch {
76
- isBuild = false;
77
- }
78
- }
79
- if (!isBuild) {
80
- url.searchParams.append("origWidth", fileMetadata.width.toString());
81
- url.searchParams.append("origHeight", fileMetadata.height.toString());
82
- url.searchParams.append("origFormat", fileMetadata.format);
83
- emittedImage.src = `/@fs` + prependForwardSlash(fileURLToNormalizedPath(url));
84
- }
85
- return emittedImage;
86
- }
87
38
  async function emitImageMetadata(id, fileEmitter) {
88
39
  if (!id) {
89
40
  return void 0;
@@ -137,6 +88,5 @@ function fileURLToNormalizedPath(filePath) {
137
88
  return slash(fileURLToPath(filePath) + filePath.search).replace(/\\/g, "/");
138
89
  }
139
90
  export {
140
- emitESMImage,
141
91
  emitImageMetadata
142
92
  };
@@ -13,7 +13,7 @@ import { VALID_INPUT_FORMATS, VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from "./co
13
13
  import { fontsPlugin } from "./fonts/vite-plugin-fonts.js";
14
14
  import { getAssetsPrefix } from "./utils/getAssetsPrefix.js";
15
15
  import { isESMImportedImage } from "./utils/imageKind.js";
16
- import { emitESMImage } from "./utils/node/emitAsset.js";
16
+ import { emitImageMetadata } from "./utils/node/emitAsset.js";
17
17
  import { getProxyCode } from "./utils/proxy.js";
18
18
  import { makeSvgComponent } from "./utils/svg.js";
19
19
  import { hashTransform, propsToFilename } from "./utils/transformToPath.js";
@@ -190,13 +190,8 @@ function assets({ fs, settings, sync, logger }) {
190
190
  if (!assetRegexEnds.test(id)) {
191
191
  return;
192
192
  }
193
- const emitFile = shouldEmitFile ? this.emitFile.bind(this) : void 0;
194
- const imageMetadata = await emitESMImage(
195
- id,
196
- this.meta.watchMode,
197
- id.endsWith(".svg"),
198
- emitFile
199
- );
193
+ const fileEmitter = shouldEmitFile ? this.emitFile.bind(this) : void 0;
194
+ const imageMetadata = await emitImageMetadata(id, fileEmitter);
200
195
  if (!imageMetadata) {
201
196
  throw new AstroError({
202
197
  ...AstroErrorData.ImageNotFound,
@@ -24,7 +24,6 @@ import {
24
24
  import * as msg from "../../core/messages.js";
25
25
  import { printHelp } from "../../core/messages.js";
26
26
  import { appendForwardSlash } from "../../core/path.js";
27
- import { apply as applyPolyfill } from "../../core/polyfill.js";
28
27
  import { ensureProcessNodeEnv, parseNpmName } from "../../core/util.js";
29
28
  import { eventCliSession, telemetry } from "../../events/index.js";
30
29
  import { exec } from "../exec.js";
@@ -90,7 +89,6 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP = {
90
89
  };
91
90
  async function add(names, { flags }) {
92
91
  ensureProcessNodeEnv("production");
93
- applyPolyfill();
94
92
  const inlineConfig = flagsToAstroInlineConfig(flags);
95
93
  const { userConfig } = await resolveConfig(inlineConfig, "add");
96
94
  telemetry.record(eventCliSession("add", userConfig));
@@ -1,9 +1,7 @@
1
1
  import { resolveConfig } from "../../core/config/config.js";
2
- import { apply as applyPolyfill } from "../../core/polyfill.js";
3
2
  import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
4
3
  import { getPackage } from "../install-package.js";
5
4
  async function db({ flags }) {
6
- applyPolyfill();
7
5
  const logger = createLoggerFromFlags(flags);
8
6
  const getPackageOpts = {
9
7
  skipAsk: !!flags.yes || !!flags.y,
@@ -4,7 +4,6 @@ import colors from "picocolors";
4
4
  import prompts from "prompts";
5
5
  import { resolveConfig } from "../../core/config/index.js";
6
6
  import { ASTRO_VERSION } from "../../core/constants.js";
7
- import { apply as applyPolyfill } from "../../core/polyfill.js";
8
7
  import { flagsToAstroInlineConfig } from "../flags.js";
9
8
  async function getInfoOutput({
10
9
  userConfig,
@@ -52,7 +51,6 @@ async function getInfoOutput({
52
51
  return output.trim();
53
52
  }
54
53
  async function printInfo({ flags }) {
55
- applyPolyfill();
56
54
  const { userConfig } = await resolveConfig(flagsToAstroInlineConfig(flags), "info");
57
55
  const output = await getInfoOutput({ userConfig, print: true });
58
56
  await copyToClipboard(output, flags.copy);
@@ -1,5 +1,5 @@
1
1
  function createBuildTimeAstroVersionProvider() {
2
- const version = "5.15.3";
2
+ const version = "6.0.0-alpha.0";
3
3
  return {
4
4
  getVersion() {
5
5
  return version;
@@ -7,7 +7,6 @@ import { resolveConfig } from "../../core/config/config.js";
7
7
  import { createSettings } from "../../core/config/settings.js";
8
8
  import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
9
9
  import * as msg from "../../core/messages.js";
10
- import { apply as applyPolyfill } from "../../core/polyfill.js";
11
10
  import { DEFAULT_PREFERENCES } from "../../preferences/defaults.js";
12
11
  import { coerce, isValidKey } from "../../preferences/index.js";
13
12
  import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
@@ -25,7 +24,6 @@ function isValidSubcommand(subcommand) {
25
24
  return PREFERENCES_SUBCOMMANDS.includes(subcommand);
26
25
  }
27
26
  async function preferences(subcommand, key, value, { flags }) {
28
- applyPolyfill();
29
27
  if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) {
30
28
  msg.printHelp({
31
29
  commandName: "astro preferences",
@@ -7,21 +7,17 @@ function getViteConfig(userViteConfig, inlineAstroConfig = {}) {
7
7
  return async ({ mode, command }) => {
8
8
  const cmd = command === "serve" ? "dev" : "build";
9
9
  const [
10
- fs,
11
10
  { mergeConfig },
12
11
  { createNodeLogger },
13
12
  { resolveConfig, createSettings },
14
13
  { createVite },
15
- { runHookConfigSetup, runHookConfigDone },
16
- { astroContentListenPlugin }
14
+ { runHookConfigSetup, runHookConfigDone }
17
15
  ] = await Promise.all([
18
- import("node:fs"),
19
16
  import("vite"),
20
17
  import("../core/config/logging.js"),
21
18
  import("../core/config/index.js"),
22
19
  import("../core/create-vite.js"),
23
- import("../integrations/hooks.js"),
24
- import("./vite-plugin-content-listen.js")
20
+ import("../integrations/hooks.js")
25
21
  ]);
26
22
  const logger = createNodeLogger(inlineAstroConfig);
27
23
  const { astroConfig: config } = await resolveConfig(inlineAstroConfig, cmd);
@@ -30,12 +26,7 @@ function getViteConfig(userViteConfig, inlineAstroConfig = {}) {
30
26
  const routesList = await createRoutesList({ settings }, logger);
31
27
  const manifest = createDevelopmentManifest(settings);
32
28
  const viteConfig = await createVite(
33
- {
34
- plugins: config.legacy.collections ? [
35
- // Initialize the content listener
36
- astroContentListenPlugin({ settings, logger, fs })
37
- ] : []
38
- },
29
+ {},
39
30
  { settings, command: cmd, logger, mode, sync: false, manifest, routesList }
40
31
  );
41
32
  await runHookConfigDone({ settings, logger });
@@ -1,9 +1,11 @@
1
- import './polyfill.js';
2
1
  import type { AstroComponentFactory } from '../runtime/server/index.js';
3
2
  import type { Props } from '../types/public/common.js';
4
3
  import type { AstroUserConfig } from '../types/public/config.js';
5
4
  import type { NamedSSRLoadedRendererValue, RouteType, SSRLoadedRenderer, SSRLoadedRendererValue, SSRManifest, SSRResult } from '../types/public/internal.js';
6
- /** Public type, used for integrations to define a renderer for the container API */
5
+ /**
6
+ * Public type, used for integrations to define a renderer for the container API
7
+ * @deprecated Use `AstroRenderer` instead.
8
+ */
7
9
  export type ContainerRenderer = {
8
10
  /**
9
11
  * The name of the renderer.
@@ -1,4 +1,3 @@
1
- import "./polyfill.js";
2
1
  import { posix } from "node:path";
3
2
  import { getDefaultClientDirectives } from "../core/client-directive/index.js";
4
3
  import { ASTRO_CONFIG_DEFAULTS } from "../core/config/schemas/index.js";
@@ -71,20 +71,24 @@ function defineCollection(config) {
71
71
  )
72
72
  });
73
73
  }
74
- if ("loader" in config) {
75
- if (config.type && config.type !== CONTENT_LAYER_TYPE) {
76
- throw new AstroUserError(
77
- `Collections that use the Content Layer API must have a \`loader\` defined and no \`type\` set. Check your collection definitions in ${importerFilename ?? "your content config file"}.`
78
- );
79
- }
80
- if (typeof config.loader === "object" && typeof config.loader.load !== "function" && ("loadEntry" in config.loader || "loadCollection" in config.loader)) {
81
- throw new AstroUserError(
82
- `Live content collections must be defined in "src/live.config.ts" file. Check your collection definitions in "${importerFilename ?? "your content config file"}" to ensure you are not using a live loader.`
83
- );
84
- }
85
- config.type = CONTENT_LAYER_TYPE;
74
+ if (!("loader" in config)) {
75
+ throw new AstroError({
76
+ ...AstroErrorData.ContentCollectionMissingLoader,
77
+ message: AstroErrorData.ContentCollectionMissingLoader.message(importerFilename)
78
+ });
79
+ }
80
+ if (config.type && config.type !== CONTENT_LAYER_TYPE) {
81
+ throw new AstroError({
82
+ ...AstroErrorData.ContentCollectionInvalidType,
83
+ message: AstroErrorData.ContentCollectionInvalidType.message(config.type, importerFilename)
84
+ });
85
+ }
86
+ if (typeof config.loader === "object" && typeof config.loader.load !== "function" && ("loadEntry" in config.loader || "loadCollection" in config.loader)) {
87
+ throw new AstroUserError(
88
+ `Live content collections must be defined in "src/live.config.ts" file. Check your collection definitions in "${importerFilename ?? "your content config file"}" to ensure you are not using a live loader.`
89
+ );
86
90
  }
87
- if (!config.type) config.type = "content";
91
+ config.type = CONTENT_LAYER_TYPE;
88
92
  return config;
89
93
  }
90
94
  export {
@@ -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.15.3") {
167
+ if (previousAstroVersion && previousAstroVersion !== "6.0.0-alpha.0") {
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.15.3") {
176
- await this.#store.metaStore().set("astro-version", "5.15.3");
175
+ if ("6.0.0-alpha.0") {
176
+ await this.#store.metaStore().set("astro-version", "6.0.0-alpha.0");
177
177
  }
178
178
  if (currentConfigDigest) {
179
179
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -212,9 +212,7 @@ ${contentConfig.error.message}`);
212
212
  }
213
213
  },
214
214
  collectionWithResolvedSchema,
215
- false,
216
- // FUTURE: Remove in this in v6
217
- id.endsWith(".svg")
215
+ false
218
216
  );
219
217
  return parsedData;
220
218
  };
@@ -31,8 +31,6 @@ export interface DataEntry<TData extends Record<string, unknown> = Record<string
31
31
  */
32
32
  deferredRender?: boolean;
33
33
  assetImports?: Array<string>;
34
- /** @deprecated */
35
- legacyId?: string;
36
34
  }
37
35
  /**
38
36
  * A read-only data store for content collections. This is used to retrieve data from the content layer at runtime.
@@ -23,9 +23,4 @@ interface GlobOptions {
23
23
  * @param pattern A glob pattern to match files, relative to the content directory.
24
24
  */
25
25
  export declare function glob(globOptions: GlobOptions): Loader;
26
- /** @private */
27
- export declare function glob(globOptions: GlobOptions & {
28
- /** @deprecated */
29
- _legacy?: true;
30
- }): Loader;
31
26
  export {};