astro 4.4.5 → 4.4.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 (83) hide show
  1. package/components/Code.astro +3 -3
  2. package/components/ViewTransitions.astro +5 -0
  3. package/dist/@types/astro.d.ts +10 -4
  4. package/dist/assets/build/generate.js +1 -1
  5. package/dist/assets/endpoint/generic.js +1 -1
  6. package/dist/assets/endpoint/node.js +39 -9
  7. package/dist/assets/utils/metadata.js +1 -1
  8. package/dist/assets/utils/transformToPath.js +1 -1
  9. package/dist/assets/vite-plugin-assets.js +2 -1
  10. package/dist/cli/add/index.js +4 -4
  11. package/dist/cli/check/index.js +1 -1
  12. package/dist/cli/db/index.js +2 -2
  13. package/dist/cli/info/index.js +2 -2
  14. package/dist/cli/install-package.js +2 -2
  15. package/dist/cli/preferences/index.js +5 -5
  16. package/dist/content/server-listeners.js +1 -1
  17. package/dist/content/types-generator.js +2 -2
  18. package/dist/content/utils.d.ts +1 -1
  19. package/dist/content/utils.js +2 -2
  20. package/dist/content/vite-plugin-content-imports.js +1 -1
  21. package/dist/content/vite-plugin-content-virtual-mod.js +1 -1
  22. package/dist/core/app/common.d.ts +1 -1
  23. package/dist/core/app/index.js +10 -10
  24. package/dist/core/app/node.d.ts +1 -1
  25. package/dist/core/app/node.js +1 -1
  26. package/dist/core/app/types.d.ts +2 -2
  27. package/dist/core/base-pipeline.js +1 -1
  28. package/dist/core/build/generate.js +14 -13
  29. package/dist/core/build/index.js +2 -2
  30. package/dist/core/build/pipeline.js +1 -1
  31. package/dist/core/build/plugins/plugin-manifest.js +3 -3
  32. package/dist/core/build/plugins/plugin-ssr.js +1 -1
  33. package/dist/core/build/plugins/util.d.ts +1 -1
  34. package/dist/core/build/static-build.js +3 -3
  35. package/dist/core/client-directive/build.js +1 -1
  36. package/dist/core/compile/compile.js +1 -1
  37. package/dist/core/config/config.js +1 -1
  38. package/dist/core/config/settings.js +1 -1
  39. package/dist/core/constants.js +1 -1
  40. package/dist/core/dev/dev.d.ts +1 -1
  41. package/dist/core/dev/dev.js +3 -3
  42. package/dist/core/endpoint/index.d.ts +1 -1
  43. package/dist/core/endpoint/index.js +2 -2
  44. package/dist/core/errors/dev/utils.js +2 -2
  45. package/dist/core/errors/errors-data.js +1 -1
  46. package/dist/core/logger/vite.d.ts +1 -1
  47. package/dist/core/logger/vite.js +1 -1
  48. package/dist/core/messages.js +2 -2
  49. package/dist/core/middleware/index.js +4 -4
  50. package/dist/core/middleware/loadMiddleware.js +1 -1
  51. package/dist/core/preview/index.js +2 -2
  52. package/dist/core/render/result.d.ts +1 -1
  53. package/dist/core/render/result.js +5 -5
  54. package/dist/core/render/route-cache.d.ts +1 -0
  55. package/dist/core/render/route-cache.js +8 -4
  56. package/dist/core/render-context.js +11 -11
  57. package/dist/core/request.d.ts +10 -3
  58. package/dist/core/request.js +9 -6
  59. package/dist/core/routing/manifest/create.js +2 -2
  60. package/dist/core/sync/index.js +3 -3
  61. package/dist/i18n/middleware.js +1 -1
  62. package/dist/integrations/index.js +1 -1
  63. package/dist/jsx-runtime/index.js +1 -1
  64. package/dist/preferences/store.js +2 -2
  65. package/dist/runtime/server/index.js +1 -1
  66. package/dist/runtime/server/render/astro/render.js +1 -1
  67. package/dist/runtime/server/render/page.js +1 -1
  68. package/dist/runtime/server/scripts.js +1 -1
  69. package/dist/runtime/server/transition.js +2 -1
  70. package/dist/vite-plugin-astro-server/base.js +1 -1
  71. package/dist/vite-plugin-astro-server/error.d.ts +1 -1
  72. package/dist/vite-plugin-astro-server/error.js +1 -1
  73. package/dist/vite-plugin-astro-server/pipeline.d.ts +1 -1
  74. package/dist/vite-plugin-astro-server/pipeline.js +6 -6
  75. package/dist/vite-plugin-astro-server/plugin.js +6 -6
  76. package/dist/vite-plugin-astro-server/request.js +1 -1
  77. package/dist/vite-plugin-astro-server/route.js +10 -11
  78. package/dist/vite-plugin-env/index.js +1 -1
  79. package/dist/vite-plugin-inject-env-ts/index.js +1 -1
  80. package/dist/vite-plugin-markdown/index.js +5 -5
  81. package/dist/vite-plugin-scanner/index.js +1 -1
  82. package/dist/vite-plugin-utils/index.js +1 -1
  83. package/package.json +2 -2
@@ -1,15 +1,14 @@
1
+ import { REROUTE_DIRECTIVE_HEADER, clientLocalsSymbol } from "../core/constants.js";
1
2
  import { AstroErrorData, isAstroError } from "../core/errors/index.js";
2
3
  import { req } from "../core/messages.js";
3
4
  import { loadMiddleware } from "../core/middleware/loadMiddleware.js";
5
+ import { RenderContext } from "../core/render-context.js";
4
6
  import { getProps } from "../core/render/index.js";
5
7
  import { createRequest } from "../core/request.js";
6
8
  import { matchAllRoutes } from "../core/routing/index.js";
7
9
  import { normalizeTheLocale } from "../i18n/index.js";
8
10
  import { getSortedPreloadedMatches } from "../prerender/routing.js";
9
- import { isServerLikeOutput } from "../prerender/utils.js";
10
11
  import { handle404Response, writeSSRResult, writeWebResponse } from "./response.js";
11
- import { REROUTE_DIRECTIVE_HEADER, clientLocalsSymbol } from "../core/constants.js";
12
- import { RenderContext } from "../core/render-context.js";
13
12
  function isLoggedRequest(url) {
14
13
  return url !== "/favicon.ico";
15
14
  }
@@ -94,7 +93,6 @@ async function handleRoute({
94
93
  }
95
94
  return handle404Response(origin, incomingRequest, incomingResponse);
96
95
  }
97
- const buildingToSSR = isServerLikeOutput(config);
98
96
  let request;
99
97
  let renderContext;
100
98
  let mod = void 0;
@@ -125,10 +123,12 @@ async function handleRoute({
125
123
  return handle404Response(origin, incomingRequest, incomingResponse);
126
124
  }
127
125
  request = createRequest({
126
+ base: config.base,
128
127
  url,
129
- headers: buildingToSSR ? incomingRequest.headers : new Headers(),
128
+ headers: incomingRequest.headers,
130
129
  logger,
131
- ssr: buildingToSSR
130
+ // no route found, so we assume the default for rendering the 404 page
131
+ staticLike: config.output === "static" || config.output === "hybrid"
132
132
  });
133
133
  route = {
134
134
  component: "",
@@ -162,15 +162,14 @@ async function handleRoute({
162
162
  route = matchedRoute.route;
163
163
  const locals = Reflect.get(incomingRequest, clientLocalsSymbol);
164
164
  request = createRequest({
165
+ base: config.base,
165
166
  url,
166
- // Headers are only available when using SSR.
167
- headers: buildingToSSR ? incomingRequest.headers : new Headers(),
167
+ headers: incomingRequest.headers,
168
168
  method: incomingRequest.method,
169
169
  body,
170
170
  logger,
171
- ssr: buildingToSSR,
172
- clientAddress: buildingToSSR ? incomingRequest.socket.remoteAddress : void 0,
173
- removeParams: buildingToSSR === false || route.prerender
171
+ clientAddress: incomingRequest.socket.remoteAddress,
172
+ staticLike: config.output === "static" || route.prerender
174
173
  });
175
174
  for (const [name, value] of Object.entries(config.server.headers ?? {})) {
176
175
  if (value)
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from "node:url";
2
- import { loadEnv } from "vite";
3
2
  import { transform } from "esbuild";
4
3
  import MagicString from "magic-string";
4
+ import { loadEnv } from "vite";
5
5
  const importMetaEnvOnlyRe = /\bimport\.meta\.env\b(?!\.)/;
6
6
  const isValidIdentifierRe = /^[_$a-zA-Z][\w$]*$/;
7
7
  const exportConstPrerenderRe = /\bexport\s+const\s+prerender\s*=\s*import\.meta\.env\.(.+?)\b/;
@@ -1,6 +1,6 @@
1
- import { bold } from "kleur/colors";
2
1
  import path from "node:path";
3
2
  import { fileURLToPath } from "node:url";
3
+ import { bold } from "kleur/colors";
4
4
  import { normalizePath } from "vite";
5
5
  import { getContentPaths, getDotAstroTypeReference } from "../content/index.js";
6
6
  import {} from "../core/logger/core.js";
@@ -1,13 +1,13 @@
1
- import {
2
- createMarkdownProcessor,
3
- InvalidAstroDataError
4
- } from "@astrojs/markdown-remark";
5
1
  import fs from "node:fs";
6
2
  import path from "node:path";
7
3
  import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import {
5
+ InvalidAstroDataError,
6
+ createMarkdownProcessor
7
+ } from "@astrojs/markdown-remark";
8
8
  import { normalizePath } from "vite";
9
- import { AstroError, AstroErrorData } from "../core/errors/index.js";
10
9
  import { safeParseFrontmatter } from "../content/utils.js";
10
+ import { AstroError, AstroErrorData } from "../core/errors/index.js";
11
11
  import { isMarkdownFile } from "../core/util.js";
12
12
  import { shorthash } from "../runtime/server/shorthash.js";
13
13
  import { getFileInfo } from "../vite-plugin-utils/index.js";
@@ -1,5 +1,5 @@
1
- import { bold } from "kleur/colors";
2
1
  import { extname } from "node:path";
2
+ import { bold } from "kleur/colors";
3
3
  import { normalizePath } from "vite";
4
4
  import {} from "../core/logger/core.js";
5
5
  import { isEndpoint, isPage, rootRelativePath } from "../core/util.js";
@@ -1,5 +1,5 @@
1
- import ancestor from "common-ancestor-path";
2
1
  import { fileURLToPath } from "node:url";
2
+ import ancestor from "common-ancestor-path";
3
3
  import {
4
4
  appendExtension,
5
5
  appendForwardSlash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
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",
@@ -158,7 +158,7 @@
158
158
  "tsconfck": "^3.0.0",
159
159
  "unist-util-visit": "^5.0.0",
160
160
  "vfile": "^6.0.1",
161
- "vite": "^5.1.2",
161
+ "vite": "^5.1.4",
162
162
  "vitefu": "^0.2.5",
163
163
  "which-pm": "^2.1.1",
164
164
  "yargs-parser": "^21.1.1",