astro 5.7.3 → 5.7.5

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 (132) hide show
  1. package/dist/actions/runtime/virtual/server.js +9 -7
  2. package/dist/assets/fonts/config.d.ts +0 -16
  3. package/dist/assets/fonts/config.js +1 -2
  4. package/dist/assets/fonts/load.js +53 -26
  5. package/dist/assets/fonts/metrics.d.ts +1 -1
  6. package/dist/assets/fonts/metrics.js +1 -1
  7. package/dist/assets/fonts/providers/index.d.ts +1 -1
  8. package/dist/assets/fonts/providers/index.js +3 -2
  9. package/dist/assets/fonts/providers/local.d.ts +4 -1
  10. package/dist/assets/fonts/providers/local.js +7 -1
  11. package/dist/assets/fonts/utils.d.ts +3 -2
  12. package/dist/assets/fonts/utils.js +28 -19
  13. package/dist/assets/fonts/vite-plugin-fonts.js +11 -8
  14. package/dist/assets/services/service.d.ts +1 -1
  15. package/dist/assets/utils/etag.d.ts +0 -11
  16. package/dist/assets/utils/etag.js +1 -2
  17. package/dist/assets/utils/vendor/image-size/lookup.d.ts +0 -2
  18. package/dist/assets/utils/vendor/image-size/lookup.js +0 -10
  19. package/dist/cli/add/index.d.ts +0 -9
  20. package/dist/cli/add/index.js +1 -2
  21. package/dist/cli/info/index.d.ts +0 -1
  22. package/dist/cli/info/index.js +0 -1
  23. package/dist/cli/preferences/index.d.ts +0 -2
  24. package/dist/container/index.js +1 -6
  25. package/dist/content/content-layer.d.ts +2 -7
  26. package/dist/content/content-layer.js +4 -6
  27. package/dist/content/index.d.ts +1 -2
  28. package/dist/content/index.js +1 -5
  29. package/dist/content/loaders/file.d.ts +2 -1
  30. package/dist/content/loaders/glob.d.ts +3 -2
  31. package/dist/content/utils.d.ts +1 -12
  32. package/dist/content/utils.js +0 -13
  33. package/dist/content/vite-plugin-content-virtual-mod.d.ts +0 -16
  34. package/dist/content/vite-plugin-content-virtual-mod.js +1 -3
  35. package/dist/core/app/index.js +3 -4
  36. package/dist/core/app/pipeline.d.ts +2 -3
  37. package/dist/core/app/pipeline.js +1 -3
  38. package/dist/core/app/types.d.ts +3 -2
  39. package/dist/core/build/consts.d.ts +0 -1
  40. package/dist/core/build/consts.js +1 -3
  41. package/dist/core/build/index.d.ts +2 -1
  42. package/dist/core/build/page-data.d.ts +3 -2
  43. package/dist/core/build/plugin.d.ts +1 -1
  44. package/dist/core/build/plugins/plugin-analyzer.d.ts +0 -2
  45. package/dist/core/build/plugins/plugin-analyzer.js +1 -2
  46. package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
  47. package/dist/core/build/plugins/plugin-chunks.js +1 -2
  48. package/dist/core/build/plugins/plugin-component-entry.d.ts +0 -8
  49. package/dist/core/build/plugins/plugin-component-entry.js +1 -3
  50. package/dist/core/build/plugins/plugin-internals.d.ts +0 -2
  51. package/dist/core/build/plugins/plugin-internals.js +1 -2
  52. package/dist/core/build/plugins/plugin-renderers.d.ts +0 -2
  53. package/dist/core/build/plugins/plugin-renderers.js +1 -2
  54. package/dist/core/build/plugins/plugin-scripts.d.ts +0 -5
  55. package/dist/core/build/plugins/plugin-scripts.js +1 -2
  56. package/dist/core/build/plugins/plugin-ssr.d.ts +0 -1
  57. package/dist/core/build/plugins/plugin-ssr.js +0 -1
  58. package/dist/core/build/plugins/util.d.ts +0 -9
  59. package/dist/core/build/plugins/util.js +0 -2
  60. package/dist/core/build/types.d.ts +1 -1
  61. package/dist/core/config/config.d.ts +0 -1
  62. package/dist/core/config/config.js +0 -1
  63. package/dist/core/config/index.d.ts +1 -2
  64. package/dist/core/config/index.js +0 -2
  65. package/dist/core/config/schemas/base.d.ts +6 -4
  66. package/dist/core/config/schemas/relative.d.ts +6 -6
  67. package/dist/core/config/timer.d.ts +0 -5
  68. package/dist/core/config/tsconfig.d.ts +1 -1
  69. package/dist/core/constants.d.ts +0 -4
  70. package/dist/core/constants.js +1 -3
  71. package/dist/core/cookies/index.d.ts +1 -1
  72. package/dist/core/cookies/index.js +2 -4
  73. package/dist/core/cookies/response.d.ts +0 -1
  74. package/dist/core/cookies/response.js +1 -5
  75. package/dist/core/dev/container.d.ts +2 -1
  76. package/dist/core/dev/dev.js +1 -1
  77. package/dist/core/dev/index.d.ts +1 -1
  78. package/dist/core/dev/index.js +1 -2
  79. package/dist/core/dev/restart.d.ts +1 -1
  80. package/dist/core/encryption.d.ts +0 -8
  81. package/dist/core/encryption.js +1 -7
  82. package/dist/core/errors/index.d.ts +1 -2
  83. package/dist/core/errors/index.js +0 -2
  84. package/dist/core/logger/core.d.ts +3 -9
  85. package/dist/core/logger/core.js +1 -5
  86. package/dist/core/messages.d.ts +0 -1
  87. package/dist/core/messages.js +2 -11
  88. package/dist/core/middleware/sequence.js +3 -0
  89. package/dist/core/preview/static-preview-server.d.ts +2 -1
  90. package/dist/core/redirects/index.d.ts +0 -1
  91. package/dist/core/redirects/index.js +0 -2
  92. package/dist/core/render/index.d.ts +0 -17
  93. package/dist/core/render/ssr-element.d.ts +0 -2
  94. package/dist/core/render/ssr-element.js +0 -2
  95. package/dist/core/render-context.js +4 -0
  96. package/dist/core/request.d.ts +1 -1
  97. package/dist/core/routing/3xx.d.ts +2 -1
  98. package/dist/core/routing/astro-designed-error-pages.d.ts +0 -1
  99. package/dist/core/routing/astro-designed-error-pages.js +1 -16
  100. package/dist/core/routing/index.d.ts +2 -3
  101. package/dist/core/routing/index.js +3 -8
  102. package/dist/core/routing/manifest/create.d.ts +2 -3
  103. package/dist/core/routing/manifest/create.js +0 -1
  104. package/dist/core/routing/request.d.ts +0 -1
  105. package/dist/core/routing/request.js +1 -2
  106. package/dist/core/routing/rewrite.d.ts +3 -2
  107. package/dist/core/server-islands/vite-plugin-server-islands.d.ts +0 -1
  108. package/dist/core/server-islands/vite-plugin-server-islands.js +0 -1
  109. package/dist/core/sync/index.d.ts +2 -1
  110. package/dist/core/util.d.ts +0 -1
  111. package/dist/core/util.js +0 -1
  112. package/dist/events/session.d.ts +1 -1
  113. package/dist/integrations/features-validation.d.ts +1 -3
  114. package/dist/integrations/features-validation.js +0 -2
  115. package/dist/preferences/index.d.ts +4 -4
  116. package/dist/type-utils.d.ts +0 -4
  117. package/dist/types/public/config.d.ts +19 -0
  118. package/dist/types/typed-emitter.d.ts +2 -1
  119. package/dist/vite-plugin-astro/hmr.d.ts +2 -1
  120. package/dist/vite-plugin-astro/query.d.ts +3 -2
  121. package/dist/vite-plugin-astro/types.d.ts +2 -1
  122. package/dist/vite-plugin-astro-server/controller.d.ts +2 -2
  123. package/dist/vite-plugin-astro-server/plugin.d.ts +2 -1
  124. package/dist/vite-plugin-astro-server/response.d.ts +0 -1
  125. package/dist/vite-plugin-astro-server/response.js +0 -12
  126. package/dist/vite-plugin-astro-server/route.d.ts +1 -1
  127. package/dist/vite-plugin-astro-server/server-state.d.ts +3 -3
  128. package/dist/vite-plugin-astro-server/server-state.js +0 -4
  129. package/dist/vite-plugin-load-fallback/index.d.ts +1 -1
  130. package/dist/vite-plugin-scanner/index.d.ts +2 -1
  131. package/package.json +4 -10
  132. package/templates/env.mjs +1 -0
@@ -1,12 +1,10 @@
1
1
  import { AstroCookies } from "./cookies.js";
2
2
  import {
3
3
  attachCookiesToResponse,
4
- getSetCookiesFromResponse,
5
- responseHasCookies
4
+ getSetCookiesFromResponse
6
5
  } from "./response.js";
7
6
  export {
8
7
  AstroCookies,
9
8
  attachCookiesToResponse,
10
- getSetCookiesFromResponse,
11
- responseHasCookies
9
+ getSetCookiesFromResponse
12
10
  };
@@ -1,5 +1,4 @@
1
1
  import { AstroCookies } from './cookies.js';
2
2
  export declare function attachCookiesToResponse(response: Response, cookies: AstroCookies): void;
3
- export declare function responseHasCookies(response: Response): boolean;
4
3
  export declare function getCookiesFromResponse(response: Response): AstroCookies | undefined;
5
4
  export declare function getSetCookiesFromResponse(response: Response): Generator<string, string[]>;
@@ -3,9 +3,6 @@ const astroCookiesSymbol = Symbol.for("astro.cookies");
3
3
  function attachCookiesToResponse(response, cookies) {
4
4
  Reflect.set(response, astroCookiesSymbol, cookies);
5
5
  }
6
- function responseHasCookies(response) {
7
- return Reflect.has(response, astroCookiesSymbol);
8
- }
9
6
  function getCookiesFromResponse(response) {
10
7
  let cookies = Reflect.get(response, astroCookiesSymbol);
11
8
  if (cookies != null) {
@@ -27,6 +24,5 @@ function* getSetCookiesFromResponse(response) {
27
24
  export {
28
25
  attachCookiesToResponse,
29
26
  getCookiesFromResponse,
30
- getSetCookiesFromResponse,
31
- responseHasCookies
27
+ getSetCookiesFromResponse
32
28
  };
@@ -15,7 +15,7 @@ export interface Container {
15
15
  handle: (req: http.IncomingMessage, res: http.ServerResponse) => void;
16
16
  close: () => Promise<void>;
17
17
  }
18
- export interface CreateContainerParams {
18
+ interface CreateContainerParams {
19
19
  logger: Logger;
20
20
  settings: AstroSettings;
21
21
  inlineConfig?: AstroInlineConfig;
@@ -24,3 +24,4 @@ export interface CreateContainerParams {
24
24
  }
25
25
  export declare function createContainer({ isRestart, logger, inlineConfig, settings, fs, }: CreateContainerParams): Promise<Container>;
26
26
  export declare function startContainer({ settings, viteServer, logger, }: Container): Promise<AddressInfo>;
27
+ export {};
@@ -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.7.3";
25
+ const currentVersion = "5.7.5";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -1,3 +1,3 @@
1
- export { createContainer, startContainer } from './container.js';
1
+ export { startContainer } from './container.js';
2
2
  export { default } from './dev.js';
3
3
  export { createContainerWithAutomaticRestart } from './restart.js';
@@ -1,8 +1,7 @@
1
- import { createContainer, startContainer } from "./container.js";
1
+ import { startContainer } from "./container.js";
2
2
  import { default as default2 } from "./dev.js";
3
3
  import { createContainerWithAutomaticRestart } from "./restart.js";
4
4
  export {
5
- createContainer,
6
5
  createContainerWithAutomaticRestart,
7
6
  default2 as default,
8
7
  startContainer
@@ -1,7 +1,7 @@
1
1
  import type nodeFs from 'node:fs';
2
2
  import type { AstroInlineConfig } from '../../types/public/config.js';
3
3
  import type { Container } from './container.js';
4
- export interface CreateContainerWithAutomaticRestart {
4
+ interface CreateContainerWithAutomaticRestart {
5
5
  inlineConfig?: AstroInlineConfig;
6
6
  fs: typeof nodeFs;
7
7
  }
@@ -2,10 +2,6 @@
2
2
  * Creates a CryptoKey object that can be used to encrypt any string.
3
3
  */
4
4
  export declare function createKey(): Promise<CryptoKey>;
5
- /**
6
- * Get the encoded value of the ASTRO_KEY env var.
7
- */
8
- export declare function getEncodedEnvironmentKey(): string;
9
5
  /**
10
6
  * See if the environment variable key ASTRO_KEY is set.
11
7
  */
@@ -14,10 +10,6 @@ export declare function hasEnvironmentKey(): boolean;
14
10
  * Get the environment variable key and decode it into a CryptoKey.
15
11
  */
16
12
  export declare function getEnvironmentKey(): Promise<CryptoKey>;
17
- /**
18
- * Takes a key that has been serialized to an array of bytes and returns a CryptoKey
19
- */
20
- export declare function importKey(bytes: Uint8Array): Promise<CryptoKey>;
21
13
  /**
22
14
  * Encodes a CryptoKey to base64 string, so that it can be embedded in JSON / JavaScript
23
15
  */
@@ -27,10 +27,6 @@ async function getEnvironmentKey() {
27
27
  const encodedKey = getEncodedEnvironmentKey();
28
28
  return decodeKey(encodedKey);
29
29
  }
30
- async function importKey(bytes) {
31
- const key = await crypto.subtle.importKey("raw", bytes, ALGORITHM, true, ["encrypt", "decrypt"]);
32
- return key;
33
- }
34
30
  async function encodeKey(key) {
35
31
  const exported = await crypto.subtle.exportKey("raw", key);
36
32
  const encodedKey = encodeBase64(new Uint8Array(exported));
@@ -76,8 +72,6 @@ export {
76
72
  decryptString,
77
73
  encodeKey,
78
74
  encryptString,
79
- getEncodedEnvironmentKey,
80
75
  getEnvironmentKey,
81
- hasEnvironmentKey,
82
- importKey
76
+ hasEnvironmentKey
83
77
  };
@@ -1,6 +1,5 @@
1
1
  export * as AstroErrorData from './errors-data.js';
2
2
  export { AggregateError, AstroError, AstroUserError, CSSError, CompilerError, MarkdownError, isAstroError, } from './errors.js';
3
- export type { ErrorLocation, ErrorWithMetadata } from './errors.js';
4
- export { codeFrame } from './printer.js';
3
+ export type { ErrorWithMetadata } from './errors.js';
5
4
  export { createSafeError, positionAt } from './utils.js';
6
5
  export { errorMap } from './zod-error-map.js';
@@ -8,7 +8,6 @@ import {
8
8
  MarkdownError,
9
9
  isAstroError
10
10
  } from "./errors.js";
11
- import { codeFrame } from "./printer.js";
12
11
  import { createSafeError, positionAt } from "./utils.js";
13
12
  import { errorMap } from "./zod-error-map.js";
14
13
  export {
@@ -19,7 +18,6 @@ export {
19
18
  CSSError,
20
19
  CompilerError,
21
20
  MarkdownError,
22
- codeFrame,
23
21
  createSafeError,
24
22
  errorMap,
25
23
  isAstroError,
@@ -7,11 +7,12 @@ export type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
7
7
  * rather than specific to a single command, function, use, etc. The label will be
8
8
  * shown in the log message to the user, so it should be relevant.
9
9
  */
10
- export type LoggerLabel = 'add' | 'build' | 'check' | 'config' | 'content' | 'crypto' | 'deprecated' | 'markdown' | 'router' | 'types' | 'vite' | 'watch' | 'middleware' | 'preferences' | 'redirects' | 'sync' | 'session' | 'toolbar' | 'assets' | 'env' | 'update' | 'adapter' | 'islands' | 'SKIP_FORMAT';
10
+ type LoggerLabel = 'add' | 'build' | 'check' | 'config' | 'content' | 'crypto' | 'deprecated' | 'markdown' | 'router' | 'types' | 'vite' | 'watch' | 'middleware' | 'preferences' | 'redirects' | 'sync' | 'session' | 'toolbar' | 'assets' | 'env' | 'update' | 'adapter' | 'islands' | 'SKIP_FORMAT';
11
11
  export interface LogOptions {
12
12
  dest: LogWritable<LogMessage>;
13
13
  level: LoggerLevel;
14
14
  }
15
+ /** @lintignore */
15
16
  export declare const dateTimeFormat: Intl.DateTimeFormat;
16
17
  export interface LogMessage {
17
18
  label: string | null;
@@ -20,15 +21,7 @@ export interface LogMessage {
20
21
  newLine: boolean;
21
22
  }
22
23
  export declare const levels: Record<LoggerLevel, number>;
23
- /** Full logging API */
24
- export declare function log(opts: LogOptions, level: LoggerLevel, label: string | null, message: string, newLine?: boolean): void;
25
24
  export declare function isLogLevelEnabled(configuredLogLevel: LoggerLevel, level: LoggerLevel): boolean;
26
- /** Emit a user-facing message. Useful for UI and other console messages. */
27
- export declare function info(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
28
- /** Emit a warning message. Useful for high-priority messages that aren't necessarily errors. */
29
- export declare function warn(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
30
- /** Emit a error message, Useful when Astro can't recover from some error. */
31
- export declare function error(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
32
25
  export declare function debug(...args: any[]): void;
33
26
  /**
34
27
  * Get the prefix for a log message.
@@ -61,3 +54,4 @@ export declare class AstroIntegrationLogger {
61
54
  error(message: string): void;
62
55
  debug(message: string): void;
63
56
  }
57
+ export {};
@@ -126,12 +126,8 @@ export {
126
126
  Logger,
127
127
  dateTimeFormat,
128
128
  debug,
129
- error,
130
129
  getEventPrefix,
131
- info,
132
130
  isLogLevelEnabled,
133
131
  levels,
134
- log,
135
- timerMessage,
136
- warn
132
+ timerMessage
137
133
  };
@@ -43,7 +43,6 @@ export declare function prerelease({ currentVersion }: {
43
43
  currentVersion: string;
44
44
  }): string;
45
45
  export declare function success(message: string, tip?: string): string;
46
- export declare function failure(message: string, tip?: string): string;
47
46
  export declare function actionRequired(message: string): string;
48
47
  export declare function cancelled(message: string, tip?: string): string;
49
48
  export declare function formatConfigErrorMessage(err: ZodError): string;
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  bgCyan,
3
3
  bgGreen,
4
- bgRed,
5
4
  bgWhite,
6
5
  bgYellow,
7
6
  black,
@@ -38,7 +37,7 @@ function serverStart({
38
37
  host,
39
38
  base
40
39
  }) {
41
- const version = "5.7.3";
40
+ const version = "5.7.5";
42
41
  const localPrefix = `${dim("\u2503")} Local `;
43
42
  const networkPrefix = `${dim("\u2503")} Network `;
44
43
  const emptyPrefix = " ".repeat(11);
@@ -156,13 +155,6 @@ function success(message, tip) {
156
155
  \u25B6 ${tip}` : void 0;
157
156
  return ["", `${badge} ${headline}`, footer].filter((v) => v !== void 0).map((msg) => ` ${msg}`).join("\n");
158
157
  }
159
- function failure(message, tip) {
160
- const badge = bgRed(black(` error `));
161
- const headline = red(message);
162
- const footer = tip ? `
163
- \u25B6 ${tip}` : void 0;
164
- return ["", `${badge} ${headline}`, footer].filter((v) => v !== void 0).map((msg) => ` ${msg}`).join("\n");
165
- }
166
158
  function actionRequired(message) {
167
159
  const badge = bgYellow(black(` action required `));
168
160
  const headline = yellow(message);
@@ -282,7 +274,7 @@ function printHelp({
282
274
  message.push(
283
275
  linebreak(),
284
276
  ` ${bgGreen(black(` ${commandName} `))} ${green(
285
- `v${"5.7.3"}`
277
+ `v${"5.7.5"}`
286
278
  )} ${headline}`
287
279
  );
288
280
  }
@@ -308,7 +300,6 @@ function printHelp({
308
300
  export {
309
301
  actionRequired,
310
302
  cancelled,
311
- failure,
312
303
  formatConfigErrorMessage,
313
304
  formatErrorMessage,
314
305
  fsStrictWarning,
@@ -3,6 +3,7 @@ import { ForbiddenRewrite } from "../errors/errors-data.js";
3
3
  import { AstroError } from "../errors/index.js";
4
4
  import { apiContextRoutesSymbol } from "../render-context.js";
5
5
  import { getParams } from "../render/index.js";
6
+ import { setOriginPathname } from "../routing/rewrite.js";
6
7
  import { defineMiddleware } from "./index.js";
7
8
  function sequence(...handlers) {
8
9
  const filtered = handlers.filter((h) => !!h);
@@ -31,6 +32,7 @@ function sequence(...handlers) {
31
32
  handleContext.request
32
33
  );
33
34
  }
35
+ const oldPathname = handleContext.url.pathname;
34
36
  const pipeline = Reflect.get(handleContext, apiContextRoutesSymbol);
35
37
  const { routeData, pathname } = await pipeline.tryRewrite(
36
38
  payload,
@@ -52,6 +54,7 @@ function sequence(...handlers) {
52
54
  handleContext.url = new URL(newRequest.url);
53
55
  handleContext.cookies = new AstroCookies(newRequest);
54
56
  handleContext.params = getParams(routeData, pathname);
57
+ setOriginPathname(handleContext.request, oldPathname);
55
58
  }
56
59
  return applyHandle(i + 1, handleContext);
57
60
  } else {
@@ -1,7 +1,7 @@
1
1
  import type http from 'node:http';
2
2
  import type { AstroSettings } from '../../types/astro.js';
3
3
  import type { Logger } from '../logger/core.js';
4
- export interface PreviewServer {
4
+ interface PreviewServer {
5
5
  host?: string;
6
6
  port: number;
7
7
  server: http.Server;
@@ -9,3 +9,4 @@ export interface PreviewServer {
9
9
  stop(): Promise<void>;
10
10
  }
11
11
  export default function createStaticPreviewServer(settings: AstroSettings, logger: Logger): Promise<PreviewServer>;
12
+ export {};
@@ -1,4 +1,3 @@
1
1
  export { RedirectComponentInstance, RedirectSinglePageBuiltModule } from './component.js';
2
2
  export { routeIsRedirect } from './helpers.js';
3
3
  export { getRedirectLocationOrThrow } from './validate.js';
4
- export { renderRedirect } from './render.js';
@@ -1,11 +1,9 @@
1
1
  import { RedirectComponentInstance, RedirectSinglePageBuiltModule } from "./component.js";
2
2
  import { routeIsRedirect } from "./helpers.js";
3
3
  import { getRedirectLocationOrThrow } from "./validate.js";
4
- import { renderRedirect } from "./render.js";
5
4
  export {
6
5
  RedirectComponentInstance,
7
6
  RedirectSinglePageBuiltModule,
8
7
  getRedirectLocationOrThrow,
9
- renderRedirect,
10
8
  routeIsRedirect
11
9
  };
@@ -1,21 +1,4 @@
1
- import type { ComponentInstance } from '../../types/astro.js';
2
- import type { RouteData } from '../../types/public/internal.js';
3
- import type { Pipeline } from '../base-pipeline.js';
4
1
  export { Pipeline } from '../base-pipeline.js';
5
2
  export { getParams, getProps } from './params-and-props.js';
6
3
  export { loadRenderer } from './renderer.js';
7
4
  export { Slots } from './slots.js';
8
- export interface SSROptions {
9
- /** The pipeline instance */
10
- pipeline: Pipeline;
11
- /** location of file on disk */
12
- filePath: URL;
13
- /** the web request (needed for dynamic routes) */
14
- pathname: string;
15
- /** The runtime component instance */
16
- preload: ComponentInstance;
17
- /** Request */
18
- request: Request;
19
- /** optional, in case we need to render something outside a dev server */
20
- route: RouteData;
21
- }
@@ -1,10 +1,8 @@
1
1
  import type { SSRElement } from '../../types/public/internal.js';
2
2
  import type { AssetsPrefix, StylesheetAsset } from '../app/types.js';
3
3
  export declare function createAssetLink(href: string, base?: string, assetsPrefix?: AssetsPrefix): string;
4
- export declare function createStylesheetElement(stylesheet: StylesheetAsset, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
5
4
  export declare function createStylesheetElementSet(stylesheets: StylesheetAsset[], base?: string, assetsPrefix?: AssetsPrefix): Set<SSRElement>;
6
5
  export declare function createModuleScriptElement(script: {
7
6
  type: 'inline' | 'external';
8
7
  value: string;
9
8
  }, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
10
- export declare function createModuleScriptElementWithSrc(src: string, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
@@ -53,7 +53,5 @@ function createModuleScriptElementWithSrc(src, base, assetsPrefix) {
53
53
  export {
54
54
  createAssetLink,
55
55
  createModuleScriptElement,
56
- createModuleScriptElementWithSrc,
57
- createStylesheetElement,
58
56
  createStylesheetElementSet
59
57
  };
@@ -124,6 +124,7 @@ class RenderContext {
124
124
  }
125
125
  const lastNext = async (ctx, payload) => {
126
126
  if (payload) {
127
+ const oldPathname = this.pathname;
127
128
  pipeline.logger.debug("router", "Called rewriting to:", payload);
128
129
  const {
129
130
  routeData,
@@ -158,6 +159,7 @@ class RenderContext {
158
159
  this.params = getParams(routeData, pathname);
159
160
  this.pathname = pathname;
160
161
  this.status = 200;
162
+ setOriginPathname(this.request, oldPathname);
161
163
  }
162
164
  let response2;
163
165
  if (!ctx.isPrerendered) {
@@ -235,6 +237,7 @@ class RenderContext {
235
237
  }
236
238
  async #executeRewrite(reroutePayload) {
237
239
  this.pipeline.logger.debug("router", "Calling rewrite: ", reroutePayload);
240
+ const oldPathname = this.pathname;
238
241
  const { routeData, componentInstance, newUrl, pathname } = await this.pipeline.tryRewrite(
239
242
  reroutePayload,
240
243
  this.request
@@ -265,6 +268,7 @@ class RenderContext {
265
268
  this.pathname = pathname;
266
269
  this.isRewriting = true;
267
270
  this.status = 200;
271
+ setOriginPathname(this.request, oldPathname);
268
272
  return await this.render(componentInstance);
269
273
  }
270
274
  createActionAPIContext() {
@@ -1,7 +1,7 @@
1
1
  import type { IncomingHttpHeaders } from 'node:http';
2
2
  import type { Logger } from './logger/core.js';
3
3
  type HeaderType = Headers | Record<string, any> | IncomingHttpHeaders;
4
- export interface CreateRequestOptions {
4
+ interface CreateRequestOptions {
5
5
  url: URL | string;
6
6
  clientAddress?: string | undefined;
7
7
  headers: HeaderType;
@@ -1,7 +1,8 @@
1
- export type RedirectTemplate = {
1
+ type RedirectTemplate = {
2
2
  from?: string;
3
3
  absoluteLocation: string | URL;
4
4
  status: number;
5
5
  relativeLocation: string;
6
6
  };
7
7
  export declare function redirectTemplate({ status, absoluteLocation, relativeLocation, from, }: RedirectTemplate): string;
8
+ export {};
@@ -1,6 +1,5 @@
1
1
  import type { ComponentInstance, RoutesList } from '../../types/astro.js';
2
2
  import type { RouteData } from '../../types/public/internal.js';
3
3
  export declare const DEFAULT_404_ROUTE: RouteData;
4
- export declare const DEFAULT_500_ROUTE: RouteData;
5
4
  export declare function ensure404Route(manifest: RoutesList): RoutesList;
6
5
  export declare const default404Instance: ComponentInstance;
@@ -1,5 +1,5 @@
1
1
  import notFoundTemplate from "../../template/4xx.js";
2
- import { DEFAULT_404_COMPONENT, DEFAULT_500_COMPONENT } from "../constants.js";
2
+ import { DEFAULT_404_COMPONENT } from "../constants.js";
3
3
  const DEFAULT_404_ROUTE = {
4
4
  component: DEFAULT_404_COMPONENT,
5
5
  generate: () => "",
@@ -14,20 +14,6 @@ const DEFAULT_404_ROUTE = {
14
14
  isIndex: false,
15
15
  origin: "internal"
16
16
  };
17
- const DEFAULT_500_ROUTE = {
18
- component: DEFAULT_500_COMPONENT,
19
- generate: () => "",
20
- params: [],
21
- pattern: /\/500/,
22
- prerender: false,
23
- pathname: "/500",
24
- segments: [[{ content: "500", dynamic: false, spread: false }]],
25
- type: "page",
26
- route: "/500",
27
- fallbackRoutes: [],
28
- isIndex: false,
29
- origin: "internal"
30
- };
31
17
  function ensure404Route(manifest) {
32
18
  if (!manifest.routes.some((route) => route.route === "/404")) {
33
19
  manifest.routes.push(DEFAULT_404_ROUTE);
@@ -51,7 +37,6 @@ const default404Instance = {
51
37
  };
52
38
  export {
53
39
  DEFAULT_404_ROUTE,
54
- DEFAULT_500_ROUTE,
55
40
  default404Instance,
56
41
  ensure404Route
57
42
  };
@@ -1,4 +1,3 @@
1
1
  export { createRoutesList } from './manifest/create.js';
2
- export { deserializeRouteData, serializeRouteData } from './manifest/serialization.js';
3
- export { matchAllRoutes, matchRoute } from './match.js';
4
- export { validateDynamicRouteModule, validateGetStaticPathsResult } from './validation.js';
2
+ export { serializeRouteData } from './manifest/serialization.js';
3
+ export { matchAllRoutes } from './match.js';
@@ -1,13 +1,8 @@
1
1
  import { createRoutesList } from "./manifest/create.js";
2
- import { deserializeRouteData, serializeRouteData } from "./manifest/serialization.js";
3
- import { matchAllRoutes, matchRoute } from "./match.js";
4
- import { validateDynamicRouteModule, validateGetStaticPathsResult } from "./validation.js";
2
+ import { serializeRouteData } from "./manifest/serialization.js";
3
+ import { matchAllRoutes } from "./match.js";
5
4
  export {
6
5
  createRoutesList,
7
- deserializeRouteData,
8
6
  matchAllRoutes,
9
- matchRoute,
10
- serializeRouteData,
11
- validateDynamicRouteModule,
12
- validateGetStaticPathsResult
7
+ serializeRouteData
13
8
  };
@@ -1,9 +1,7 @@
1
1
  import type { AstroSettings, RoutesList } from '../../../types/astro.js';
2
2
  import type { Logger } from '../../logger/core.js';
3
3
  import nodeFs from 'node:fs';
4
- import type { RoutePart } from '../../../types/public/internal.js';
5
- export declare function getParts(part: string, file: string): RoutePart[];
6
- export interface CreateRouteManifestParams {
4
+ interface CreateRouteManifestParams {
7
5
  /** Astro Settings object */
8
6
  settings: AstroSettings;
9
7
  /** Current working directory */
@@ -19,3 +17,4 @@ export declare function resolveInjectedRoute(entrypoint: string, root: URL, cwd?
19
17
  resolved: string;
20
18
  component: string;
21
19
  };
20
+ export {};
@@ -512,6 +512,5 @@ function joinSegments(segments) {
512
512
  }
513
513
  export {
514
514
  createRoutesList,
515
- getParts,
516
515
  resolveInjectedRoute
517
516
  };
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Utilities for extracting information from `Request`
3
3
  */
4
- export declare function getFirstForwardedValue(multiValueHeader?: string | string[] | null): string | undefined;
5
4
  /**
6
5
  * Returns the first value associated to the `x-forwarded-for` header.
7
6
  *
@@ -5,6 +5,5 @@ function getClientIpAddress(request) {
5
5
  return getFirstForwardedValue(request.headers.get("x-forwarded-for"));
6
6
  }
7
7
  export {
8
- getClientIpAddress,
9
- getFirstForwardedValue
8
+ getClientIpAddress
10
9
  };
@@ -2,7 +2,7 @@ import type { RewritePayload } from '../../types/public/common.js';
2
2
  import type { AstroConfig } from '../../types/public/config.js';
3
3
  import type { RouteData } from '../../types/public/internal.js';
4
4
  import type { Logger } from '../logger/core.js';
5
- export type FindRouteToRewrite = {
5
+ type FindRouteToRewrite = {
6
6
  payload: RewritePayload;
7
7
  routes: RouteData[];
8
8
  request: Request;
@@ -10,7 +10,7 @@ export type FindRouteToRewrite = {
10
10
  buildFormat: AstroConfig['build']['format'];
11
11
  base: AstroConfig['base'];
12
12
  };
13
- export interface FindRouteToRewriteResult {
13
+ interface FindRouteToRewriteResult {
14
14
  routeData: RouteData;
15
15
  newUrl: URL;
16
16
  pathname: string;
@@ -33,3 +33,4 @@ export declare function findRouteToRewrite({ payload, routes, request, trailingS
33
33
  export declare function copyRequest(newUrl: URL, oldRequest: Request, isPrerendered: boolean, logger: Logger, routePattern: string): Request;
34
34
  export declare function setOriginPathname(request: Request, pathname: string): void;
35
35
  export declare function getOriginPathname(request: Request): string;
36
+ export {};
@@ -1,5 +1,4 @@
1
1
  import type { Plugin as VitePlugin } from 'vite';
2
2
  import type { AstroPluginOptions } from '../../types/astro.js';
3
3
  export declare const VIRTUAL_ISLAND_MAP_ID = "@astro-server-islands";
4
- export declare const RESOLVED_VIRTUAL_ISLAND_MAP_ID: string;
5
4
  export declare function vitePluginServerIslands({ settings, logger }: AstroPluginOptions): VitePlugin;
@@ -94,7 +94,6 @@ function vitePluginServerIslands({ settings, logger }) {
94
94
  };
95
95
  }
96
96
  export {
97
- RESOLVED_VIRTUAL_ISLAND_MAP_ID,
98
97
  VIRTUAL_ISLAND_MAP_ID,
99
98
  vitePluginServerIslands
100
99
  };
@@ -4,7 +4,7 @@ import type { AstroSettings, RoutesList } from '../../types/astro.js';
4
4
  import type { AstroInlineConfig } from '../../types/public/config.js';
5
5
  import type { SSRManifest } from '../app/types.js';
6
6
  import type { Logger } from '../logger/core.js';
7
- export type SyncOptions = {
7
+ type SyncOptions = {
8
8
  mode: string;
9
9
  logger: Logger;
10
10
  settings: AstroSettings;
@@ -38,3 +38,4 @@ export declare function clearContentLayerCache({ settings, logger, fs, isDev, }:
38
38
  * @experimental The JavaScript API is experimental
39
39
  */
40
40
  export declare function syncInternal({ mode, logger, fs, settings, skip, force, routesList, command, watcher, manifest, }: SyncOptions): Promise<void>;
41
+ export {};
@@ -32,7 +32,6 @@ export declare function parseNpmName(spec: string): {
32
32
  */
33
33
  export declare function viteID(filePath: URL): string;
34
34
  export declare const VALID_ID_PREFIX = "/@id/";
35
- export declare const NULL_BYTE_PLACEHOLDER = "__x00__";
36
35
  export declare function unwrapId(id: string): string;
37
36
  export declare function resolvePages(config: AstroConfig): URL;
38
37
  export declare function isPage(file: URL, settings: AstroSettings): boolean;
package/dist/core/util.js CHANGED
@@ -127,7 +127,6 @@ function ensureProcessNodeEnv(defaultNodeEnv) {
127
127
  }
128
128
  }
129
129
  export {
130
- NULL_BYTE_PLACEHOLDER,
131
130
  VALID_ID_PREFIX,
132
131
  arraify,
133
132
  ensureProcessNodeEnv,
@@ -11,7 +11,7 @@ type ConfigInfoRecord = Record<string, ConfigInfoValue>;
11
11
  type ConfigInfoBase = {
12
12
  [alias in keyof AstroUserConfig]: ConfigInfoValue | ConfigInfoRecord;
13
13
  };
14
- export interface ConfigInfo extends ConfigInfoBase {
14
+ interface ConfigInfo extends ConfigInfoBase {
15
15
  build: ConfigInfoRecord;
16
16
  image: ConfigInfoRecord;
17
17
  markdown: ConfigInfoRecord;
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '../core/logger/core.js';
2
2
  import type { AstroSettings } from '../types/astro.js';
3
- import type { AdapterSupport, AdapterSupportsKind, AstroAdapterFeatureMap } from '../types/public/integrations.js';
3
+ import type { AstroAdapterFeatureMap } from '../types/public/integrations.js';
4
4
  export declare const AdapterFeatureStability: {
5
5
  readonly STABLE: "stable";
6
6
  readonly DEPRECATED: "deprecated";
@@ -19,7 +19,5 @@ type ValidationResult = {
19
19
  *
20
20
  */
21
21
  export declare function validateSupportedFeatures(adapterName: string, featureMap: AstroAdapterFeatureMap, settings: AstroSettings, logger: Logger): ValidationResult;
22
- export declare function unwrapSupportKind(supportKind?: AdapterSupport): AdapterSupportsKind | undefined;
23
- export declare function getSupportMessage(supportKind: AdapterSupport): string | undefined;
24
22
  export declare function getAdapterStaticRecommendation(adapterName: string): string | undefined;
25
23
  export {};
@@ -126,7 +126,5 @@ function getAdapterStaticRecommendation(adapterName) {
126
126
  export {
127
127
  AdapterFeatureStability,
128
128
  getAdapterStaticRecommendation,
129
- getSupportMessage,
130
- unwrapSupportKind,
131
129
  validateSupportedFeatures
132
130
  };