astro 1.2.5 → 1.2.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.
- package/dist/@types/astro.d.ts +14 -13
- package/dist/cli/check/index.d.ts +2 -2
- package/dist/cli/check/index.js +2 -2
- package/dist/cli/index.js +28 -9
- package/dist/core/add/index.js +1 -1
- package/dist/core/build/generate.d.ts +3 -3
- package/dist/core/build/generate.js +27 -27
- package/dist/core/build/index.d.ts +2 -2
- package/dist/core/build/index.js +23 -19
- package/dist/core/build/internal.js +5 -2
- package/dist/core/build/page-data.d.ts +2 -2
- package/dist/core/build/page-data.js +2 -2
- package/dist/core/build/static-build.js +26 -28
- package/dist/core/build/types.d.ts +2 -2
- package/dist/core/build/vite-plugin-css.d.ts +0 -2
- package/dist/core/build/vite-plugin-css.js +3 -3
- package/dist/core/build/vite-plugin-hoisted-scripts.d.ts +2 -2
- package/dist/core/build/vite-plugin-hoisted-scripts.js +3 -3
- package/dist/core/build/vite-plugin-pages.js +2 -2
- package/dist/core/build/vite-plugin-ssr.js +15 -11
- package/dist/core/config/config.d.ts +41 -0
- package/dist/core/{config.js → config/config.js} +5 -166
- package/dist/core/config/index.d.ts +4 -0
- package/dist/core/config/index.js +18 -0
- package/dist/core/config/schema.d.ts +478 -0
- package/dist/core/config/schema.js +148 -0
- package/dist/core/config/settings.d.ts +8 -0
- package/dist/core/config/settings.js +16 -0
- package/dist/core/config/tsconfig.d.ts +2 -0
- package/dist/core/config/tsconfig.js +13 -0
- package/dist/core/create-vite.d.ts +3 -3
- package/dist/core/create-vite.js +21 -21
- package/dist/core/dev/index.d.ts +2 -2
- package/dist/core/dev/index.js +16 -12
- package/dist/core/endpoint/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/index.d.ts +2 -2
- package/dist/core/preview/index.js +9 -9
- package/dist/core/render/dev/index.d.ts +5 -5
- package/dist/core/render/dev/index.js +14 -14
- package/dist/core/render/dev/scripts.d.ts +2 -2
- package/dist/core/render/dev/scripts.js +4 -7
- package/dist/core/routing/manifest/create.d.ts +3 -3
- package/dist/core/routing/manifest/create.js +9 -12
- package/dist/core/util.d.ts +3 -3
- package/dist/core/util.js +9 -9
- package/dist/integrations/index.d.ts +6 -6
- package/dist/integrations/index.js +19 -17
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/vite-plugin-astro/index.d.ts +3 -3
- package/dist/vite-plugin-astro/index.js +2 -1
- package/dist/vite-plugin-astro-postprocess/index.d.ts +3 -3
- package/dist/vite-plugin-astro-postprocess/index.js +1 -1
- package/dist/vite-plugin-astro-server/index.d.ts +4 -4
- package/dist/vite-plugin-astro-server/index.js +27 -24
- package/dist/vite-plugin-config-alias/index.d.ts +3 -3
- package/dist/vite-plugin-config-alias/index.js +6 -5
- package/dist/vite-plugin-env/index.d.ts +3 -3
- package/dist/vite-plugin-env/index.js +2 -3
- package/dist/vite-plugin-integrations-container/index.d.ts +3 -3
- package/dist/vite-plugin-integrations-container/index.js +2 -2
- package/dist/vite-plugin-jsx/index.d.ts +3 -3
- package/dist/vite-plugin-jsx/index.js +3 -3
- package/dist/vite-plugin-markdown/index.d.ts +3 -3
- package/dist/vite-plugin-markdown/index.js +3 -3
- package/dist/vite-plugin-markdown-legacy/index.d.ts +3 -3
- package/dist/vite-plugin-markdown-legacy/index.js +2 -1
- package/dist/vite-plugin-scripts/index.d.ts +3 -3
- package/dist/vite-plugin-scripts/index.js +5 -5
- package/dist/vite-plugin-scripts/page-ssr.d.ts +3 -3
- package/dist/vite-plugin-scripts/page-ssr.js +7 -5
- package/package.json +2 -2
- package/dist/core/config.d.ts +0 -260
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark';
|
|
2
|
+
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
|
3
|
+
import type { ViteUserConfig } from '../../@types/astro';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const AstroConfigSchema: z.ZodObject<{
|
|
6
|
+
root: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
7
|
+
srcDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
8
|
+
publicDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
9
|
+
outDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
10
|
+
site: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
11
|
+
base: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, string | undefined>;
|
|
12
|
+
trailingSlash: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"never">, z.ZodLiteral<"ignore">]>>>;
|
|
13
|
+
output: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"server">]>>>;
|
|
14
|
+
adapter: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name: string;
|
|
19
|
+
hooks: {};
|
|
20
|
+
}, {
|
|
21
|
+
hooks?: {} | undefined;
|
|
22
|
+
name: string;
|
|
23
|
+
}>>;
|
|
24
|
+
integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
name: string;
|
|
29
|
+
hooks: {};
|
|
30
|
+
}, {
|
|
31
|
+
hooks?: {} | undefined;
|
|
32
|
+
name: string;
|
|
33
|
+
}>, "many">>, {
|
|
34
|
+
name: string;
|
|
35
|
+
hooks: {};
|
|
36
|
+
}[], unknown>;
|
|
37
|
+
build: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
38
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"file">, z.ZodLiteral<"directory">]>>>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
format: "file" | "directory";
|
|
41
|
+
}, {
|
|
42
|
+
format?: "file" | "directory" | undefined;
|
|
43
|
+
}>>>;
|
|
44
|
+
server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
45
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>>;
|
|
46
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
host: string | boolean;
|
|
49
|
+
port: number;
|
|
50
|
+
}, {
|
|
51
|
+
host?: string | boolean | undefined;
|
|
52
|
+
port?: number | undefined;
|
|
53
|
+
}>>>, {
|
|
54
|
+
host: string | boolean;
|
|
55
|
+
port: number;
|
|
56
|
+
}, unknown>;
|
|
57
|
+
style: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
58
|
+
postcss: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
59
|
+
options: z.ZodAny;
|
|
60
|
+
plugins: z.ZodArray<z.ZodAny, "many">;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
options?: any;
|
|
63
|
+
plugins: any[];
|
|
64
|
+
}, {
|
|
65
|
+
options?: any;
|
|
66
|
+
plugins: any[];
|
|
67
|
+
}>>>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
postcss: {
|
|
70
|
+
options?: any;
|
|
71
|
+
plugins: any[];
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
postcss?: {
|
|
75
|
+
options?: any;
|
|
76
|
+
plugins: any[];
|
|
77
|
+
} | undefined;
|
|
78
|
+
}>>>;
|
|
79
|
+
markdown: z.ZodDefault<z.ZodObject<{
|
|
80
|
+
drafts: z.ZodDefault<z.ZodBoolean>;
|
|
81
|
+
syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
|
|
82
|
+
shikiConfig: z.ZodDefault<z.ZodObject<{
|
|
83
|
+
langs: z.ZodDefault<z.ZodArray<z.ZodType<ILanguageRegistration, z.ZodTypeDef, ILanguageRegistration>, "many">>;
|
|
84
|
+
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[Theme, ...Theme[]]>, z.ZodType<IThemeRegistration, z.ZodTypeDef, IThemeRegistration>]>>;
|
|
85
|
+
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
langs: ILanguageRegistration[];
|
|
88
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
89
|
+
wrap: boolean | null;
|
|
90
|
+
}, {
|
|
91
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
92
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
93
|
+
wrap?: boolean | null | undefined;
|
|
94
|
+
}>>;
|
|
95
|
+
remarkPlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodTuple<[z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
96
|
+
rehypePlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodTuple<[z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
97
|
+
remarkRehype: z.ZodDefault<z.ZodOptional<z.ZodType<RemarkRehype, z.ZodTypeDef, RemarkRehype>>>;
|
|
98
|
+
extendDefaultPlugins: z.ZodDefault<z.ZodBoolean>;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
drafts: boolean;
|
|
101
|
+
syntaxHighlight: false | "shiki" | "prism";
|
|
102
|
+
shikiConfig: {
|
|
103
|
+
langs: ILanguageRegistration[];
|
|
104
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
105
|
+
wrap: boolean | null;
|
|
106
|
+
};
|
|
107
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
108
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
109
|
+
remarkRehype: RemarkRehype;
|
|
110
|
+
extendDefaultPlugins: boolean;
|
|
111
|
+
}, {
|
|
112
|
+
drafts?: boolean | undefined;
|
|
113
|
+
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
114
|
+
shikiConfig?: {
|
|
115
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
116
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
117
|
+
wrap?: boolean | null | undefined;
|
|
118
|
+
} | undefined;
|
|
119
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
120
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
121
|
+
remarkRehype?: RemarkRehype | undefined;
|
|
122
|
+
extendDefaultPlugins?: boolean | undefined;
|
|
123
|
+
}>>;
|
|
124
|
+
vite: z.ZodDefault<z.ZodType<ViteUserConfig, z.ZodTypeDef, ViteUserConfig>>;
|
|
125
|
+
legacy: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
126
|
+
astroFlavoredMarkdown: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
astroFlavoredMarkdown: boolean;
|
|
129
|
+
}, {
|
|
130
|
+
astroFlavoredMarkdown?: boolean | undefined;
|
|
131
|
+
}>>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
site?: string | undefined;
|
|
134
|
+
adapter?: {
|
|
135
|
+
name: string;
|
|
136
|
+
hooks: {};
|
|
137
|
+
} | undefined;
|
|
138
|
+
base: string;
|
|
139
|
+
markdown: {
|
|
140
|
+
drafts: boolean;
|
|
141
|
+
syntaxHighlight: false | "shiki" | "prism";
|
|
142
|
+
shikiConfig: {
|
|
143
|
+
langs: ILanguageRegistration[];
|
|
144
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
145
|
+
wrap: boolean | null;
|
|
146
|
+
};
|
|
147
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
148
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
149
|
+
remarkRehype: RemarkRehype;
|
|
150
|
+
extendDefaultPlugins: boolean;
|
|
151
|
+
};
|
|
152
|
+
build: {
|
|
153
|
+
format: "file" | "directory";
|
|
154
|
+
};
|
|
155
|
+
root: URL;
|
|
156
|
+
srcDir: URL;
|
|
157
|
+
publicDir: URL;
|
|
158
|
+
outDir: URL;
|
|
159
|
+
trailingSlash: "never" | "always" | "ignore";
|
|
160
|
+
server: {
|
|
161
|
+
host: string | boolean;
|
|
162
|
+
port: number;
|
|
163
|
+
};
|
|
164
|
+
output: "static" | "server";
|
|
165
|
+
integrations: {
|
|
166
|
+
name: string;
|
|
167
|
+
hooks: {};
|
|
168
|
+
}[];
|
|
169
|
+
style: {
|
|
170
|
+
postcss: {
|
|
171
|
+
options?: any;
|
|
172
|
+
plugins: any[];
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
vite: ViteUserConfig;
|
|
176
|
+
legacy: {
|
|
177
|
+
astroFlavoredMarkdown: boolean;
|
|
178
|
+
};
|
|
179
|
+
}, {
|
|
180
|
+
site?: string | undefined;
|
|
181
|
+
base?: string | undefined;
|
|
182
|
+
markdown?: {
|
|
183
|
+
drafts?: boolean | undefined;
|
|
184
|
+
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
185
|
+
shikiConfig?: {
|
|
186
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
187
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
188
|
+
wrap?: boolean | null | undefined;
|
|
189
|
+
} | undefined;
|
|
190
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
191
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
192
|
+
remarkRehype?: RemarkRehype | undefined;
|
|
193
|
+
extendDefaultPlugins?: boolean | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
build?: {
|
|
196
|
+
format?: "file" | "directory" | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
root?: string | undefined;
|
|
199
|
+
srcDir?: string | undefined;
|
|
200
|
+
publicDir?: string | undefined;
|
|
201
|
+
outDir?: string | undefined;
|
|
202
|
+
trailingSlash?: "never" | "always" | "ignore" | undefined;
|
|
203
|
+
server?: unknown;
|
|
204
|
+
output?: "static" | "server" | undefined;
|
|
205
|
+
adapter?: {
|
|
206
|
+
hooks?: {} | undefined;
|
|
207
|
+
name: string;
|
|
208
|
+
} | undefined;
|
|
209
|
+
integrations?: unknown;
|
|
210
|
+
style?: {
|
|
211
|
+
postcss?: {
|
|
212
|
+
options?: any;
|
|
213
|
+
plugins: any[];
|
|
214
|
+
} | undefined;
|
|
215
|
+
} | undefined;
|
|
216
|
+
vite?: ViteUserConfig | undefined;
|
|
217
|
+
legacy?: {
|
|
218
|
+
astroFlavoredMarkdown?: boolean | undefined;
|
|
219
|
+
} | undefined;
|
|
220
|
+
}>;
|
|
221
|
+
export declare function createRelativeSchema(cmd: string, fileProtocolRoot: URL): z.ZodObject<z.extendShape<{
|
|
222
|
+
root: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
223
|
+
srcDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
224
|
+
publicDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
225
|
+
outDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
226
|
+
site: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
227
|
+
base: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, string | undefined>;
|
|
228
|
+
trailingSlash: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"never">, z.ZodLiteral<"ignore">]>>>;
|
|
229
|
+
output: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"server">]>>>;
|
|
230
|
+
adapter: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
name: z.ZodString;
|
|
232
|
+
hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
name: string;
|
|
235
|
+
hooks: {};
|
|
236
|
+
}, {
|
|
237
|
+
hooks?: {} | undefined;
|
|
238
|
+
name: string;
|
|
239
|
+
}>>;
|
|
240
|
+
integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
241
|
+
name: z.ZodString;
|
|
242
|
+
hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
name: string;
|
|
245
|
+
hooks: {};
|
|
246
|
+
}, {
|
|
247
|
+
hooks?: {} | undefined;
|
|
248
|
+
name: string;
|
|
249
|
+
}>, "many">>, {
|
|
250
|
+
name: string;
|
|
251
|
+
hooks: {};
|
|
252
|
+
}[], unknown>;
|
|
253
|
+
build: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
254
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"file">, z.ZodLiteral<"directory">]>>>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
format: "file" | "directory";
|
|
257
|
+
}, {
|
|
258
|
+
format?: "file" | "directory" | undefined;
|
|
259
|
+
}>>>;
|
|
260
|
+
server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
261
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>>;
|
|
262
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
host: string | boolean;
|
|
265
|
+
port: number;
|
|
266
|
+
}, {
|
|
267
|
+
host?: string | boolean | undefined;
|
|
268
|
+
port?: number | undefined;
|
|
269
|
+
}>>>, {
|
|
270
|
+
host: string | boolean;
|
|
271
|
+
port: number;
|
|
272
|
+
}, unknown>;
|
|
273
|
+
style: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
274
|
+
postcss: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
275
|
+
options: z.ZodAny;
|
|
276
|
+
plugins: z.ZodArray<z.ZodAny, "many">;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
options?: any;
|
|
279
|
+
plugins: any[];
|
|
280
|
+
}, {
|
|
281
|
+
options?: any;
|
|
282
|
+
plugins: any[];
|
|
283
|
+
}>>>;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
postcss: {
|
|
286
|
+
options?: any;
|
|
287
|
+
plugins: any[];
|
|
288
|
+
};
|
|
289
|
+
}, {
|
|
290
|
+
postcss?: {
|
|
291
|
+
options?: any;
|
|
292
|
+
plugins: any[];
|
|
293
|
+
} | undefined;
|
|
294
|
+
}>>>;
|
|
295
|
+
markdown: z.ZodDefault<z.ZodObject<{
|
|
296
|
+
drafts: z.ZodDefault<z.ZodBoolean>;
|
|
297
|
+
syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
|
|
298
|
+
shikiConfig: z.ZodDefault<z.ZodObject<{
|
|
299
|
+
langs: z.ZodDefault<z.ZodArray<z.ZodType<ILanguageRegistration, z.ZodTypeDef, ILanguageRegistration>, "many">>;
|
|
300
|
+
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[Theme, ...Theme[]]>, z.ZodType<IThemeRegistration, z.ZodTypeDef, IThemeRegistration>]>>;
|
|
301
|
+
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
langs: ILanguageRegistration[];
|
|
304
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
305
|
+
wrap: boolean | null;
|
|
306
|
+
}, {
|
|
307
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
308
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
309
|
+
wrap?: boolean | null | undefined;
|
|
310
|
+
}>>;
|
|
311
|
+
remarkPlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodTuple<[z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
312
|
+
rehypePlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodTuple<[z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
313
|
+
remarkRehype: z.ZodDefault<z.ZodOptional<z.ZodType<RemarkRehype, z.ZodTypeDef, RemarkRehype>>>;
|
|
314
|
+
extendDefaultPlugins: z.ZodDefault<z.ZodBoolean>;
|
|
315
|
+
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
drafts: boolean;
|
|
317
|
+
syntaxHighlight: false | "shiki" | "prism";
|
|
318
|
+
shikiConfig: {
|
|
319
|
+
langs: ILanguageRegistration[];
|
|
320
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
321
|
+
wrap: boolean | null;
|
|
322
|
+
};
|
|
323
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
324
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
325
|
+
remarkRehype: RemarkRehype;
|
|
326
|
+
extendDefaultPlugins: boolean;
|
|
327
|
+
}, {
|
|
328
|
+
drafts?: boolean | undefined;
|
|
329
|
+
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
330
|
+
shikiConfig?: {
|
|
331
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
332
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
333
|
+
wrap?: boolean | null | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
336
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
337
|
+
remarkRehype?: RemarkRehype | undefined;
|
|
338
|
+
extendDefaultPlugins?: boolean | undefined;
|
|
339
|
+
}>>;
|
|
340
|
+
vite: z.ZodDefault<z.ZodType<ViteUserConfig, z.ZodTypeDef, ViteUserConfig>>;
|
|
341
|
+
legacy: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
342
|
+
astroFlavoredMarkdown: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
343
|
+
}, "strip", z.ZodTypeAny, {
|
|
344
|
+
astroFlavoredMarkdown: boolean;
|
|
345
|
+
}, {
|
|
346
|
+
astroFlavoredMarkdown?: boolean | undefined;
|
|
347
|
+
}>>>;
|
|
348
|
+
}, {
|
|
349
|
+
root: z.ZodEffects<z.ZodDefault<z.ZodString>, URL, string | undefined>;
|
|
350
|
+
srcDir: z.ZodEffects<z.ZodDefault<z.ZodString>, URL, string | undefined>;
|
|
351
|
+
publicDir: z.ZodEffects<z.ZodDefault<z.ZodString>, URL, string | undefined>;
|
|
352
|
+
outDir: z.ZodEffects<z.ZodDefault<z.ZodString>, URL, string | undefined>;
|
|
353
|
+
server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
354
|
+
host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>>;
|
|
355
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
356
|
+
streaming: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
host: string | boolean;
|
|
359
|
+
port: number;
|
|
360
|
+
streaming: boolean;
|
|
361
|
+
}, {
|
|
362
|
+
host?: string | boolean | undefined;
|
|
363
|
+
port?: number | undefined;
|
|
364
|
+
streaming?: boolean | undefined;
|
|
365
|
+
}>>>, {
|
|
366
|
+
host: string | boolean;
|
|
367
|
+
port: number;
|
|
368
|
+
streaming: boolean;
|
|
369
|
+
}, unknown>;
|
|
370
|
+
style: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
371
|
+
postcss: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
372
|
+
options: z.ZodAny;
|
|
373
|
+
plugins: z.ZodArray<z.ZodAny, "many">;
|
|
374
|
+
}, "strip", z.ZodTypeAny, {
|
|
375
|
+
options?: any;
|
|
376
|
+
plugins: any[];
|
|
377
|
+
}, {
|
|
378
|
+
options?: any;
|
|
379
|
+
plugins: any[];
|
|
380
|
+
}>>>, {
|
|
381
|
+
options?: any;
|
|
382
|
+
plugins: any[];
|
|
383
|
+
}, unknown>;
|
|
384
|
+
}, "strip", z.ZodTypeAny, {
|
|
385
|
+
postcss: {
|
|
386
|
+
options?: any;
|
|
387
|
+
plugins: any[];
|
|
388
|
+
};
|
|
389
|
+
}, {
|
|
390
|
+
postcss?: unknown;
|
|
391
|
+
}>>>;
|
|
392
|
+
}>, "strip", z.ZodTypeAny, {
|
|
393
|
+
site?: string | undefined;
|
|
394
|
+
adapter?: {
|
|
395
|
+
name: string;
|
|
396
|
+
hooks: {};
|
|
397
|
+
} | undefined;
|
|
398
|
+
base: string;
|
|
399
|
+
markdown: {
|
|
400
|
+
drafts: boolean;
|
|
401
|
+
syntaxHighlight: false | "shiki" | "prism";
|
|
402
|
+
shikiConfig: {
|
|
403
|
+
langs: ILanguageRegistration[];
|
|
404
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
405
|
+
wrap: boolean | null;
|
|
406
|
+
};
|
|
407
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
408
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
409
|
+
remarkRehype: RemarkRehype;
|
|
410
|
+
extendDefaultPlugins: boolean;
|
|
411
|
+
};
|
|
412
|
+
build: {
|
|
413
|
+
format: "file" | "directory";
|
|
414
|
+
};
|
|
415
|
+
root: URL;
|
|
416
|
+
srcDir: URL;
|
|
417
|
+
publicDir: URL;
|
|
418
|
+
outDir: URL;
|
|
419
|
+
trailingSlash: "never" | "always" | "ignore";
|
|
420
|
+
server: {
|
|
421
|
+
host: string | boolean;
|
|
422
|
+
port: number;
|
|
423
|
+
streaming: boolean;
|
|
424
|
+
};
|
|
425
|
+
output: "static" | "server";
|
|
426
|
+
integrations: {
|
|
427
|
+
name: string;
|
|
428
|
+
hooks: {};
|
|
429
|
+
}[];
|
|
430
|
+
style: {
|
|
431
|
+
postcss: {
|
|
432
|
+
options?: any;
|
|
433
|
+
plugins: any[];
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
vite: ViteUserConfig;
|
|
437
|
+
legacy: {
|
|
438
|
+
astroFlavoredMarkdown: boolean;
|
|
439
|
+
};
|
|
440
|
+
}, {
|
|
441
|
+
site?: string | undefined;
|
|
442
|
+
base?: string | undefined;
|
|
443
|
+
markdown?: {
|
|
444
|
+
drafts?: boolean | undefined;
|
|
445
|
+
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
446
|
+
shikiConfig?: {
|
|
447
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
448
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
449
|
+
wrap?: boolean | null | undefined;
|
|
450
|
+
} | undefined;
|
|
451
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
452
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
453
|
+
remarkRehype?: RemarkRehype | undefined;
|
|
454
|
+
extendDefaultPlugins?: boolean | undefined;
|
|
455
|
+
} | undefined;
|
|
456
|
+
build?: {
|
|
457
|
+
format?: "file" | "directory" | undefined;
|
|
458
|
+
} | undefined;
|
|
459
|
+
root?: string | undefined;
|
|
460
|
+
srcDir?: string | undefined;
|
|
461
|
+
publicDir?: string | undefined;
|
|
462
|
+
outDir?: string | undefined;
|
|
463
|
+
trailingSlash?: "never" | "always" | "ignore" | undefined;
|
|
464
|
+
server?: unknown;
|
|
465
|
+
output?: "static" | "server" | undefined;
|
|
466
|
+
adapter?: {
|
|
467
|
+
hooks?: {} | undefined;
|
|
468
|
+
name: string;
|
|
469
|
+
} | undefined;
|
|
470
|
+
integrations?: unknown;
|
|
471
|
+
style?: {
|
|
472
|
+
postcss?: unknown;
|
|
473
|
+
} | undefined;
|
|
474
|
+
vite?: ViteUserConfig | undefined;
|
|
475
|
+
legacy?: {
|
|
476
|
+
astroFlavoredMarkdown?: boolean | undefined;
|
|
477
|
+
} | undefined;
|
|
478
|
+
}>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import postcssrc from "postcss-load-config";
|
|
2
|
+
import { BUNDLED_THEMES } from "shiki";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { appendForwardSlash, prependForwardSlash, trimSlashes } from "../path.js";
|
|
6
|
+
import { isObject } from "../util.js";
|
|
7
|
+
const ASTRO_CONFIG_DEFAULTS = {
|
|
8
|
+
root: ".",
|
|
9
|
+
srcDir: "./src",
|
|
10
|
+
publicDir: "./public",
|
|
11
|
+
outDir: "./dist",
|
|
12
|
+
base: "/",
|
|
13
|
+
trailingSlash: "ignore",
|
|
14
|
+
build: { format: "directory" },
|
|
15
|
+
server: {
|
|
16
|
+
host: false,
|
|
17
|
+
port: 3e3,
|
|
18
|
+
streaming: true
|
|
19
|
+
},
|
|
20
|
+
style: { postcss: { options: {}, plugins: [] } },
|
|
21
|
+
integrations: [],
|
|
22
|
+
markdown: {
|
|
23
|
+
drafts: false,
|
|
24
|
+
syntaxHighlight: "shiki",
|
|
25
|
+
shikiConfig: {
|
|
26
|
+
langs: [],
|
|
27
|
+
theme: "github-dark",
|
|
28
|
+
wrap: false
|
|
29
|
+
},
|
|
30
|
+
remarkPlugins: [],
|
|
31
|
+
rehypePlugins: [],
|
|
32
|
+
remarkRehype: {}
|
|
33
|
+
},
|
|
34
|
+
vite: {},
|
|
35
|
+
legacy: {
|
|
36
|
+
astroFlavoredMarkdown: false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const AstroConfigSchema = z.object({
|
|
40
|
+
root: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.root).transform((val) => new URL(val)),
|
|
41
|
+
srcDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.srcDir).transform((val) => new URL(val)),
|
|
42
|
+
publicDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.publicDir).transform((val) => new URL(val)),
|
|
43
|
+
outDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.outDir).transform((val) => new URL(val)),
|
|
44
|
+
site: z.string().url().optional().transform((val) => val ? appendForwardSlash(val) : val),
|
|
45
|
+
base: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.base).transform((val) => prependForwardSlash(appendForwardSlash(trimSlashes(val)))),
|
|
46
|
+
trailingSlash: z.union([z.literal("always"), z.literal("never"), z.literal("ignore")]).optional().default(ASTRO_CONFIG_DEFAULTS.trailingSlash),
|
|
47
|
+
output: z.union([z.literal("static"), z.literal("server")]).optional().default("static"),
|
|
48
|
+
adapter: z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }).optional(),
|
|
49
|
+
integrations: z.preprocess(
|
|
50
|
+
(val) => Array.isArray(val) ? val.flat(Infinity).filter(Boolean) : val,
|
|
51
|
+
z.array(z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) })).default(ASTRO_CONFIG_DEFAULTS.integrations)
|
|
52
|
+
),
|
|
53
|
+
build: z.object({
|
|
54
|
+
format: z.union([z.literal("file"), z.literal("directory")]).optional().default(ASTRO_CONFIG_DEFAULTS.build.format)
|
|
55
|
+
}).optional().default({}),
|
|
56
|
+
server: z.preprocess(
|
|
57
|
+
(val) => typeof val === "function" ? val({ command: "error" }) : val,
|
|
58
|
+
z.object({
|
|
59
|
+
host: z.union([z.string(), z.boolean()]).optional().default(ASTRO_CONFIG_DEFAULTS.server.host),
|
|
60
|
+
port: z.number().optional().default(ASTRO_CONFIG_DEFAULTS.server.port)
|
|
61
|
+
}).optional().default({})
|
|
62
|
+
),
|
|
63
|
+
style: z.object({
|
|
64
|
+
postcss: z.object({
|
|
65
|
+
options: z.any(),
|
|
66
|
+
plugins: z.array(z.any())
|
|
67
|
+
}).optional().default(ASTRO_CONFIG_DEFAULTS.style.postcss)
|
|
68
|
+
}).optional().default({}),
|
|
69
|
+
markdown: z.object({
|
|
70
|
+
drafts: z.boolean().default(false),
|
|
71
|
+
syntaxHighlight: z.union([z.literal("shiki"), z.literal("prism"), z.literal(false)]).default(ASTRO_CONFIG_DEFAULTS.markdown.syntaxHighlight),
|
|
72
|
+
shikiConfig: z.object({
|
|
73
|
+
langs: z.custom().array().default([]),
|
|
74
|
+
theme: z.enum(BUNDLED_THEMES).or(z.custom()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.theme),
|
|
75
|
+
wrap: z.boolean().or(z.null()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.wrap)
|
|
76
|
+
}).default({}),
|
|
77
|
+
remarkPlugins: z.union([
|
|
78
|
+
z.string(),
|
|
79
|
+
z.tuple([z.string(), z.any()]),
|
|
80
|
+
z.custom((data) => typeof data === "function"),
|
|
81
|
+
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
82
|
+
]).array().default(ASTRO_CONFIG_DEFAULTS.markdown.remarkPlugins),
|
|
83
|
+
rehypePlugins: z.union([
|
|
84
|
+
z.string(),
|
|
85
|
+
z.tuple([z.string(), z.any()]),
|
|
86
|
+
z.custom((data) => typeof data === "function"),
|
|
87
|
+
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
88
|
+
]).array().default(ASTRO_CONFIG_DEFAULTS.markdown.rehypePlugins),
|
|
89
|
+
remarkRehype: z.custom((data) => data instanceof Object && !Array.isArray(data)).optional().default(ASTRO_CONFIG_DEFAULTS.markdown.remarkRehype),
|
|
90
|
+
extendDefaultPlugins: z.boolean().default(false)
|
|
91
|
+
}).default({}),
|
|
92
|
+
vite: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.vite),
|
|
93
|
+
legacy: z.object({
|
|
94
|
+
astroFlavoredMarkdown: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.legacy.astroFlavoredMarkdown)
|
|
95
|
+
}).optional().default({})
|
|
96
|
+
});
|
|
97
|
+
async function resolvePostcssConfig(inlineOptions, root) {
|
|
98
|
+
if (isObject(inlineOptions)) {
|
|
99
|
+
const options = { ...inlineOptions };
|
|
100
|
+
delete options.plugins;
|
|
101
|
+
return {
|
|
102
|
+
options,
|
|
103
|
+
plugins: inlineOptions.plugins || []
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const searchPath = typeof inlineOptions === "string" ? inlineOptions : fileURLToPath(root);
|
|
107
|
+
try {
|
|
108
|
+
return await postcssrc({}, searchPath);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
if (!/No PostCSS Config found/.test(err.message)) {
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
options: {},
|
|
115
|
+
plugins: []
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function createRelativeSchema(cmd, fileProtocolRoot) {
|
|
120
|
+
const AstroConfigRelativeSchema = AstroConfigSchema.extend({
|
|
121
|
+
root: z.string().default(ASTRO_CONFIG_DEFAULTS.root).transform((val) => new URL(appendForwardSlash(val), fileProtocolRoot)),
|
|
122
|
+
srcDir: z.string().default(ASTRO_CONFIG_DEFAULTS.srcDir).transform((val) => new URL(appendForwardSlash(val), fileProtocolRoot)),
|
|
123
|
+
publicDir: z.string().default(ASTRO_CONFIG_DEFAULTS.publicDir).transform((val) => new URL(appendForwardSlash(val), fileProtocolRoot)),
|
|
124
|
+
outDir: z.string().default(ASTRO_CONFIG_DEFAULTS.outDir).transform((val) => new URL(appendForwardSlash(val), fileProtocolRoot)),
|
|
125
|
+
server: z.preprocess(
|
|
126
|
+
(val) => typeof val === "function" ? val({ command: cmd === "dev" ? "dev" : "preview" }) : val,
|
|
127
|
+
z.object({
|
|
128
|
+
host: z.union([z.string(), z.boolean()]).optional().default(ASTRO_CONFIG_DEFAULTS.server.host),
|
|
129
|
+
port: z.number().optional().default(ASTRO_CONFIG_DEFAULTS.server.port),
|
|
130
|
+
streaming: z.boolean().optional().default(true)
|
|
131
|
+
}).optional().default({})
|
|
132
|
+
),
|
|
133
|
+
style: z.object({
|
|
134
|
+
postcss: z.preprocess(
|
|
135
|
+
(val) => resolvePostcssConfig(val, fileProtocolRoot),
|
|
136
|
+
z.object({
|
|
137
|
+
options: z.any(),
|
|
138
|
+
plugins: z.array(z.any())
|
|
139
|
+
}).optional().default(ASTRO_CONFIG_DEFAULTS.style.postcss)
|
|
140
|
+
)
|
|
141
|
+
}).optional().default({})
|
|
142
|
+
});
|
|
143
|
+
return AstroConfigRelativeSchema;
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
AstroConfigSchema,
|
|
147
|
+
createRelativeSchema
|
|
148
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TsConfigJson } from 'tsconfig-resolver';
|
|
2
|
+
import type { AstroConfig, AstroSettings } from '../../@types/astro';
|
|
3
|
+
export interface CreateSettings {
|
|
4
|
+
config: AstroConfig;
|
|
5
|
+
tsConfig?: TsConfigJson;
|
|
6
|
+
tsConfigPath?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSettings({ config, tsConfig, tsConfigPath }: CreateSettings): AstroSettings;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import jsxRenderer from "../../jsx/renderer.js";
|
|
2
|
+
function createSettings({ config, tsConfig, tsConfigPath }) {
|
|
3
|
+
return {
|
|
4
|
+
config,
|
|
5
|
+
tsConfig,
|
|
6
|
+
tsConfigPath,
|
|
7
|
+
adapter: void 0,
|
|
8
|
+
injectedRoutes: [],
|
|
9
|
+
pageExtensions: [".astro", ".md", ".html"],
|
|
10
|
+
renderers: [jsxRenderer],
|
|
11
|
+
scripts: []
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
createSettings
|
|
16
|
+
};
|