astro 7.0.0-alpha.2 → 7.0.0-beta.4

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 (93) hide show
  1. package/dist/assets/build/generate.js +4 -3
  2. package/dist/assets/fonts/core/collect-font-data.js +1 -0
  3. package/dist/assets/fonts/types.d.ts +1 -0
  4. package/dist/cli/add/index.js +1 -44
  5. package/dist/cli/dev/background.js +1 -1
  6. package/dist/cli/dev/index.js +1 -1
  7. package/dist/cli/flags.js +4 -6
  8. package/dist/cli/help/index.js +1 -2
  9. package/dist/cli/index.js +1 -15
  10. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  11. package/dist/container/index.d.ts +3 -3
  12. package/dist/container/index.js +1 -4
  13. package/dist/content/content-layer.js +3 -3
  14. package/dist/content/runtime.d.ts +1 -1
  15. package/dist/content/runtime.js +1 -0
  16. package/dist/content/vite-plugin-content-virtual-mod.js +27 -0
  17. package/dist/core/app/base.d.ts +1 -1
  18. package/dist/core/app/base.js +14 -24
  19. package/dist/core/app/dev/pipeline.js +0 -9
  20. package/dist/core/app/manifest.d.ts +0 -2
  21. package/dist/core/app/manifest.js +0 -8
  22. package/dist/core/app/types.d.ts +1 -8
  23. package/dist/core/base-pipeline.d.ts +3 -9
  24. package/dist/core/base-pipeline.js +4 -23
  25. package/dist/core/build/app.d.ts +0 -2
  26. package/dist/core/build/app.js +0 -5
  27. package/dist/core/build/generate.js +0 -14
  28. package/dist/core/build/pipeline.js +0 -9
  29. package/dist/core/build/plugins/plugin-css.js +1 -0
  30. package/dist/core/build/plugins/plugin-manifest.js +4 -9
  31. package/dist/core/config/config.js +3 -2
  32. package/dist/core/config/schemas/base.d.ts +9 -22
  33. package/dist/core/config/schemas/base.js +11 -27
  34. package/dist/core/config/schemas/relative.d.ts +15 -36
  35. package/dist/core/config/validate.js +10 -2
  36. package/dist/core/constants.js +1 -1
  37. package/dist/core/dev/dev.js +1 -1
  38. package/dist/core/errors/default-handler.js +21 -8
  39. package/dist/core/fetch/fetch-state.js +3 -16
  40. package/dist/core/fetch/types.d.ts +1 -1
  41. package/dist/core/fetch/vite-plugin.js +4 -6
  42. package/dist/core/hono/index.d.ts +1 -0
  43. package/dist/core/hono/index.js +1 -0
  44. package/dist/core/logger/impls/node.js +0 -1
  45. package/dist/core/logger/load.js +3 -2
  46. package/dist/core/messages/runtime.js +1 -1
  47. package/dist/core/middleware/index.js +8 -1
  48. package/dist/core/middleware/vite-plugin.d.ts +1 -0
  49. package/dist/core/middleware/vite-plugin.js +5 -1
  50. package/dist/core/util/normalized-url.js +2 -5
  51. package/dist/core/util/pathname.d.ts +13 -7
  52. package/dist/core/util/pathname.js +9 -6
  53. package/dist/i18n/index.js +6 -2
  54. package/dist/manifest/serialized.js +4 -5
  55. package/dist/runtime/server/index.d.ts +1 -1
  56. package/dist/runtime/server/index.js +4 -0
  57. package/dist/runtime/server/jsx.js +2 -1
  58. package/dist/runtime/server/render/astro/render-template.d.ts +1 -1
  59. package/dist/runtime/server/render/astro/render.d.ts +0 -4
  60. package/dist/runtime/server/render/astro/render.js +76 -68
  61. package/dist/runtime/server/render/head.js +2 -1
  62. package/dist/runtime/server/render/index.d.ts +1 -0
  63. package/dist/runtime/server/render/index.js +2 -0
  64. package/dist/runtime/server/render/page.js +9 -44
  65. package/dist/runtime/server/render/streaming.d.ts +23 -0
  66. package/dist/runtime/server/render/streaming.js +238 -0
  67. package/dist/runtime/server/render/util.js +5 -1
  68. package/dist/types/public/config.d.ts +115 -123
  69. package/dist/types/public/context.d.ts +1 -1
  70. package/dist/types/public/internal.d.ts +0 -15
  71. package/dist/vite-plugin-app/app.js +1 -1
  72. package/dist/vite-plugin-app/pipeline.js +0 -9
  73. package/dist/vite-plugin-hmr-reload/index.js +19 -6
  74. package/dist/vite-plugin-html/transform/slots.js +4 -1
  75. package/dist/vite-plugin-pages/pages.d.ts +11 -0
  76. package/dist/vite-plugin-pages/pages.js +1 -3
  77. package/package.json +13 -7
  78. package/dist/cli/db/index.d.ts +0 -4
  79. package/dist/cli/db/index.js +0 -25
  80. package/dist/jsx/rehype.d.ts +0 -5
  81. package/dist/jsx/rehype.js +0 -241
  82. package/dist/runtime/server/html-string-cache.d.ts +0 -48
  83. package/dist/runtime/server/html-string-cache.js +0 -119
  84. package/dist/runtime/server/render/queue/builder.d.ts +0 -14
  85. package/dist/runtime/server/render/queue/builder.js +0 -182
  86. package/dist/runtime/server/render/queue/jsx-builder.d.ts +0 -33
  87. package/dist/runtime/server/render/queue/jsx-builder.js +0 -146
  88. package/dist/runtime/server/render/queue/pool.d.ts +0 -123
  89. package/dist/runtime/server/render/queue/pool.js +0 -203
  90. package/dist/runtime/server/render/queue/renderer.d.ts +0 -12
  91. package/dist/runtime/server/render/queue/renderer.js +0 -103
  92. package/dist/runtime/server/render/queue/types.d.ts +0 -81
  93. package/dist/runtime/server/render/queue/types.js +0 -0
@@ -167,20 +167,6 @@ ${colors.bgGreen(colors.black(` ${verb} static routes `))}`);
167
167
  colors.green(`\u2713 Completed in ${getTimeStat(generatePagesTimer, performance.now())}.
168
168
  `)
169
169
  );
170
- if (options.settings.logLevel === "debug" && options.settings.config.experimental?.queuedRendering && prerenderer.app) {
171
- try {
172
- const stats = prerenderer.app.getQueueStats();
173
- if (stats && (stats.acquireFromPool > 0 || stats.acquireNew > 0)) {
174
- logger.info(
175
- null,
176
- colors.dim(
177
- `[Queue Pool] ${stats.acquireFromPool.toLocaleString()} reused / ${stats.acquireNew.toLocaleString()} new nodes | Hit rate: ${stats.hitRate.toFixed(1)}% | Pool: ${stats.poolSize}/${stats.maxSize}`
178
- )
179
- );
180
- }
181
- } catch {
182
- }
183
- }
184
170
  if (staticImageList.size) {
185
171
  logger.info("SKIP_FORMAT", `${colors.bgGreen(colors.black(` generating optimized images `))}`);
186
172
  const totalCount = Array.from(staticImageList.values()).map((x) => x.transforms.size).reduce((a, b) => a + b, 0);
@@ -9,9 +9,6 @@ import { createDefaultRoutes } from "../routing/default.js";
9
9
  import { getFallbackRoute, routeIsFallback, routeIsRedirect } from "../routing/helpers.js";
10
10
  import { findRouteToRewrite } from "../routing/rewrite.js";
11
11
  import { cssOrder, mergeInlineCss, getPageData } from "./runtime.js";
12
- import { newNodePool } from "../../runtime/server/render/queue/pool.js";
13
- import { HTMLStringCache } from "../../runtime/server/html-string-cache.js";
14
- import { queueRenderingEnabled } from "../app/manifest.js";
15
12
  class BuildPipeline extends Pipeline {
16
13
  internals;
17
14
  options;
@@ -65,12 +62,6 @@ class BuildPipeline extends Pipeline {
65
62
  super(logger, manifest, "production", manifest.renderers, resolve, manifest.serverLike);
66
63
  this.manifest = manifest;
67
64
  this.defaultRoutes = defaultRoutes;
68
- if (queueRenderingEnabled(this.manifest.experimentalQueuedRendering)) {
69
- this.nodePool = newNodePool(this.manifest.experimentalQueuedRendering);
70
- if (this.manifest.experimentalQueuedRendering.contentCache) {
71
- this.htmlStringCache = new HTMLStringCache(1e3);
72
- }
73
- }
74
65
  }
75
66
  getRoutes() {
76
67
  return this.getOptions().routesList.routes;
@@ -107,6 +107,7 @@ function rollupPluginAstroBuildCSS(options) {
107
107
  if (meta.importedCss.size < 1) continue;
108
108
  if (this.environment?.name === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
109
109
  for (const id of Object.keys(chunk.modules)) {
110
+ if (!isCSSRequest(id)) continue;
110
111
  for (const pageData of getParentClientOnlys(id, this, internals)) {
111
112
  for (const importedCssImport of meta.importedCss) {
112
113
  const cssToInfoRecord = pagesToCss[pageData.moduleSpecifier] ??= {};
@@ -221,9 +221,9 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
221
221
  }
222
222
  }
223
223
  const middlewareMode = resolveMiddlewareMode(opts.settings.adapter?.adapterFeatures);
224
- let experimentalLogger = void 0;
225
- if (settings.config.experimental.logger) {
226
- experimentalLogger = settings.config.experimental.logger;
224
+ let loggerConfig = void 0;
225
+ if (settings.config.logger) {
226
+ loggerConfig = settings.config.logger;
227
227
  }
228
228
  return {
229
229
  rootDir: opts.settings.config.root.toString(),
@@ -244,11 +244,6 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
244
244
  trailingSlash: settings.config.trailingSlash,
245
245
  compressHTML: settings.config.compressHTML,
246
246
  assetsPrefix: settings.config.build.assetsPrefix,
247
- experimentalQueuedRendering: {
248
- enabled: settings.config.experimental.queuedRendering?.enabled ?? false,
249
- poolSize: 0,
250
- contentCache: false
251
- },
252
247
  componentMetadata: Array.from(internals.componentMetadata),
253
248
  renderers: [],
254
249
  clientDirectives: Array.from(settings.clientDirectives),
@@ -282,7 +277,7 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
282
277
  internalFetchHeaders,
283
278
  logLevel: settings.logLevel,
284
279
  shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp),
285
- experimentalLogger
280
+ loggerConfig
286
281
  };
287
282
  }
288
283
  export {
@@ -67,13 +67,14 @@ async function loadConfig(root, configFile, fsMod = fs) {
67
67
  }
68
68
  }
69
69
  function splitInlineConfig(inlineConfig) {
70
- const { configFile, mode, logLevel, ...inlineUserConfig } = inlineConfig;
70
+ const { configFile, mode, logLevel, _logger, ...inlineUserConfig } = inlineConfig;
71
71
  return {
72
72
  inlineUserConfig,
73
73
  inlineOnlyConfig: {
74
74
  configFile,
75
75
  mode,
76
- logLevel
76
+ logLevel,
77
+ _logger
77
78
  }
78
79
  };
79
80
  }
@@ -57,7 +57,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
57
57
  allowedHosts: never[];
58
58
  };
59
59
  integrations: never[];
60
- markdown: Required<Omit<import("@astrojs/markdown-remark").AstroMarkdownOptions, "image">>;
60
+ markdown: Required<Omit<import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, "image">>;
61
61
  vite: {};
62
62
  legacy: {
63
63
  collectionsBackwardsCompat: false;
@@ -75,17 +75,11 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
75
75
  validateSecrets: false;
76
76
  };
77
77
  prerenderConflictBehavior: "warn";
78
+ fetchFile: string;
78
79
  experimental: {
79
- advancedRouting: false;
80
80
  clientPrerender: false;
81
81
  contentIntellisense: false;
82
82
  chromeDevtoolsWorkspace: false;
83
- queuedRendering: {
84
- enabled: false;
85
- };
86
- logger: {
87
- entrypoint: string;
88
- };
89
83
  };
90
84
  };
91
85
  export declare const AstroConfigSchema: z.ZodObject<{
@@ -335,8 +329,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
335
329
  processor: z.ZodDefault<z.ZodObject<{
336
330
  name: z.ZodString;
337
331
  options: z.ZodDefault<z.ZodCustom<object, object>>;
338
- createRenderer: z.ZodCustom<(shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>, (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>>;
339
- createMdxRenderer: z.ZodOptional<z.ZodCustom<((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined, ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined>>;
332
+ createRenderer: z.ZodCustom<(shared: import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions) => Promise<import("@astrojs/internal-helpers/markdown").MarkdownRenderer>, (shared: import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions) => Promise<import("@astrojs/internal-helpers/markdown").MarkdownRenderer>>;
333
+ createMdxRenderer: z.ZodOptional<z.ZodCustom<((shared: import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined, ((shared: import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined>>;
340
334
  }, z.core.$strip>>;
341
335
  }, z.core.$strip>>;
342
336
  vite: z.ZodDefault<z.ZodCustom<ViteUserConfig, ViteUserConfig>>;
@@ -462,6 +456,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
462
456
  ignore: "ignore";
463
457
  warn: "warn";
464
458
  }>>>;
459
+ fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
460
+ logger: z.ZodOptional<z.ZodObject<{
461
+ entrypoint: z.ZodString;
462
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
463
+ }, z.core.$strip>>;
465
464
  fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
466
465
  name: z.ZodString;
467
466
  cssVariable: z.ZodString;
@@ -506,9 +505,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
506
505
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
507
506
  }, z.core.$strict>>>;
508
507
  experimental: z.ZodPrefault<z.ZodObject<{
509
- advancedRouting: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
510
- fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
511
- }, z.core.$strict>]>>>;
512
508
  clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
513
509
  contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
514
510
  chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -528,15 +524,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
528
524
  swr: z.ZodOptional<z.ZodNumber>;
529
525
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
530
526
  }, z.core.$strip>>>;
531
- queuedRendering: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
532
- enabled: z.ZodPrefault<z.ZodOptional<z.ZodBoolean>>;
533
- poolSize: z.ZodOptional<z.ZodNumber>;
534
- contentCache: z.ZodOptional<z.ZodBoolean>;
535
- }, z.core.$strip>>>;
536
- logger: z.ZodOptional<z.ZodObject<{
537
- entrypoint: z.ZodString;
538
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
539
- }, z.core.$strip>>;
540
527
  }, z.core.$strict>>;
541
528
  legacy: z.ZodPrefault<z.ZodObject<{
542
529
  collectionsBackwardsCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -2,7 +2,7 @@ import {
2
2
  markdownConfigDefaults,
3
3
  syntaxHighlightDefaults
4
4
  } from "@astrojs/internal-helpers/markdown";
5
- import { unified } from "@astrojs/markdown-remark";
5
+ import { satteri } from "@astrojs/markdown-satteri";
6
6
  import { bundledThemes } from "shiki";
7
7
  import * as z from "zod/v4";
8
8
  import { FontFamilySchema } from "../../../assets/fonts/config.js";
@@ -64,17 +64,11 @@ const ASTRO_CONFIG_DEFAULTS = {
64
64
  validateSecrets: false
65
65
  },
66
66
  prerenderConflictBehavior: "warn",
67
+ fetchFile: "fetch",
67
68
  experimental: {
68
- advancedRouting: false,
69
69
  clientPrerender: false,
70
70
  contentIntellisense: false,
71
- chromeDevtoolsWorkspace: false,
72
- queuedRendering: {
73
- enabled: false
74
- },
75
- logger: {
76
- entrypoint: "astro/logger/node"
77
- }
71
+ chromeDevtoolsWorkspace: false
78
72
  }
79
73
  };
80
74
  const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type);
@@ -244,7 +238,7 @@ const AstroConfigSchema = z.object({
244
238
  remarkRehype: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.markdown.remarkRehype),
245
239
  // Deprecated: left undefined unless the user explicitly sets them, so the
246
240
  // deprecation warning only fires when actually used. The active processor
247
- // (`unified()`) supplies the real default (`gfm`/smart punctuation on) when
241
+ // (`satteri()`) supplies the real default (`gfm`/smart punctuation on) when
248
242
  // these are absent.
249
243
  gfm: z.boolean().optional(),
250
244
  smartypants: z.union([z.boolean(), smartypantsOptionsSchema]).transform((val) => {
@@ -262,7 +256,7 @@ const AstroConfigSchema = z.object({
262
256
  createMdxRenderer: z.custom(
263
257
  (v) => v === void 0 || typeof v === "function"
264
258
  ).optional()
265
- }).default(() => unified())
259
+ }).default(() => satteri())
266
260
  }).prefault({}),
267
261
  vite: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.vite),
268
262
  i18n: z.optional(
@@ -327,29 +321,19 @@ const AstroConfigSchema = z.object({
327
321
  }).strict().optional().default(ASTRO_CONFIG_DEFAULTS.env),
328
322
  session: SessionSchema.optional(),
329
323
  prerenderConflictBehavior: z.enum(["error", "warn", "ignore"]).optional().default(ASTRO_CONFIG_DEFAULTS.prerenderConflictBehavior),
324
+ fetchFile: z.string().nullable().optional().default(ASTRO_CONFIG_DEFAULTS.fetchFile),
325
+ logger: z.object({
326
+ entrypoint: z.string(),
327
+ config: z.record(z.string(), z.any()).optional()
328
+ }).optional(),
330
329
  fonts: z.array(FontFamilySchema).optional(),
331
330
  experimental: z.strictObject({
332
- advancedRouting: z.union([
333
- z.boolean(),
334
- z.strictObject({
335
- fetchFile: z.string().nullable().optional().default("app")
336
- })
337
- ]).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.advancedRouting),
338
331
  clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
339
332
  contentIntellisense: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentIntellisense),
340
333
  chromeDevtoolsWorkspace: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.chromeDevtoolsWorkspace),
341
334
  svgOptimizer: SvgOptimizerSchema.optional(),
342
335
  cache: CacheSchema.optional(),
343
- routeRules: RouteRulesSchema.optional(),
344
- queuedRendering: z.object({
345
- enabled: z.boolean().optional().prefault(false),
346
- poolSize: z.number().int().nonnegative().optional(),
347
- contentCache: z.boolean().optional()
348
- }).optional().prefault(ASTRO_CONFIG_DEFAULTS.experimental.queuedRendering),
349
- logger: z.object({
350
- entrypoint: z.string(),
351
- config: z.record(z.string(), z.any()).optional()
352
- }).optional()
336
+ routeRules: RouteRulesSchema.optional()
353
337
  }).prefault({}),
354
338
  legacy: z.object({
355
339
  collectionsBackwardsCompat: z.boolean().optional().default(false)
@@ -344,6 +344,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
344
344
  ignore: "ignore";
345
345
  warn: "warn";
346
346
  }>>>;
347
+ fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
348
+ logger: z.ZodOptional<z.ZodObject<{
349
+ entrypoint: z.ZodString;
350
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
351
+ }, z.core.$strip>>;
347
352
  fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
348
353
  name: z.ZodString;
349
354
  cssVariable: z.ZodString;
@@ -388,9 +393,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
388
393
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
389
394
  }, z.core.$strict>>>;
390
395
  experimental: z.ZodPrefault<z.ZodObject<{
391
- advancedRouting: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
392
- fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
393
- }, z.core.$strict>]>>>;
394
396
  clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
395
397
  contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
396
398
  chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -410,15 +412,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
410
412
  swr: z.ZodOptional<z.ZodNumber>;
411
413
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
412
414
  }, z.core.$strip>>>;
413
- queuedRendering: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
414
- enabled: z.ZodPrefault<z.ZodOptional<z.ZodBoolean>>;
415
- poolSize: z.ZodOptional<z.ZodNumber>;
416
- contentCache: z.ZodOptional<z.ZodBoolean>;
417
- }, z.core.$strip>>>;
418
- logger: z.ZodOptional<z.ZodObject<{
419
- entrypoint: z.ZodString;
420
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
421
- }, z.core.$strip>>;
422
415
  }, z.core.$strict>>;
423
416
  legacy: z.ZodPrefault<z.ZodObject<{
424
417
  collectionsBackwardsCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -588,18 +581,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
588
581
  validateSecrets: boolean;
589
582
  };
590
583
  prerenderConflictBehavior: "error" | "ignore" | "warn";
584
+ fetchFile: string | null;
591
585
  experimental: {
592
- advancedRouting: boolean | {
593
- fetchFile: string | null;
594
- };
595
586
  clientPrerender: boolean;
596
587
  contentIntellisense: boolean;
597
588
  chromeDevtoolsWorkspace: boolean;
598
- queuedRendering: {
599
- enabled: boolean;
600
- poolSize?: number | undefined;
601
- contentCache?: boolean | undefined;
602
- };
603
589
  svgOptimizer?: {
604
590
  name: string;
605
591
  optimize: (contents: string) => string | Promise<string>;
@@ -616,10 +602,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
616
602
  swr?: number | undefined;
617
603
  tags?: string[] | undefined;
618
604
  }> | undefined;
619
- logger?: {
620
- entrypoint: string;
621
- config?: Record<string, any> | undefined;
622
- } | undefined;
623
605
  };
624
606
  legacy: {
625
607
  collectionsBackwardsCompat: boolean;
@@ -693,6 +675,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
693
675
  } | undefined;
694
676
  ttl?: number | undefined;
695
677
  } | undefined;
678
+ logger?: {
679
+ entrypoint: string;
680
+ config?: Record<string, any> | undefined;
681
+ } | undefined;
696
682
  fonts?: {
697
683
  name: string;
698
684
  cssVariable: string;
@@ -845,18 +831,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
845
831
  validateSecrets: boolean;
846
832
  };
847
833
  prerenderConflictBehavior: "error" | "ignore" | "warn";
834
+ fetchFile: string | null;
848
835
  experimental: {
849
- advancedRouting: boolean | {
850
- fetchFile: string | null;
851
- };
852
836
  clientPrerender: boolean;
853
837
  contentIntellisense: boolean;
854
838
  chromeDevtoolsWorkspace: boolean;
855
- queuedRendering: {
856
- enabled: boolean;
857
- poolSize?: number | undefined;
858
- contentCache?: boolean | undefined;
859
- };
860
839
  svgOptimizer?: {
861
840
  name: string;
862
841
  optimize: (contents: string) => string | Promise<string>;
@@ -873,10 +852,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
873
852
  swr?: number | undefined;
874
853
  tags?: string[] | undefined;
875
854
  }> | undefined;
876
- logger?: {
877
- entrypoint: string;
878
- config?: Record<string, any> | undefined;
879
- } | undefined;
880
855
  };
881
856
  legacy: {
882
857
  collectionsBackwardsCompat: boolean;
@@ -950,6 +925,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
950
925
  } | undefined;
951
926
  ttl?: number | undefined;
952
927
  } | undefined;
928
+ logger?: {
929
+ entrypoint: string;
930
+ config?: Record<string, any> | undefined;
931
+ } | undefined;
953
932
  fonts?: {
954
933
  name: string;
955
934
  cssVariable: string;
@@ -30,7 +30,7 @@ function warnDeprecatedMarkdownOptions(config) {
30
30
  const names = deprecated.map((key) => `\`markdown.${key}\``).join(" and ");
31
31
  const isPlural = deprecated.length > 1;
32
32
  console.warn(
33
- `[astro] ${names} ${isPlural ? "are" : "is"} deprecated. Move ${isPlural ? "them" : "it"} onto your processor instead (e.g. \`unified({ gfm: false, smartypants: false })\`). Will be removed in a future major.`
33
+ `[astro] ${names} ${isPlural ? "are" : "is"} deprecated. Move ${isPlural ? "them" : "it"} onto your processor instead (e.g. \`satteri({ features: { gfm: false, smartPunctuation: false } })\`, or \`unified({ gfm: false, smartypants: false })\` from \`@astrojs/markdown-remark\`). Will be removed in a future major.`
34
34
  );
35
35
  }
36
36
  let didWarnAboutLegacyMarkdownPlugins = false;
@@ -45,7 +45,15 @@ async function coerceLegacyMarkdownPlugins(config) {
45
45
  if (remarkPlugins.length === 0 && rehypePlugins.length === 0 && Object.keys(remarkRehype).length === 0) {
46
46
  return;
47
47
  }
48
- const { unified, isUnifiedProcessor } = await import("@astrojs/markdown-remark");
48
+ let unified;
49
+ let isUnifiedProcessor;
50
+ try {
51
+ ({ unified, isUnifiedProcessor } = await import("@astrojs/markdown-remark"));
52
+ } catch {
53
+ throw new Error(
54
+ "`markdown.remarkPlugins`, `markdown.rehypePlugins`, and `markdown.remarkRehype` run on the `unified` processor from `@astrojs/markdown-remark`, which is no longer installed by default now that S\xE4tteri is the default Markdown processor. Install it with:\n npm install @astrojs/markdown-remark"
55
+ );
56
+ }
49
57
  const current = md.processor;
50
58
  if (!current || isUnifiedProcessor(current)) {
51
59
  const target = current ?? (md.processor = unified());
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "7.0.0-alpha.2";
1
+ const ASTRO_VERSION = "7.0.0-beta.4";
2
2
  const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`;
3
3
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
4
4
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
@@ -26,7 +26,7 @@ async function dev(inlineConfig) {
26
26
  await telemetry.record([]);
27
27
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
28
28
  const logger = restart.container.logger;
29
- const currentVersion = "7.0.0-alpha.2";
29
+ const currentVersion = "7.0.0-beta.4";
30
30
  const isPrerelease = currentVersion.includes("-");
31
31
  if (!isPrerelease) {
32
32
  try {
@@ -6,6 +6,7 @@ import { AstroMiddleware } from "../middleware/astro-middleware.js";
6
6
  import { PagesHandler } from "../pages/handler.js";
7
7
  import { matchRoute } from "../routing/match.js";
8
8
  import { provideSession } from "../session/handler.js";
9
+ import { validateHost } from "../app/validate-headers.js";
9
10
  class DefaultErrorHandler {
10
11
  #app;
11
12
  #astroMiddleware;
@@ -31,15 +32,27 @@ class DefaultErrorHandler {
31
32
  if (errorRouteData) {
32
33
  if (errorRouteData.prerender) {
33
34
  const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
34
- const statusURL = new URL(`${app.baseWithoutTrailingSlash}/${status}${maybeDotHtml}`, url);
35
+ const allowedDomains = app.manifest.allowedDomains;
36
+ const validatedHost = validateHost(url.host, url.protocol.replace(":", ""), allowedDomains);
37
+ const safeOrigin = validatedHost ? url.origin : `${url.protocol}//localhost`;
38
+ const statusURL = new URL(
39
+ `${app.baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
40
+ safeOrigin
41
+ );
35
42
  if (statusURL.toString() !== request.url && resolvedRenderOptions.prerenderedErrorPageFetch) {
36
- const response2 = await resolvedRenderOptions.prerenderedErrorPageFetch(
37
- statusURL.toString()
38
- );
39
- const override = { status, removeContentEncodingHeaders: true };
40
- const newResponse = mergeResponses(response2, originalResponse, override);
41
- prepareResponse(newResponse, resolvedRenderOptions);
42
- return newResponse;
43
+ try {
44
+ const response2 = await resolvedRenderOptions.prerenderedErrorPageFetch(
45
+ statusURL.toString()
46
+ );
47
+ const override = { status, removeContentEncodingHeaders: true };
48
+ const newResponse = mergeResponses(response2, originalResponse, override);
49
+ prepareResponse(newResponse, resolvedRenderOptions);
50
+ return newResponse;
51
+ } catch {
52
+ const response2 = mergeResponses(new Response(null, { status }), originalResponse);
53
+ prepareResponse(response2, resolvedRenderOptions);
54
+ return response2;
55
+ }
43
56
  }
44
57
  }
45
58
  const mod = await app.pipeline.getComponentByRoute(errorRouteData);
@@ -29,6 +29,7 @@ import { getParams, getProps } from "../render/index.js";
29
29
  import { Rewrites } from "../rewrites/handler.js";
30
30
  import { isRoute404or500, isRouteServerIsland } from "../routing/match.js";
31
31
  import { normalizeUrl } from "../util/normalized-url.js";
32
+ import { validateAndDecodePathname } from "../util/pathname.js";
32
33
  import { getOriginPathname, setOriginPathname } from "../routing/rewrite.js";
33
34
  import { computePathnameFromDomain } from "../i18n/domain.js";
34
35
  import { getCustom404Route, routeHasHtmlExtension } from "../routing/helpers.js";
@@ -190,7 +191,7 @@ class FetchState {
190
191
  this.locals = options?.locals ?? {};
191
192
  this.url = normalizeUrl(url);
192
193
  this.cookies = new AstroCookies(request);
193
- if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0) {
194
+ if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0 && !this.routeData?.prerender) {
194
195
  this.#applyForwardedHeaders();
195
196
  }
196
197
  if (!Reflect.get(this.request, originPathnameSymbol)) {
@@ -274,13 +275,6 @@ class FetchState {
274
275
  },
275
276
  key: manifest.key,
276
277
  trailingSlash: manifest.trailingSlash,
277
- _experimentalQueuedRendering: {
278
- pool: pipeline.nodePool,
279
- htmlStringCache: pipeline.htmlStringCache,
280
- enabled: manifest.experimentalQueuedRendering?.enabled,
281
- poolSize: manifest.experimentalQueuedRendering?.poolSize,
282
- contentCache: manifest.experimentalQueuedRendering?.contentCache
283
- },
284
278
  _metadata: {
285
279
  hasHydrationScript: false,
286
280
  rendererSpecificHydrationScripts: /* @__PURE__ */ new Set(),
@@ -701,7 +695,7 @@ class FetchState {
701
695
  }
702
696
  pathname = prependForwardSlash(pathname);
703
697
  try {
704
- return decodeURI(pathname);
698
+ return validateAndDecodePathname(pathname);
705
699
  } catch (e) {
706
700
  this.pipeline.logger.error(null, e.toString());
707
701
  return pathname;
@@ -829,13 +823,6 @@ class FetchState {
829
823
  return state.getCsp();
830
824
  },
831
825
  get logger() {
832
- if (!state.pipeline.manifest.experimentalLogger) {
833
- state.pipeline.logger.warn(
834
- null,
835
- "The Astro.logger is available only when experimental.logger is defined."
836
- );
837
- return void 0;
838
- }
839
826
  return {
840
827
  info(msg) {
841
828
  state.pipeline.logger.info(null, msg);
@@ -6,7 +6,7 @@
6
6
  export type FetchHandler = (request: Request) => Promise<Response>;
7
7
  /**
8
8
  * An object with a `fetch` method that handles incoming requests.
9
- * This is the shape expected by `src/app.ts` and aligns with the
9
+ * This is the shape expected by `src/fetch.ts` and aligns with the
10
10
  * convention used by Cloudflare Workers, Bun, and Hono.
11
11
  *
12
12
  * @example
@@ -5,14 +5,12 @@ import {
5
5
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../constants.js";
6
6
  const FETCHABLE_MODULE_ID = "virtual:astro:fetchable";
7
7
  const FETCHABLE_RESOLVED_MODULE_ID = "\0" + FETCHABLE_MODULE_ID;
8
- const DEFAULT_FETCH_FILE = "app";
8
+ const DEFAULT_FETCH_FILE = "fetch";
9
9
  function vitePluginFetchable({ settings }) {
10
10
  let resolvedUserAppId;
11
11
  let userAppPresent = false;
12
- const advancedRoutingConfig = settings.config.experimental.advancedRouting;
13
- const advancedRoutingEnabled = !!advancedRoutingConfig;
14
- const fetchFile = (typeof advancedRoutingConfig === "object" ? advancedRoutingConfig.fetchFile : void 0) ?? DEFAULT_FETCH_FILE;
15
- const fetchFileDisabled = typeof advancedRoutingConfig === "object" && advancedRoutingConfig.fetchFile === null;
12
+ const fetchFile = settings.config.fetchFile ?? DEFAULT_FETCH_FILE;
13
+ const fetchFileDisabled = settings.config.fetchFile === null;
16
14
  const normalizedSrcDir = viteNormalizePath(fileURLToPath(settings.config.srcDir));
17
15
  return {
18
16
  name: "@astro/plugin-fetchable",
@@ -48,7 +46,7 @@ function vitePluginFetchable({ settings }) {
48
46
  return FETCHABLE_RESOLVED_MODULE_ID;
49
47
  }
50
48
  const resolved = await this.resolve(`${normalizedSrcDir}${fetchFile}`);
51
- userAppPresent = advancedRoutingEnabled && !!resolved;
49
+ userAppPresent = !!resolved;
52
50
  resolvedUserAppId = resolved?.id;
53
51
  return FETCHABLE_RESOLVED_MODULE_ID;
54
52
  }
@@ -10,6 +10,7 @@ type HonoContextLike = {
10
10
  set?: (key: string, value: unknown) => void;
11
11
  };
12
12
  type HonoMiddlewareHandler = (context: HonoContextLike, next: () => Promise<void>) => Promise<Response | void>;
13
+ export declare function getFetchState(context: HonoContextLike): FetchState;
13
14
  export declare function astro(): HonoMiddlewareHandler;
14
15
  export declare function trailingSlash(): HonoMiddlewareHandler;
15
16
  export declare function middleware(): HonoMiddlewareHandler;
@@ -92,6 +92,7 @@ export {
92
92
  actions,
93
93
  astro,
94
94
  cache,
95
+ getFetchState,
95
96
  i18n,
96
97
  middleware,
97
98
  pages,
@@ -28,7 +28,6 @@ function node_default(options) {
28
28
  return nodeLogDestination(options);
29
29
  }
30
30
  function createNodeLoggerFromFlags(inlineConfig) {
31
- if (inlineConfig.logger) return inlineConfig.logger;
32
31
  return new AstroLogger({
33
32
  destination: nodeLogDestination(),
34
33
  level: inlineConfig.logLevel ?? "info"
@@ -72,9 +72,10 @@ async function loadLogger(config, level = "info") {
72
72
  throw error;
73
73
  }
74
74
  async function loadOrCreateNodeLogger(astroConfig, inlineAstroConfig) {
75
+ if (inlineAstroConfig._logger) return inlineAstroConfig._logger;
75
76
  try {
76
- if (astroConfig.experimental.logger) {
77
- return await loadLogger(astroConfig.experimental.logger, inlineAstroConfig.logLevel);
77
+ if (astroConfig.logger) {
78
+ return await loadLogger(astroConfig.logger, inlineAstroConfig.logLevel);
78
79
  } else {
79
80
  return createNodeLoggerFromFlags(inlineAstroConfig);
80
81
  }
@@ -269,7 +269,7 @@ function printHelp({
269
269
  message.push(
270
270
  linebreak(),
271
271
  ` ${bgGreen(black(` ${commandName} `))} ${green(
272
- `v${"7.0.0-alpha.2"}`
272
+ `v${"7.0.0-beta.4"}`
273
273
  )} ${headline}`
274
274
  );
275
275
  }
@@ -75,7 +75,14 @@ function createContext({
75
75
  session: void 0,
76
76
  cache: new DisabledAstroCache(),
77
77
  csp: void 0,
78
- logger: void 0
78
+ logger: {
79
+ info() {
80
+ },
81
+ warn() {
82
+ },
83
+ error() {
84
+ }
85
+ }
79
86
  };
80
87
  return Object.assign(context, {
81
88
  getActionResult: createGetActionResult(context.locals),
@@ -3,6 +3,7 @@ import type { AstroSettings } from '../../types/astro.js';
3
3
  import type { BuildInternals } from '../build/internal.js';
4
4
  import type { StaticBuildOptions } from '../build/types.js';
5
5
  export declare const MIDDLEWARE_MODULE_ID = "virtual:astro:middleware";
6
+ export declare function isMiddlewarePath(relativePath: string): boolean;
6
7
  export declare function vitePluginMiddleware({ settings }: {
7
8
  settings: AstroSettings;
8
9
  }): VitePlugin;