astro 4.11.6 → 4.12.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/client.d.ts +1 -0
- package/components/Code.astro +12 -0
- package/dist/@types/astro.d.ts +154 -74
- package/dist/actions/index.d.ts +4 -1
- package/dist/actions/index.js +15 -10
- package/dist/assets/internal.js +5 -12
- package/dist/assets/utils/index.d.ts +2 -1
- package/dist/assets/utils/index.js +3 -1
- package/dist/assets/utils/{emitAsset.d.ts → node/emitAsset.d.ts} +1 -1
- package/dist/assets/utils/{emitAsset.js → node/emitAsset.js} +2 -2
- package/dist/assets/utils/remoteProbe.d.ts +2 -2
- package/dist/assets/utils/remoteProbe.js +13 -6
- package/dist/assets/vite-plugin-assets.js +2 -1
- package/dist/cli/check/index.js +7 -5
- package/dist/cli/sync/index.d.ts +1 -1
- package/dist/cli/sync/index.js +6 -3
- package/dist/container/index.js +3 -1
- package/dist/content/runtime-assets.js +1 -1
- package/dist/content/vite-plugin-content-virtual-mod.js +4 -8
- package/dist/core/app/common.js +3 -1
- package/dist/core/app/index.js +3 -2
- package/dist/core/app/pipeline.d.ts +1 -1
- package/dist/core/app/pipeline.js +11 -11
- package/dist/core/app/types.d.ts +6 -2
- package/dist/core/base-pipeline.d.ts +21 -1
- package/dist/core/base-pipeline.js +3 -1
- package/dist/core/build/generate.js +1 -0
- package/dist/core/build/index.js +10 -6
- package/dist/core/build/pipeline.d.ts +6 -0
- package/dist/core/build/pipeline.js +11 -8
- package/dist/core/build/plugins/plugin-manifest.js +3 -1
- package/dist/core/build/plugins/plugin-ssr.js +8 -4
- package/dist/core/build/static-build.js +5 -5
- package/dist/core/config/schema.d.ts +37 -0
- package/dist/core/config/schema.js +5 -2
- package/dist/core/config/settings.js +2 -0
- package/dist/core/constants.d.ts +7 -0
- package/dist/core/constants.js +5 -1
- package/dist/core/create-vite.js +2 -2
- package/dist/core/dev/container.js +8 -0
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -2
- package/dist/core/errors/errors-data.d.ts +2 -10
- package/dist/core/errors/errors-data.js +0 -6
- package/dist/core/errors/overlay.js +6 -7
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/callMiddleware.js +6 -6
- package/dist/core/redirects/render.js +1 -2
- package/dist/core/render/paginate.js +8 -1
- package/dist/core/render-context.js +8 -1
- package/dist/core/routing/astro-designed-error-pages.d.ts +2 -7
- package/dist/core/routing/astro-designed-error-pages.js +4 -1
- package/dist/core/routing/default.d.ts +10 -0
- package/dist/core/routing/default.js +38 -0
- package/dist/core/routing/manifest/create.d.ts +1 -2
- package/dist/core/routing/manifest/create.js +2 -34
- package/dist/core/routing/manifest/pattern.d.ts +2 -0
- package/dist/core/routing/manifest/pattern.js +35 -0
- package/dist/core/server-islands/endpoint.d.ts +8 -0
- package/dist/core/server-islands/endpoint.js +76 -0
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +7 -0
- package/dist/core/server-islands/vite-plugin-server-islands.js +82 -0
- package/dist/core/sync/index.d.ts +13 -5
- package/dist/core/sync/index.js +36 -23
- package/dist/core/sync/setup-env-ts.d.ts +8 -0
- package/dist/{vite-plugin-inject-env-ts/index.js → core/sync/setup-env-ts.js} +11 -28
- package/dist/env/errors.d.ts +7 -0
- package/dist/env/errors.js +16 -0
- package/dist/env/runtime.d.ts +4 -3
- package/dist/env/runtime.js +9 -5
- package/dist/env/validators.d.ts +5 -3
- package/dist/env/vite-plugin-env.js +2 -11
- package/dist/integrations/hooks.d.ts +3 -1
- package/dist/integrations/hooks.js +5 -4
- package/dist/jsx/babel.js +6 -8
- package/dist/jsx/rehype.js +4 -8
- package/dist/jsx-runtime/index.js +1 -2
- package/dist/runtime/client/dev-toolbar/entrypoint.js +3 -2
- package/dist/runtime/server/render/component.d.ts +2 -1
- package/dist/runtime/server/render/component.js +4 -0
- package/dist/runtime/server/render/server-islands.d.ts +5 -0
- package/dist/runtime/server/render/server-islands.js +73 -0
- package/dist/runtime/server/render/slot.d.ts +2 -1
- package/dist/runtime/server/render/slot.js +8 -1
- package/dist/vite-plugin-astro/index.js +3 -1
- package/dist/vite-plugin-astro/metadata.d.ts +1 -0
- package/dist/vite-plugin-astro/metadata.js +12 -0
- package/dist/vite-plugin-astro/types.d.ts +1 -0
- package/dist/vite-plugin-astro-server/pipeline.d.ts +7 -0
- package/dist/vite-plugin-astro-server/pipeline.js +20 -5
- package/dist/vite-plugin-astro-server/plugin.js +5 -3
- package/dist/vite-plugin-astro-server/route.js +13 -14
- package/dist/vite-plugin-markdown/index.js +2 -8
- package/dist/vite-plugin-utils/index.d.ts +5 -0
- package/dist/vite-plugin-utils/index.js +5 -0
- package/package.json +5 -4
- package/templates/env/module.mjs +5 -2
- package/dist/vite-plugin-inject-env-ts/index.d.ts +0 -17
|
@@ -58,6 +58,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
58
58
|
clientPrerender: false;
|
|
59
59
|
globalRoutePriority: false;
|
|
60
60
|
rewriting: false;
|
|
61
|
+
serverIslands: false;
|
|
61
62
|
env: {
|
|
62
63
|
validateSecrets: false;
|
|
63
64
|
};
|
|
@@ -256,6 +257,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
256
257
|
langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
|
|
257
258
|
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>;
|
|
258
259
|
themes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>>;
|
|
260
|
+
defaultColor: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"light">, z.ZodLiteral<"dark">, z.ZodString, z.ZodLiteral<false>]>>;
|
|
259
261
|
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
260
262
|
transformers: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiTransformer, z.ZodTypeDef, ShikiTransformer>, "many">, ShikiTransformer[], ShikiTransformer[]>>;
|
|
261
263
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -264,10 +266,12 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
264
266
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
265
267
|
wrap: boolean | null;
|
|
266
268
|
transformers: ShikiTransformer[];
|
|
269
|
+
defaultColor?: string | false | undefined;
|
|
267
270
|
}, {
|
|
268
271
|
langs?: ShikiLang[] | undefined;
|
|
269
272
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
270
273
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
274
|
+
defaultColor?: string | false | undefined;
|
|
271
275
|
wrap?: boolean | null | undefined;
|
|
272
276
|
transformers?: ShikiTransformer[] | undefined;
|
|
273
277
|
}>>;
|
|
@@ -284,6 +288,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
284
288
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
285
289
|
wrap: boolean | null;
|
|
286
290
|
transformers: ShikiTransformer[];
|
|
291
|
+
defaultColor?: string | false | undefined;
|
|
287
292
|
};
|
|
288
293
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
289
294
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -296,6 +301,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
296
301
|
langs?: ShikiLang[] | undefined;
|
|
297
302
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
298
303
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
304
|
+
defaultColor?: string | false | undefined;
|
|
299
305
|
wrap?: boolean | null | undefined;
|
|
300
306
|
transformers?: ShikiTransformer[] | undefined;
|
|
301
307
|
} | undefined;
|
|
@@ -610,6 +616,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
610
616
|
optional?: boolean | undefined;
|
|
611
617
|
})> | undefined;
|
|
612
618
|
}>>;
|
|
619
|
+
serverIslands: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
613
620
|
}, "strict", z.ZodTypeAny, {
|
|
614
621
|
actions: boolean;
|
|
615
622
|
directRenderScript: boolean;
|
|
@@ -618,6 +625,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
618
625
|
clientPrerender: boolean;
|
|
619
626
|
globalRoutePriority: boolean;
|
|
620
627
|
rewriting: boolean;
|
|
628
|
+
serverIslands: boolean;
|
|
621
629
|
env?: {
|
|
622
630
|
validateSecrets: boolean;
|
|
623
631
|
schema?: Record<string, ({
|
|
@@ -668,6 +676,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
668
676
|
clientPrerender?: boolean | undefined;
|
|
669
677
|
globalRoutePriority?: boolean | undefined;
|
|
670
678
|
rewriting?: boolean | undefined;
|
|
679
|
+
serverIslands?: boolean | undefined;
|
|
671
680
|
env?: {
|
|
672
681
|
validateSecrets?: boolean | undefined;
|
|
673
682
|
schema?: Record<string, ({
|
|
@@ -776,6 +785,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
776
785
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
777
786
|
wrap: boolean | null;
|
|
778
787
|
transformers: ShikiTransformer[];
|
|
788
|
+
defaultColor?: string | false | undefined;
|
|
779
789
|
};
|
|
780
790
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
781
791
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -795,6 +805,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
795
805
|
clientPrerender: boolean;
|
|
796
806
|
globalRoutePriority: boolean;
|
|
797
807
|
rewriting: boolean;
|
|
808
|
+
serverIslands: boolean;
|
|
798
809
|
env?: {
|
|
799
810
|
validateSecrets: boolean;
|
|
800
811
|
schema?: Record<string, ({
|
|
@@ -924,6 +935,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
924
935
|
langs?: ShikiLang[] | undefined;
|
|
925
936
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
926
937
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
938
|
+
defaultColor?: string | false | undefined;
|
|
927
939
|
wrap?: boolean | null | undefined;
|
|
928
940
|
transformers?: ShikiTransformer[] | undefined;
|
|
929
941
|
} | undefined;
|
|
@@ -958,6 +970,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
958
970
|
clientPrerender?: boolean | undefined;
|
|
959
971
|
globalRoutePriority?: boolean | undefined;
|
|
960
972
|
rewriting?: boolean | undefined;
|
|
973
|
+
serverIslands?: boolean | undefined;
|
|
961
974
|
env?: {
|
|
962
975
|
validateSecrets?: boolean | undefined;
|
|
963
976
|
schema?: Record<string, ({
|
|
@@ -1197,6 +1210,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1197
1210
|
langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
|
|
1198
1211
|
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>;
|
|
1199
1212
|
themes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>>;
|
|
1213
|
+
defaultColor: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"light">, z.ZodLiteral<"dark">, z.ZodString, z.ZodLiteral<false>]>>;
|
|
1200
1214
|
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
1201
1215
|
transformers: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiTransformer, z.ZodTypeDef, ShikiTransformer>, "many">, ShikiTransformer[], ShikiTransformer[]>>;
|
|
1202
1216
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1205,10 +1219,12 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1205
1219
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1206
1220
|
wrap: boolean | null;
|
|
1207
1221
|
transformers: ShikiTransformer[];
|
|
1222
|
+
defaultColor?: string | false | undefined;
|
|
1208
1223
|
}, {
|
|
1209
1224
|
langs?: ShikiLang[] | undefined;
|
|
1210
1225
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1211
1226
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1227
|
+
defaultColor?: string | false | undefined;
|
|
1212
1228
|
wrap?: boolean | null | undefined;
|
|
1213
1229
|
transformers?: ShikiTransformer[] | undefined;
|
|
1214
1230
|
}>>;
|
|
@@ -1225,6 +1241,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1225
1241
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1226
1242
|
wrap: boolean | null;
|
|
1227
1243
|
transformers: ShikiTransformer[];
|
|
1244
|
+
defaultColor?: string | false | undefined;
|
|
1228
1245
|
};
|
|
1229
1246
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
1230
1247
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -1237,6 +1254,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1237
1254
|
langs?: ShikiLang[] | undefined;
|
|
1238
1255
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1239
1256
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1257
|
+
defaultColor?: string | false | undefined;
|
|
1240
1258
|
wrap?: boolean | null | undefined;
|
|
1241
1259
|
transformers?: ShikiTransformer[] | undefined;
|
|
1242
1260
|
} | undefined;
|
|
@@ -1551,6 +1569,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1551
1569
|
optional?: boolean | undefined;
|
|
1552
1570
|
})> | undefined;
|
|
1553
1571
|
}>>;
|
|
1572
|
+
serverIslands: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1554
1573
|
}, "strict", z.ZodTypeAny, {
|
|
1555
1574
|
actions: boolean;
|
|
1556
1575
|
directRenderScript: boolean;
|
|
@@ -1559,6 +1578,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1559
1578
|
clientPrerender: boolean;
|
|
1560
1579
|
globalRoutePriority: boolean;
|
|
1561
1580
|
rewriting: boolean;
|
|
1581
|
+
serverIslands: boolean;
|
|
1562
1582
|
env?: {
|
|
1563
1583
|
validateSecrets: boolean;
|
|
1564
1584
|
schema?: Record<string, ({
|
|
@@ -1609,6 +1629,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1609
1629
|
clientPrerender?: boolean | undefined;
|
|
1610
1630
|
globalRoutePriority?: boolean | undefined;
|
|
1611
1631
|
rewriting?: boolean | undefined;
|
|
1632
|
+
serverIslands?: boolean | undefined;
|
|
1612
1633
|
env?: {
|
|
1613
1634
|
validateSecrets?: boolean | undefined;
|
|
1614
1635
|
schema?: Record<string, ({
|
|
@@ -1792,6 +1813,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1792
1813
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1793
1814
|
wrap: boolean | null;
|
|
1794
1815
|
transformers: ShikiTransformer[];
|
|
1816
|
+
defaultColor?: string | false | undefined;
|
|
1795
1817
|
};
|
|
1796
1818
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
1797
1819
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -1811,6 +1833,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1811
1833
|
clientPrerender: boolean;
|
|
1812
1834
|
globalRoutePriority: boolean;
|
|
1813
1835
|
rewriting: boolean;
|
|
1836
|
+
serverIslands: boolean;
|
|
1814
1837
|
env?: {
|
|
1815
1838
|
validateSecrets: boolean;
|
|
1816
1839
|
schema?: Record<string, ({
|
|
@@ -1940,6 +1963,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1940
1963
|
langs?: ShikiLang[] | undefined;
|
|
1941
1964
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1942
1965
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1966
|
+
defaultColor?: string | false | undefined;
|
|
1943
1967
|
wrap?: boolean | null | undefined;
|
|
1944
1968
|
transformers?: ShikiTransformer[] | undefined;
|
|
1945
1969
|
} | undefined;
|
|
@@ -1974,6 +1998,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1974
1998
|
clientPrerender?: boolean | undefined;
|
|
1975
1999
|
globalRoutePriority?: boolean | undefined;
|
|
1976
2000
|
rewriting?: boolean | undefined;
|
|
2001
|
+
serverIslands?: boolean | undefined;
|
|
1977
2002
|
env?: {
|
|
1978
2003
|
validateSecrets?: boolean | undefined;
|
|
1979
2004
|
schema?: Record<string, ({
|
|
@@ -2083,6 +2108,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2083
2108
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2084
2109
|
wrap: boolean | null;
|
|
2085
2110
|
transformers: ShikiTransformer[];
|
|
2111
|
+
defaultColor?: string | false | undefined;
|
|
2086
2112
|
};
|
|
2087
2113
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
2088
2114
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -2102,6 +2128,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2102
2128
|
clientPrerender: boolean;
|
|
2103
2129
|
globalRoutePriority: boolean;
|
|
2104
2130
|
rewriting: boolean;
|
|
2131
|
+
serverIslands: boolean;
|
|
2105
2132
|
env?: {
|
|
2106
2133
|
validateSecrets: boolean;
|
|
2107
2134
|
schema?: Record<string, ({
|
|
@@ -2231,6 +2258,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2231
2258
|
langs?: ShikiLang[] | undefined;
|
|
2232
2259
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2233
2260
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2261
|
+
defaultColor?: string | false | undefined;
|
|
2234
2262
|
wrap?: boolean | null | undefined;
|
|
2235
2263
|
transformers?: ShikiTransformer[] | undefined;
|
|
2236
2264
|
} | undefined;
|
|
@@ -2265,6 +2293,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2265
2293
|
clientPrerender?: boolean | undefined;
|
|
2266
2294
|
globalRoutePriority?: boolean | undefined;
|
|
2267
2295
|
rewriting?: boolean | undefined;
|
|
2296
|
+
serverIslands?: boolean | undefined;
|
|
2268
2297
|
env?: {
|
|
2269
2298
|
validateSecrets?: boolean | undefined;
|
|
2270
2299
|
schema?: Record<string, ({
|
|
@@ -2374,6 +2403,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2374
2403
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2375
2404
|
wrap: boolean | null;
|
|
2376
2405
|
transformers: ShikiTransformer[];
|
|
2406
|
+
defaultColor?: string | false | undefined;
|
|
2377
2407
|
};
|
|
2378
2408
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
2379
2409
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -2393,6 +2423,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2393
2423
|
clientPrerender: boolean;
|
|
2394
2424
|
globalRoutePriority: boolean;
|
|
2395
2425
|
rewriting: boolean;
|
|
2426
|
+
serverIslands: boolean;
|
|
2396
2427
|
env?: {
|
|
2397
2428
|
validateSecrets: boolean;
|
|
2398
2429
|
schema?: Record<string, ({
|
|
@@ -2522,6 +2553,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2522
2553
|
langs?: ShikiLang[] | undefined;
|
|
2523
2554
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2524
2555
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2556
|
+
defaultColor?: string | false | undefined;
|
|
2525
2557
|
wrap?: boolean | null | undefined;
|
|
2526
2558
|
transformers?: ShikiTransformer[] | undefined;
|
|
2527
2559
|
} | undefined;
|
|
@@ -2556,6 +2588,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2556
2588
|
clientPrerender?: boolean | undefined;
|
|
2557
2589
|
globalRoutePriority?: boolean | undefined;
|
|
2558
2590
|
rewriting?: boolean | undefined;
|
|
2591
|
+
serverIslands?: boolean | undefined;
|
|
2559
2592
|
env?: {
|
|
2560
2593
|
validateSecrets?: boolean | undefined;
|
|
2561
2594
|
schema?: Record<string, ({
|
|
@@ -2665,6 +2698,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2665
2698
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2666
2699
|
wrap: boolean | null;
|
|
2667
2700
|
transformers: ShikiTransformer[];
|
|
2701
|
+
defaultColor?: string | false | undefined;
|
|
2668
2702
|
};
|
|
2669
2703
|
remarkPlugins: (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
2670
2704
|
rehypePlugins: (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
@@ -2684,6 +2718,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2684
2718
|
clientPrerender: boolean;
|
|
2685
2719
|
globalRoutePriority: boolean;
|
|
2686
2720
|
rewriting: boolean;
|
|
2721
|
+
serverIslands: boolean;
|
|
2687
2722
|
env?: {
|
|
2688
2723
|
validateSecrets: boolean;
|
|
2689
2724
|
schema?: Record<string, ({
|
|
@@ -2813,6 +2848,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2813
2848
|
langs?: ShikiLang[] | undefined;
|
|
2814
2849
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2815
2850
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2851
|
+
defaultColor?: string | false | undefined;
|
|
2816
2852
|
wrap?: boolean | null | undefined;
|
|
2817
2853
|
transformers?: ShikiTransformer[] | undefined;
|
|
2818
2854
|
} | undefined;
|
|
@@ -2847,6 +2883,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2847
2883
|
clientPrerender?: boolean | undefined;
|
|
2848
2884
|
globalRoutePriority?: boolean | undefined;
|
|
2849
2885
|
rewriting?: boolean | undefined;
|
|
2886
|
+
serverIslands?: boolean | undefined;
|
|
2850
2887
|
env?: {
|
|
2851
2888
|
validateSecrets?: boolean | undefined;
|
|
2852
2889
|
schema?: Record<string, ({
|
|
@@ -48,6 +48,7 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
48
48
|
clientPrerender: false,
|
|
49
49
|
globalRoutePriority: false,
|
|
50
50
|
rewriting: false,
|
|
51
|
+
serverIslands: false,
|
|
51
52
|
env: {
|
|
52
53
|
validateSecrets: false
|
|
53
54
|
}
|
|
@@ -182,6 +183,7 @@ const AstroConfigSchema = z.object({
|
|
|
182
183
|
themes: z.record(
|
|
183
184
|
z.enum(Object.keys(bundledThemes)).or(z.custom())
|
|
184
185
|
).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.themes),
|
|
186
|
+
defaultColor: z.union([z.literal("light"), z.literal("dark"), z.string(), z.literal(false)]).optional(),
|
|
185
187
|
wrap: z.boolean().or(z.null()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.wrap),
|
|
186
188
|
transformers: z.custom().array().transform((transformers) => {
|
|
187
189
|
for (const transformer of transformers) {
|
|
@@ -333,7 +335,8 @@ const AstroConfigSchema = z.object({
|
|
|
333
335
|
env: z.object({
|
|
334
336
|
schema: EnvSchema.optional(),
|
|
335
337
|
validateSecrets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.env.validateSecrets)
|
|
336
|
-
}).strict().optional()
|
|
338
|
+
}).strict().optional(),
|
|
339
|
+
serverIslands: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.serverIslands)
|
|
337
340
|
}).strict(
|
|
338
341
|
`Invalid or outdated experimental feature.
|
|
339
342
|
Check for incorrect spelling or outdated Astro version.
|
|
@@ -407,7 +410,7 @@ function createRelativeSchema(cmd, fileProtocolRoot) {
|
|
|
407
410
|
}).refine((obj) => !obj.outDir.toString().startsWith(obj.publicDir.toString()), {
|
|
408
411
|
message: "The value of `outDir` must not point to a path within the folder set as `publicDir`, this will cause an infinite loop"
|
|
409
412
|
}).superRefine((configuration, ctx) => {
|
|
410
|
-
const { site,
|
|
413
|
+
const { site, i18n, output } = configuration;
|
|
411
414
|
const hasDomains = i18n?.domains ? Object.keys(i18n.domains).length > 0 : false;
|
|
412
415
|
if (hasDomains) {
|
|
413
416
|
if (!site) {
|
|
@@ -21,6 +21,8 @@ function createBaseSettings(config) {
|
|
|
21
21
|
adapter: void 0,
|
|
22
22
|
injectedRoutes: [],
|
|
23
23
|
resolvedInjectedRoutes: [],
|
|
24
|
+
serverIslandMap: /* @__PURE__ */ new Map(),
|
|
25
|
+
serverIslandNameMap: /* @__PURE__ */ new Map(),
|
|
24
26
|
pageExtensions: [".astro", ".html", ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS],
|
|
25
27
|
contentEntryTypes: [markdownContentEntryType],
|
|
26
28
|
dataEntryTypes: [
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export declare const ASTRO_VERSION: string;
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
export declare const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
|
|
22
|
+
/**
|
|
23
|
+
* Header and value that are attached to a Response object when a **user rewrite** occurs.
|
|
24
|
+
*
|
|
25
|
+
* This metadata is used to determine the origin of a Response. If a rewrite has occurred, it should be prioritised over other logic.
|
|
26
|
+
*/
|
|
27
|
+
export declare const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
|
|
28
|
+
export declare const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
|
|
22
29
|
/**
|
|
23
30
|
* The name for the header used to help i18n middleware, which only needs to act on "page" and "fallback" route types.
|
|
24
31
|
*/
|
package/dist/core/constants.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
const ASTRO_VERSION = "4.
|
|
1
|
+
const ASTRO_VERSION = "4.12.0";
|
|
2
2
|
const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
|
|
3
|
+
const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
|
|
4
|
+
const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
|
|
3
5
|
const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
|
|
4
6
|
const DEFAULT_404_COMPONENT = "astro-default-404.astro";
|
|
5
7
|
const DEFAULT_500_COMPONENT = "astro-default-500.astro";
|
|
@@ -23,6 +25,8 @@ export {
|
|
|
23
25
|
MIDDLEWARE_PATH_SEGMENT_NAME,
|
|
24
26
|
REROUTABLE_STATUS_CODES,
|
|
25
27
|
REROUTE_DIRECTIVE_HEADER,
|
|
28
|
+
REWRITE_DIRECTIVE_HEADER_KEY,
|
|
29
|
+
REWRITE_DIRECTIVE_HEADER_VALUE,
|
|
26
30
|
ROUTE_TYPE_HEADER,
|
|
27
31
|
SUPPORTED_MARKDOWN_FILE_EXTENSIONS,
|
|
28
32
|
clientAddressSymbol,
|
package/dist/core/create-vite.js
CHANGED
|
@@ -24,7 +24,6 @@ import envVitePlugin from "../vite-plugin-env/index.js";
|
|
|
24
24
|
import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
|
|
25
25
|
import astroHeadPlugin from "../vite-plugin-head/index.js";
|
|
26
26
|
import htmlVitePlugin from "../vite-plugin-html/index.js";
|
|
27
|
-
import { astroInjectEnvTsPlugin } from "../vite-plugin-inject-env-ts/index.js";
|
|
28
27
|
import astroIntegrationsContainerPlugin from "../vite-plugin-integrations-container/index.js";
|
|
29
28
|
import astroLoadFallbackPlugin from "../vite-plugin-load-fallback/index.js";
|
|
30
29
|
import markdownVitePlugin from "../vite-plugin-markdown/index.js";
|
|
@@ -36,6 +35,7 @@ import { vitePluginSSRManifest } from "../vite-plugin-ssr-manifest/index.js";
|
|
|
36
35
|
import { createViteLogger } from "./logger/vite.js";
|
|
37
36
|
import { vitePluginMiddleware } from "./middleware/vite-plugin.js";
|
|
38
37
|
import { joinPaths } from "./path.js";
|
|
38
|
+
import { vitePluginServerIslands } from "./server-islands/vite-plugin-server-islands.js";
|
|
39
39
|
import { isObject } from "./util.js";
|
|
40
40
|
const ALWAYS_NOEXTERNAL = [
|
|
41
41
|
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
|
|
@@ -112,7 +112,6 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
112
112
|
astroScriptsPageSSRPlugin({ settings }),
|
|
113
113
|
astroHeadPlugin(),
|
|
114
114
|
astroScannerPlugin({ settings, logger }),
|
|
115
|
-
astroInjectEnvTsPlugin({ settings, logger, fs }),
|
|
116
115
|
astroContentVirtualModPlugin({ fs, settings }),
|
|
117
116
|
astroContentImportPlugin({ fs, settings, logger }),
|
|
118
117
|
astroContentAssetPropagationPlugin({ mode, settings }),
|
|
@@ -124,6 +123,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
124
123
|
astroDevToolbar({ settings, logger }),
|
|
125
124
|
vitePluginFileURL({}),
|
|
126
125
|
astroInternationalization({ settings }),
|
|
126
|
+
settings.config.experimental.serverIslands && vitePluginServerIslands({ settings }),
|
|
127
127
|
astroContainer()
|
|
128
128
|
],
|
|
129
129
|
publicDir: fileURLToPath(settings.config.publicDir),
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "../../integrations/hooks.js";
|
|
10
10
|
import { createVite } from "../create-vite.js";
|
|
11
11
|
import { apply as applyPolyfill } from "../polyfill.js";
|
|
12
|
+
import { syncInternal } from "../sync/index.js";
|
|
12
13
|
async function createContainer({
|
|
13
14
|
isRestart = false,
|
|
14
15
|
logger,
|
|
@@ -43,6 +44,13 @@ async function createContainer({
|
|
|
43
44
|
{ settings, logger, mode: "dev", command: "dev", fs, sync: false }
|
|
44
45
|
);
|
|
45
46
|
await runHookConfigDone({ settings, logger });
|
|
47
|
+
await syncInternal({
|
|
48
|
+
settings,
|
|
49
|
+
logger,
|
|
50
|
+
skip: {
|
|
51
|
+
content: true
|
|
52
|
+
}
|
|
53
|
+
});
|
|
46
54
|
const viteServer = await vite.createServer(viteConfig);
|
|
47
55
|
const container = {
|
|
48
56
|
inlineConfig: inlineConfig ?? {},
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
|
|
|
19
19
|
await telemetry.record([]);
|
|
20
20
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
21
21
|
const logger = restart.container.logger;
|
|
22
|
-
const currentVersion = "4.
|
|
22
|
+
const currentVersion = "4.12.0";
|
|
23
23
|
const isPrerelease = currentVersion.includes("-");
|
|
24
24
|
if (!isPrerelease) {
|
|
25
25
|
try {
|
|
@@ -82,8 +82,7 @@ async function getViteErrorPayload(err) {
|
|
|
82
82
|
let highlighterLang = err.loc?.file?.split(".").pop();
|
|
83
83
|
if (ALTERNATIVE_JS_EXTS.includes(highlighterLang ?? "")) {
|
|
84
84
|
highlighterLang = "js";
|
|
85
|
-
}
|
|
86
|
-
if (ALTERNATIVE_MD_EXTS.includes(highlighterLang ?? "")) {
|
|
85
|
+
} else if (ALTERNATIVE_MD_EXTS.includes(highlighterLang ?? "")) {
|
|
87
86
|
highlighterLang = "md";
|
|
88
87
|
}
|
|
89
88
|
const highlightedCode = err.fullCode ? await codeToHtml(err.fullCode, {
|
|
@@ -1102,22 +1102,14 @@ export declare const RouteNotFound: {
|
|
|
1102
1102
|
* @docs
|
|
1103
1103
|
* @description
|
|
1104
1104
|
* Some environment variables do not match the data type and/or properties defined in `experimental.env.schema`.
|
|
1105
|
+
* @message
|
|
1106
|
+
* The following environment variables defined in `experimental.env.schema` are invalid.
|
|
1105
1107
|
*/
|
|
1106
1108
|
export declare const EnvInvalidVariables: {
|
|
1107
1109
|
name: string;
|
|
1108
1110
|
title: string;
|
|
1109
1111
|
message: (errors: Array<string>) => string;
|
|
1110
1112
|
};
|
|
1111
|
-
/**
|
|
1112
|
-
* @docs
|
|
1113
|
-
* @description
|
|
1114
|
-
* An environment variable does not match the data type and/or properties defined in `experimental.env.schema`.
|
|
1115
|
-
*/
|
|
1116
|
-
export declare const EnvInvalidVariable: {
|
|
1117
|
-
name: string;
|
|
1118
|
-
title: string;
|
|
1119
|
-
message: (key: string, type: string) => string;
|
|
1120
|
-
};
|
|
1121
1113
|
/**
|
|
1122
1114
|
* @docs
|
|
1123
1115
|
* @description
|
|
@@ -404,11 +404,6 @@ const EnvInvalidVariables = {
|
|
|
404
404
|
${errors.map((err) => `- ${err}`).join("\n")}
|
|
405
405
|
`
|
|
406
406
|
};
|
|
407
|
-
const EnvInvalidVariable = {
|
|
408
|
-
name: "EnvInvalidVariable",
|
|
409
|
-
title: "Invalid Environment Variable",
|
|
410
|
-
message: (key, type) => `The following environment variable does not match the data type and/or properties defined in \`experimental.env.schema\`: ${key} is not of type ${type}`
|
|
411
|
-
};
|
|
412
407
|
const EnvUnsupportedGetSecret = {
|
|
413
408
|
name: "EnvUnsupportedGetSecret",
|
|
414
409
|
title: "Unsupported astro:env getSecret",
|
|
@@ -577,7 +572,6 @@ export {
|
|
|
577
572
|
DataCollectionEntryParseError,
|
|
578
573
|
DuplicateContentEntrySlugError,
|
|
579
574
|
EndpointDidNotReturnAResponse,
|
|
580
|
-
EnvInvalidVariable,
|
|
581
575
|
EnvInvalidVariables,
|
|
582
576
|
EnvUnsupportedGetSecret,
|
|
583
577
|
ExpectedImage,
|
|
@@ -666,6 +666,9 @@ class ErrorOverlay extends HTMLElement {
|
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
668
|
const el = this.root.querySelector(selector);
|
|
669
|
+
if (!el) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
669
672
|
if (html) {
|
|
670
673
|
text = text.split(" ").map((v) => {
|
|
671
674
|
if (!v.startsWith("https://")) return v;
|
|
@@ -673,13 +676,9 @@ class ErrorOverlay extends HTMLElement {
|
|
|
673
676
|
return `<a target="_blank" href="${v.slice(0, -1)}">${v.slice(0, -1)}</a>.`;
|
|
674
677
|
return `<a target="_blank" href="${v}">${v}</a>`;
|
|
675
678
|
}).join(" ");
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
el.textContent = text.trim();
|
|
680
|
-
} else {
|
|
681
|
-
el.innerHTML = text.trim();
|
|
682
|
-
}
|
|
679
|
+
el.innerHTML = text.trim();
|
|
680
|
+
} else {
|
|
681
|
+
el.textContent = text.trim();
|
|
683
682
|
}
|
|
684
683
|
}
|
|
685
684
|
createLink(text, href) {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export declare const build: (inlineConfig: AstroInlineConfig) => Promise<void>;
|
|
|
14
14
|
*
|
|
15
15
|
* @experimental The JavaScript API is experimental
|
|
16
16
|
*/
|
|
17
|
-
export declare const sync: (inlineConfig: AstroInlineConfig) => Promise<
|
|
17
|
+
export declare const sync: (inlineConfig: AstroInlineConfig) => Promise<void>;
|
package/dist/core/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { default as _sync } from "./sync/index.js";
|
|
|
3
3
|
import { default as default2 } from "./dev/index.js";
|
|
4
4
|
import { default as default3 } from "./preview/index.js";
|
|
5
5
|
const build = (inlineConfig) => _build(inlineConfig);
|
|
6
|
-
const sync = (inlineConfig) => _sync(inlineConfig);
|
|
6
|
+
const sync = (inlineConfig) => _sync({ inlineConfig });
|
|
7
7
|
export {
|
|
8
8
|
build,
|
|
9
9
|
default2 as dev,
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "4.
|
|
40
|
+
const version = "4.12.0";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -269,7 +269,7 @@ function printHelp({
|
|
|
269
269
|
message.push(
|
|
270
270
|
linebreak(),
|
|
271
271
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
272
|
-
`v${"4.
|
|
272
|
+
`v${"4.12.0"}`
|
|
273
273
|
)} ${headline}`
|
|
274
274
|
);
|
|
275
275
|
}
|
|
@@ -4,15 +4,15 @@ async function callMiddleware(onRequest, apiContext, responseFunction, enableRer
|
|
|
4
4
|
let responseFunctionPromise = void 0;
|
|
5
5
|
const next = async (payload) => {
|
|
6
6
|
nextCalled = true;
|
|
7
|
-
if (!enableRerouting && payload) {
|
|
8
|
-
logger.warn(
|
|
9
|
-
"router",
|
|
10
|
-
"The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config."
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
7
|
if (enableRerouting) {
|
|
14
8
|
responseFunctionPromise = responseFunction(apiContext, payload);
|
|
15
9
|
} else {
|
|
10
|
+
if (payload) {
|
|
11
|
+
logger.warn(
|
|
12
|
+
"router",
|
|
13
|
+
"The rewrite API is experimental. To use this feature, add the `rewriting` flag to the `experimental` object in your Astro config."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
16
|
responseFunctionPromise = responseFunction(apiContext);
|
|
17
17
|
}
|
|
18
18
|
return responseFunctionPromise;
|
|
@@ -19,8 +19,7 @@ function redirectRouteGenerate(renderContext) {
|
|
|
19
19
|
let target = redirect;
|
|
20
20
|
for (const param of Object.keys(params)) {
|
|
21
21
|
const paramValue = params[param];
|
|
22
|
-
target = target.replace(`[${param}]`, paramValue);
|
|
23
|
-
target = target.replace(`[...${param}]`, paramValue);
|
|
22
|
+
target = target.replace(`[${param}]`, paramValue).replace(`[...${param}]`, paramValue);
|
|
24
23
|
}
|
|
25
24
|
return target;
|
|
26
25
|
} else if (typeof redirect === "undefined") {
|
|
@@ -34,6 +34,13 @@ function generatePaginateFunction(routeMatch) {
|
|
|
34
34
|
page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
|
|
35
35
|
})
|
|
36
36
|
);
|
|
37
|
+
const first = pageNum === 1 ? void 0 : correctIndexRoute(
|
|
38
|
+
routeMatch.generate({
|
|
39
|
+
...params,
|
|
40
|
+
page: includesFirstPageNumber ? "1" : void 0
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
const last = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(lastPage) }));
|
|
37
44
|
return {
|
|
38
45
|
params,
|
|
39
46
|
props: {
|
|
@@ -46,7 +53,7 @@ function generatePaginateFunction(routeMatch) {
|
|
|
46
53
|
total: data.length,
|
|
47
54
|
currentPage: pageNum,
|
|
48
55
|
lastPage,
|
|
49
|
-
url: { current, next, prev }
|
|
56
|
+
url: { current, next, prev, first, last }
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
};
|
|
@@ -9,6 +9,8 @@ import { renderPage } from "../runtime/server/index.js";
|
|
|
9
9
|
import {
|
|
10
10
|
ASTRO_VERSION,
|
|
11
11
|
REROUTE_DIRECTIVE_HEADER,
|
|
12
|
+
REWRITE_DIRECTIVE_HEADER_KEY,
|
|
13
|
+
REWRITE_DIRECTIVE_HEADER_VALUE,
|
|
12
14
|
ROUTE_TYPE_HEADER,
|
|
13
15
|
clientAddressSymbol,
|
|
14
16
|
clientLocalsSymbol,
|
|
@@ -145,9 +147,12 @@ class RenderContext {
|
|
|
145
147
|
throw e;
|
|
146
148
|
}
|
|
147
149
|
response2.headers.set(ROUTE_TYPE_HEADER, "page");
|
|
148
|
-
if (this.routeData.route === "/404" || this.routeData.route === "/500"
|
|
150
|
+
if (this.routeData.route === "/404" || this.routeData.route === "/500") {
|
|
149
151
|
response2.headers.set(REROUTE_DIRECTIVE_HEADER, "no");
|
|
150
152
|
}
|
|
153
|
+
if (this.isRewriting) {
|
|
154
|
+
response2.headers.set(REWRITE_DIRECTIVE_HEADER_KEY, REWRITE_DIRECTIVE_HEADER_VALUE);
|
|
155
|
+
}
|
|
151
156
|
break;
|
|
152
157
|
}
|
|
153
158
|
case "fallback": {
|
|
@@ -286,6 +291,7 @@ class RenderContext {
|
|
|
286
291
|
/** This function returns the `Astro` faux-global */
|
|
287
292
|
createAstro: (astroGlobal, props, slots) => this.createAstro(result, astroGlobal, props, slots),
|
|
288
293
|
links,
|
|
294
|
+
params: this.params,
|
|
289
295
|
partial,
|
|
290
296
|
pathname,
|
|
291
297
|
renderers,
|
|
@@ -295,6 +301,7 @@ class RenderContext {
|
|
|
295
301
|
scripts,
|
|
296
302
|
styles,
|
|
297
303
|
actionResult,
|
|
304
|
+
serverIslandNameMap: manifest.serverIslandNameMap ?? /* @__PURE__ */ new Map(),
|
|
298
305
|
_metadata: {
|
|
299
306
|
hasHydrationScript: false,
|
|
300
307
|
rendererSpecificHydrationScripts: /* @__PURE__ */ new Set(),
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type { ManifestData, RouteData } from '../../@types/astro.js';
|
|
1
|
+
import type { ComponentInstance, ManifestData, RouteData } from '../../@types/astro.js';
|
|
2
2
|
export declare const DEFAULT_404_ROUTE: RouteData;
|
|
3
3
|
export declare const DEFAULT_500_ROUTE: RouteData;
|
|
4
4
|
export declare function ensure404Route(manifest: ManifestData): ManifestData;
|
|
5
|
-
export declare
|
|
6
|
-
pathname: string;
|
|
7
|
-
}): Promise<Response>;
|
|
8
|
-
export declare namespace default404Page {
|
|
9
|
-
var isAstroComponentFactory: boolean;
|
|
10
|
-
}
|
|
5
|
+
export declare const default404Instance: ComponentInstance;
|