astro 4.5.18 → 4.6.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/dist/@types/astro.d.ts +96 -3
- package/dist/core/app/index.js +8 -0
- package/dist/core/app/middlewares.d.ts +7 -0
- package/dist/core/app/middlewares.js +26 -0
- package/dist/core/app/types.d.ts +2 -1
- package/dist/core/base-pipeline.js +6 -3
- package/dist/core/build/generate.js +3 -2
- package/dist/core/build/plugins/plugin-manifest.js +3 -2
- package/dist/core/config/schema.d.ts +168 -65
- package/dist/core/config/schema.js +20 -13
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.d.ts +3 -11
- package/dist/core/cookies/cookies.js +9 -7
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/errors/errors-data.d.ts +23 -0
- package/dist/core/errors/errors-data.js +13 -1
- package/dist/core/errors/overlay.js +2 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/vite-plugin.js +8 -0
- package/dist/core/render/index.d.ts +1 -1
- package/dist/core/render/index.js +1 -1
- package/dist/core/render/{result.js → slots.js} +4 -2
- package/dist/core/routing/manifest/create.js +1 -1
- package/dist/i18n/index.d.ts +18 -1
- package/dist/i18n/index.js +107 -0
- package/dist/i18n/middleware.d.ts +1 -1
- package/dist/i18n/middleware.js +40 -81
- package/dist/i18n/utils.d.ts +2 -2
- package/dist/i18n/utils.js +20 -21
- package/dist/runtime/client/dev-toolbar/apps/astro.js +6 -1
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js +1 -1
- package/dist/runtime/client/dev-toolbar/apps/settings.js +38 -1
- package/dist/runtime/client/dev-toolbar/apps/utils/window.d.ts +2 -1
- package/dist/runtime/client/dev-toolbar/apps/utils/window.js +18 -2
- package/dist/runtime/client/dev-toolbar/apps/xray.js +6 -1
- package/dist/runtime/client/dev-toolbar/entrypoint.js +3 -1
- package/dist/runtime/client/dev-toolbar/settings.d.ts +4 -1
- package/dist/runtime/client/dev-toolbar/settings.js +2 -1
- package/dist/runtime/client/dev-toolbar/toolbar.d.ts +2 -0
- package/dist/runtime/client/dev-toolbar/toolbar.js +25 -3
- package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +1 -0
- package/dist/runtime/client/dev-toolbar/ui-library/index.js +2 -0
- package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +15 -0
- package/dist/runtime/client/dev-toolbar/ui-library/select.js +100 -0
- package/dist/runtime/client/dev-toolbar/ui-library/window.d.ts +9 -0
- package/dist/runtime/client/dev-toolbar/ui-library/window.js +53 -3
- package/dist/runtime/server/render/astro/render-template.d.ts +1 -1
- package/dist/virtual-modules/i18n.d.ts +102 -0
- package/dist/virtual-modules/i18n.js +86 -6
- package/dist/vite-plugin-astro-server/plugin.js +2 -1
- package/dist/vite-plugin-astro-server/route.js +1 -1
- package/package.json +6 -5
- /package/dist/core/render/{result.d.ts → slots.d.ts} +0 -0
|
@@ -271,38 +271,35 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
271
271
|
}>]>, "many">;
|
|
272
272
|
domains: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
273
273
|
fallback: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
274
|
-
routing: z.
|
|
275
|
-
prefixDefaultLocale: z.ZodDefault<z.ZodBoolean
|
|
276
|
-
redirectToDefaultLocale: z.ZodDefault<z.ZodBoolean
|
|
277
|
-
strategy: z.ZodDefault<z.ZodEnum<["pathname"]>>;
|
|
274
|
+
routing: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"manual">, z.ZodEffects<z.ZodObject<{
|
|
275
|
+
prefixDefaultLocale: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
276
|
+
redirectToDefaultLocale: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
278
277
|
}, "strip", z.ZodTypeAny, {
|
|
279
278
|
prefixDefaultLocale: boolean;
|
|
280
279
|
redirectToDefaultLocale: boolean;
|
|
281
|
-
strategy: "pathname";
|
|
282
280
|
}, {
|
|
283
281
|
prefixDefaultLocale?: boolean | undefined;
|
|
284
282
|
redirectToDefaultLocale?: boolean | undefined;
|
|
285
|
-
|
|
286
|
-
}>>, {
|
|
283
|
+
}>, {
|
|
287
284
|
prefixDefaultLocale: boolean;
|
|
288
285
|
redirectToDefaultLocale: boolean;
|
|
289
|
-
strategy: "pathname";
|
|
290
286
|
}, {
|
|
291
287
|
prefixDefaultLocale?: boolean | undefined;
|
|
292
288
|
redirectToDefaultLocale?: boolean | undefined;
|
|
293
|
-
|
|
294
|
-
} | undefined>;
|
|
289
|
+
}>]>>>;
|
|
295
290
|
}, "strip", z.ZodTypeAny, {
|
|
296
291
|
defaultLocale: string;
|
|
297
292
|
locales: (string | {
|
|
298
293
|
path: string;
|
|
299
294
|
codes: [string, ...string[]];
|
|
300
295
|
})[];
|
|
301
|
-
routing: {
|
|
296
|
+
routing: ("manual" | {
|
|
302
297
|
prefixDefaultLocale: boolean;
|
|
303
298
|
redirectToDefaultLocale: boolean;
|
|
304
|
-
|
|
305
|
-
|
|
299
|
+
}) & ("manual" | {
|
|
300
|
+
prefixDefaultLocale: boolean;
|
|
301
|
+
redirectToDefaultLocale: boolean;
|
|
302
|
+
} | undefined);
|
|
306
303
|
domains?: Record<string, string> | undefined;
|
|
307
304
|
fallback?: Record<string, string> | undefined;
|
|
308
305
|
}, {
|
|
@@ -313,10 +310,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
313
310
|
})[];
|
|
314
311
|
domains?: Record<string, string> | undefined;
|
|
315
312
|
fallback?: Record<string, string> | undefined;
|
|
316
|
-
routing?: {
|
|
313
|
+
routing?: "manual" | {
|
|
317
314
|
prefixDefaultLocale?: boolean | undefined;
|
|
318
315
|
redirectToDefaultLocale?: boolean | undefined;
|
|
319
|
-
strategy?: "pathname" | undefined;
|
|
320
316
|
} | undefined;
|
|
321
317
|
}>>, {
|
|
322
318
|
defaultLocale: string;
|
|
@@ -324,11 +320,13 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
324
320
|
path: string;
|
|
325
321
|
codes: [string, ...string[]];
|
|
326
322
|
})[];
|
|
327
|
-
routing: {
|
|
323
|
+
routing: ("manual" | {
|
|
328
324
|
prefixDefaultLocale: boolean;
|
|
329
325
|
redirectToDefaultLocale: boolean;
|
|
330
|
-
|
|
331
|
-
|
|
326
|
+
}) & ("manual" | {
|
|
327
|
+
prefixDefaultLocale: boolean;
|
|
328
|
+
redirectToDefaultLocale: boolean;
|
|
329
|
+
} | undefined);
|
|
332
330
|
domains?: Record<string, string> | undefined;
|
|
333
331
|
fallback?: Record<string, string> | undefined;
|
|
334
332
|
} | undefined, {
|
|
@@ -339,10 +337,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
339
337
|
})[];
|
|
340
338
|
domains?: Record<string, string> | undefined;
|
|
341
339
|
fallback?: Record<string, string> | undefined;
|
|
342
|
-
routing?: {
|
|
340
|
+
routing?: "manual" | {
|
|
343
341
|
prefixDefaultLocale?: boolean | undefined;
|
|
344
342
|
redirectToDefaultLocale?: boolean | undefined;
|
|
345
|
-
strategy?: "pathname" | undefined;
|
|
346
343
|
} | undefined;
|
|
347
344
|
} | undefined>>;
|
|
348
345
|
experimental: z.ZodDefault<z.ZodObject<{
|
|
@@ -351,6 +348,23 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
351
348
|
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
352
349
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
353
350
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
351
|
+
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
352
|
+
csrfProtection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
353
|
+
origin: z.ZodDefault<z.ZodBoolean>;
|
|
354
|
+
}, "strip", z.ZodTypeAny, {
|
|
355
|
+
origin: boolean;
|
|
356
|
+
}, {
|
|
357
|
+
origin?: boolean | undefined;
|
|
358
|
+
}>>>;
|
|
359
|
+
}, "strip", z.ZodTypeAny, {
|
|
360
|
+
csrfProtection: {
|
|
361
|
+
origin: boolean;
|
|
362
|
+
};
|
|
363
|
+
}, {
|
|
364
|
+
csrfProtection?: {
|
|
365
|
+
origin?: boolean | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
}>>>;
|
|
354
368
|
i18nDomains: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
355
369
|
}, "strict", z.ZodTypeAny, {
|
|
356
370
|
directRenderScript: boolean;
|
|
@@ -359,12 +373,22 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
359
373
|
clientPrerender: boolean;
|
|
360
374
|
globalRoutePriority: boolean;
|
|
361
375
|
i18nDomains: boolean;
|
|
376
|
+
security: {
|
|
377
|
+
csrfProtection: {
|
|
378
|
+
origin: boolean;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
362
381
|
}, {
|
|
363
382
|
directRenderScript?: boolean | undefined;
|
|
364
383
|
contentCollectionCache?: boolean | undefined;
|
|
365
384
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
366
385
|
clientPrerender?: boolean | undefined;
|
|
367
386
|
globalRoutePriority?: boolean | undefined;
|
|
387
|
+
security?: {
|
|
388
|
+
csrfProtection?: {
|
|
389
|
+
origin?: boolean | undefined;
|
|
390
|
+
} | undefined;
|
|
391
|
+
} | undefined;
|
|
368
392
|
i18nDomains?: boolean | undefined;
|
|
369
393
|
}>>;
|
|
370
394
|
legacy: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
@@ -447,6 +471,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
447
471
|
clientPrerender: boolean;
|
|
448
472
|
globalRoutePriority: boolean;
|
|
449
473
|
i18nDomains: boolean;
|
|
474
|
+
security: {
|
|
475
|
+
csrfProtection: {
|
|
476
|
+
origin: boolean;
|
|
477
|
+
};
|
|
478
|
+
};
|
|
450
479
|
};
|
|
451
480
|
legacy: {};
|
|
452
481
|
site?: string | undefined;
|
|
@@ -466,11 +495,13 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
466
495
|
path: string;
|
|
467
496
|
codes: [string, ...string[]];
|
|
468
497
|
})[];
|
|
469
|
-
routing: {
|
|
498
|
+
routing: ("manual" | {
|
|
470
499
|
prefixDefaultLocale: boolean;
|
|
471
500
|
redirectToDefaultLocale: boolean;
|
|
472
|
-
|
|
473
|
-
|
|
501
|
+
}) & ("manual" | {
|
|
502
|
+
prefixDefaultLocale: boolean;
|
|
503
|
+
redirectToDefaultLocale: boolean;
|
|
504
|
+
} | undefined);
|
|
474
505
|
domains?: Record<string, string> | undefined;
|
|
475
506
|
fallback?: Record<string, string> | undefined;
|
|
476
507
|
} | undefined;
|
|
@@ -553,10 +584,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
553
584
|
})[];
|
|
554
585
|
domains?: Record<string, string> | undefined;
|
|
555
586
|
fallback?: Record<string, string> | undefined;
|
|
556
|
-
routing?: {
|
|
587
|
+
routing?: "manual" | {
|
|
557
588
|
prefixDefaultLocale?: boolean | undefined;
|
|
558
589
|
redirectToDefaultLocale?: boolean | undefined;
|
|
559
|
-
strategy?: "pathname" | undefined;
|
|
560
590
|
} | undefined;
|
|
561
591
|
} | undefined;
|
|
562
592
|
experimental?: {
|
|
@@ -565,6 +595,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
565
595
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
566
596
|
clientPrerender?: boolean | undefined;
|
|
567
597
|
globalRoutePriority?: boolean | undefined;
|
|
598
|
+
security?: {
|
|
599
|
+
csrfProtection?: {
|
|
600
|
+
origin?: boolean | undefined;
|
|
601
|
+
} | undefined;
|
|
602
|
+
} | undefined;
|
|
568
603
|
i18nDomains?: boolean | undefined;
|
|
569
604
|
} | undefined;
|
|
570
605
|
legacy?: {} | undefined;
|
|
@@ -758,38 +793,35 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
758
793
|
}>]>, "many">;
|
|
759
794
|
domains: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
760
795
|
fallback: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
761
|
-
routing: z.
|
|
762
|
-
prefixDefaultLocale: z.ZodDefault<z.ZodBoolean
|
|
763
|
-
redirectToDefaultLocale: z.ZodDefault<z.ZodBoolean
|
|
764
|
-
strategy: z.ZodDefault<z.ZodEnum<["pathname"]>>;
|
|
796
|
+
routing: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"manual">, z.ZodEffects<z.ZodObject<{
|
|
797
|
+
prefixDefaultLocale: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
798
|
+
redirectToDefaultLocale: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
765
799
|
}, "strip", z.ZodTypeAny, {
|
|
766
800
|
prefixDefaultLocale: boolean;
|
|
767
801
|
redirectToDefaultLocale: boolean;
|
|
768
|
-
strategy: "pathname";
|
|
769
802
|
}, {
|
|
770
803
|
prefixDefaultLocale?: boolean | undefined;
|
|
771
804
|
redirectToDefaultLocale?: boolean | undefined;
|
|
772
|
-
|
|
773
|
-
}>>, {
|
|
805
|
+
}>, {
|
|
774
806
|
prefixDefaultLocale: boolean;
|
|
775
807
|
redirectToDefaultLocale: boolean;
|
|
776
|
-
strategy: "pathname";
|
|
777
808
|
}, {
|
|
778
809
|
prefixDefaultLocale?: boolean | undefined;
|
|
779
810
|
redirectToDefaultLocale?: boolean | undefined;
|
|
780
|
-
|
|
781
|
-
} | undefined>;
|
|
811
|
+
}>]>>>;
|
|
782
812
|
}, "strip", z.ZodTypeAny, {
|
|
783
813
|
defaultLocale: string;
|
|
784
814
|
locales: (string | {
|
|
785
815
|
path: string;
|
|
786
816
|
codes: [string, ...string[]];
|
|
787
817
|
})[];
|
|
788
|
-
routing: {
|
|
818
|
+
routing: ("manual" | {
|
|
789
819
|
prefixDefaultLocale: boolean;
|
|
790
820
|
redirectToDefaultLocale: boolean;
|
|
791
|
-
|
|
792
|
-
|
|
821
|
+
}) & ("manual" | {
|
|
822
|
+
prefixDefaultLocale: boolean;
|
|
823
|
+
redirectToDefaultLocale: boolean;
|
|
824
|
+
} | undefined);
|
|
793
825
|
domains?: Record<string, string> | undefined;
|
|
794
826
|
fallback?: Record<string, string> | undefined;
|
|
795
827
|
}, {
|
|
@@ -800,10 +832,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
800
832
|
})[];
|
|
801
833
|
domains?: Record<string, string> | undefined;
|
|
802
834
|
fallback?: Record<string, string> | undefined;
|
|
803
|
-
routing?: {
|
|
835
|
+
routing?: "manual" | {
|
|
804
836
|
prefixDefaultLocale?: boolean | undefined;
|
|
805
837
|
redirectToDefaultLocale?: boolean | undefined;
|
|
806
|
-
strategy?: "pathname" | undefined;
|
|
807
838
|
} | undefined;
|
|
808
839
|
}>>, {
|
|
809
840
|
defaultLocale: string;
|
|
@@ -811,11 +842,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
811
842
|
path: string;
|
|
812
843
|
codes: [string, ...string[]];
|
|
813
844
|
})[];
|
|
814
|
-
routing: {
|
|
845
|
+
routing: ("manual" | {
|
|
815
846
|
prefixDefaultLocale: boolean;
|
|
816
847
|
redirectToDefaultLocale: boolean;
|
|
817
|
-
|
|
818
|
-
|
|
848
|
+
}) & ("manual" | {
|
|
849
|
+
prefixDefaultLocale: boolean;
|
|
850
|
+
redirectToDefaultLocale: boolean;
|
|
851
|
+
} | undefined);
|
|
819
852
|
domains?: Record<string, string> | undefined;
|
|
820
853
|
fallback?: Record<string, string> | undefined;
|
|
821
854
|
} | undefined, {
|
|
@@ -826,10 +859,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
826
859
|
})[];
|
|
827
860
|
domains?: Record<string, string> | undefined;
|
|
828
861
|
fallback?: Record<string, string> | undefined;
|
|
829
|
-
routing?: {
|
|
862
|
+
routing?: "manual" | {
|
|
830
863
|
prefixDefaultLocale?: boolean | undefined;
|
|
831
864
|
redirectToDefaultLocale?: boolean | undefined;
|
|
832
|
-
strategy?: "pathname" | undefined;
|
|
833
865
|
} | undefined;
|
|
834
866
|
} | undefined>>;
|
|
835
867
|
experimental: z.ZodDefault<z.ZodObject<{
|
|
@@ -838,6 +870,23 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
838
870
|
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
839
871
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
840
872
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
873
|
+
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
874
|
+
csrfProtection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
875
|
+
origin: z.ZodDefault<z.ZodBoolean>;
|
|
876
|
+
}, "strip", z.ZodTypeAny, {
|
|
877
|
+
origin: boolean;
|
|
878
|
+
}, {
|
|
879
|
+
origin?: boolean | undefined;
|
|
880
|
+
}>>>;
|
|
881
|
+
}, "strip", z.ZodTypeAny, {
|
|
882
|
+
csrfProtection: {
|
|
883
|
+
origin: boolean;
|
|
884
|
+
};
|
|
885
|
+
}, {
|
|
886
|
+
csrfProtection?: {
|
|
887
|
+
origin?: boolean | undefined;
|
|
888
|
+
} | undefined;
|
|
889
|
+
}>>>;
|
|
841
890
|
i18nDomains: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
842
891
|
}, "strict", z.ZodTypeAny, {
|
|
843
892
|
directRenderScript: boolean;
|
|
@@ -846,12 +895,22 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
846
895
|
clientPrerender: boolean;
|
|
847
896
|
globalRoutePriority: boolean;
|
|
848
897
|
i18nDomains: boolean;
|
|
898
|
+
security: {
|
|
899
|
+
csrfProtection: {
|
|
900
|
+
origin: boolean;
|
|
901
|
+
};
|
|
902
|
+
};
|
|
849
903
|
}, {
|
|
850
904
|
directRenderScript?: boolean | undefined;
|
|
851
905
|
contentCollectionCache?: boolean | undefined;
|
|
852
906
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
853
907
|
clientPrerender?: boolean | undefined;
|
|
854
908
|
globalRoutePriority?: boolean | undefined;
|
|
909
|
+
security?: {
|
|
910
|
+
csrfProtection?: {
|
|
911
|
+
origin?: boolean | undefined;
|
|
912
|
+
} | undefined;
|
|
913
|
+
} | undefined;
|
|
855
914
|
i18nDomains?: boolean | undefined;
|
|
856
915
|
}>>;
|
|
857
916
|
legacy: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
@@ -1008,6 +1067,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1008
1067
|
clientPrerender: boolean;
|
|
1009
1068
|
globalRoutePriority: boolean;
|
|
1010
1069
|
i18nDomains: boolean;
|
|
1070
|
+
security: {
|
|
1071
|
+
csrfProtection: {
|
|
1072
|
+
origin: boolean;
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1011
1075
|
};
|
|
1012
1076
|
legacy: {};
|
|
1013
1077
|
site?: string | undefined;
|
|
@@ -1027,11 +1091,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1027
1091
|
path: string;
|
|
1028
1092
|
codes: [string, ...string[]];
|
|
1029
1093
|
})[];
|
|
1030
|
-
routing: {
|
|
1094
|
+
routing: ("manual" | {
|
|
1031
1095
|
prefixDefaultLocale: boolean;
|
|
1032
1096
|
redirectToDefaultLocale: boolean;
|
|
1033
|
-
|
|
1034
|
-
|
|
1097
|
+
}) & ("manual" | {
|
|
1098
|
+
prefixDefaultLocale: boolean;
|
|
1099
|
+
redirectToDefaultLocale: boolean;
|
|
1100
|
+
} | undefined);
|
|
1035
1101
|
domains?: Record<string, string> | undefined;
|
|
1036
1102
|
fallback?: Record<string, string> | undefined;
|
|
1037
1103
|
} | undefined;
|
|
@@ -1095,10 +1161,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1095
1161
|
})[];
|
|
1096
1162
|
domains?: Record<string, string> | undefined;
|
|
1097
1163
|
fallback?: Record<string, string> | undefined;
|
|
1098
|
-
routing?: {
|
|
1164
|
+
routing?: "manual" | {
|
|
1099
1165
|
prefixDefaultLocale?: boolean | undefined;
|
|
1100
1166
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1101
|
-
strategy?: "pathname" | undefined;
|
|
1102
1167
|
} | undefined;
|
|
1103
1168
|
} | undefined;
|
|
1104
1169
|
experimental?: {
|
|
@@ -1107,6 +1172,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1107
1172
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1108
1173
|
clientPrerender?: boolean | undefined;
|
|
1109
1174
|
globalRoutePriority?: boolean | undefined;
|
|
1175
|
+
security?: {
|
|
1176
|
+
csrfProtection?: {
|
|
1177
|
+
origin?: boolean | undefined;
|
|
1178
|
+
} | undefined;
|
|
1179
|
+
} | undefined;
|
|
1110
1180
|
i18nDomains?: boolean | undefined;
|
|
1111
1181
|
} | undefined;
|
|
1112
1182
|
legacy?: {} | undefined;
|
|
@@ -1209,6 +1279,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1209
1279
|
clientPrerender: boolean;
|
|
1210
1280
|
globalRoutePriority: boolean;
|
|
1211
1281
|
i18nDomains: boolean;
|
|
1282
|
+
security: {
|
|
1283
|
+
csrfProtection: {
|
|
1284
|
+
origin: boolean;
|
|
1285
|
+
};
|
|
1286
|
+
};
|
|
1212
1287
|
};
|
|
1213
1288
|
legacy: {};
|
|
1214
1289
|
site?: string | undefined;
|
|
@@ -1228,11 +1303,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1228
1303
|
path: string;
|
|
1229
1304
|
codes: [string, ...string[]];
|
|
1230
1305
|
})[];
|
|
1231
|
-
routing: {
|
|
1306
|
+
routing: ("manual" | {
|
|
1232
1307
|
prefixDefaultLocale: boolean;
|
|
1233
1308
|
redirectToDefaultLocale: boolean;
|
|
1234
|
-
|
|
1235
|
-
|
|
1309
|
+
}) & ("manual" | {
|
|
1310
|
+
prefixDefaultLocale: boolean;
|
|
1311
|
+
redirectToDefaultLocale: boolean;
|
|
1312
|
+
} | undefined);
|
|
1236
1313
|
domains?: Record<string, string> | undefined;
|
|
1237
1314
|
fallback?: Record<string, string> | undefined;
|
|
1238
1315
|
} | undefined;
|
|
@@ -1296,10 +1373,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1296
1373
|
})[];
|
|
1297
1374
|
domains?: Record<string, string> | undefined;
|
|
1298
1375
|
fallback?: Record<string, string> | undefined;
|
|
1299
|
-
routing?: {
|
|
1376
|
+
routing?: "manual" | {
|
|
1300
1377
|
prefixDefaultLocale?: boolean | undefined;
|
|
1301
1378
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1302
|
-
strategy?: "pathname" | undefined;
|
|
1303
1379
|
} | undefined;
|
|
1304
1380
|
} | undefined;
|
|
1305
1381
|
experimental?: {
|
|
@@ -1308,6 +1384,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1308
1384
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1309
1385
|
clientPrerender?: boolean | undefined;
|
|
1310
1386
|
globalRoutePriority?: boolean | undefined;
|
|
1387
|
+
security?: {
|
|
1388
|
+
csrfProtection?: {
|
|
1389
|
+
origin?: boolean | undefined;
|
|
1390
|
+
} | undefined;
|
|
1391
|
+
} | undefined;
|
|
1311
1392
|
i18nDomains?: boolean | undefined;
|
|
1312
1393
|
} | undefined;
|
|
1313
1394
|
legacy?: {} | undefined;
|
|
@@ -1410,6 +1491,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1410
1491
|
clientPrerender: boolean;
|
|
1411
1492
|
globalRoutePriority: boolean;
|
|
1412
1493
|
i18nDomains: boolean;
|
|
1494
|
+
security: {
|
|
1495
|
+
csrfProtection: {
|
|
1496
|
+
origin: boolean;
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1413
1499
|
};
|
|
1414
1500
|
legacy: {};
|
|
1415
1501
|
site?: string | undefined;
|
|
@@ -1429,11 +1515,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1429
1515
|
path: string;
|
|
1430
1516
|
codes: [string, ...string[]];
|
|
1431
1517
|
})[];
|
|
1432
|
-
routing: {
|
|
1518
|
+
routing: ("manual" | {
|
|
1433
1519
|
prefixDefaultLocale: boolean;
|
|
1434
1520
|
redirectToDefaultLocale: boolean;
|
|
1435
|
-
|
|
1436
|
-
|
|
1521
|
+
}) & ("manual" | {
|
|
1522
|
+
prefixDefaultLocale: boolean;
|
|
1523
|
+
redirectToDefaultLocale: boolean;
|
|
1524
|
+
} | undefined);
|
|
1437
1525
|
domains?: Record<string, string> | undefined;
|
|
1438
1526
|
fallback?: Record<string, string> | undefined;
|
|
1439
1527
|
} | undefined;
|
|
@@ -1497,10 +1585,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1497
1585
|
})[];
|
|
1498
1586
|
domains?: Record<string, string> | undefined;
|
|
1499
1587
|
fallback?: Record<string, string> | undefined;
|
|
1500
|
-
routing?: {
|
|
1588
|
+
routing?: "manual" | {
|
|
1501
1589
|
prefixDefaultLocale?: boolean | undefined;
|
|
1502
1590
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1503
|
-
strategy?: "pathname" | undefined;
|
|
1504
1591
|
} | undefined;
|
|
1505
1592
|
} | undefined;
|
|
1506
1593
|
experimental?: {
|
|
@@ -1509,6 +1596,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1509
1596
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1510
1597
|
clientPrerender?: boolean | undefined;
|
|
1511
1598
|
globalRoutePriority?: boolean | undefined;
|
|
1599
|
+
security?: {
|
|
1600
|
+
csrfProtection?: {
|
|
1601
|
+
origin?: boolean | undefined;
|
|
1602
|
+
} | undefined;
|
|
1603
|
+
} | undefined;
|
|
1512
1604
|
i18nDomains?: boolean | undefined;
|
|
1513
1605
|
} | undefined;
|
|
1514
1606
|
legacy?: {} | undefined;
|
|
@@ -1611,6 +1703,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1611
1703
|
clientPrerender: boolean;
|
|
1612
1704
|
globalRoutePriority: boolean;
|
|
1613
1705
|
i18nDomains: boolean;
|
|
1706
|
+
security: {
|
|
1707
|
+
csrfProtection: {
|
|
1708
|
+
origin: boolean;
|
|
1709
|
+
};
|
|
1710
|
+
};
|
|
1614
1711
|
};
|
|
1615
1712
|
legacy: {};
|
|
1616
1713
|
site?: string | undefined;
|
|
@@ -1630,11 +1727,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1630
1727
|
path: string;
|
|
1631
1728
|
codes: [string, ...string[]];
|
|
1632
1729
|
})[];
|
|
1633
|
-
routing: {
|
|
1730
|
+
routing: ("manual" | {
|
|
1634
1731
|
prefixDefaultLocale: boolean;
|
|
1635
1732
|
redirectToDefaultLocale: boolean;
|
|
1636
|
-
|
|
1637
|
-
|
|
1733
|
+
}) & ("manual" | {
|
|
1734
|
+
prefixDefaultLocale: boolean;
|
|
1735
|
+
redirectToDefaultLocale: boolean;
|
|
1736
|
+
} | undefined);
|
|
1638
1737
|
domains?: Record<string, string> | undefined;
|
|
1639
1738
|
fallback?: Record<string, string> | undefined;
|
|
1640
1739
|
} | undefined;
|
|
@@ -1698,10 +1797,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1698
1797
|
})[];
|
|
1699
1798
|
domains?: Record<string, string> | undefined;
|
|
1700
1799
|
fallback?: Record<string, string> | undefined;
|
|
1701
|
-
routing?: {
|
|
1800
|
+
routing?: "manual" | {
|
|
1702
1801
|
prefixDefaultLocale?: boolean | undefined;
|
|
1703
1802
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1704
|
-
strategy?: "pathname" | undefined;
|
|
1705
1803
|
} | undefined;
|
|
1706
1804
|
} | undefined;
|
|
1707
1805
|
experimental?: {
|
|
@@ -1710,6 +1808,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1710
1808
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1711
1809
|
clientPrerender?: boolean | undefined;
|
|
1712
1810
|
globalRoutePriority?: boolean | undefined;
|
|
1811
|
+
security?: {
|
|
1812
|
+
csrfProtection?: {
|
|
1813
|
+
origin?: boolean | undefined;
|
|
1814
|
+
} | undefined;
|
|
1815
|
+
} | undefined;
|
|
1713
1816
|
i18nDomains?: boolean | undefined;
|
|
1714
1817
|
} | undefined;
|
|
1715
1818
|
legacy?: {} | undefined;
|
|
@@ -44,7 +44,8 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
44
44
|
contentCollectionJsonSchema: false,
|
|
45
45
|
clientPrerender: false,
|
|
46
46
|
globalRoutePriority: false,
|
|
47
|
-
i18nDomains: false
|
|
47
|
+
i18nDomains: false,
|
|
48
|
+
security: {}
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
const AstroConfigSchema = z.object({
|
|
@@ -222,18 +223,19 @@ const AstroConfigSchema = z.object({
|
|
|
222
223
|
)
|
|
223
224
|
).optional(),
|
|
224
225
|
fallback: z.record(z.string(), z.string()).optional(),
|
|
225
|
-
routing: z.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
226
|
+
routing: z.literal("manual").or(
|
|
227
|
+
z.object({
|
|
228
|
+
prefixDefaultLocale: z.boolean().optional().default(false),
|
|
229
|
+
redirectToDefaultLocale: z.boolean().optional().default(true)
|
|
230
|
+
}).refine(
|
|
231
|
+
({ prefixDefaultLocale, redirectToDefaultLocale }) => {
|
|
232
|
+
return !(prefixDefaultLocale === false && redirectToDefaultLocale === false);
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
message: "The option `i18n.redirectToDefaultLocale` is only useful when the `i18n.prefixDefaultLocale` is set to `true`. Remove the option `i18n.redirectToDefaultLocale`, or change its value to `true`."
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
).optional().default({})
|
|
237
239
|
}).optional().superRefine((i18n, ctx) => {
|
|
238
240
|
if (i18n) {
|
|
239
241
|
const { defaultLocale, locales: _locales, fallback, domains } = i18n;
|
|
@@ -318,6 +320,11 @@ const AstroConfigSchema = z.object({
|
|
|
318
320
|
contentCollectionJsonSchema: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionJsonSchema),
|
|
319
321
|
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
320
322
|
globalRoutePriority: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.globalRoutePriority),
|
|
323
|
+
security: z.object({
|
|
324
|
+
csrfProtection: z.object({
|
|
325
|
+
origin: z.boolean().default(false)
|
|
326
|
+
}).optional().default({})
|
|
327
|
+
}).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.security),
|
|
321
328
|
i18nDomains: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.i18nDomains)
|
|
322
329
|
}).strict(
|
|
323
330
|
`Invalid or outdated experimental feature.
|
package/dist/core/constants.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
expires?: Date;
|
|
4
|
-
httpOnly?: boolean;
|
|
5
|
-
maxAge?: number;
|
|
6
|
-
path?: string;
|
|
7
|
-
sameSite?: boolean | 'lax' | 'none' | 'strict';
|
|
8
|
-
secure?: boolean;
|
|
9
|
-
encode?: (value: string) => string;
|
|
10
|
-
}
|
|
1
|
+
import type { CookieSerializeOptions } from 'cookie';
|
|
2
|
+
export type AstroCookieSetOptions = Pick<CookieSerializeOptions, 'domain' | 'path' | 'expires' | 'maxAge' | 'httpOnly' | 'sameSite' | 'secure' | 'encode'>;
|
|
11
3
|
export interface AstroCookieGetOptions {
|
|
12
4
|
decode?: (value: string) => string;
|
|
13
5
|
}
|
|
14
|
-
type AstroCookieDeleteOptions =
|
|
6
|
+
type AstroCookieDeleteOptions = Omit<AstroCookieSetOptions, 'expires' | 'maxAge' | 'encode'>;
|
|
15
7
|
interface AstroCookieInterface {
|
|
16
8
|
value: string;
|
|
17
9
|
json(): Record<string, any>;
|
|
@@ -42,15 +42,17 @@ class AstroCookies {
|
|
|
42
42
|
* @param options Options related to this deletion, such as the path of the cookie.
|
|
43
43
|
*/
|
|
44
44
|
delete(key, options) {
|
|
45
|
+
const {
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
maxAge: _ignoredMaxAge,
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
expires: _ignoredExpires,
|
|
50
|
+
...sanitizedOptions
|
|
51
|
+
} = options || {};
|
|
45
52
|
const serializeOptions = {
|
|
46
|
-
expires: DELETED_EXPIRATION
|
|
53
|
+
expires: DELETED_EXPIRATION,
|
|
54
|
+
...sanitizedOptions
|
|
47
55
|
};
|
|
48
|
-
if (options?.domain) {
|
|
49
|
-
serializeOptions.domain = options.domain;
|
|
50
|
-
}
|
|
51
|
-
if (options?.path) {
|
|
52
|
-
serializeOptions.path = options.path;
|
|
53
|
-
}
|
|
54
56
|
this.#ensureOutgoingMap().set(key, [
|
|
55
57
|
DELETED_VALUE,
|
|
56
58
|
serialize(key, DELETED_VALUE, serializeOptions),
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.
|
|
26
|
+
const currentVersion = "4.6.0";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
|
@@ -106,7 +106,7 @@ function collectInfoFromStacktrace(error) {
|
|
|
106
106
|
if (!stackInfo.loc || !stackInfo.loc.column && !stackInfo.loc.line) {
|
|
107
107
|
const possibleFilePath = error.loc?.file || error.pluginCode || error.id || // TODO: this could be better, `src` might be something else
|
|
108
108
|
stackText.split("\n").find((ln) => ln.includes("src") || ln.includes("node_modules"));
|
|
109
|
-
const source = possibleFilePath?.replace(/^[^(]+\(([^)]+).*$/, "$1").replace(/^\s+at\s+/, "");
|
|
109
|
+
const source = possibleFilePath?.replace?.(/^[^(]+\(([^)]+).*$/, "$1").replace(/^\s+at\s+/, "");
|
|
110
110
|
let file = source?.replace(/:\d+/g, "");
|
|
111
111
|
const location = /:(\d+):(\d+)/.exec(source) ?? [];
|
|
112
112
|
const line = location[1];
|