astro 0.25.2 → 0.26.0

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 (151) hide show
  1. package/dist/@types/astro.js +0 -0
  2. package/dist/@types/serialize-javascript.d.js +0 -0
  3. package/dist/@types/shorthash.d.js +0 -0
  4. package/dist/adapter-ssg/index.js +0 -0
  5. package/dist/cli/check.js +4 -4
  6. package/dist/cli/index.js +21 -32
  7. package/dist/core/add/babel.js +0 -0
  8. package/dist/core/add/consts.js +0 -0
  9. package/dist/core/add/imports.js +0 -0
  10. package/dist/core/add/index.js +7 -14
  11. package/dist/core/add/wrapper.js +0 -0
  12. package/dist/core/app/common.js +0 -0
  13. package/dist/core/app/index.js +13 -10
  14. package/dist/core/app/node.js +0 -0
  15. package/dist/core/app/types.js +0 -0
  16. package/dist/core/build/add-rollup-input.js +0 -0
  17. package/dist/core/build/common.js +4 -5
  18. package/dist/core/build/generate.js +65 -72
  19. package/dist/core/build/index.js +59 -74
  20. package/dist/core/build/internal.js +4 -0
  21. package/dist/core/build/page-data.js +10 -9
  22. package/dist/core/build/static-build.js +46 -28
  23. package/dist/core/build/types.d.js +0 -0
  24. package/dist/core/build/util.js +0 -0
  25. package/dist/core/build/vite-plugin-hoisted-scripts.js +1 -1
  26. package/dist/core/build/vite-plugin-internals.js +0 -0
  27. package/dist/core/build/vite-plugin-pages.js +1 -0
  28. package/dist/core/build/vite-plugin-ssr.js +4 -2
  29. package/dist/core/config.js +87 -79
  30. package/dist/core/create-vite.js +12 -7
  31. package/dist/core/dev/index.js +8 -7
  32. package/dist/core/endpoint/dev/index.js +5 -10
  33. package/dist/core/endpoint/index.js +1 -3
  34. package/dist/core/errors.js +45 -0
  35. package/dist/core/logger/console.js +43 -0
  36. package/dist/core/logger/core.js +103 -0
  37. package/dist/core/logger/node.js +94 -0
  38. package/dist/core/messages.js +50 -24
  39. package/dist/core/path.js +0 -0
  40. package/dist/core/polyfill.js +0 -0
  41. package/dist/core/preview/index.js +8 -8
  42. package/dist/core/preview/util.js +3 -6
  43. package/dist/core/render/core.js +5 -6
  44. package/dist/core/render/dev/css.js +5 -6
  45. package/dist/core/render/dev/hmr.js +0 -0
  46. package/dist/core/render/dev/html.js +0 -0
  47. package/dist/core/render/dev/index.js +23 -36
  48. package/dist/core/render/paginate.js +0 -0
  49. package/dist/core/render/pretty-feed.js +103 -0
  50. package/dist/core/render/result.js +33 -15
  51. package/dist/core/render/route-cache.js +2 -2
  52. package/dist/core/render/rss.js +5 -4
  53. package/dist/core/render/script.js +0 -0
  54. package/dist/core/render/ssr-element.js +1 -1
  55. package/dist/core/render/util.js +26 -0
  56. package/dist/core/request.js +27 -0
  57. package/dist/core/routing/index.js +0 -0
  58. package/dist/core/routing/manifest/create.js +8 -6
  59. package/dist/core/routing/manifest/serialization.js +0 -0
  60. package/dist/core/routing/match.js +0 -0
  61. package/dist/core/routing/params.js +0 -0
  62. package/dist/core/routing/validation.js +1 -1
  63. package/dist/core/util.js +57 -125
  64. package/dist/integrations/index.js +9 -1
  65. package/dist/runtime/client/hmr.js +0 -0
  66. package/dist/runtime/client/idle.js +0 -0
  67. package/dist/runtime/client/load.js +0 -0
  68. package/dist/runtime/client/media.js +0 -0
  69. package/dist/runtime/client/only.js +0 -0
  70. package/dist/runtime/client/visible.js +0 -0
  71. package/dist/runtime/server/escape.js +0 -0
  72. package/dist/runtime/server/hydration.js +0 -0
  73. package/dist/runtime/server/index.js +42 -36
  74. package/dist/runtime/server/metadata.js +0 -0
  75. package/dist/runtime/server/util.js +0 -0
  76. package/dist/template/4xx.js +1 -1
  77. package/dist/template/5xx.js +0 -0
  78. package/dist/template/css.js +0 -0
  79. package/dist/types/@types/astro.d.ts +291 -233
  80. package/dist/types/cli/index.d.ts +1 -1
  81. package/dist/types/core/add/index.d.ts +1 -1
  82. package/dist/types/core/build/common.d.ts +0 -1
  83. package/dist/types/core/build/generate.d.ts +1 -1
  84. package/dist/types/core/build/index.d.ts +1 -1
  85. package/dist/types/core/build/internal.d.ts +1 -0
  86. package/dist/types/core/build/page-data.d.ts +1 -1
  87. package/dist/types/core/build/vite-plugin-pages.d.ts +1 -0
  88. package/dist/types/core/config.d.ts +125 -116
  89. package/dist/types/core/create-vite.d.ts +1 -1
  90. package/dist/types/core/dev/index.d.ts +1 -1
  91. package/dist/types/core/endpoint/index.d.ts +1 -1
  92. package/dist/types/core/errors.d.ts +23 -0
  93. package/dist/types/core/logger/console.d.ts +4 -0
  94. package/dist/types/core/{logger.d.ts → logger/core.d.ts} +7 -22
  95. package/dist/types/core/logger/node.d.ts +34 -0
  96. package/dist/types/core/messages.d.ts +4 -2
  97. package/dist/types/core/preview/index.d.ts +1 -1
  98. package/dist/types/core/preview/util.d.ts +1 -2
  99. package/dist/types/core/render/core.d.ts +2 -3
  100. package/dist/types/core/render/dev/css.d.ts +0 -2
  101. package/dist/types/core/render/dev/index.d.ts +4 -6
  102. package/dist/types/core/render/pretty-feed.d.ts +2 -0
  103. package/dist/types/core/render/result.d.ts +2 -3
  104. package/dist/types/core/render/route-cache.d.ts +1 -1
  105. package/dist/types/core/render/util.d.ts +6 -0
  106. package/dist/types/core/request.d.ts +14 -0
  107. package/dist/types/core/routing/manifest/create.d.ts +1 -1
  108. package/dist/types/core/routing/validation.d.ts +1 -1
  109. package/dist/types/core/util.d.ts +11 -7
  110. package/dist/types/integrations/index.d.ts +6 -0
  111. package/dist/types/runtime/server/index.d.ts +1 -2
  112. package/dist/types/vite-plugin-astro/hmr.d.ts +1 -1
  113. package/dist/types/vite-plugin-astro/index.d.ts +1 -1
  114. package/dist/types/vite-plugin-astro-server/index.d.ts +1 -1
  115. package/dist/types/vite-plugin-build-css/index.d.ts +2 -1
  116. package/dist/types/vite-plugin-build-html/extract-assets.d.ts +1 -1
  117. package/dist/types/vite-plugin-build-html/index.d.ts +3 -3
  118. package/dist/types/vite-plugin-config-alias/index.d.ts +1 -1
  119. package/dist/types/vite-plugin-jsx/index.d.ts +1 -1
  120. package/dist/vite-plugin-astro/compile.js +12 -14
  121. package/dist/vite-plugin-astro/hmr.js +2 -2
  122. package/dist/vite-plugin-astro/index.js +21 -8
  123. package/dist/vite-plugin-astro/query.js +0 -0
  124. package/dist/vite-plugin-astro/styles.js +1 -1
  125. package/dist/vite-plugin-astro-postprocess/index.js +31 -34
  126. package/dist/vite-plugin-astro-server/index.js +50 -22
  127. package/dist/vite-plugin-build-css/index.js +47 -4
  128. package/dist/vite-plugin-build-css/resolve.js +0 -0
  129. package/dist/vite-plugin-build-html/add-rollup-input.js +0 -0
  130. package/dist/vite-plugin-build-html/extract-assets.js +0 -0
  131. package/dist/vite-plugin-build-html/index.js +22 -23
  132. package/dist/vite-plugin-build-html/util.js +0 -0
  133. package/dist/vite-plugin-config-alias/index.js +1 -1
  134. package/dist/vite-plugin-env/index.js +1 -1
  135. package/dist/vite-plugin-integrations-container/index.js +0 -0
  136. package/dist/vite-plugin-jsx/index.js +1 -1
  137. package/dist/vite-plugin-markdown/index.js +89 -18
  138. package/dist/vite-plugin-scripts/index.js +0 -0
  139. package/env.d.ts +1 -1
  140. package/package.json +13 -9
  141. package/dist/core/build/scan-based-build.js +0 -61
  142. package/dist/core/dev/util.js +0 -44
  143. package/dist/core/logger.js +0 -174
  144. package/dist/core/render/dev/error.js +0 -34
  145. package/dist/core/render/request.js +0 -23
  146. package/dist/core/render/sitemap.js +0 -18
  147. package/dist/types/core/build/scan-based-build.d.ts +0 -18
  148. package/dist/types/core/dev/util.d.ts +0 -9
  149. package/dist/types/core/render/dev/error.d.ts +0 -7
  150. package/dist/types/core/render/request.d.ts +0 -15
  151. package/dist/types/core/render/sitemap.d.ts +0 -2
@@ -1,2 +1,2 @@
1
1
  /** The primary CLI action */
2
- export declare function cli(args: string[]): Promise<undefined>;
2
+ export declare function cli(args: string[]): Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import type yargs from 'yargs-parser';
2
- import { LogOptions } from '../logger.js';
2
+ import { LogOptions } from '../logger/core.js';
3
3
  export interface AddOptions {
4
4
  logging: LogOptions;
5
5
  flags: yargs.Arguments;
@@ -1,4 +1,3 @@
1
1
  import type { AstroConfig, RouteType } from '../../@types/astro';
2
- export declare function getOutRoot(astroConfig: AstroConfig): URL;
3
2
  export declare function getOutFolder(astroConfig: AstroConfig, pathname: string, routeType: RouteType): URL;
4
3
  export declare function getOutFile(astroConfig: AstroConfig, outFolder: URL, pathname: string, routeType: RouteType): URL;
@@ -1,7 +1,7 @@
1
1
  import type { OutputAsset, OutputChunk, RollupOutput } from 'rollup';
2
2
  import type { AstroConfig } from '../../@types/astro';
3
- import type { PageBuildData, StaticBuildOptions } from './types';
4
3
  import type { BuildInternals } from '../../core/build/internal.js';
4
+ import type { PageBuildData, StaticBuildOptions } from './types';
5
5
  export declare function rootRelativeFacadeId(facadeId: string, astroConfig: AstroConfig): string;
6
6
  export declare function chunkIsPage(astroConfig: AstroConfig, output: OutputAsset | OutputChunk, internals: BuildInternals): boolean;
7
7
  export declare function generatePages(result: RollupOutput, opts: StaticBuildOptions, internals: BuildInternals, facadeIdToPageDataMap: Map<string, PageBuildData>): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { AstroConfig } from '../../@types/astro';
2
- import type { LogOptions } from '../logger';
2
+ import type { LogOptions } from '../logger/core';
3
3
  export interface BuildOptions {
4
4
  mode?: string;
5
5
  logging: LogOptions;
@@ -37,4 +37,5 @@ export declare function trackPageData(internals: BuildInternals, component: stri
37
37
  export declare function getPageDatasByChunk(internals: BuildInternals, chunk: RenderedChunk): Generator<PageBuildData, void, unknown>;
38
38
  export declare function getPageDataByComponent(internals: BuildInternals, component: string): PageBuildData | undefined;
39
39
  export declare function getPageDataByViteID(internals: BuildInternals, viteid: ViteID): PageBuildData | undefined;
40
+ export declare function hasPageDataByViteID(internals: BuildInternals, viteid: ViteID): boolean;
40
41
  export declare function eachPageData(internals: BuildInternals): Generator<PageBuildData, void, undefined>;
@@ -1,6 +1,6 @@
1
1
  import type { AstroConfig, ManifestData } from '../../@types/astro';
2
2
  import type { AllPagesData } from './types';
3
- import type { LogOptions } from '../logger';
3
+ import type { LogOptions } from '../logger/core';
4
4
  import type { ViteDevServer } from 'vite';
5
5
  import { RouteCache } from '../render/route-cache.js';
6
6
  export interface CollectPagesDataOptions {
@@ -2,4 +2,5 @@ import type { Plugin as VitePlugin } from 'vite';
2
2
  import type { BuildInternals } from './internal.js';
3
3
  import type { StaticBuildOptions } from './types';
4
4
  export declare const virtualModuleId = "@astrojs-pages-virtual-entry";
5
+ export declare const resolvedVirtualModuleId: string;
5
6
  export declare function vitePluginPages(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin;
@@ -1,13 +1,9 @@
1
1
  import type { AstroConfig, AstroUserConfig, CLIFlags } from '../@types/astro';
2
2
  import type { Arguments as Flags } from 'yargs-parser';
3
3
  import { z } from 'zod';
4
+ export declare const LEGACY_ASTRO_CONFIG_KEYS: Set<string>;
4
5
  export declare const AstroConfigSchema: z.ZodObject<{
5
- projectRoot: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
6
- src: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
7
- pages: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
8
- public: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
9
- dist: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
10
- integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
6
+ adapter: z.ZodOptional<z.ZodObject<{
11
7
  name: z.ZodString;
12
8
  hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
13
9
  }, "strip", z.ZodTypeAny, {
@@ -16,14 +12,38 @@ export declare const AstroConfigSchema: z.ZodObject<{
16
12
  }, {
17
13
  hooks?: {} | undefined;
18
14
  name: string;
19
- }>, "many">>, {
20
- name: string;
21
- hooks: {};
22
- }[], {
23
- hooks?: {} | undefined;
24
- name: string;
25
- }[] | undefined>;
26
- adapter: z.ZodOptional<z.ZodObject<{
15
+ }>>;
16
+ root: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
17
+ srcDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
18
+ publicDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
19
+ outDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
20
+ site: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>, string | undefined, string | undefined>;
21
+ base: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, string | undefined>;
22
+ trailingSlash: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"never">, z.ZodLiteral<"ignore">]>>>;
23
+ build: z.ZodDefault<z.ZodOptional<z.ZodObject<{
24
+ format: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"file">, z.ZodLiteral<"directory">]>>>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ format: "file" | "directory";
27
+ }, {
28
+ format?: "file" | "directory" | undefined;
29
+ }>>>;
30
+ server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
31
+ host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>>;
32
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ host: string | boolean;
35
+ port: number;
36
+ }, {
37
+ host?: string | boolean | undefined;
38
+ port?: number | undefined;
39
+ }>>>, {
40
+ host: string | boolean;
41
+ port: number;
42
+ }, {
43
+ host?: string | boolean | undefined;
44
+ port?: number | undefined;
45
+ } | undefined>;
46
+ integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
27
47
  name: z.ZodString;
28
48
  hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
29
49
  }, "strip", z.ZodTypeAny, {
@@ -32,8 +52,14 @@ export declare const AstroConfigSchema: z.ZodObject<{
32
52
  }, {
33
53
  hooks?: {} | undefined;
34
54
  name: string;
35
- }>>;
36
- styleOptions: z.ZodDefault<z.ZodOptional<z.ZodObject<{
55
+ }>, "many">>, {
56
+ name: string;
57
+ hooks: {};
58
+ }[], {
59
+ hooks?: {} | undefined;
60
+ name: string;
61
+ }[] | undefined>;
62
+ style: z.ZodDefault<z.ZodOptional<z.ZodObject<{
37
63
  postcss: z.ZodDefault<z.ZodOptional<z.ZodObject<{
38
64
  options: z.ZodAny;
39
65
  plugins: z.ZodArray<z.ZodAny, "many">;
@@ -55,158 +81,141 @@ export declare const AstroConfigSchema: z.ZodObject<{
55
81
  plugins: any[];
56
82
  } | undefined;
57
83
  }>>>;
58
- markdownOptions: z.ZodDefault<z.ZodOptional<z.ZodObject<{
59
- render: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
60
- }, "strict", z.ZodTypeAny, {
61
- render?: any;
62
- }, {
63
- render?: any;
64
- }>>>;
65
- buildOptions: z.ZodDefault<z.ZodOptional<z.ZodObject<{
66
- site: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
67
- sitemapFilter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
68
- sitemap: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
69
- pageUrlFormat: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"file">, z.ZodLiteral<"directory">]>>>;
70
- legacyBuild: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
71
- experimentalStaticBuild: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
72
- experimentalSsr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
84
+ markdown: z.ZodDefault<z.ZodOptional<z.ZodObject<{
73
85
  drafts: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
74
- }, "strip", z.ZodTypeAny, {
75
- site?: string | undefined;
76
- sitemapFilter?: ((...args: unknown[]) => unknown) | undefined;
77
- sitemap: boolean;
78
- pageUrlFormat: "file" | "directory";
79
- legacyBuild: boolean;
80
- experimentalStaticBuild: boolean;
81
- experimentalSsr: boolean;
86
+ mode: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"md">, z.ZodLiteral<"mdx">]>>>;
87
+ syntaxHighlight: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>>;
88
+ shikiConfig: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
89
+ remarkPlugins: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
90
+ rehypePlugins: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
91
+ }, "passthrough", z.ZodTypeAny, {
92
+ shikiConfig?: any;
82
93
  drafts: boolean;
94
+ mode: "md" | "mdx";
95
+ syntaxHighlight: false | "shiki" | "prism";
96
+ remarkPlugins: any[];
97
+ rehypePlugins: any[];
83
98
  }, {
84
- site?: string | undefined;
85
- sitemapFilter?: ((...args: unknown[]) => unknown) | undefined;
86
- sitemap?: boolean | undefined;
87
- pageUrlFormat?: "file" | "directory" | undefined;
88
- legacyBuild?: boolean | undefined;
89
- experimentalStaticBuild?: boolean | undefined;
90
- experimentalSsr?: boolean | undefined;
91
99
  drafts?: boolean | undefined;
100
+ mode?: "md" | "mdx" | undefined;
101
+ syntaxHighlight?: false | "shiki" | "prism" | undefined;
102
+ shikiConfig?: any;
103
+ remarkPlugins?: any[] | undefined;
104
+ rehypePlugins?: any[] | undefined;
92
105
  }>>>;
93
- devOptions: z.ZodDefault<z.ZodOptional<z.ZodObject<{
94
- host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>>;
95
- hostname: z.ZodDefault<z.ZodOptional<z.ZodString>>;
96
- port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
97
- trailingSlash: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"never">, z.ZodLiteral<"ignore">]>>>;
106
+ vite: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
107
+ experimental: z.ZodDefault<z.ZodOptional<z.ZodObject<{
108
+ ssr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
109
+ integrations: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
98
110
  }, "strip", z.ZodTypeAny, {
99
- host: string | boolean;
100
- hostname: string;
101
- port: number;
102
- trailingSlash: "always" | "never" | "ignore";
111
+ integrations: boolean;
112
+ ssr: boolean;
103
113
  }, {
104
- host?: string | boolean | undefined;
105
- hostname?: string | undefined;
106
- port?: number | undefined;
107
- trailingSlash?: "always" | "never" | "ignore" | undefined;
114
+ integrations?: boolean | undefined;
115
+ ssr?: boolean | undefined;
108
116
  }>>>;
109
- experimentalIntegrations: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
110
- vite: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
111
117
  }, "strip", z.ZodTypeAny, {
112
118
  adapter?: {
113
119
  name: string;
114
120
  hooks: {};
115
121
  } | undefined;
122
+ site?: string | undefined;
116
123
  vite?: any;
117
- projectRoot: URL;
118
- src: URL;
119
- pages: URL;
120
- public: URL;
121
- dist: URL;
124
+ root: URL;
125
+ srcDir: URL;
126
+ publicDir: URL;
127
+ outDir: URL;
128
+ base: string;
129
+ trailingSlash: "always" | "never" | "ignore";
130
+ build: {
131
+ format: "file" | "directory";
132
+ };
133
+ server: {
134
+ host: string | boolean;
135
+ port: number;
136
+ };
122
137
  integrations: {
123
138
  name: string;
124
139
  hooks: {};
125
140
  }[];
126
- styleOptions: {
141
+ style: {
127
142
  postcss: {
128
143
  options?: any;
129
144
  plugins: any[];
130
145
  };
131
146
  };
132
- markdownOptions: {
133
- render?: any;
134
- };
135
- buildOptions: {
136
- site?: string | undefined;
137
- sitemapFilter?: ((...args: unknown[]) => unknown) | undefined;
138
- sitemap: boolean;
139
- pageUrlFormat: "file" | "directory";
140
- legacyBuild: boolean;
141
- experimentalStaticBuild: boolean;
142
- experimentalSsr: boolean;
147
+ markdown: {
148
+ shikiConfig?: any;
143
149
  drafts: boolean;
150
+ mode: "md" | "mdx";
151
+ syntaxHighlight: false | "shiki" | "prism";
152
+ remarkPlugins: any[];
153
+ rehypePlugins: any[];
144
154
  };
145
- devOptions: {
146
- host: string | boolean;
147
- hostname: string;
148
- port: number;
149
- trailingSlash: "always" | "never" | "ignore";
155
+ experimental: {
156
+ integrations: boolean;
157
+ ssr: boolean;
150
158
  };
151
- experimentalIntegrations: boolean;
152
159
  }, {
153
- projectRoot?: string | undefined;
154
- src?: string | undefined;
155
- pages?: string | undefined;
156
- public?: string | undefined;
157
- dist?: string | undefined;
158
- integrations?: {
159
- hooks?: {} | undefined;
160
- name: string;
161
- }[] | undefined;
162
160
  adapter?: {
163
161
  hooks?: {} | undefined;
164
162
  name: string;
165
163
  } | undefined;
166
- styleOptions?: {
164
+ root?: string | undefined;
165
+ srcDir?: string | undefined;
166
+ publicDir?: string | undefined;
167
+ outDir?: string | undefined;
168
+ site?: string | undefined;
169
+ base?: string | undefined;
170
+ trailingSlash?: "always" | "never" | "ignore" | undefined;
171
+ build?: {
172
+ format?: "file" | "directory" | undefined;
173
+ } | undefined;
174
+ server?: {
175
+ host?: string | boolean | undefined;
176
+ port?: number | undefined;
177
+ } | undefined;
178
+ integrations?: {
179
+ hooks?: {} | undefined;
180
+ name: string;
181
+ }[] | undefined;
182
+ style?: {
167
183
  postcss?: {
168
184
  options?: any;
169
185
  plugins: any[];
170
186
  } | undefined;
171
187
  } | undefined;
172
- markdownOptions?: {
173
- render?: any;
174
- } | undefined;
175
- buildOptions?: {
176
- site?: string | undefined;
177
- sitemapFilter?: ((...args: unknown[]) => unknown) | undefined;
178
- sitemap?: boolean | undefined;
179
- pageUrlFormat?: "file" | "directory" | undefined;
180
- legacyBuild?: boolean | undefined;
181
- experimentalStaticBuild?: boolean | undefined;
182
- experimentalSsr?: boolean | undefined;
188
+ markdown?: {
183
189
  drafts?: boolean | undefined;
190
+ mode?: "md" | "mdx" | undefined;
191
+ syntaxHighlight?: false | "shiki" | "prism" | undefined;
192
+ shikiConfig?: any;
193
+ remarkPlugins?: any[] | undefined;
194
+ rehypePlugins?: any[] | undefined;
184
195
  } | undefined;
185
- devOptions?: {
186
- host?: string | boolean | undefined;
187
- hostname?: string | undefined;
188
- port?: number | undefined;
189
- trailingSlash?: "always" | "never" | "ignore" | undefined;
190
- } | undefined;
191
- experimentalIntegrations?: boolean | undefined;
192
196
  vite?: any;
197
+ experimental?: {
198
+ integrations?: boolean | undefined;
199
+ ssr?: boolean | undefined;
200
+ } | undefined;
193
201
  }>;
194
202
  /** Turn raw config values into normalized values */
195
- export declare function validateConfig(userConfig: any, root: string): Promise<AstroConfig>;
203
+ export declare function validateConfig(userConfig: any, root: string, cmd: string): Promise<AstroConfig>;
196
204
  interface LoadConfigOptions {
197
205
  cwd?: string;
198
206
  flags?: Flags;
207
+ cmd: string;
208
+ validate?: boolean;
199
209
  }
200
210
  /**
201
211
  * Resolve the file URL of the user's `astro.config.js|cjs|mjs|ts` file
202
212
  * Note: currently the same as loadConfig but only returns the `filePath`
203
213
  * instead of the resolved config
204
214
  */
205
- export declare function resolveConfigURL(configOptions: LoadConfigOptions): Promise<URL | undefined>;
215
+ export declare function resolveConfigURL(configOptions: Pick<LoadConfigOptions, 'cwd' | 'flags'>): Promise<URL | undefined>;
206
216
  /** Attempt to load an `astro.config.mjs` file */
207
217
  export declare function loadConfig(configOptions: LoadConfigOptions): Promise<AstroConfig>;
208
218
  /** Attempt to resolve an Astro configuration object. Normalize, validate, and return. */
209
- export declare function resolveConfig(userConfig: AstroUserConfig, root: string, flags?: CLIFlags): Promise<AstroConfig>;
210
- export declare function formatConfigError(err: z.ZodError): string;
219
+ export declare function resolveConfig(userConfig: AstroUserConfig, root: string, flags: CLIFlags | undefined, cmd: string): Promise<AstroConfig>;
211
220
  export declare function mergeConfig(defaults: Record<string, any>, overrides: Record<string, any>, isRoot?: boolean): Record<string, any>;
212
221
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { AstroConfig } from '../@types/astro';
2
- import type { LogOptions } from './logger';
2
+ import type { LogOptions } from './logger/core';
3
3
  import * as vite from 'vite';
4
4
  export declare type ViteConfigWithSSR = vite.InlineConfig & {
5
5
  ssr?: vite.SSROptions;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import type { AddressInfo } from 'net';
3
3
  import type { AstroConfig } from '../../@types/astro';
4
- import { LogOptions } from '../logger.js';
4
+ import { LogOptions } from '../logger/core.js';
5
5
  export interface DevOptions {
6
6
  logging: LogOptions;
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import type { EndpointHandler } from '../../@types/astro';
2
2
  import type { RenderOptions } from '../render/core';
3
- export declare type EndpointOptions = Pick<RenderOptions, 'logging' | 'headers' | 'method' | 'origin' | 'route' | 'routeCache' | 'pathname' | 'route' | 'site' | 'ssr'>;
3
+ export declare type EndpointOptions = Pick<RenderOptions, 'logging' | 'origin' | 'request' | 'route' | 'routeCache' | 'pathname' | 'route' | 'site' | 'ssr'>;
4
4
  declare type EndpointCallResult = {
5
5
  type: 'simple';
6
6
  body: string;
@@ -0,0 +1,23 @@
1
+ import type { ViteDevServer } from 'vite';
2
+ export interface ErrorWithMetadata {
3
+ [name: string]: any;
4
+ message: string;
5
+ stack: string;
6
+ id?: string;
7
+ frame?: string;
8
+ plugin?: string;
9
+ pluginCode?: string;
10
+ loc?: {
11
+ file?: string;
12
+ line: number;
13
+ column: number;
14
+ };
15
+ }
16
+ export declare function cleanErrorStack(stack: string): string;
17
+ /** Update the error message to correct any vite-isms that we don't want to expose to the user. */
18
+ export declare function fixViteErrorMessage(_err: unknown, server: ViteDevServer): Error;
19
+ /**
20
+ * Takes any error-like object and returns a standardized Error + metadata object.
21
+ * Useful for consistent reporting regardless of where the error surfaced from.
22
+ */
23
+ export declare function collectErrorMetadata(e: any): ErrorWithMetadata;
@@ -0,0 +1,4 @@
1
+ import type { LogMessage } from './core.js';
2
+ export declare const consoleLogDestination: {
3
+ write(event: LogMessage): boolean;
4
+ };
@@ -1,17 +1,14 @@
1
- /// <reference types="node" />
2
- import type { AstroConfig } from '../@types/astro';
3
- import { Writable } from 'stream';
4
- export declare const defaultLogDestination: Writable;
5
- interface LogWritable<T> extends Writable {
1
+ import type { AstroConfig } from '../../@types/astro';
2
+ interface LogWritable<T> {
6
3
  write: (chunk: T) => boolean;
7
4
  }
8
5
  export declare type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
9
6
  export declare type LoggerEvent = 'info' | 'warn' | 'error';
10
7
  export interface LogOptions {
11
- dest?: LogWritable<LogMessage>;
12
- level?: LoggerLevel;
8
+ dest: LogWritable<LogMessage>;
9
+ level: LoggerLevel;
13
10
  }
14
- export declare const defaultLogOptions: Required<LogOptions>;
11
+ export declare const dateTimeFormat: Intl.DateTimeFormat;
15
12
  export interface LogMessage {
16
13
  type: string | null;
17
14
  level: LoggerLevel;
@@ -19,16 +16,8 @@ export interface LogMessage {
19
16
  args: Array<any>;
20
17
  }
21
18
  export declare const levels: Record<LoggerLevel, number>;
22
- export declare function enableVerboseLogging(): void;
23
19
  /** Full logging API */
24
- export declare function log(opts: LogOptions | undefined, level: LoggerLevel, type: string | null, ...args: Array<any>): void;
25
- /**
26
- * Emit a message only shown in debug mode.
27
- * Astro (along with many of its dependencies) uses the `debug` package for debug logging.
28
- * You can enable these logs with the `DEBUG=astro:*` environment variable.
29
- * More info https://github.com/debug-js/debug#environment-variables
30
- */
31
- export declare function debug(type: string, ...messages: Array<any>): any;
20
+ export declare function log(opts: LogOptions, level: LoggerLevel, type: string | null, ...args: Array<any>): void;
32
21
  /** Emit a user-facing message. Useful for UI and other console messages. */
33
22
  export declare function info(opts: LogOptions, type: string | null, ...messages: Array<any>): void;
34
23
  /** Emit a warning message. Useful for high-priority messages that aren't necessarily errors. */
@@ -37,11 +26,7 @@ export declare function warn(opts: LogOptions, type: string | null, ...messages:
37
26
  export declare function error(opts: LogOptions, type: string | null, ...messages: Array<any>): void;
38
27
  declare type LogFn = typeof info | typeof warn | typeof error;
39
28
  export declare function table(opts: LogOptions, columns: number[]): (logFn: LogFn, ...input: Array<any>) => void;
40
- export declare const logger: {
41
- info: (type: string | null, ...messages: any[]) => void;
42
- warn: (type: string | null, ...messages: any[]) => void;
43
- error: (type: string | null, ...messages: any[]) => void;
44
- };
29
+ export declare function debug(...args: any[]): void;
45
30
  export declare let defaultLogLevel: LoggerLevel;
46
31
  /** Print out a timer message for debug() */
47
32
  export declare function timerMessage(message: string, startTime?: number): string;
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ import { Writable } from 'stream';
3
+ export declare const nodeLogDestination: Writable;
4
+ interface LogWritable<T> {
5
+ write: (chunk: T) => boolean;
6
+ }
7
+ export declare type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
8
+ export declare type LoggerEvent = 'info' | 'warn' | 'error';
9
+ export interface LogOptions {
10
+ dest?: LogWritable<LogMessage>;
11
+ level?: LoggerLevel;
12
+ }
13
+ export declare const nodeLogOptions: Required<LogOptions>;
14
+ export interface LogMessage {
15
+ type: string | null;
16
+ level: LoggerLevel;
17
+ message: string;
18
+ args: Array<any>;
19
+ }
20
+ export declare const levels: Record<LoggerLevel, number>;
21
+ /**
22
+ * Emit a message only shown in debug mode.
23
+ * Astro (along with many of its dependencies) uses the `debug` package for debug logging.
24
+ * You can enable these logs with the `DEBUG=astro:*` environment variable.
25
+ * More info https://github.com/debug-js/debug#environment-variables
26
+ */
27
+ export declare function debug(type: string, ...messages: Array<any>): any;
28
+ export declare const logger: {
29
+ info: (type: string | null, ...messages: any[]) => void;
30
+ warn: (type: string | null, ...messages: any[]) => void;
31
+ error: (type: string | null, ...messages: any[]) => void;
32
+ };
33
+ export declare function enableVerboseLogging(): void;
34
+ export {};
@@ -4,6 +4,7 @@
4
4
  /// <reference types="node" />
5
5
  import type { AddressInfo } from 'net';
6
6
  import type { AstroConfig } from '../@types/astro';
7
+ import { ZodError } from 'zod';
7
8
  /** Display */
8
9
  export declare function req({ url, statusCode, reqTime }: {
9
10
  url: string;
@@ -34,8 +35,9 @@ export declare function cancelled(message: string, tip?: string): string;
34
35
  export declare function portInUse({ port }: {
35
36
  port: number;
36
37
  }): string;
37
- /** Pretty-print errors */
38
- export declare function err(error: Error): string;
38
+ export declare function getNetworkLogging(host: string | boolean): 'none' | 'host-to-expose' | 'visible';
39
+ export declare function formatConfigErrorMessage(err: ZodError): string;
40
+ export declare function formatErrorMessage(_err: Error, args?: string[]): string;
39
41
  export declare function printHelp({ commandName, headline, usage, commands, flags, }: {
40
42
  commandName: string;
41
43
  headline?: string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { AstroConfig } from '../../@types/astro';
3
- import type { LogOptions } from '../logger';
3
+ import type { LogOptions } from '../logger/core';
4
4
  import http from 'http';
5
5
  interface PreviewOptions {
6
6
  logging: LogOptions;
@@ -1,2 +1 @@
1
- import type { AstroConfig } from '../../@types/astro';
2
- export declare function getResolvedHostForHttpServer(config: AstroConfig): string | undefined;
1
+ export declare function getResolvedHostForHttpServer(host: string | boolean): string | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { ComponentInstance, MarkdownRenderOptions, Params, Props, SSRLoadedRenderer, RouteData, SSRElement } from '../../@types/astro';
2
- import type { LogOptions } from '../logger.js';
2
+ import type { LogOptions } from '../logger/core.js';
3
3
  import { RouteCache } from './route-cache.js';
4
4
  interface GetParamsAndPropsOptions {
5
5
  mod: ComponentInstance;
@@ -28,8 +28,7 @@ export interface RenderOptions {
28
28
  routeCache: RouteCache;
29
29
  site?: string;
30
30
  ssr: boolean;
31
- method: string;
32
- headers: Headers;
31
+ request: Request;
33
32
  }
34
33
  export declare function render(opts: RenderOptions): Promise<{
35
34
  type: 'html';
@@ -1,5 +1,3 @@
1
1
  import type * as vite from 'vite';
2
- export declare const STYLE_EXTENSIONS: Set<string>;
3
- export declare const isCSSRequest: (request: string) => boolean;
4
2
  /** Given a filePath URL, crawl Vite’s module graph to find all style imports. */
5
3
  export declare function getStylesForURL(filePath: URL, viteServer: vite.ViteDevServer): Set<string>;
@@ -1,6 +1,6 @@
1
1
  import type * as vite from 'vite';
2
2
  import type { AstroConfig, ComponentInstance, RouteData, RuntimeMode, SSRLoadedRenderer } from '../../../@types/astro';
3
- import { LogOptions } from '../../logger.js';
3
+ import { LogOptions } from '../../logger/core.js';
4
4
  import { RouteCache } from '../route-cache.js';
5
5
  export interface SSROptions {
6
6
  /** an instance of the AstroConfig */
@@ -11,7 +11,7 @@ export interface SSROptions {
11
11
  logging: LogOptions;
12
12
  /** "development" or "production" */
13
13
  mode: RuntimeMode;
14
- /** production website, needed for some RSS & Sitemap functions */
14
+ /** production website, needed for some RSS functions */
15
15
  origin: string;
16
16
  /** the web request (needed for dynamic routes) */
17
17
  pathname: string;
@@ -21,10 +21,8 @@ export interface SSROptions {
21
21
  routeCache: RouteCache;
22
22
  /** Vite instance */
23
23
  viteServer: vite.ViteDevServer;
24
- /** Method */
25
- method: string;
26
- /** Headers */
27
- headers: Headers;
24
+ /** Request */
25
+ request: Request;
28
26
  }
29
27
  export declare type ComponentPreload = [SSRLoadedRenderer[], ComponentInstance];
30
28
  export declare type RenderResponse = {