astro 6.3.8 → 6.4.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.
- package/components/Code.astro +1 -1
- package/dist/assets/fonts/config.d.ts +4 -4
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +16 -10
- package/dist/content/data-store.d.ts +1 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/runtime.d.ts +1 -1
- package/dist/content/runtime.js +3 -1
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +1 -1
- package/dist/core/app/entrypoints/node.d.ts +1 -1
- package/dist/core/app/entrypoints/node.js +2 -0
- package/dist/core/app/node.d.ts +16 -0
- package/dist/core/app/node.js +56 -13
- package/dist/core/build/static-build.js +13 -8
- package/dist/core/config/merge.js +4 -0
- package/dist/core/config/schemas/base.d.ts +16 -10
- package/dist/core/config/schemas/base.js +23 -3
- package/dist/core/config/schemas/relative.d.ts +60 -42
- package/dist/core/config/validate.js +52 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/fetch/fetch-state.js +49 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/preview/index.js +6 -5
- package/dist/core/preview/static-preview-server.js +2 -1
- package/dist/core/render/params-and-props.js +1 -1
- package/dist/core/render/route-cache.js +1 -1
- package/dist/core/routing/validation.js +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +6 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +13 -3
- package/dist/core/session/config.d.ts +1 -1
- package/dist/markdown/index.d.ts +4 -0
- package/dist/markdown/index.js +14 -0
- package/dist/prerender/utils.js +5 -1
- package/dist/types/public/config.d.ts +32 -1
- package/dist/types/public/content.d.ts +1 -1
- package/dist/types/public/index.d.ts +1 -1
- package/dist/types/public/integrations.d.ts +8 -0
- package/dist/vite-plugin-app/app.js +2 -9
- package/dist/vite-plugin-integrations-container/index.js +15 -6
- package/dist/vite-plugin-markdown/content-entry-type.js +7 -4
- package/dist/vite-plugin-markdown/images.js +9 -11
- package/dist/vite-plugin-markdown/index.js +12 -11
- package/package.json +4 -6
- package/dist/jsx/rehype.d.ts +0 -5
- package/dist/jsx/rehype.js +0 -241
|
@@ -21,10 +21,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
21
21
|
prefetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
22
22
|
prefetchAll: z.ZodOptional<z.ZodBoolean>;
|
|
23
23
|
defaultStrategy: z.ZodOptional<z.ZodEnum<{
|
|
24
|
-
load: "load";
|
|
25
24
|
tap: "tap";
|
|
26
25
|
hover: "hover";
|
|
27
26
|
viewport: "viewport";
|
|
27
|
+
load: "load";
|
|
28
28
|
}>>;
|
|
29
29
|
}, z.core.$strip>]>>;
|
|
30
30
|
image: z.ZodPrefault<z.ZodObject<{
|
|
@@ -46,9 +46,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
46
46
|
}, z.core.$strip>>>;
|
|
47
47
|
layout: z.ZodOptional<z.ZodEnum<{
|
|
48
48
|
fixed: "fixed";
|
|
49
|
-
none: "none";
|
|
50
49
|
constrained: "constrained";
|
|
51
50
|
"full-width": "full-width";
|
|
51
|
+
none: "none";
|
|
52
52
|
}>>;
|
|
53
53
|
objectFit: z.ZodOptional<z.ZodString>;
|
|
54
54
|
objectPosition: z.ZodOptional<z.ZodString>;
|
|
@@ -137,7 +137,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
137
137
|
"vitesse-black": "vitesse-black";
|
|
138
138
|
"vitesse-dark": "vitesse-dark";
|
|
139
139
|
"vitesse-light": "vitesse-light";
|
|
140
|
-
}>, z.ZodCustom<NonNullable<import("
|
|
140
|
+
}>, z.ZodCustom<NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj, NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj>]>>;
|
|
141
141
|
themes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<{
|
|
142
142
|
andromeeda: "andromeeda";
|
|
143
143
|
"aurora-x": "aurora-x";
|
|
@@ -204,7 +204,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
204
204
|
"vitesse-black": "vitesse-black";
|
|
205
205
|
"vitesse-dark": "vitesse-dark";
|
|
206
206
|
"vitesse-light": "vitesse-light";
|
|
207
|
-
}>, z.ZodCustom<NonNullable<import("
|
|
207
|
+
}>, z.ZodCustom<NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj, NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj>]>>>>;
|
|
208
208
|
defaultColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"light">, z.ZodLiteral<"dark">, z.ZodString, z.ZodLiteral<false>]>>;
|
|
209
209
|
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
210
210
|
transformers: z.ZodDefault<z.ZodArray<z.ZodCustom<import("shiki").ShikiTransformer & import("./base.js").ComplexifyUnionObj, import("shiki").ShikiTransformer & import("./base.js").ComplexifyUnionObj>>>;
|
|
@@ -212,8 +212,14 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
212
212
|
remarkPlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodCustom<import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj, import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj>, z.ZodTuple<[z.ZodCustom<import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj, import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj>, z.ZodAny], null>]>>>;
|
|
213
213
|
rehypePlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodCustom<import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj, import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj>, z.ZodTuple<[z.ZodCustom<import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj, import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj>, z.ZodAny], null>]>>>;
|
|
214
214
|
remarkRehype: z.ZodDefault<z.ZodCustom<import("./base.js").RemarkRehype, import("./base.js").RemarkRehype>>;
|
|
215
|
-
gfm: z.
|
|
216
|
-
smartypants: z.
|
|
215
|
+
gfm: z.ZodOptional<z.ZodBoolean>;
|
|
216
|
+
smartypants: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<import("./base.js").Smartypants, unknown, z.core.$ZodTypeInternals<import("./base.js").Smartypants, unknown>>]>, z.ZodTransform<false | import("./base.js").Smartypants, boolean | import("./base.js").Smartypants>>>;
|
|
217
|
+
processor: z.ZodDefault<z.ZodObject<{
|
|
218
|
+
name: z.ZodString;
|
|
219
|
+
options: z.ZodDefault<z.ZodCustom<object, object>>;
|
|
220
|
+
createRenderer: z.ZodCustom<(shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>, (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>>;
|
|
221
|
+
createMdxRenderer: z.ZodOptional<z.ZodCustom<((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined, ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined>>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
217
223
|
}, z.core.$strip>>;
|
|
218
224
|
vite: z.ZodDefault<z.ZodCustom<import("../../../index.js").ViteUserConfig, import("../../../index.js").ViteUserConfig>>;
|
|
219
225
|
i18n: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
@@ -323,9 +329,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
323
329
|
path: z.ZodOptional<z.ZodString>;
|
|
324
330
|
maxAge: z.ZodOptional<z.ZodNumber>;
|
|
325
331
|
sameSite: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
332
|
+
none: "none";
|
|
326
333
|
strict: "strict";
|
|
327
334
|
lax: "lax";
|
|
328
|
-
none: "none";
|
|
329
335
|
}>, z.ZodBoolean]>>;
|
|
330
336
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
331
337
|
}, z.core.$strip>, z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
@@ -369,11 +375,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
369
375
|
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
370
376
|
optimizedFallbacks: z.ZodOptional<z.ZodBoolean>;
|
|
371
377
|
display: z.ZodOptional<z.ZodEnum<{
|
|
372
|
-
optional: "optional";
|
|
373
378
|
auto: "auto";
|
|
379
|
+
optional: "optional";
|
|
380
|
+
fallback: "fallback";
|
|
374
381
|
block: "block";
|
|
375
382
|
swap: "swap";
|
|
376
|
-
fallback: "fallback";
|
|
377
383
|
}>>;
|
|
378
384
|
stretch: z.ZodOptional<z.ZodString>;
|
|
379
385
|
featureSettings: z.ZodOptional<z.ZodString>;
|
|
@@ -436,8 +442,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
436
442
|
redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
437
443
|
inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
438
444
|
never: "never";
|
|
439
|
-
auto: "auto";
|
|
440
445
|
always: "always";
|
|
446
|
+
auto: "auto";
|
|
441
447
|
}>>>;
|
|
442
448
|
concurrency: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
443
449
|
}, z.core.$strip>>>;
|
|
@@ -481,7 +487,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
481
487
|
pathname?: string | undefined;
|
|
482
488
|
}[];
|
|
483
489
|
responsiveStyles: boolean;
|
|
484
|
-
layout?: "fixed" | "
|
|
490
|
+
layout?: "fixed" | "constrained" | "full-width" | "none" | undefined;
|
|
485
491
|
objectFit?: string | undefined;
|
|
486
492
|
objectPosition?: string | undefined;
|
|
487
493
|
breakpoints?: number[] | undefined;
|
|
@@ -498,17 +504,23 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
498
504
|
shikiConfig: {
|
|
499
505
|
langs: (import("shiki").LanguageRegistration & import("./base.js").ComplexifyUnionObj)[];
|
|
500
506
|
langAlias: Record<string, string>;
|
|
501
|
-
theme: "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<import("
|
|
502
|
-
themes: Record<string, "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<import("
|
|
507
|
+
theme: "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj);
|
|
508
|
+
themes: Record<string, "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj)>;
|
|
503
509
|
wrap: boolean | null;
|
|
504
510
|
transformers: (import("shiki").ShikiTransformer & import("./base.js").ComplexifyUnionObj)[];
|
|
505
511
|
defaultColor?: string | false | undefined;
|
|
506
512
|
};
|
|
507
|
-
remarkPlugins: (string | (import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj) | [
|
|
508
|
-
rehypePlugins: (string | (import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj) | [
|
|
513
|
+
remarkPlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj, any])[];
|
|
514
|
+
rehypePlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj, any])[];
|
|
509
515
|
remarkRehype: import("./base.js").RemarkRehype;
|
|
510
|
-
|
|
511
|
-
|
|
516
|
+
processor: {
|
|
517
|
+
name: string;
|
|
518
|
+
options: object;
|
|
519
|
+
createRenderer: (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>;
|
|
520
|
+
createMdxRenderer?: ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined;
|
|
521
|
+
};
|
|
522
|
+
gfm?: boolean | undefined;
|
|
523
|
+
smartypants?: false | import("./base.js").Smartypants | undefined;
|
|
512
524
|
};
|
|
513
525
|
vite: import("../../../index.js").ViteUserConfig;
|
|
514
526
|
security: {
|
|
@@ -545,6 +557,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
545
557
|
context: "server";
|
|
546
558
|
access: "secret";
|
|
547
559
|
}) & ({
|
|
560
|
+
type: "enum";
|
|
561
|
+
values: string[];
|
|
562
|
+
optional?: boolean | undefined;
|
|
563
|
+
default?: string | undefined;
|
|
564
|
+
} | {
|
|
548
565
|
type: "string";
|
|
549
566
|
optional?: boolean | undefined;
|
|
550
567
|
default?: string | undefined;
|
|
@@ -564,11 +581,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
564
581
|
lt?: number | undefined;
|
|
565
582
|
max?: number | undefined;
|
|
566
583
|
int?: boolean | undefined;
|
|
567
|
-
} | {
|
|
568
|
-
type: "enum";
|
|
569
|
-
values: string[];
|
|
570
|
-
optional?: boolean | undefined;
|
|
571
|
-
default?: string | undefined;
|
|
572
584
|
} | {
|
|
573
585
|
type: "boolean";
|
|
574
586
|
optional?: boolean | undefined;
|
|
@@ -627,7 +639,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
627
639
|
assets: string;
|
|
628
640
|
serverEntry: string;
|
|
629
641
|
redirects: boolean;
|
|
630
|
-
inlineStylesheets: "never" | "
|
|
642
|
+
inlineStylesheets: "never" | "always" | "auto";
|
|
631
643
|
concurrency: number;
|
|
632
644
|
assetsPrefix?: string | ({
|
|
633
645
|
fallback: string;
|
|
@@ -649,7 +661,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
649
661
|
} | undefined;
|
|
650
662
|
prefetch?: boolean | {
|
|
651
663
|
prefetchAll?: boolean | undefined;
|
|
652
|
-
defaultStrategy?: "
|
|
664
|
+
defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
|
|
653
665
|
} | undefined;
|
|
654
666
|
i18n?: {
|
|
655
667
|
defaultLocale: string;
|
|
@@ -678,7 +690,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
678
690
|
domain?: string | undefined;
|
|
679
691
|
path?: string | undefined;
|
|
680
692
|
maxAge?: number | undefined;
|
|
681
|
-
sameSite?: boolean | "
|
|
693
|
+
sameSite?: boolean | "none" | "strict" | "lax" | undefined;
|
|
682
694
|
secure?: boolean | undefined;
|
|
683
695
|
} | undefined;
|
|
684
696
|
ttl?: number | undefined;
|
|
@@ -693,7 +705,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
693
705
|
formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
|
|
694
706
|
fallbacks?: string[] | undefined;
|
|
695
707
|
optimizedFallbacks?: boolean | undefined;
|
|
696
|
-
display?: "
|
|
708
|
+
display?: "auto" | "optional" | "fallback" | "block" | "swap" | undefined;
|
|
697
709
|
stretch?: string | undefined;
|
|
698
710
|
featureSettings?: string | undefined;
|
|
699
711
|
variationSettings?: string | undefined;
|
|
@@ -733,7 +745,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
733
745
|
pathname?: string | undefined;
|
|
734
746
|
}[];
|
|
735
747
|
responsiveStyles: boolean;
|
|
736
|
-
layout?: "fixed" | "
|
|
748
|
+
layout?: "fixed" | "constrained" | "full-width" | "none" | undefined;
|
|
737
749
|
objectFit?: string | undefined;
|
|
738
750
|
objectPosition?: string | undefined;
|
|
739
751
|
breakpoints?: number[] | undefined;
|
|
@@ -750,17 +762,23 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
750
762
|
shikiConfig: {
|
|
751
763
|
langs: (import("shiki").LanguageRegistration & import("./base.js").ComplexifyUnionObj)[];
|
|
752
764
|
langAlias: Record<string, string>;
|
|
753
|
-
theme: "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<import("
|
|
754
|
-
themes: Record<string, "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<import("
|
|
765
|
+
theme: "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj);
|
|
766
|
+
themes: Record<string, "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("./base.js").ComplexifyUnionObj)>;
|
|
755
767
|
wrap: boolean | null;
|
|
756
768
|
transformers: (import("shiki").ShikiTransformer & import("./base.js").ComplexifyUnionObj)[];
|
|
757
769
|
defaultColor?: string | false | undefined;
|
|
758
770
|
};
|
|
759
|
-
remarkPlugins: (string | (import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj) | [
|
|
760
|
-
rehypePlugins: (string | (import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj) | [
|
|
771
|
+
remarkPlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RemarkPlugin & import("./base.js").ComplexifyUnionObj, any])[];
|
|
772
|
+
rehypePlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RehypePlugin & import("./base.js").ComplexifyUnionObj, any])[];
|
|
761
773
|
remarkRehype: import("./base.js").RemarkRehype;
|
|
762
|
-
|
|
763
|
-
|
|
774
|
+
processor: {
|
|
775
|
+
name: string;
|
|
776
|
+
options: object;
|
|
777
|
+
createRenderer: (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>;
|
|
778
|
+
createMdxRenderer?: ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined;
|
|
779
|
+
};
|
|
780
|
+
gfm?: boolean | undefined;
|
|
781
|
+
smartypants?: false | import("./base.js").Smartypants | undefined;
|
|
764
782
|
};
|
|
765
783
|
vite: import("../../../index.js").ViteUserConfig;
|
|
766
784
|
security: {
|
|
@@ -797,6 +815,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
797
815
|
context: "server";
|
|
798
816
|
access: "secret";
|
|
799
817
|
}) & ({
|
|
818
|
+
type: "enum";
|
|
819
|
+
values: string[];
|
|
820
|
+
optional?: boolean | undefined;
|
|
821
|
+
default?: string | undefined;
|
|
822
|
+
} | {
|
|
800
823
|
type: "string";
|
|
801
824
|
optional?: boolean | undefined;
|
|
802
825
|
default?: string | undefined;
|
|
@@ -816,11 +839,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
816
839
|
lt?: number | undefined;
|
|
817
840
|
max?: number | undefined;
|
|
818
841
|
int?: boolean | undefined;
|
|
819
|
-
} | {
|
|
820
|
-
type: "enum";
|
|
821
|
-
values: string[];
|
|
822
|
-
optional?: boolean | undefined;
|
|
823
|
-
default?: string | undefined;
|
|
824
842
|
} | {
|
|
825
843
|
type: "boolean";
|
|
826
844
|
optional?: boolean | undefined;
|
|
@@ -879,7 +897,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
879
897
|
assets: string;
|
|
880
898
|
serverEntry: string;
|
|
881
899
|
redirects: boolean;
|
|
882
|
-
inlineStylesheets: "never" | "
|
|
900
|
+
inlineStylesheets: "never" | "always" | "auto";
|
|
883
901
|
concurrency: number;
|
|
884
902
|
assetsPrefix?: string | ({
|
|
885
903
|
fallback: string;
|
|
@@ -901,7 +919,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
901
919
|
} | undefined;
|
|
902
920
|
prefetch?: boolean | {
|
|
903
921
|
prefetchAll?: boolean | undefined;
|
|
904
|
-
defaultStrategy?: "
|
|
922
|
+
defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
|
|
905
923
|
} | undefined;
|
|
906
924
|
i18n?: {
|
|
907
925
|
defaultLocale: string;
|
|
@@ -930,7 +948,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
930
948
|
domain?: string | undefined;
|
|
931
949
|
path?: string | undefined;
|
|
932
950
|
maxAge?: number | undefined;
|
|
933
|
-
sameSite?: boolean | "
|
|
951
|
+
sameSite?: boolean | "none" | "strict" | "lax" | undefined;
|
|
934
952
|
secure?: boolean | undefined;
|
|
935
953
|
} | undefined;
|
|
936
954
|
ttl?: number | undefined;
|
|
@@ -945,7 +963,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
945
963
|
formats?: ["woff2" | "woff" | "otf" | "ttf" | "eot", ...("woff2" | "woff" | "otf" | "ttf" | "eot")[]] | undefined;
|
|
946
964
|
fallbacks?: string[] | undefined;
|
|
947
965
|
optimizedFallbacks?: boolean | undefined;
|
|
948
|
-
display?: "
|
|
966
|
+
display?: "auto" | "optional" | "fallback" | "block" | "swap" | undefined;
|
|
949
967
|
stretch?: string | undefined;
|
|
950
968
|
featureSettings?: string | undefined;
|
|
951
969
|
variationSettings?: string | undefined;
|
|
@@ -2,6 +2,8 @@ import { errorMap } from "../errors/index.js";
|
|
|
2
2
|
import { AstroConfigRefinedSchema, createRelativeSchema } from "./schemas/index.js";
|
|
3
3
|
async function validateConfig(userConfig, root, cmd) {
|
|
4
4
|
const AstroConfigRelativeSchema = createRelativeSchema(cmd, root);
|
|
5
|
+
await coerceLegacyMarkdownPlugins(userConfig);
|
|
6
|
+
warnDeprecatedMarkdownOptions(userConfig);
|
|
5
7
|
return await validateConfigRefined(
|
|
6
8
|
await AstroConfigRelativeSchema.parseAsync(userConfig, {
|
|
7
9
|
error(issue) {
|
|
@@ -17,7 +19,57 @@ See https://docs.astro.build/en/reference/experimental-flags/ for a list of all
|
|
|
17
19
|
})
|
|
18
20
|
);
|
|
19
21
|
}
|
|
22
|
+
let didWarnAboutDeprecatedMarkdownOptions = false;
|
|
23
|
+
function warnDeprecatedMarkdownOptions(config) {
|
|
24
|
+
if (didWarnAboutDeprecatedMarkdownOptions) return;
|
|
25
|
+
const md = config?.markdown;
|
|
26
|
+
if (!md) return;
|
|
27
|
+
const deprecated = ["gfm", "smartypants"].filter((k) => md[k] !== void 0);
|
|
28
|
+
if (deprecated.length === 0) return;
|
|
29
|
+
didWarnAboutDeprecatedMarkdownOptions = true;
|
|
30
|
+
const names = deprecated.map((key) => `\`markdown.${key}\``).join(" and ");
|
|
31
|
+
const isPlural = deprecated.length > 1;
|
|
32
|
+
console.warn(
|
|
33
|
+
`[astro] ${names} ${isPlural ? "are" : "is"} deprecated. Move ${isPlural ? "them" : "it"} onto your processor instead (e.g. \`unified({ gfm: false, smartypants: false })\`). Will be removed in a future major.`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
let didWarnAboutLegacyMarkdownPlugins = false;
|
|
37
|
+
let didWarnAboutProcessorMismatch = false;
|
|
38
|
+
async function coerceLegacyMarkdownPlugins(config) {
|
|
39
|
+
const md = config?.markdown;
|
|
40
|
+
if (!md) return;
|
|
41
|
+
const remarkPlugins = md.remarkPlugins ?? [];
|
|
42
|
+
const rehypePlugins = md.rehypePlugins ?? [];
|
|
43
|
+
const remarkRehype = md.remarkRehype ?? {};
|
|
44
|
+
if (remarkPlugins.length === 0 && rehypePlugins.length === 0 && Object.keys(remarkRehype).length === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const { unified, isUnifiedProcessor } = await import("@astrojs/markdown-remark");
|
|
48
|
+
const current = md.processor;
|
|
49
|
+
if (!current || isUnifiedProcessor(current)) {
|
|
50
|
+
const target = current ?? (md.processor = unified());
|
|
51
|
+
target.options.remarkPlugins.push(...remarkPlugins);
|
|
52
|
+
target.options.rehypePlugins.push(...rehypePlugins);
|
|
53
|
+
Object.assign(target.options.remarkRehype, remarkRehype);
|
|
54
|
+
if (!didWarnAboutLegacyMarkdownPlugins) {
|
|
55
|
+
didWarnAboutLegacyMarkdownPlugins = true;
|
|
56
|
+
console.warn(
|
|
57
|
+
"[astro] `markdown.remarkPlugins`, `markdown.rehypePlugins`, and `markdown.remarkRehype` are deprecated. Pass them to `unified({...})` from `@astrojs/markdown-remark` directly instead."
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
delete md.remarkPlugins;
|
|
61
|
+
delete md.rehypePlugins;
|
|
62
|
+
delete md.remarkRehype;
|
|
63
|
+
} else if (!didWarnAboutProcessorMismatch) {
|
|
64
|
+
didWarnAboutProcessorMismatch = true;
|
|
65
|
+
console.warn(
|
|
66
|
+
`[astro] \`markdown.remarkPlugins\`/\`rehypePlugins\`/\`remarkRehype\` are set, but your \`${current.name}\` processor doesn't run them. Move them to \`unified({...})\` from \`@astrojs/markdown-remark\` and set \`markdown.processor: unified({...})\` if you want them to apply.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
20
70
|
async function validateConfigRefined(updatedConfig) {
|
|
71
|
+
await coerceLegacyMarkdownPlugins(updatedConfig);
|
|
72
|
+
warnDeprecatedMarkdownOptions(updatedConfig);
|
|
21
73
|
return await AstroConfigRefinedSchema.parseAsync(updatedConfig, { error: errorMap });
|
|
22
74
|
}
|
|
23
75
|
export {
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -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.
|
|
40
|
+
const currentVersion = "6.4.0";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -32,6 +32,7 @@ import { normalizeUrl } from "../util/normalized-url.js";
|
|
|
32
32
|
import { getOriginPathname, setOriginPathname } from "../routing/rewrite.js";
|
|
33
33
|
import { routeHasHtmlExtension } from "../routing/helpers.js";
|
|
34
34
|
import { getRenderOptions } from "../app/render-options.js";
|
|
35
|
+
import { getFirstForwardedValue, validateForwardedHeaders } from "../app/validate-headers.js";
|
|
35
36
|
function getFetchStateFromAPIContext(context) {
|
|
36
37
|
const state = context[fetchStateSymbol];
|
|
37
38
|
if (!state) {
|
|
@@ -164,6 +165,9 @@ class FetchState {
|
|
|
164
165
|
this.locals = options?.locals ?? {};
|
|
165
166
|
this.url = normalizeUrl(url);
|
|
166
167
|
this.cookies = new AstroCookies(request);
|
|
168
|
+
if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0) {
|
|
169
|
+
this.#applyForwardedHeaders();
|
|
170
|
+
}
|
|
167
171
|
if (!Reflect.get(request, originPathnameSymbol)) {
|
|
168
172
|
setOriginPathname(
|
|
169
173
|
request,
|
|
@@ -646,6 +650,51 @@ class FetchState {
|
|
|
646
650
|
return pathname;
|
|
647
651
|
}
|
|
648
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* Reads X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port
|
|
655
|
+
* from the request headers, validates them against the manifest's
|
|
656
|
+
* `allowedDomains`, and updates `this.url` accordingly. Also resolves
|
|
657
|
+
* `clientAddress` from X-Forwarded-For when the host is trusted.
|
|
658
|
+
*
|
|
659
|
+
* Only called when `allowedDomains` is configured — without it,
|
|
660
|
+
* forwarded headers are never trusted.
|
|
661
|
+
*/
|
|
662
|
+
#applyForwardedHeaders() {
|
|
663
|
+
const headers = this.request.headers;
|
|
664
|
+
const allowedDomains = this.pipeline.manifest.allowedDomains;
|
|
665
|
+
const validated = validateForwardedHeaders(
|
|
666
|
+
getFirstForwardedValue(headers.get("x-forwarded-proto") ?? void 0),
|
|
667
|
+
getFirstForwardedValue(headers.get("x-forwarded-host") ?? void 0),
|
|
668
|
+
getFirstForwardedValue(headers.get("x-forwarded-port") ?? void 0),
|
|
669
|
+
allowedDomains
|
|
670
|
+
);
|
|
671
|
+
if (!validated.protocol && !validated.host && !validated.port) return;
|
|
672
|
+
if (validated.protocol) {
|
|
673
|
+
this.url.protocol = validated.protocol + ":";
|
|
674
|
+
}
|
|
675
|
+
if (validated.host) {
|
|
676
|
+
const colonIdx = validated.host.indexOf(":");
|
|
677
|
+
if (colonIdx !== -1) {
|
|
678
|
+
this.url.hostname = validated.host.slice(0, colonIdx);
|
|
679
|
+
this.url.port = validated.host.slice(colonIdx + 1);
|
|
680
|
+
} else {
|
|
681
|
+
this.url.hostname = validated.host;
|
|
682
|
+
this.url.port = "";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if (validated.port) {
|
|
686
|
+
this.url.port = validated.port;
|
|
687
|
+
}
|
|
688
|
+
const hostTrusted = validated.host !== void 0;
|
|
689
|
+
if (hostTrusted && !this.clientAddress) {
|
|
690
|
+
const forwardedFor = getFirstForwardedValue(
|
|
691
|
+
this.request.headers.get("x-forwarded-for") ?? void 0
|
|
692
|
+
);
|
|
693
|
+
if (forwardedFor) {
|
|
694
|
+
this.clientAddress = forwardedFor;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
649
698
|
/**
|
|
650
699
|
* Returns the resolved `props` for this render, computing them lazily
|
|
651
700
|
* from the route + component module on first access. If the
|
|
@@ -9,7 +9,7 @@ import { resolveConfig } from "../config/config.js";
|
|
|
9
9
|
import { loadOrCreateNodeLogger } from "../logger/load.js";
|
|
10
10
|
import { createSettings } from "../config/settings.js";
|
|
11
11
|
import { createRoutesList } from "../routing/create-manifest.js";
|
|
12
|
-
import { getPrerenderDefault } from "../../prerender/utils.js";
|
|
12
|
+
import { getClientOutputDirectory, getPrerenderDefault } from "../../prerender/utils.js";
|
|
13
13
|
import { ensureProcessNodeEnv } from "../util.js";
|
|
14
14
|
import createStaticPreviewServer from "./static-preview-server.js";
|
|
15
15
|
import { getResolvedHostForHttpServer } from "./util.js";
|
|
@@ -28,12 +28,13 @@ async function preview(inlineConfig) {
|
|
|
28
28
|
command: "preview",
|
|
29
29
|
logger
|
|
30
30
|
});
|
|
31
|
-
await createRoutesList({ settings, cwd: inlineConfig.root }, logger);
|
|
32
31
|
settings.buildOutput = getPrerenderDefault(settings.config) ? "static" : "server";
|
|
32
|
+
await createRoutesList({ settings, cwd: inlineConfig.root }, logger);
|
|
33
33
|
await runHookConfigDone({ settings, logger, command: "preview" });
|
|
34
|
-
if (settings.buildOutput === "static") {
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (settings.buildOutput === "static" && !settings.adapter?.previewEntrypoint) {
|
|
35
|
+
const clientOutDir = getClientOutputDirectory(settings);
|
|
36
|
+
if (!fs.existsSync(clientOutDir)) {
|
|
37
|
+
const outDirPath = fileURLToPath(clientOutDir);
|
|
37
38
|
throw new Error(
|
|
38
39
|
`[preview] The output directory ${outDirPath} does not exist. Did you run \`astro build\`?`
|
|
39
40
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { mergeConfig, preview } from "vite";
|
|
4
|
+
import { getClientOutputDirectory } from "../../prerender/utils.js";
|
|
4
5
|
import * as msg from "../messages/runtime.js";
|
|
5
6
|
import { getResolvedHostForHttpServer } from "./util.js";
|
|
6
7
|
import { vitePluginAstroPreview } from "./vite-plugin-astro-preview.js";
|
|
@@ -15,7 +16,7 @@ async function createStaticPreviewServer(settings, logger) {
|
|
|
15
16
|
base: settings.config.base,
|
|
16
17
|
appType: "mpa",
|
|
17
18
|
build: {
|
|
18
|
-
outDir: fileURLToPath(settings
|
|
19
|
+
outDir: fileURLToPath(getClientOutputDirectory(settings))
|
|
19
20
|
},
|
|
20
21
|
root: fileURLToPath(settings.config.root),
|
|
21
22
|
preview: {
|
|
@@ -29,7 +29,7 @@ async function getProps(opts) {
|
|
|
29
29
|
});
|
|
30
30
|
const params = getParams(route, pathname);
|
|
31
31
|
const matchedStaticPath = findPathItemByKey(staticPaths, params, route, logger, trailingSlash);
|
|
32
|
-
if (!matchedStaticPath && (serverLike ? route.prerender : true)) {
|
|
32
|
+
if (!matchedStaticPath && route.origin !== "internal" && (serverLike ? route.prerender : true)) {
|
|
33
33
|
throw new AstroError({
|
|
34
34
|
...AstroErrorData.NoMatchingStaticPathFound,
|
|
35
35
|
message: AstroErrorData.NoMatchingStaticPathFound.message(pathname),
|
|
@@ -17,7 +17,7 @@ async function callGetStaticPaths({
|
|
|
17
17
|
return cached.staticPaths;
|
|
18
18
|
}
|
|
19
19
|
validateDynamicRouteModule(mod, { ssr, route });
|
|
20
|
-
if (ssr && !route.prerender) {
|
|
20
|
+
if (ssr && !route.prerender || route.origin === "internal") {
|
|
21
21
|
const entry = Object.assign([], { keyed: /* @__PURE__ */ new Map() });
|
|
22
22
|
routeCache.set(route, { ...cached, mod, staticPaths: entry });
|
|
23
23
|
return entry;
|
|
@@ -3,7 +3,7 @@ function validateDynamicRouteModule(mod, {
|
|
|
3
3
|
ssr,
|
|
4
4
|
route
|
|
5
5
|
}) {
|
|
6
|
-
if ((!ssr || route.prerender) && !mod.getStaticPaths) {
|
|
6
|
+
if ((!ssr || route.prerender) && route.origin !== "internal" && !mod.getStaticPaths) {
|
|
7
7
|
throw new AstroError({
|
|
8
8
|
...AstroErrorData.GetStaticPathsRequired,
|
|
9
9
|
location: { file: route.component }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Plugin as VitePlugin } from 'vite';
|
|
1
|
+
import type { BuildEnvironment, Plugin as VitePlugin } from 'vite';
|
|
2
2
|
import type { AstroPluginOptions } from '../../types/astro.js';
|
|
3
3
|
import type { ServerIslandsState } from './shared-state.js';
|
|
4
4
|
export declare const SERVER_ISLAND_MANIFEST = "virtual:astro:server-island-manifest";
|
|
@@ -6,3 +6,8 @@ export declare const SERVER_ISLAND_MAP_MARKER = "$$server-islands-map$$";
|
|
|
6
6
|
export declare function vitePluginServerIslands({ settings, serverIslandsState, }: AstroPluginOptions & {
|
|
7
7
|
serverIslandsState: ServerIslandsState;
|
|
8
8
|
}): VitePlugin;
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the prerender environment discovered any server islands during the build.
|
|
11
|
+
* This encapsulates the logic of finding the server islands plugin and querying its state.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasServerIslands(environment: BuildEnvironment): boolean;
|
|
@@ -28,6 +28,11 @@ function vitePluginServerIslands({
|
|
|
28
28
|
return {
|
|
29
29
|
name: "astro:server-islands",
|
|
30
30
|
enforce: "post",
|
|
31
|
+
api: {
|
|
32
|
+
hasServerIslands() {
|
|
33
|
+
return serverIslandsState.hasIslands();
|
|
34
|
+
}
|
|
35
|
+
},
|
|
31
36
|
config(_config, { command: _command }) {
|
|
32
37
|
command = _command;
|
|
33
38
|
},
|
|
@@ -111,9 +116,8 @@ export const serverIslandNameMap = ${serverIslandPlaceholderNameMap};`
|
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
if (id === RESOLVED_SERVER_ISLAND_MANIFEST) {
|
|
114
|
-
if (command === "build"
|
|
115
|
-
|
|
116
|
-
if (hasServerIslands && settings.buildOutput !== "server") {
|
|
119
|
+
if (command === "build") {
|
|
120
|
+
if (serverIslandsState.hasIslands() && !settings.adapter) {
|
|
117
121
|
throw new AstroError(AstroErrorData.NoAdapterInstalledServerIslands);
|
|
118
122
|
}
|
|
119
123
|
}
|
|
@@ -163,8 +167,14 @@ export const serverIslandNameMap = ${serverIslandPlaceholderNameMap};`
|
|
|
163
167
|
}
|
|
164
168
|
};
|
|
165
169
|
}
|
|
170
|
+
function hasServerIslands(environment) {
|
|
171
|
+
const plugins = environment.config.plugins ?? [];
|
|
172
|
+
const serverIslandsPlugin = plugins.find((p) => p.name === "astro:server-islands");
|
|
173
|
+
return typeof serverIslandsPlugin?.api?.hasServerIslands === "function" && serverIslandsPlugin.api.hasServerIslands();
|
|
174
|
+
}
|
|
166
175
|
export {
|
|
167
176
|
SERVER_ISLAND_MANIFEST,
|
|
168
177
|
SERVER_ISLAND_MAP_MARKER,
|
|
178
|
+
hasServerIslands,
|
|
169
179
|
vitePluginServerIslands
|
|
170
180
|
};
|
|
@@ -15,9 +15,9 @@ export declare const SessionSchema: z.ZodObject<{
|
|
|
15
15
|
path: z.ZodOptional<z.ZodString>;
|
|
16
16
|
maxAge: z.ZodOptional<z.ZodNumber>;
|
|
17
17
|
sameSite: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
18
|
+
none: "none";
|
|
18
19
|
strict: "strict";
|
|
19
20
|
lax: "lax";
|
|
20
|
-
none: "none";
|
|
21
21
|
}>, z.ZodBoolean]>>;
|
|
22
22
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
23
23
|
}, z.core.$strip>, z.ZodPipe<z.ZodString, z.ZodTransform<{
|