astro 6.1.5 → 6.1.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 (88) hide show
  1. package/dist/actions/integration.js +1 -1
  2. package/dist/assets/build/generate.d.ts +2 -2
  3. package/dist/assets/endpoint/shared.js +7 -0
  4. package/dist/assets/fonts/core/compute-font-families-assets.d.ts +2 -2
  5. package/dist/assets/fonts/core/get-or-create-font-family-assets.d.ts +2 -2
  6. package/dist/assets/fonts/vite-plugin-fonts.d.ts +2 -2
  7. package/dist/assets/internal.d.ts +1 -0
  8. package/dist/assets/internal.js +3 -1
  9. package/dist/assets/utils/inferSourceFormat.d.ts +6 -0
  10. package/dist/assets/utils/inferSourceFormat.js +21 -0
  11. package/dist/assets/vite-plugin-assets.d.ts +2 -2
  12. package/dist/cli/create-key/core/create-key.d.ts +2 -2
  13. package/dist/cli/docs/core/open-docs.d.ts +2 -2
  14. package/dist/cli/flags.d.ts +2 -2
  15. package/dist/cli/flags.js +1 -1
  16. package/dist/cli/info/core/info.d.ts +2 -2
  17. package/dist/cli/info/infra/tinyclip-clipboard.d.ts +2 -2
  18. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  19. package/dist/cli/infra/logger-help-display.d.ts +2 -2
  20. package/dist/cli/install-package.d.ts +2 -2
  21. package/dist/container/index.js +3 -3
  22. package/dist/content/content-layer.d.ts +2 -2
  23. package/dist/content/content-layer.js +3 -3
  24. package/dist/content/instance.d.ts +2 -2
  25. package/dist/content/server-listeners.d.ts +2 -2
  26. package/dist/content/types-generator.d.ts +2 -2
  27. package/dist/content/utils.d.ts +2 -2
  28. package/dist/content/vite-plugin-content-imports.d.ts +2 -2
  29. package/dist/core/app/base.d.ts +2 -2
  30. package/dist/core/app/base.js +3 -3
  31. package/dist/core/app/dev/app.d.ts +4 -4
  32. package/dist/core/app/logging.d.ts +2 -2
  33. package/dist/core/app/logging.js +3 -3
  34. package/dist/core/app/types.d.ts +2 -2
  35. package/dist/core/base-pipeline.d.ts +3 -3
  36. package/dist/core/build/generate.d.ts +2 -2
  37. package/dist/core/build/index.d.ts +2 -2
  38. package/dist/core/build/page-data.d.ts +2 -2
  39. package/dist/core/build/types.d.ts +2 -2
  40. package/dist/core/cache/runtime/noop.d.ts +2 -2
  41. package/dist/core/constants.js +1 -1
  42. package/dist/core/create-vite.d.ts +2 -2
  43. package/dist/core/dev/adapter-validation.d.ts +3 -3
  44. package/dist/core/dev/container.d.ts +3 -3
  45. package/dist/core/dev/container.js +2 -2
  46. package/dist/core/dev/dev.js +1 -1
  47. package/dist/core/logger/console.d.ts +2 -2
  48. package/dist/core/logger/console.js +4 -1
  49. package/dist/core/logger/core.d.ts +48 -21
  50. package/dist/core/logger/core.js +8 -4
  51. package/dist/core/logger/node.d.ts +4 -4
  52. package/dist/core/logger/node.js +21 -9
  53. package/dist/core/logger/vite.d.ts +1 -1
  54. package/dist/core/messages/runtime.d.ts +2 -2
  55. package/dist/core/messages/runtime.js +1 -1
  56. package/dist/core/preview/static-preview-server.d.ts +2 -2
  57. package/dist/core/render/params-and-props.d.ts +2 -2
  58. package/dist/core/render/route-cache.d.ts +3 -3
  59. package/dist/core/render/slots.d.ts +2 -2
  60. package/dist/core/request.d.ts +2 -2
  61. package/dist/core/routing/create-manifest.d.ts +3 -3
  62. package/dist/core/routing/prerender.d.ts +2 -2
  63. package/dist/core/routing/rewrite.d.ts +2 -2
  64. package/dist/core/sync/index.d.ts +3 -3
  65. package/dist/integrations/features-validation.d.ts +2 -2
  66. package/dist/integrations/hooks.d.ts +13 -13
  67. package/dist/runtime/server/endpoint.d.ts +2 -2
  68. package/dist/runtime/server/escape.d.ts +8 -0
  69. package/dist/runtime/server/escape.js +4 -0
  70. package/dist/runtime/server/render/server-islands.js +5 -12
  71. package/dist/runtime/server/render/util.js +2 -5
  72. package/dist/types/astro.d.ts +3 -3
  73. package/dist/types/public/config.d.ts +2 -2
  74. package/dist/vite-plugin-app/app.d.ts +5 -5
  75. package/dist/vite-plugin-app/createAstroServerApp.d.ts +2 -2
  76. package/dist/vite-plugin-app/createAstroServerApp.js +3 -3
  77. package/dist/vite-plugin-astro/compile.d.ts +2 -2
  78. package/dist/vite-plugin-astro/hmr.d.ts +2 -2
  79. package/dist/vite-plugin-astro/index.d.ts +2 -2
  80. package/dist/vite-plugin-astro-server/base.d.ts +2 -2
  81. package/dist/vite-plugin-astro-server/error.d.ts +2 -2
  82. package/dist/vite-plugin-astro-server/plugin.d.ts +2 -2
  83. package/dist/vite-plugin-astro-server/sec-fetch.d.ts +2 -2
  84. package/dist/vite-plugin-hmr-reload/index.js +17 -0
  85. package/dist/vite-plugin-integrations-container/index.d.ts +2 -2
  86. package/dist/vite-plugin-markdown/index.d.ts +2 -2
  87. package/dist/vite-plugin-routes/index.d.ts +2 -2
  88. package/package.json +4 -6
@@ -1,10 +1,10 @@
1
1
  import nodeFs from 'node:fs';
2
2
  import * as vite from 'vite';
3
3
  import type { AstroSettings, RoutesList } from '../types/astro.js';
4
- import type { Logger } from './logger/core.js';
4
+ import type { AstroLogger } from './logger/core.js';
5
5
  type CreateViteOptions = {
6
6
  settings: AstroSettings;
7
- logger: Logger;
7
+ logger: AstroLogger;
8
8
  mode: string;
9
9
  fs?: typeof nodeFs;
10
10
  routesList: RoutesList;
@@ -1,5 +1,5 @@
1
1
  import type { AstroSettings } from '../../types/astro.js';
2
2
  import type { AstroAdapter } from '../../types/public/integrations.js';
3
- import type { Logger } from '../logger/core.js';
4
- export declare function warnMissingAdapter(logger: Logger, settings: AstroSettings): void;
5
- export declare function validateSetAdapter(logger: Logger, settings: AstroSettings, adapter: AstroAdapter, maybeConflictingIntegration: string, command?: 'dev' | 'build' | string): void;
3
+ import type { AstroLogger } from '../logger/core.js';
4
+ export declare function warnMissingAdapter(logger: AstroLogger, settings: AstroSettings): void;
5
+ export declare function validateSetAdapter(logger: AstroLogger, settings: AstroSettings, adapter: AstroAdapter, maybeConflictingIntegration: string, command?: 'dev' | 'build' | string): void;
@@ -4,10 +4,10 @@ import type { AddressInfo } from 'node:net';
4
4
  import * as vite from 'vite';
5
5
  import type { AstroSettings } from '../../types/astro.js';
6
6
  import type { AstroInlineConfig } from '../../types/public/config.js';
7
- import type { Logger } from '../logger/core.js';
7
+ import type { AstroLogger } from '../logger/core.js';
8
8
  export interface Container {
9
9
  fs: typeof nodeFs;
10
- logger: Logger;
10
+ logger: AstroLogger;
11
11
  settings: AstroSettings;
12
12
  viteServer: vite.ViteDevServer;
13
13
  inlineConfig: AstroInlineConfig;
@@ -16,7 +16,7 @@ export interface Container {
16
16
  close: () => Promise<void>;
17
17
  }
18
18
  interface CreateContainerParams {
19
- logger: Logger;
19
+ logger: AstroLogger;
20
20
  settings: AstroSettings;
21
21
  inlineConfig?: AstroInlineConfig;
22
22
  isRestart?: boolean;
@@ -26,7 +26,7 @@ async function createContainer({
26
26
  });
27
27
  const {
28
28
  base,
29
- server: { host, headers, open: serverOpen, allowedHosts }
29
+ server: { host, headers, open: serverOpen, allowedHosts, port }
30
30
  } = settings.config;
31
31
  const isServerOpenURL = typeof serverOpen === "string" && !isRestart;
32
32
  const isServerOpenBoolean = serverOpen && !isRestart;
@@ -50,7 +50,7 @@ async function createContainer({
50
50
  );
51
51
  const viteConfig = await createVite(
52
52
  {
53
- server: { host, headers, open, allowedHosts },
53
+ server: { host, headers, open, allowedHosts, port },
54
54
  optimizeDeps: {
55
55
  include: rendererClientEntries
56
56
  }
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
37
37
  await telemetry.record([]);
38
38
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
39
39
  const logger = restart.container.logger;
40
- const currentVersion = "6.1.5";
40
+ const currentVersion = "6.1.7";
41
41
  const isPrerelease = currentVersion.includes("-");
42
42
  if (!isPrerelease) {
43
43
  try {
@@ -1,2 +1,2 @@
1
- import { type LogMessage, type LogWritable } from './core.js';
2
- export declare const consoleLogDestination: LogWritable<LogMessage>;
1
+ import { type AstroLogMessage, type AstroLoggerDestination } from './core.js';
2
+ export declare const consoleLogDestination: AstroLoggerDestination<AstroLogMessage>;
@@ -1,4 +1,7 @@
1
- import { getEventPrefix, levels } from "./core.js";
1
+ import {
2
+ getEventPrefix,
3
+ levels
4
+ } from "./core.js";
2
5
  const consoleLogDestination = {
3
6
  write(event) {
4
7
  let dest = console.error;
@@ -1,50 +1,77 @@
1
- export interface LogWritable<T> {
1
+ export interface AstroLoggerDestination<T> {
2
2
  write: (chunk: T) => boolean;
3
3
  }
4
- export type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
4
+ /**
5
+ * How the log should be formatted
6
+ * - 'default': how Astro usually format the logs
7
+ * - 'json': logs are formatted in JSON format
8
+ */
9
+ export type AstroLoggerFormat = 'default' | 'json';
10
+ /**
11
+ * The level of logging. Priority is the following:
12
+ * 1. debug
13
+ * 2. error
14
+ * 3. warn
15
+ * 4. info
16
+ * 5. silent
17
+ */
18
+ export type AstroLoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
5
19
  /**
6
20
  * Defined logger labels. Add more as needed, but keep them high-level & reusable,
7
21
  * rather than specific to a single command, function, use, etc. The label will be
8
22
  * shown in the log message to the user, so it should be relevant.
9
23
  */
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' | 'cache' | 'csp' | 'SKIP_FORMAT';
11
- export interface LogOptions {
12
- dest: LogWritable<LogMessage>;
13
- level: LoggerLevel;
24
+ type AstroLoggerLabel = 'add' | 'build' | 'check' | 'config' | 'content' | 'crypto' | 'deprecated' | 'markdown' | 'router' | 'types' | 'vite' | 'watch' | 'middleware' | 'preferences' | 'redirects' | 'sync' | 'session' | 'toolbar' | 'assets' | 'env' | 'update' | 'adapter' | 'islands' | 'cache' | 'csp' | 'SKIP_FORMAT';
25
+ export interface AstroLogOptions {
26
+ destination: AstroLoggerDestination<AstroLogMessage>;
27
+ level: AstroLoggerLevel;
28
+ _format?: AstroLoggerFormat;
14
29
  }
15
30
  /** @lintignore */
16
31
  export declare const dateTimeFormat: Intl.DateTimeFormat;
17
- export interface LogMessage {
32
+ export interface AstroLogMessage {
33
+ /**
34
+ * Label associated to the message. Used by Astro for pretty logging
35
+ */
18
36
  label: string | null;
19
- level: LoggerLevel;
37
+ /**
38
+ * The level of the log
39
+ */
40
+ level: AstroLoggerLevel;
41
+ /**
42
+ * The message of the log
43
+ */
20
44
  message: string;
45
+ /**
46
+ * Whether a newline should be appended to the end of the message i.e. message + '\n'
47
+ */
21
48
  newLine: boolean;
22
49
  }
23
- export declare const levels: Record<LoggerLevel, number>;
24
- export declare function isLogLevelEnabled(configuredLogLevel: LoggerLevel, level: LoggerLevel): boolean;
50
+ export declare const levels: Record<AstroLoggerLevel, number>;
51
+ export declare function isLogLevelEnabled(configuredLogLevel: AstroLoggerLevel, level: AstroLoggerLevel): boolean;
25
52
  export declare function debug(...args: any[]): void;
26
53
  /**
27
54
  * Get the prefix for a log message.
28
55
  * This includes the timestamp, log level, and label all properly formatted
29
56
  * with colors. This is shared across different loggers, so it's defined here.
30
57
  */
31
- export declare function getEventPrefix({ level, label }: LogMessage): string;
58
+ export declare function getEventPrefix({ level, label }: AstroLogMessage): string;
32
59
  /** Print out a timer message for debug() */
33
60
  export declare function timerMessage(message: string, startTime?: number): string;
34
- export declare class Logger {
35
- options: LogOptions;
36
- constructor(options: LogOptions);
37
- info(label: LoggerLabel | null, message: string, newLine?: boolean): void;
38
- warn(label: LoggerLabel | null, message: string, newLine?: boolean): void;
39
- error(label: LoggerLabel | null, message: string, newLine?: boolean): void;
40
- debug(label: LoggerLabel, ...messages: any[]): void;
41
- level(): LoggerLevel;
61
+ export declare class AstroLogger {
62
+ options: AstroLogOptions;
63
+ constructor(options: AstroLogOptions);
64
+ info(label: AstroLoggerLabel | null, message: string, newLine?: boolean): void;
65
+ warn(label: AstroLoggerLabel | null, message: string, newLine?: boolean): void;
66
+ error(label: AstroLoggerLabel | null, message: string, newLine?: boolean): void;
67
+ debug(label: AstroLoggerLabel, ...messages: any[]): void;
68
+ level(): AstroLoggerLevel;
42
69
  forkIntegrationLogger(label: string): AstroIntegrationLogger;
43
70
  }
44
71
  export declare class AstroIntegrationLogger {
45
- options: LogOptions;
72
+ options: AstroLogOptions;
46
73
  label: string;
47
- constructor(logging: LogOptions, label: string);
74
+ constructor(logging: AstroLogOptions, label: string);
48
75
  /**
49
76
  * Creates a new logger instance with a new label, but the same log options.
50
77
  */
@@ -14,12 +14,13 @@ const levels = {
14
14
  };
15
15
  function log(opts, level, label, message, newLine = true) {
16
16
  const logLevel = opts.level;
17
- const dest = opts.dest;
17
+ const dest = opts.destination;
18
18
  const event = {
19
19
  label,
20
20
  level,
21
21
  message,
22
- newLine
22
+ newLine,
23
+ _format: opts._format
23
24
  };
24
25
  if (!isLogLevelEnabled(logLevel, level)) {
25
26
  return;
@@ -71,9 +72,12 @@ function timerMessage(message, startTime = Date.now()) {
71
72
  let timeDisplay = timeDiff < 750 ? `${Math.round(timeDiff)}ms` : `${(timeDiff / 1e3).toFixed(1)}s`;
72
73
  return `${message} ${colors.dim(timeDisplay)}`;
73
74
  }
74
- class Logger {
75
+ class AstroLogger {
75
76
  options;
76
77
  constructor(options) {
78
+ if (!options._format) {
79
+ options._format = "default";
80
+ }
77
81
  this.options = options;
78
82
  }
79
83
  info(label, message, newLine = true) {
@@ -123,7 +127,7 @@ class AstroIntegrationLogger {
123
127
  }
124
128
  export {
125
129
  AstroIntegrationLogger,
126
- Logger,
130
+ AstroLogger,
127
131
  dateTimeFormat,
128
132
  debug,
129
133
  getEventPrefix,
@@ -1,6 +1,6 @@
1
1
  import type { AstroInlineConfig } from '../../types/public/config.js';
2
- import { Logger } from './core.js';
3
- import { type LogMessage, type LogWritable } from './core.js';
4
- export declare const nodeLogDestination: LogWritable<LogMessage>;
2
+ import { AstroLogger } from './core.js';
3
+ import { type AstroLogMessage, type AstroLoggerDestination } from './core.js';
4
+ export declare const nodeLogDestination: AstroLoggerDestination<AstroLogMessage>;
5
5
  export declare function enableVerboseLogging(): void;
6
- export declare function createNodeLogger(inlineConfig: AstroInlineConfig): Logger;
6
+ export declare function createNodeLogger(inlineConfig: AstroInlineConfig): AstroLogger;
@@ -1,19 +1,31 @@
1
1
  import { createDebug, enable as obugEnable } from "obug";
2
- import { Logger } from "./core.js";
3
- import { getEventPrefix, levels } from "./core.js";
2
+ import { AstroLogger } from "./core.js";
3
+ import {
4
+ getEventPrefix,
5
+ levels
6
+ } from "./core.js";
4
7
  const nodeLogDestination = {
5
8
  write(event) {
6
9
  let dest = process.stderr;
7
10
  if (levels[event.level] < levels["error"]) {
8
11
  dest = process.stdout;
9
12
  }
13
+ let format = event._format ?? "default";
10
14
  let trailingLine = event.newLine ? "\n" : "";
11
- if (event.label === "SKIP_FORMAT") {
12
- dest.write(event.message + trailingLine);
13
- } else {
14
- dest.write(getEventPrefix(event) + " " + event.message + trailingLine);
15
+ switch (format) {
16
+ case "json": {
17
+ dest.write(JSON.stringify({ message: event.message, label: event.label }) + trailingLine);
18
+ return true;
19
+ }
20
+ case "default": {
21
+ if (event.label === "SKIP_FORMAT") {
22
+ dest.write(event.message + trailingLine);
23
+ } else {
24
+ dest.write(getEventPrefix(event) + " " + event.message + trailingLine);
25
+ }
26
+ return true;
27
+ }
15
28
  }
16
- return true;
17
29
  }
18
30
  };
19
31
  const debuggers = {};
@@ -33,8 +45,8 @@ function enableVerboseLogging() {
33
45
  }
34
46
  function createNodeLogger(inlineConfig) {
35
47
  if (inlineConfig.logger) return inlineConfig.logger;
36
- return new Logger({
37
- dest: nodeLogDestination,
48
+ return new AstroLogger({
49
+ destination: nodeLogDestination,
38
50
  level: inlineConfig.logLevel ?? "info"
39
51
  });
40
52
  }
@@ -1,3 +1,3 @@
1
1
  import type { LogLevel, Logger as ViteLogger } from 'vite';
2
- import { type Logger as AstroLogger } from './core.js';
2
+ import { type AstroLogger as AstroLogger } from './core.js';
3
3
  export declare function createViteLogger(astroLogger: AstroLogger, viteLogLevel?: LogLevel): ViteLogger;
@@ -3,7 +3,7 @@ import type { $ZodError } from 'zod/v4/core';
3
3
  import { type ErrorWithMetadata } from '../errors/index.js';
4
4
  import type { AstroVersionProvider, TextStyler } from '../../cli/definitions.js';
5
5
  import type { AstroConfig } from '../../types/public/index.js';
6
- import type { Logger } from '../logger/core.js';
6
+ import type { AstroLogger } from '../logger/core.js';
7
7
  /**
8
8
  * Prestyled messages for the CLI. Used by astro CLI commands.
9
9
  */
@@ -60,4 +60,4 @@ export declare function printHelp({ commandName, headline, usage, tables, descri
60
60
  tables?: Record<string, [command: string, help: string][]>;
61
61
  description?: string;
62
62
  }): void;
63
- export declare function warnIfCspWithShiki(config: AstroConfig, logger: Logger): void;
63
+ export declare function warnIfCspWithShiki(config: AstroConfig, logger: AstroLogger): void;
@@ -276,7 +276,7 @@ function printHelp({
276
276
  message.push(
277
277
  linebreak(),
278
278
  ` ${bgGreen(black(` ${commandName} `))} ${green(
279
- `v${"6.1.5"}`
279
+ `v${"6.1.7"}`
280
280
  )} ${headline}`
281
281
  );
282
282
  }
@@ -1,6 +1,6 @@
1
1
  import type http from 'node:http';
2
2
  import type { AstroSettings } from '../../types/astro.js';
3
- import type { Logger } from '../logger/core.js';
3
+ import type { AstroLogger } from '../logger/core.js';
4
4
  interface PreviewServer {
5
5
  host?: string;
6
6
  port: number;
@@ -8,5 +8,5 @@ interface PreviewServer {
8
8
  closed(): Promise<void>;
9
9
  stop(): Promise<void>;
10
10
  }
11
- export default function createStaticPreviewServer(settings: AstroSettings, logger: Logger): Promise<PreviewServer>;
11
+ export default function createStaticPreviewServer(settings: AstroSettings, logger: AstroLogger): Promise<PreviewServer>;
12
12
  export {};
@@ -2,14 +2,14 @@ import type { ComponentInstance } from '../../types/astro.js';
2
2
  import type { Params, Props } from '../../types/public/common.js';
3
3
  import type { AstroConfig } from '../../types/public/index.js';
4
4
  import type { RouteData } from '../../types/public/internal.js';
5
- import type { Logger } from '../logger/core.js';
5
+ import type { AstroLogger } from '../logger/core.js';
6
6
  import type { RouteCache } from './route-cache.js';
7
7
  interface GetParamsAndPropsOptions {
8
8
  mod: ComponentInstance | undefined;
9
9
  routeData?: RouteData | undefined;
10
10
  routeCache: RouteCache;
11
11
  pathname: string;
12
- logger: Logger;
12
+ logger: AstroLogger;
13
13
  serverLike: boolean;
14
14
  base: string;
15
15
  trailingSlash: AstroConfig['trailingSlash'];
@@ -2,7 +2,7 @@ import type { ComponentInstance } from '../../types/astro.js';
2
2
  import type { GetStaticPathsItem, GetStaticPathsResultKeyed, Params } from '../../types/public/common.js';
3
3
  import type { AstroConfig, RuntimeMode } from '../../types/public/config.js';
4
4
  import type { RouteData } from '../../types/public/internal.js';
5
- import type { Logger } from '../logger/core.js';
5
+ import type { AstroLogger } from '../logger/core.js';
6
6
  interface CallGetStaticPathsOptions {
7
7
  mod: ComponentInstance | undefined;
8
8
  route: RouteData;
@@ -24,12 +24,12 @@ export declare class RouteCache {
24
24
  private logger;
25
25
  private cache;
26
26
  private runtimeMode;
27
- constructor(logger: Logger, runtimeMode?: RuntimeMode);
27
+ constructor(logger: AstroLogger, runtimeMode?: RuntimeMode);
28
28
  /** Clear the cache. */
29
29
  clearAll(): void;
30
30
  set(route: RouteData, entry: RouteCacheEntry): void;
31
31
  get(route: RouteData): RouteCacheEntry | undefined;
32
32
  key(route: RouteData): string;
33
33
  }
34
- export declare function findPathItemByKey(staticPaths: GetStaticPathsResultKeyed, params: Params, route: RouteData, logger: Logger, trailingSlash: AstroConfig['trailingSlash']): GetStaticPathsItem | undefined;
34
+ export declare function findPathItemByKey(staticPaths: GetStaticPathsResultKeyed, params: Params, route: RouteData, logger: AstroLogger, trailingSlash: AstroConfig['trailingSlash']): GetStaticPathsItem | undefined;
35
35
  export {};
@@ -1,9 +1,9 @@
1
1
  import { type ComponentSlots } from '../../runtime/server/index.js';
2
2
  import type { SSRResult } from '../../types/public/internal.js';
3
- import type { Logger } from '../logger/core.js';
3
+ import type { AstroLogger } from '../logger/core.js';
4
4
  export declare class Slots {
5
5
  #private;
6
- constructor(result: SSRResult, slots: ComponentSlots | null, logger: Logger);
6
+ constructor(result: SSRResult, slots: ComponentSlots | null, logger: AstroLogger);
7
7
  has(name: string): boolean;
8
8
  render(name: string, args?: any[]): Promise<any>;
9
9
  }
@@ -1,5 +1,5 @@
1
1
  import type { IncomingHttpHeaders } from 'node:http';
2
- import type { Logger } from './logger/core.js';
2
+ import type { AstroLogger } from './logger/core.js';
3
3
  type HeaderType = Headers | Record<string, any> | IncomingHttpHeaders;
4
4
  interface CreateRequestOptions {
5
5
  url: URL | string;
@@ -7,7 +7,7 @@ interface CreateRequestOptions {
7
7
  headers: HeaderType;
8
8
  method?: string;
9
9
  body?: RequestInit['body'];
10
- logger: Logger;
10
+ logger: AstroLogger;
11
11
  locals?: object | undefined;
12
12
  /**
13
13
  * Whether the request is being created for a static build or for a prerendered page within a hybrid/SSR build, or for emulating one of those in dev mode.
@@ -2,7 +2,7 @@ import nodeFs from 'node:fs';
2
2
  import type { AstroSettings, RoutesList } from '../../types/astro.js';
3
3
  import type { AstroConfig } from '../../types/public/config.js';
4
4
  import type { RouteData } from '../../types/public/internal.js';
5
- import type { Logger } from '../logger/core.js';
5
+ import type { AstroLogger } from '../logger/core.js';
6
6
  export interface RouteEntry {
7
7
  path: string;
8
8
  isDir: boolean;
@@ -16,11 +16,11 @@ interface CreateRouteManifestParams {
16
16
  /** fs module, for testing */
17
17
  fsMod?: typeof nodeFs;
18
18
  }
19
- export declare function createRoutesFromEntries(entries: RouteEntry[], settings: RoutingSettings, logger: Logger, pagesDirRelative?: string): RouteData[];
19
+ export declare function createRoutesFromEntries(entries: RouteEntry[], settings: RoutingSettings, logger: AstroLogger, pagesDirRelative?: string): RouteData[];
20
20
  /**
21
21
  * Create a full route manifest from filesystem and injected routes.
22
22
  */
23
- export declare function createRoutesList(params: CreateRouteManifestParams, logger: Logger, { dev, }?: {
23
+ export declare function createRoutesList(params: CreateRouteManifestParams, logger: AstroLogger, { dev, }?: {
24
24
  dev?: boolean;
25
25
  }): Promise<RoutesList>;
26
26
  /**
@@ -1,9 +1,9 @@
1
1
  import type { AstroSettings } from '../../types/astro.js';
2
2
  import type { RouteData } from '../../types/public/internal.js';
3
- import type { Logger } from '../logger/core.js';
3
+ import type { AstroLogger } from '../logger/core.js';
4
4
  /**
5
5
  * Parses the `export const prerender = true|false` declaration from a route's
6
6
  * source content. Returns `true`, `false`, or `undefined` if not present.
7
7
  */
8
8
  export declare function parsePrerenderExport(content: string): boolean | undefined;
9
- export declare function getRoutePrerenderOption(content: string, route: RouteData, settings: AstroSettings, logger: Logger): Promise<void>;
9
+ export declare function getRoutePrerenderOption(content: string, route: RouteData, settings: AstroSettings, logger: AstroLogger): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  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
- import type { Logger } from '../logger/core.js';
4
+ import type { AstroLogger } from '../logger/core.js';
5
5
  type FindRouteToRewrite = {
6
6
  payload: RewritePayload;
7
7
  routes: RouteData[];
@@ -31,7 +31,7 @@ export declare function findRouteToRewrite({ payload, routes, request, trailingS
31
31
  * @param logger
32
32
  * @param routePattern
33
33
  */
34
- export declare function copyRequest(newUrl: URL, oldRequest: Request, isPrerendered: boolean, logger: Logger, routePattern: string): Request;
34
+ export declare function copyRequest(newUrl: URL, oldRequest: Request, isPrerendered: boolean, logger: AstroLogger, routePattern: string): Request;
35
35
  export declare function setOriginPathname(request: Request, pathname: string, trailingSlash: AstroConfig['trailingSlash'], buildFormat: AstroConfig['build']['format']): void;
36
36
  export declare function getOriginPathname(request: Request): string;
37
37
  /**
@@ -2,10 +2,10 @@ import fsMod from 'node:fs';
2
2
  import { type FSWatcher } from 'vite';
3
3
  import type { AstroSettings } from '../../types/astro.js';
4
4
  import type { AstroInlineConfig } from '../../types/public/config.js';
5
- import type { Logger } from '../logger/core.js';
5
+ import type { AstroLogger } from '../logger/core.js';
6
6
  type SyncOptions = {
7
7
  mode: string;
8
- logger: Logger;
8
+ logger: AstroLogger;
9
9
  settings: AstroSettings;
10
10
  force?: boolean;
11
11
  skip?: {
@@ -24,7 +24,7 @@ export default function sync(inlineConfig: AstroInlineConfig, { fs, telemetry: _
24
24
  */
25
25
  export declare function clearContentLayerCache({ settings, logger, fs, isDev, }: {
26
26
  settings: AstroSettings;
27
- logger: Logger;
27
+ logger: AstroLogger;
28
28
  fs?: typeof fsMod;
29
29
  isDev: boolean;
30
30
  }): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { Logger } from '../core/logger/core.js';
1
+ import type { AstroLogger } from '../core/logger/core.js';
2
2
  import type { AstroSettings } from '../types/astro.js';
3
3
  import type { AdapterSupport, AdapterSupportsKind, AstroAdapterFeatureMap } from '../types/public/integrations.js';
4
4
  export declare const AdapterFeatureStability: {
@@ -18,7 +18,7 @@ type ValidationResult = {
18
18
  * will throw a runtime error.
19
19
  *
20
20
  */
21
- export declare function validateSupportedFeatures(adapterName: string, featureMap: AstroAdapterFeatureMap, settings: AstroSettings, logger: Logger): ValidationResult;
21
+ export declare function validateSupportedFeatures(adapterName: string, featureMap: AstroAdapterFeatureMap, settings: AstroSettings, logger: AstroLogger): ValidationResult;
22
22
  export declare function unwrapSupportKind(supportKind?: AdapterSupport): AdapterSupportsKind | undefined;
23
23
  export declare function getSupportMessage(supportKind: AdapterSupport): string | undefined;
24
24
  export declare function getAdapterStaticRecommendation(adapterName: string): string | undefined;
@@ -3,7 +3,7 @@ import type { AddressInfo } from 'node:net';
3
3
  import type { InlineConfig, ViteDevServer } from 'vite';
4
4
  import type { SerializedSSRManifest } from '../core/app/types.js';
5
5
  import type { PageBuildData } from '../core/build/types.js';
6
- import type { Logger } from '../core/logger/core.js';
6
+ import type { AstroLogger } from '../core/logger/core.js';
7
7
  import type { AstroSettings } from '../types/astro.js';
8
8
  import type { AstroConfig } from '../types/public/config.js';
9
9
  import type { IntegrationResolvedRoute, RouteOptions, RouteToHeaders } from '../types/public/integrations.js';
@@ -41,69 +41,69 @@ export declare function normalizeInjectedTypeFilename(filename: string, integrat
41
41
  interface RunHookConfigSetup {
42
42
  settings: AstroSettings;
43
43
  command: 'dev' | 'build' | 'preview' | 'sync';
44
- logger: Logger;
44
+ logger: AstroLogger;
45
45
  isRestart?: boolean;
46
46
  fs?: typeof fsMod;
47
47
  }
48
48
  export declare function runHookConfigSetup({ settings, command, logger, isRestart, fs, }: RunHookConfigSetup): Promise<AstroSettings>;
49
49
  export declare function runHookConfigDone({ settings, logger, command, }: {
50
50
  settings: AstroSettings;
51
- logger: Logger;
51
+ logger: AstroLogger;
52
52
  command?: 'dev' | 'build' | 'preview' | 'sync';
53
53
  }): Promise<void>;
54
54
  export declare function runHookServerSetup({ config, server, logger, }: {
55
55
  config: AstroConfig;
56
56
  server: ViteDevServer;
57
- logger: Logger;
57
+ logger: AstroLogger;
58
58
  }): Promise<void>;
59
59
  export declare function runHookServerStart({ config, address, logger, }: {
60
60
  config: AstroConfig;
61
61
  address: AddressInfo;
62
- logger: Logger;
62
+ logger: AstroLogger;
63
63
  }): Promise<void>;
64
64
  export declare function runHookServerDone({ config, logger, }: {
65
65
  config: AstroConfig;
66
- logger: Logger;
66
+ logger: AstroLogger;
67
67
  }): Promise<void>;
68
68
  export declare function runHookBuildStart({ settings, logger, }: {
69
69
  settings: AstroSettings;
70
- logger: Logger;
70
+ logger: AstroLogger;
71
71
  }): Promise<void>;
72
72
  export declare function runHookBuildSetup({ config, vite, pages, target, logger, }: {
73
73
  config: AstroConfig;
74
74
  vite: InlineConfig;
75
75
  pages: Map<string, PageBuildData>;
76
76
  target: 'server' | 'client';
77
- logger: Logger;
77
+ logger: AstroLogger;
78
78
  }): Promise<InlineConfig>;
79
79
  type RunHookBuildSsr = {
80
80
  config: AstroConfig;
81
81
  manifest: SerializedSSRManifest;
82
- logger: Logger;
82
+ logger: AstroLogger;
83
83
  middlewareEntryPoint: URL | undefined;
84
84
  };
85
85
  export declare function runHookBuildSsr({ config, manifest, logger, middlewareEntryPoint, }: RunHookBuildSsr): Promise<void>;
86
86
  export declare function runHookBuildGenerated({ settings, logger, routeToHeaders, }: {
87
87
  settings: AstroSettings;
88
- logger: Logger;
88
+ logger: AstroLogger;
89
89
  routeToHeaders: RouteToHeaders;
90
90
  }): Promise<void>;
91
91
  type RunHookBuildDone = {
92
92
  settings: AstroSettings;
93
93
  pages: string[];
94
94
  routes: RouteData[];
95
- logger: Logger;
95
+ logger: AstroLogger;
96
96
  };
97
97
  export declare function runHookBuildDone({ settings, pages, routes, logger }: RunHookBuildDone): Promise<void>;
98
98
  export declare function runHookRouteSetup({ route, settings, logger, }: {
99
99
  route: RouteOptions;
100
100
  settings: AstroSettings;
101
- logger: Logger;
101
+ logger: AstroLogger;
102
102
  }): Promise<void>;
103
103
  export declare function runHookRoutesResolved({ routes, settings, logger, }: {
104
104
  routes: Array<RouteData>;
105
105
  settings: AstroSettings;
106
- logger: Logger;
106
+ logger: AstroLogger;
107
107
  }): Promise<void>;
108
108
  export declare function toIntegrationResolvedRoute(route: RouteData, trailingSlash: AstroConfig['trailingSlash']): IntegrationResolvedRoute;
109
109
  export {};
@@ -1,7 +1,7 @@
1
- import type { Logger } from '../../core/logger/core.js';
1
+ import type { AstroLogger } from '../../core/logger/core.js';
2
2
  import type { APIRoute } from '../../types/public/common.js';
3
3
  import type { APIContext } from '../../types/public/context.js';
4
4
  /** Renders an endpoint request to completion, returning the body. */
5
5
  export declare function renderEndpoint(mod: {
6
6
  [method: string]: APIRoute;
7
- }, context: APIContext, isPrerendered: boolean, logger: Logger): Promise<Response>;
7
+ }, context: APIContext, isPrerendered: boolean, logger: AstroLogger): Promise<Response>;
@@ -1,4 +1,12 @@
1
1
  export declare const escapeHTML: (str: string) => string;
2
+ /**
3
+ * Serializes a value to a JSON string that is safe to embed inside a `<script>` tag.
4
+ * All `<` characters are escaped to `\u003c` so the browser's HTML parser cannot be
5
+ * tricked into closing the script block early via `</script>` variants (case-insensitive,
6
+ * whitespace, or self-closing forms) or `<!--` comment injection.
7
+ * @see https://mathiasbynens.be/notes/etago
8
+ */
9
+ export declare function stringifyForScript(value: any): string;
2
10
  export declare class HTMLBytes extends Uint8Array {
3
11
  }
4
12
  declare const htmlStringSymbol: unique symbol;
@@ -1,6 +1,9 @@
1
1
  import { escape } from "html-escaper";
2
2
  import { streamAsyncIterator } from "./util.js";
3
3
  const escapeHTML = escape;
4
+ function stringifyForScript(value) {
5
+ return JSON.stringify(value)?.replace(/</g, "\\u003c");
6
+ }
4
7
  class HTMLBytes extends Uint8Array {
5
8
  }
6
9
  Object.defineProperty(HTMLBytes.prototype, Symbol.toStringTag, {
@@ -77,5 +80,6 @@ export {
77
80
  isHTMLBytes,
78
81
  isHTMLString,
79
82
  markHTMLString,
83
+ stringifyForScript,
80
84
  unescapeHTML
81
85
  };