astro 6.2.2 → 6.3.1

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 (113) hide show
  1. package/dist/actions/handler.d.ts +32 -0
  2. package/dist/actions/handler.js +45 -0
  3. package/dist/actions/runtime/server.js +1 -1
  4. package/dist/assets/build/generate.js +1 -1
  5. package/dist/assets/build/remote.d.ts +3 -2
  6. package/dist/assets/build/remote.js +16 -9
  7. package/dist/assets/endpoint/generic.js +8 -20
  8. package/dist/assets/endpoint/loadImage.d.ts +11 -0
  9. package/dist/assets/endpoint/loadImage.js +19 -0
  10. package/dist/assets/endpoint/shared.js +7 -2
  11. package/dist/assets/index.d.ts +1 -0
  12. package/dist/assets/index.js +2 -0
  13. package/dist/assets/services/sharp.js +7 -0
  14. package/dist/assets/utils/index.d.ts +1 -0
  15. package/dist/assets/utils/index.js +2 -0
  16. package/dist/assets/utils/redirectValidation.d.ts +48 -0
  17. package/dist/assets/utils/redirectValidation.js +48 -0
  18. package/dist/assets/utils/remoteProbe.js +25 -2
  19. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  20. package/dist/container/index.js +18 -14
  21. package/dist/content/content-layer.js +3 -4
  22. package/dist/content/server-listeners.js +0 -4
  23. package/dist/content/vite-plugin-content-virtual-mod.js +9 -1
  24. package/dist/core/app/base.d.ts +33 -15
  25. package/dist/core/app/base.js +120 -324
  26. package/dist/core/app/dev/app.d.ts +3 -2
  27. package/dist/core/app/dev/app.js +4 -60
  28. package/dist/core/app/entrypoints/virtual/dev.js +2 -0
  29. package/dist/core/app/entrypoints/virtual/prod.js +4 -1
  30. package/dist/core/app/prepare-response.d.ts +11 -0
  31. package/dist/core/app/prepare-response.js +18 -0
  32. package/dist/core/app/render-options.d.ts +11 -0
  33. package/dist/core/app/render-options.js +11 -0
  34. package/dist/core/base-pipeline.d.ts +38 -1
  35. package/dist/core/base-pipeline.js +50 -7
  36. package/dist/core/build/app.d.ts +3 -4
  37. package/dist/core/build/app.js +3 -17
  38. package/dist/core/cache/handler.d.ts +29 -0
  39. package/dist/core/cache/handler.js +81 -0
  40. package/dist/core/config/schemas/base.d.ts +4 -0
  41. package/dist/core/config/schemas/base.js +4 -0
  42. package/dist/core/config/schemas/relative.d.ts +6 -0
  43. package/dist/core/constants.d.ts +27 -1
  44. package/dist/core/constants.js +14 -1
  45. package/dist/core/cookies/cookies.d.ts +7 -2
  46. package/dist/core/cookies/cookies.js +11 -4
  47. package/dist/core/cookies/response.d.ts +1 -1
  48. package/dist/core/cookies/response.js +1 -2
  49. package/dist/core/create-vite.js +15 -0
  50. package/dist/core/csp/runtime.js +6 -4
  51. package/dist/core/dev/dev.js +1 -1
  52. package/dist/core/errors/build-handler.d.ts +17 -0
  53. package/dist/core/errors/build-handler.js +22 -0
  54. package/dist/core/errors/default-handler.d.ts +14 -0
  55. package/dist/core/errors/default-handler.js +144 -0
  56. package/dist/core/errors/dev-handler.d.ts +21 -0
  57. package/dist/core/errors/dev-handler.js +82 -0
  58. package/dist/core/errors/handler.d.ts +9 -0
  59. package/dist/core/errors/handler.js +0 -0
  60. package/dist/core/fetch/default-handler.d.ts +17 -0
  61. package/dist/core/fetch/default-handler.js +45 -0
  62. package/dist/core/fetch/fetch-state.d.ts +244 -0
  63. package/dist/core/fetch/fetch-state.js +779 -0
  64. package/dist/core/fetch/index.d.ts +61 -0
  65. package/dist/core/fetch/index.js +121 -0
  66. package/dist/core/fetch/types.d.ts +6 -0
  67. package/dist/core/fetch/types.js +0 -0
  68. package/dist/core/fetch/vite-plugin.d.ts +5 -0
  69. package/dist/core/fetch/vite-plugin.js +69 -0
  70. package/dist/core/hono/index.d.ts +21 -0
  71. package/dist/core/hono/index.js +98 -0
  72. package/dist/core/i18n/handler.d.ts +18 -0
  73. package/dist/core/i18n/handler.js +119 -0
  74. package/dist/core/logger/core.d.ts +8 -0
  75. package/dist/core/logger/core.js +16 -0
  76. package/dist/core/messages/runtime.js +1 -1
  77. package/dist/core/middleware/astro-middleware.d.ts +27 -0
  78. package/dist/core/middleware/astro-middleware.js +53 -0
  79. package/dist/core/pages/handler.d.ts +20 -0
  80. package/dist/core/pages/handler.js +74 -0
  81. package/dist/core/preview/static-preview-server.js +3 -1
  82. package/dist/core/redirects/render.d.ts +2 -2
  83. package/dist/core/redirects/render.js +7 -8
  84. package/dist/core/rewrites/handler.d.ts +37 -0
  85. package/dist/core/rewrites/handler.js +67 -0
  86. package/dist/core/routing/3xx.js +8 -4
  87. package/dist/core/routing/handler.d.ts +17 -0
  88. package/dist/core/routing/handler.js +172 -0
  89. package/dist/core/routing/match.d.ts +0 -7
  90. package/dist/core/routing/match.js +0 -5
  91. package/dist/core/routing/trailing-slash-handler.d.ts +18 -0
  92. package/dist/core/routing/trailing-slash-handler.js +67 -0
  93. package/dist/core/session/drivers.d.ts +1 -1
  94. package/dist/core/session/handler.d.ts +11 -0
  95. package/dist/core/session/handler.js +33 -0
  96. package/dist/core/util/normalized-url.d.ts +10 -0
  97. package/dist/core/util/normalized-url.js +21 -0
  98. package/dist/i18n/middleware.d.ts +10 -0
  99. package/dist/i18n/middleware.js +4 -88
  100. package/dist/i18n/utils.js +2 -2
  101. package/dist/runtime/server/astro-island.js +57 -20
  102. package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
  103. package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
  104. package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
  105. package/dist/runtime/server/astro-island.prebuilt.js +1 -1
  106. package/dist/runtime/server/render/server-islands.js +2 -1
  107. package/dist/types/public/config.d.ts +46 -12
  108. package/dist/types/public/internal.d.ts +1 -1
  109. package/dist/vite-plugin-app/app.d.ts +4 -5
  110. package/dist/vite-plugin-app/app.js +20 -65
  111. package/package.json +11 -7
  112. package/dist/core/render-context.d.ts +0 -77
  113. package/dist/core/render-context.js +0 -826
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "6.2.2",
3
+ "version": "6.3.1",
4
4
  "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
5
5
  "type": "module",
6
6
  "author": "withastro",
@@ -21,6 +21,9 @@
21
21
  "app/*": [
22
22
  "./dist/core/app/*"
23
23
  ],
24
+ "hono": [
25
+ "./dist/core/hono/index"
26
+ ],
24
27
  "middleware": [
25
28
  "./dist/virtual-modules/middleware.d.ts"
26
29
  ]
@@ -55,6 +58,7 @@
55
58
  "./app/entrypoint/dev": "./dist/core/app/entrypoints/virtual/dev.js",
56
59
  "./app/entrypoint/prod": "./dist/core/app/entrypoints/virtual/prod.js",
57
60
  "./app/manifest": "./dist/core/app/entrypoints/manifest.js",
61
+ "./app/fetch/default-handler": "./dist/core/fetch/default-handler.js",
58
62
  "./entrypoints/prerender": "./dist/entrypoints/prerender.js",
59
63
  "./entrypoints/legacy": "./dist/entrypoints/legacy.js",
60
64
  "./client/*": "./dist/runtime/client/*",
@@ -71,6 +75,8 @@
71
75
  "./assets/services/sharp": "./dist/assets/services/sharp.js",
72
76
  "./assets/services/noop": "./dist/assets/services/noop.js",
73
77
  "./cache/memory": "./dist/core/cache/memory-provider.js",
78
+ "./fetch": "./dist/core/fetch/index.js",
79
+ "./hono": "./dist/core/hono/index.js",
74
80
  "./assets/fonts/runtime.js": "./dist/assets/fonts/runtime.js",
75
81
  "./loaders": "./dist/content/loaders/index.js",
76
82
  "./content/config": "./dist/content/config.js",
@@ -160,7 +166,7 @@
160
166
  "zod": "^4.3.6",
161
167
  "@astrojs/internal-helpers": "0.9.0",
162
168
  "@astrojs/markdown-remark": "7.1.1",
163
- "@astrojs/telemetry": "3.3.1"
169
+ "@astrojs/telemetry": "3.3.2"
164
170
  },
165
171
  "optionalDependencies": {
166
172
  "sharp": "^0.34.0"
@@ -181,6 +187,7 @@
181
187
  "eol": "^0.10.0",
182
188
  "expect-type": "^1.3.0",
183
189
  "fs-fixture": "^2.13.0",
190
+ "hono": "^4.12.14",
184
191
  "mdast-util-mdx": "^3.0.0",
185
192
  "mdast-util-mdx-jsx": "^3.2.0",
186
193
  "node-mocks-http": "^1.17.2",
@@ -212,7 +219,7 @@
212
219
  },
213
220
  "scripts": {
214
221
  "prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
215
- "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc && astro-check -- -- --root ./components",
222
+ "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc -b && astro-check -- -- --root ./components",
216
223
  "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm",
217
224
  "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
218
225
  "test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:types",
@@ -223,10 +230,7 @@
223
230
  "test:e2e:chrome": "playwright test",
224
231
  "test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
225
232
  "test:types": "tsc --build test/types/tsconfig.json",
226
- "typecheck:tests": "tsc --build tsconfig.test.json",
227
233
  "test:unit": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.ts",
228
- "test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
229
- "test:integration:js": "astro-scripts test \"test/*.test.js\"",
230
- "test:integration:ts": "astro-scripts test \"test/*.test.ts\" --strip-types"
234
+ "test:integration": "astro-scripts test \"test/*.test.ts\" --parallel --strip-types"
231
235
  }
232
236
  }
@@ -1,77 +0,0 @@
1
- import type { ActionAPIContext } from '../actions/runtime/types.js';
2
- import type { ComponentInstance } from '../types/astro.js';
3
- import type { MiddlewareHandler, Params, Props } from '../types/public/common.js';
4
- import type { APIContext, AstroGlobal } from '../types/public/context.js';
5
- import type { RouteData, SSRResult } from '../types/public/internal.js';
6
- import type { ServerIslandMappings, SSRActions } from './app/types.js';
7
- import { AstroCookies } from './cookies/index.js';
8
- import { type Pipeline } from './render/index.js';
9
- import { type CacheLike } from './cache/runtime/cache.js';
10
- import { AstroSession } from './session/runtime.js';
11
- /**
12
- * Each request is rendered using a `RenderContext`.
13
- * It contains data unique to each request. It is responsible for executing middleware, calling endpoints, and rendering the page by gathering necessary data from a `Pipeline`.
14
- */
15
- export type CreateRenderContext = Pick<RenderContext, 'pathname' | 'pipeline' | 'request' | 'routeData' | 'clientAddress'> & Partial<Pick<RenderContext, 'locals' | 'status' | 'props' | 'partial' | 'actions' | 'shouldInjectCspMetaTags' | 'skipMiddleware'>>;
16
- export declare class RenderContext {
17
- #private;
18
- readonly pipeline: Pipeline;
19
- locals: App.Locals;
20
- readonly middleware: MiddlewareHandler;
21
- readonly actions: SSRActions;
22
- readonly serverIslands: ServerIslandMappings;
23
- pathname: string;
24
- request: Request;
25
- routeData: RouteData;
26
- status: number;
27
- clientAddress: string | undefined;
28
- protected cookies: AstroCookies;
29
- params: Params;
30
- protected url: URL;
31
- props: Props;
32
- partial: undefined | boolean;
33
- shouldInjectCspMetaTags: boolean;
34
- session: AstroSession | undefined;
35
- cache: CacheLike;
36
- skipMiddleware: boolean;
37
- private constructor();
38
- /**
39
- * A flag that tells the render content if the rewriting was triggered
40
- */
41
- isRewriting: boolean;
42
- /**
43
- * A safety net in case of loops
44
- */
45
- counter: number;
46
- result: SSRResult | undefined;
47
- static create({ locals, pathname, pipeline, request, routeData, clientAddress, status, props, partial, shouldInjectCspMetaTags, skipMiddleware, }: CreateRenderContext): Promise<RenderContext>;
48
- /**
49
- * The main function of the RenderContext.
50
- *
51
- * Use this function to render any route known to Astro.
52
- * It attempts to render a route. A route can be a:
53
- *
54
- * - page
55
- * - redirect
56
- * - endpoint
57
- * - fallback
58
- */
59
- render(componentInstance: ComponentInstance | undefined, slots?: Record<string, any>): Promise<Response>;
60
- createAPIContext(props: APIContext['props'], context: ActionAPIContext): APIContext;
61
- createActionAPIContext(): ActionAPIContext;
62
- createResult(mod: ComponentInstance, ctx: ActionAPIContext): Promise<SSRResult>;
63
- /**
64
- * The Astro global is sourced in 3 different phases:
65
- * - **Static**: `.generator` and `.glob` is printed by the compiler, instantiated once per process per astro file
66
- * - **Page-level**: `.request`, `.cookies`, `.locals` etc. These remain the same for the duration of the request.
67
- * - **Component-level**: `.props`, `.slots`, and `.self` are unique to each _use_ of each component.
68
- *
69
- * The page level partial is used as the prototype of the user-visible `Astro` global object, which is instantiated once per use of a component.
70
- */
71
- createAstro(result: SSRResult, props: Record<string, any>, slotValues: Record<string, any> | null, apiContext: ActionAPIContext): AstroGlobal;
72
- createAstroPagePartial(result: SSRResult, apiContext: ActionAPIContext): Omit<AstroGlobal, 'props' | 'self' | 'slots'>;
73
- getClientAddress(): string;
74
- computeCurrentLocale(): string | undefined;
75
- computePreferredLocale(): string | undefined;
76
- computePreferredLocaleList(): string[] | undefined;
77
- }