astro 4.8.6 → 4.9.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/astro-jsx.d.ts +1 -1
- package/dist/@types/astro.d.ts +43 -96
- package/dist/actions/runtime/middleware.d.ts +1 -0
- package/dist/actions/runtime/middleware.js +44 -12
- package/dist/actions/runtime/route.js +1 -2
- package/dist/actions/runtime/utils.d.ts +6 -1
- package/dist/actions/runtime/utils.js +2 -1
- package/dist/actions/runtime/virtual/server.d.ts +4 -2
- package/dist/actions/runtime/virtual/server.js +9 -11
- package/dist/actions/utils.d.ts +2 -0
- package/dist/actions/utils.js +2 -1
- package/dist/container/index.d.ts +162 -0
- package/dist/container/index.js +234 -0
- package/dist/container/pipeline.d.ts +11 -0
- package/dist/container/pipeline.js +96 -0
- package/dist/core/app/node.js +4 -1
- package/dist/core/build/consts.d.ts +1 -0
- package/dist/core/build/consts.js +3 -1
- package/dist/core/build/generate.js +3 -3
- package/dist/core/build/index.js +2 -2
- package/dist/core/build/plugins/plugin-content.d.ts +1 -1
- package/dist/core/build/plugins/plugin-content.js +13 -2
- package/dist/core/build/plugins/plugin-manifest.js +2 -2
- package/dist/core/build/static-build.d.ts +2 -1
- package/dist/core/build/static-build.js +7 -6
- package/dist/core/config/schema.d.ts +92 -120
- package/dist/core/config/schema.js +18 -23
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.d.ts +1 -1
- package/dist/core/render-context.js +6 -3
- package/dist/core/routing/manifest/create.d.ts +4 -1
- package/dist/core/routing/manifest/create.js +10 -8
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/integrations/features-validation.js +1 -1
- package/dist/runtime/client/dev-toolbar/apps/utils/highlight.js +2 -0
- package/dist/runtime/server/jsx.js +1 -0
- package/dist/vite-plugin-astro-server/plugin.d.ts +0 -1
- package/dist/vite-plugin-astro-server/plugin.js +1 -1
- package/package.json +7 -3
- package/templates/actions.mjs +37 -12
|
@@ -14,6 +14,54 @@ type ShikiTransformer = ComplexifyWithUnion<NonNullable<ShikiConfig['transformer
|
|
|
14
14
|
type RehypePlugin = ComplexifyWithUnion<_RehypePlugin>;
|
|
15
15
|
type RemarkPlugin = ComplexifyWithUnion<_RemarkPlugin>;
|
|
16
16
|
type RemarkRehype = ComplexifyWithOmit<_RemarkRehype>;
|
|
17
|
+
export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
18
|
+
root: string;
|
|
19
|
+
srcDir: string;
|
|
20
|
+
publicDir: string;
|
|
21
|
+
outDir: string;
|
|
22
|
+
cacheDir: string;
|
|
23
|
+
base: string;
|
|
24
|
+
trailingSlash: "ignore";
|
|
25
|
+
build: {
|
|
26
|
+
format: "directory";
|
|
27
|
+
client: string;
|
|
28
|
+
server: string;
|
|
29
|
+
assets: string;
|
|
30
|
+
serverEntry: string;
|
|
31
|
+
redirects: true;
|
|
32
|
+
inlineStylesheets: "auto";
|
|
33
|
+
};
|
|
34
|
+
image: {
|
|
35
|
+
service: {
|
|
36
|
+
entrypoint: "astro/assets/services/sharp";
|
|
37
|
+
config: {};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
devToolbar: {
|
|
41
|
+
enabled: true;
|
|
42
|
+
};
|
|
43
|
+
compressHTML: true;
|
|
44
|
+
server: {
|
|
45
|
+
host: false;
|
|
46
|
+
port: number;
|
|
47
|
+
open: false;
|
|
48
|
+
};
|
|
49
|
+
integrations: never[];
|
|
50
|
+
markdown: Required<import("@astrojs/markdown-remark").AstroMarkdownOptions>;
|
|
51
|
+
vite: {};
|
|
52
|
+
legacy: {};
|
|
53
|
+
redirects: {};
|
|
54
|
+
security: {};
|
|
55
|
+
experimental: {
|
|
56
|
+
actions: false;
|
|
57
|
+
directRenderScript: false;
|
|
58
|
+
contentCollectionCache: false;
|
|
59
|
+
contentCollectionJsonSchema: false;
|
|
60
|
+
clientPrerender: false;
|
|
61
|
+
globalRoutePriority: false;
|
|
62
|
+
rewriting: false;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
17
65
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
18
66
|
root: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
19
67
|
srcDir: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, URL, string | undefined>;
|
|
@@ -336,6 +384,13 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
336
384
|
redirectToDefaultLocale?: boolean | undefined;
|
|
337
385
|
} | undefined;
|
|
338
386
|
} | undefined>>;
|
|
387
|
+
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
388
|
+
checkOrigin: z.ZodDefault<z.ZodBoolean>;
|
|
389
|
+
}, "strip", z.ZodTypeAny, {
|
|
390
|
+
checkOrigin: boolean;
|
|
391
|
+
}, {
|
|
392
|
+
checkOrigin?: boolean | undefined;
|
|
393
|
+
}>>>;
|
|
339
394
|
experimental: z.ZodDefault<z.ZodObject<{
|
|
340
395
|
actions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
341
396
|
directRenderScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -343,24 +398,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
343
398
|
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
344
399
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
345
400
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
346
|
-
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
347
|
-
csrfProtection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
348
|
-
origin: z.ZodDefault<z.ZodBoolean>;
|
|
349
|
-
}, "strip", z.ZodTypeAny, {
|
|
350
|
-
origin: boolean;
|
|
351
|
-
}, {
|
|
352
|
-
origin?: boolean | undefined;
|
|
353
|
-
}>>>;
|
|
354
|
-
}, "strip", z.ZodTypeAny, {
|
|
355
|
-
csrfProtection: {
|
|
356
|
-
origin: boolean;
|
|
357
|
-
};
|
|
358
|
-
}, {
|
|
359
|
-
csrfProtection?: {
|
|
360
|
-
origin?: boolean | undefined;
|
|
361
|
-
} | undefined;
|
|
362
|
-
}>>>;
|
|
363
|
-
i18nDomains: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
364
401
|
rewriting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
365
402
|
}, "strict", z.ZodTypeAny, {
|
|
366
403
|
actions: boolean;
|
|
@@ -369,13 +406,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
369
406
|
contentCollectionJsonSchema: boolean;
|
|
370
407
|
clientPrerender: boolean;
|
|
371
408
|
globalRoutePriority: boolean;
|
|
372
|
-
i18nDomains: boolean;
|
|
373
409
|
rewriting: boolean;
|
|
374
|
-
security: {
|
|
375
|
-
csrfProtection: {
|
|
376
|
-
origin: boolean;
|
|
377
|
-
};
|
|
378
|
-
};
|
|
379
410
|
}, {
|
|
380
411
|
actions?: boolean | undefined;
|
|
381
412
|
directRenderScript?: boolean | undefined;
|
|
@@ -383,13 +414,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
383
414
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
384
415
|
clientPrerender?: boolean | undefined;
|
|
385
416
|
globalRoutePriority?: boolean | undefined;
|
|
386
|
-
i18nDomains?: boolean | undefined;
|
|
387
417
|
rewriting?: boolean | undefined;
|
|
388
|
-
security?: {
|
|
389
|
-
csrfProtection?: {
|
|
390
|
-
origin?: boolean | undefined;
|
|
391
|
-
} | undefined;
|
|
392
|
-
} | undefined;
|
|
393
418
|
}>>;
|
|
394
419
|
legacy: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
395
420
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -464,6 +489,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
464
489
|
smartypants: boolean;
|
|
465
490
|
};
|
|
466
491
|
vite: ViteUserConfig;
|
|
492
|
+
security: {
|
|
493
|
+
checkOrigin: boolean;
|
|
494
|
+
};
|
|
467
495
|
experimental: {
|
|
468
496
|
actions: boolean;
|
|
469
497
|
directRenderScript: boolean;
|
|
@@ -471,13 +499,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
471
499
|
contentCollectionJsonSchema: boolean;
|
|
472
500
|
clientPrerender: boolean;
|
|
473
501
|
globalRoutePriority: boolean;
|
|
474
|
-
i18nDomains: boolean;
|
|
475
502
|
rewriting: boolean;
|
|
476
|
-
security: {
|
|
477
|
-
csrfProtection: {
|
|
478
|
-
origin: boolean;
|
|
479
|
-
};
|
|
480
|
-
};
|
|
481
503
|
};
|
|
482
504
|
legacy: {};
|
|
483
505
|
site?: string | undefined;
|
|
@@ -588,6 +610,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
588
610
|
redirectToDefaultLocale?: boolean | undefined;
|
|
589
611
|
} | undefined;
|
|
590
612
|
} | undefined;
|
|
613
|
+
security?: {
|
|
614
|
+
checkOrigin?: boolean | undefined;
|
|
615
|
+
} | undefined;
|
|
591
616
|
experimental?: {
|
|
592
617
|
actions?: boolean | undefined;
|
|
593
618
|
directRenderScript?: boolean | undefined;
|
|
@@ -595,13 +620,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
595
620
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
596
621
|
clientPrerender?: boolean | undefined;
|
|
597
622
|
globalRoutePriority?: boolean | undefined;
|
|
598
|
-
i18nDomains?: boolean | undefined;
|
|
599
623
|
rewriting?: boolean | undefined;
|
|
600
|
-
security?: {
|
|
601
|
-
csrfProtection?: {
|
|
602
|
-
origin?: boolean | undefined;
|
|
603
|
-
} | undefined;
|
|
604
|
-
} | undefined;
|
|
605
624
|
} | undefined;
|
|
606
625
|
legacy?: {} | undefined;
|
|
607
626
|
}>;
|
|
@@ -928,6 +947,13 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
928
947
|
redirectToDefaultLocale?: boolean | undefined;
|
|
929
948
|
} | undefined;
|
|
930
949
|
} | undefined>>;
|
|
950
|
+
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
951
|
+
checkOrigin: z.ZodDefault<z.ZodBoolean>;
|
|
952
|
+
}, "strip", z.ZodTypeAny, {
|
|
953
|
+
checkOrigin: boolean;
|
|
954
|
+
}, {
|
|
955
|
+
checkOrigin?: boolean | undefined;
|
|
956
|
+
}>>>;
|
|
931
957
|
experimental: z.ZodDefault<z.ZodObject<{
|
|
932
958
|
actions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
933
959
|
directRenderScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -935,24 +961,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
935
961
|
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
936
962
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
937
963
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
938
|
-
security: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
939
|
-
csrfProtection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
940
|
-
origin: z.ZodDefault<z.ZodBoolean>;
|
|
941
|
-
}, "strip", z.ZodTypeAny, {
|
|
942
|
-
origin: boolean;
|
|
943
|
-
}, {
|
|
944
|
-
origin?: boolean | undefined;
|
|
945
|
-
}>>>;
|
|
946
|
-
}, "strip", z.ZodTypeAny, {
|
|
947
|
-
csrfProtection: {
|
|
948
|
-
origin: boolean;
|
|
949
|
-
};
|
|
950
|
-
}, {
|
|
951
|
-
csrfProtection?: {
|
|
952
|
-
origin?: boolean | undefined;
|
|
953
|
-
} | undefined;
|
|
954
|
-
}>>>;
|
|
955
|
-
i18nDomains: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
956
964
|
rewriting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
957
965
|
}, "strict", z.ZodTypeAny, {
|
|
958
966
|
actions: boolean;
|
|
@@ -961,13 +969,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
961
969
|
contentCollectionJsonSchema: boolean;
|
|
962
970
|
clientPrerender: boolean;
|
|
963
971
|
globalRoutePriority: boolean;
|
|
964
|
-
i18nDomains: boolean;
|
|
965
972
|
rewriting: boolean;
|
|
966
|
-
security: {
|
|
967
|
-
csrfProtection: {
|
|
968
|
-
origin: boolean;
|
|
969
|
-
};
|
|
970
|
-
};
|
|
971
973
|
}, {
|
|
972
974
|
actions?: boolean | undefined;
|
|
973
975
|
directRenderScript?: boolean | undefined;
|
|
@@ -975,13 +977,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
975
977
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
976
978
|
clientPrerender?: boolean | undefined;
|
|
977
979
|
globalRoutePriority?: boolean | undefined;
|
|
978
|
-
i18nDomains?: boolean | undefined;
|
|
979
980
|
rewriting?: boolean | undefined;
|
|
980
|
-
security?: {
|
|
981
|
-
csrfProtection?: {
|
|
982
|
-
origin?: boolean | undefined;
|
|
983
|
-
} | undefined;
|
|
984
|
-
} | undefined;
|
|
985
981
|
}>>;
|
|
986
982
|
legacy: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
987
983
|
}, {
|
|
@@ -1131,6 +1127,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1131
1127
|
smartypants: boolean;
|
|
1132
1128
|
};
|
|
1133
1129
|
vite: ViteUserConfig;
|
|
1130
|
+
security: {
|
|
1131
|
+
checkOrigin: boolean;
|
|
1132
|
+
};
|
|
1134
1133
|
experimental: {
|
|
1135
1134
|
actions: boolean;
|
|
1136
1135
|
directRenderScript: boolean;
|
|
@@ -1138,13 +1137,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1138
1137
|
contentCollectionJsonSchema: boolean;
|
|
1139
1138
|
clientPrerender: boolean;
|
|
1140
1139
|
globalRoutePriority: boolean;
|
|
1141
|
-
i18nDomains: boolean;
|
|
1142
1140
|
rewriting: boolean;
|
|
1143
|
-
security: {
|
|
1144
|
-
csrfProtection: {
|
|
1145
|
-
origin: boolean;
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
1148
1141
|
};
|
|
1149
1142
|
legacy: {};
|
|
1150
1143
|
site?: string | undefined;
|
|
@@ -1255,6 +1248,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1255
1248
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1256
1249
|
} | undefined;
|
|
1257
1250
|
} | undefined;
|
|
1251
|
+
security?: {
|
|
1252
|
+
checkOrigin?: boolean | undefined;
|
|
1253
|
+
} | undefined;
|
|
1258
1254
|
experimental?: {
|
|
1259
1255
|
actions?: boolean | undefined;
|
|
1260
1256
|
directRenderScript?: boolean | undefined;
|
|
@@ -1262,13 +1258,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1262
1258
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1263
1259
|
clientPrerender?: boolean | undefined;
|
|
1264
1260
|
globalRoutePriority?: boolean | undefined;
|
|
1265
|
-
i18nDomains?: boolean | undefined;
|
|
1266
1261
|
rewriting?: boolean | undefined;
|
|
1267
|
-
security?: {
|
|
1268
|
-
csrfProtection?: {
|
|
1269
|
-
origin?: boolean | undefined;
|
|
1270
|
-
} | undefined;
|
|
1271
|
-
} | undefined;
|
|
1272
1262
|
} | undefined;
|
|
1273
1263
|
legacy?: {} | undefined;
|
|
1274
1264
|
}>, {
|
|
@@ -1344,6 +1334,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1344
1334
|
smartypants: boolean;
|
|
1345
1335
|
};
|
|
1346
1336
|
vite: ViteUserConfig;
|
|
1337
|
+
security: {
|
|
1338
|
+
checkOrigin: boolean;
|
|
1339
|
+
};
|
|
1347
1340
|
experimental: {
|
|
1348
1341
|
actions: boolean;
|
|
1349
1342
|
directRenderScript: boolean;
|
|
@@ -1351,13 +1344,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1351
1344
|
contentCollectionJsonSchema: boolean;
|
|
1352
1345
|
clientPrerender: boolean;
|
|
1353
1346
|
globalRoutePriority: boolean;
|
|
1354
|
-
i18nDomains: boolean;
|
|
1355
1347
|
rewriting: boolean;
|
|
1356
|
-
security: {
|
|
1357
|
-
csrfProtection: {
|
|
1358
|
-
origin: boolean;
|
|
1359
|
-
};
|
|
1360
|
-
};
|
|
1361
1348
|
};
|
|
1362
1349
|
legacy: {};
|
|
1363
1350
|
site?: string | undefined;
|
|
@@ -1468,6 +1455,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1468
1455
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1469
1456
|
} | undefined;
|
|
1470
1457
|
} | undefined;
|
|
1458
|
+
security?: {
|
|
1459
|
+
checkOrigin?: boolean | undefined;
|
|
1460
|
+
} | undefined;
|
|
1471
1461
|
experimental?: {
|
|
1472
1462
|
actions?: boolean | undefined;
|
|
1473
1463
|
directRenderScript?: boolean | undefined;
|
|
@@ -1475,13 +1465,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1475
1465
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1476
1466
|
clientPrerender?: boolean | undefined;
|
|
1477
1467
|
globalRoutePriority?: boolean | undefined;
|
|
1478
|
-
i18nDomains?: boolean | undefined;
|
|
1479
1468
|
rewriting?: boolean | undefined;
|
|
1480
|
-
security?: {
|
|
1481
|
-
csrfProtection?: {
|
|
1482
|
-
origin?: boolean | undefined;
|
|
1483
|
-
} | undefined;
|
|
1484
|
-
} | undefined;
|
|
1485
1469
|
} | undefined;
|
|
1486
1470
|
legacy?: {} | undefined;
|
|
1487
1471
|
}>, {
|
|
@@ -1557,6 +1541,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1557
1541
|
smartypants: boolean;
|
|
1558
1542
|
};
|
|
1559
1543
|
vite: ViteUserConfig;
|
|
1544
|
+
security: {
|
|
1545
|
+
checkOrigin: boolean;
|
|
1546
|
+
};
|
|
1560
1547
|
experimental: {
|
|
1561
1548
|
actions: boolean;
|
|
1562
1549
|
directRenderScript: boolean;
|
|
@@ -1564,13 +1551,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1564
1551
|
contentCollectionJsonSchema: boolean;
|
|
1565
1552
|
clientPrerender: boolean;
|
|
1566
1553
|
globalRoutePriority: boolean;
|
|
1567
|
-
i18nDomains: boolean;
|
|
1568
1554
|
rewriting: boolean;
|
|
1569
|
-
security: {
|
|
1570
|
-
csrfProtection: {
|
|
1571
|
-
origin: boolean;
|
|
1572
|
-
};
|
|
1573
|
-
};
|
|
1574
1555
|
};
|
|
1575
1556
|
legacy: {};
|
|
1576
1557
|
site?: string | undefined;
|
|
@@ -1681,6 +1662,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1681
1662
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1682
1663
|
} | undefined;
|
|
1683
1664
|
} | undefined;
|
|
1665
|
+
security?: {
|
|
1666
|
+
checkOrigin?: boolean | undefined;
|
|
1667
|
+
} | undefined;
|
|
1684
1668
|
experimental?: {
|
|
1685
1669
|
actions?: boolean | undefined;
|
|
1686
1670
|
directRenderScript?: boolean | undefined;
|
|
@@ -1688,13 +1672,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1688
1672
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1689
1673
|
clientPrerender?: boolean | undefined;
|
|
1690
1674
|
globalRoutePriority?: boolean | undefined;
|
|
1691
|
-
i18nDomains?: boolean | undefined;
|
|
1692
1675
|
rewriting?: boolean | undefined;
|
|
1693
|
-
security?: {
|
|
1694
|
-
csrfProtection?: {
|
|
1695
|
-
origin?: boolean | undefined;
|
|
1696
|
-
} | undefined;
|
|
1697
|
-
} | undefined;
|
|
1698
1676
|
} | undefined;
|
|
1699
1677
|
legacy?: {} | undefined;
|
|
1700
1678
|
}>, {
|
|
@@ -1770,6 +1748,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1770
1748
|
smartypants: boolean;
|
|
1771
1749
|
};
|
|
1772
1750
|
vite: ViteUserConfig;
|
|
1751
|
+
security: {
|
|
1752
|
+
checkOrigin: boolean;
|
|
1753
|
+
};
|
|
1773
1754
|
experimental: {
|
|
1774
1755
|
actions: boolean;
|
|
1775
1756
|
directRenderScript: boolean;
|
|
@@ -1777,13 +1758,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1777
1758
|
contentCollectionJsonSchema: boolean;
|
|
1778
1759
|
clientPrerender: boolean;
|
|
1779
1760
|
globalRoutePriority: boolean;
|
|
1780
|
-
i18nDomains: boolean;
|
|
1781
1761
|
rewriting: boolean;
|
|
1782
|
-
security: {
|
|
1783
|
-
csrfProtection: {
|
|
1784
|
-
origin: boolean;
|
|
1785
|
-
};
|
|
1786
|
-
};
|
|
1787
1762
|
};
|
|
1788
1763
|
legacy: {};
|
|
1789
1764
|
site?: string | undefined;
|
|
@@ -1894,6 +1869,9 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1894
1869
|
redirectToDefaultLocale?: boolean | undefined;
|
|
1895
1870
|
} | undefined;
|
|
1896
1871
|
} | undefined;
|
|
1872
|
+
security?: {
|
|
1873
|
+
checkOrigin?: boolean | undefined;
|
|
1874
|
+
} | undefined;
|
|
1897
1875
|
experimental?: {
|
|
1898
1876
|
actions?: boolean | undefined;
|
|
1899
1877
|
directRenderScript?: boolean | undefined;
|
|
@@ -1901,13 +1879,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1901
1879
|
contentCollectionJsonSchema?: boolean | undefined;
|
|
1902
1880
|
clientPrerender?: boolean | undefined;
|
|
1903
1881
|
globalRoutePriority?: boolean | undefined;
|
|
1904
|
-
i18nDomains?: boolean | undefined;
|
|
1905
1882
|
rewriting?: boolean | undefined;
|
|
1906
|
-
security?: {
|
|
1907
|
-
csrfProtection?: {
|
|
1908
|
-
origin?: boolean | undefined;
|
|
1909
|
-
} | undefined;
|
|
1910
|
-
} | undefined;
|
|
1911
1883
|
} | undefined;
|
|
1912
1884
|
legacy?: {} | undefined;
|
|
1913
1885
|
}>;
|
|
@@ -38,6 +38,7 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
38
38
|
vite: {},
|
|
39
39
|
legacy: {},
|
|
40
40
|
redirects: {},
|
|
41
|
+
security: {},
|
|
41
42
|
experimental: {
|
|
42
43
|
actions: false,
|
|
43
44
|
directRenderScript: false,
|
|
@@ -45,8 +46,6 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
45
46
|
contentCollectionJsonSchema: false,
|
|
46
47
|
clientPrerender: false,
|
|
47
48
|
globalRoutePriority: false,
|
|
48
|
-
i18nDomains: false,
|
|
49
|
-
security: {},
|
|
50
49
|
rewriting: false
|
|
51
50
|
}
|
|
52
51
|
};
|
|
@@ -316,6 +315,9 @@ const AstroConfigSchema = z.object({
|
|
|
316
315
|
}
|
|
317
316
|
})
|
|
318
317
|
),
|
|
318
|
+
security: z.object({
|
|
319
|
+
checkOrigin: z.boolean().default(false)
|
|
320
|
+
}).optional().default(ASTRO_CONFIG_DEFAULTS.security),
|
|
319
321
|
experimental: z.object({
|
|
320
322
|
actions: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.actions),
|
|
321
323
|
directRenderScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.directRenderScript),
|
|
@@ -323,12 +325,6 @@ const AstroConfigSchema = z.object({
|
|
|
323
325
|
contentCollectionJsonSchema: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionJsonSchema),
|
|
324
326
|
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
325
327
|
globalRoutePriority: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.globalRoutePriority),
|
|
326
|
-
security: z.object({
|
|
327
|
-
csrfProtection: z.object({
|
|
328
|
-
origin: z.boolean().default(false)
|
|
329
|
-
}).optional().default({})
|
|
330
|
-
}).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.security),
|
|
331
|
-
i18nDomains: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.i18nDomains),
|
|
332
328
|
rewriting: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.rewriting)
|
|
333
329
|
}).strict(
|
|
334
330
|
`Invalid or outdated experimental feature.
|
|
@@ -404,21 +400,19 @@ function createRelativeSchema(cmd, fileProtocolRoot) {
|
|
|
404
400
|
message: "The value of `outDir` must not point to a path within the folder set as `publicDir`, this will cause an infinite loop"
|
|
405
401
|
}).superRefine((configuration, ctx) => {
|
|
406
402
|
const { site, experimental, i18n, output } = configuration;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
});
|
|
421
|
-
}
|
|
403
|
+
const hasDomains = i18n?.domains ? Object.keys(i18n.domains).length > 0 : false;
|
|
404
|
+
if (hasDomains) {
|
|
405
|
+
if (!site) {
|
|
406
|
+
ctx.addIssue({
|
|
407
|
+
code: z.ZodIssueCode.custom,
|
|
408
|
+
message: "The option `site` isn't set. When using the 'domains' strategy for `i18n`, `site` is required to create absolute URLs for locales that aren't mapped to a domain."
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
if (output !== "server") {
|
|
412
|
+
ctx.addIssue({
|
|
413
|
+
code: z.ZodIssueCode.custom,
|
|
414
|
+
message: 'Domain support is only available when `output` is `"server"`.'
|
|
415
|
+
});
|
|
422
416
|
}
|
|
423
417
|
}
|
|
424
418
|
});
|
|
@@ -432,6 +426,7 @@ function resolveDirAsUrl(dir, root) {
|
|
|
432
426
|
return pathToFileURL(resolvedDir);
|
|
433
427
|
}
|
|
434
428
|
export {
|
|
429
|
+
ASTRO_CONFIG_DEFAULTS,
|
|
435
430
|
AstroConfigSchema,
|
|
436
431
|
createRelativeSchema
|
|
437
432
|
};
|
package/dist/core/constants.js
CHANGED
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.9.0";
|
|
23
23
|
const isPrerelease = currentVersion.includes("-");
|
|
24
24
|
if (!isPrerelease) {
|
|
25
25
|
try {
|
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.9.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.9.0"}`
|
|
273
273
|
)} ${headline}`
|
|
274
274
|
);
|
|
275
275
|
}
|
|
@@ -39,7 +39,7 @@ export declare class RenderContext {
|
|
|
39
39
|
* - endpoint
|
|
40
40
|
* - fallback
|
|
41
41
|
*/
|
|
42
|
-
render(componentInstance: ComponentInstance | undefined): Promise<Response>;
|
|
42
|
+
render(componentInstance: ComponentInstance | undefined, slots?: Record<string, any>): Promise<Response>;
|
|
43
43
|
createAPIContext(props: APIContext['props']): APIContext;
|
|
44
44
|
createActionAPIContext(): ActionAPIContext;
|
|
45
45
|
createResult(mod: ComponentInstance): Promise<SSRResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGetActionResult } from "../actions/utils.js";
|
|
1
|
+
import { createGetActionResult, hasActionsInternal } from "../actions/utils.js";
|
|
2
2
|
import {
|
|
3
3
|
computeCurrentLocale,
|
|
4
4
|
computePreferredLocale,
|
|
@@ -71,7 +71,7 @@ class RenderContext {
|
|
|
71
71
|
* - endpoint
|
|
72
72
|
* - fallback
|
|
73
73
|
*/
|
|
74
|
-
async render(componentInstance) {
|
|
74
|
+
async render(componentInstance, slots = {}) {
|
|
75
75
|
const { cookies, middleware, pathname, pipeline } = this;
|
|
76
76
|
const { logger, routeCache, serverLike, streaming } = pipeline;
|
|
77
77
|
const props = await getProps({
|
|
@@ -126,7 +126,7 @@ class RenderContext {
|
|
|
126
126
|
result,
|
|
127
127
|
componentInstance?.default,
|
|
128
128
|
props,
|
|
129
|
-
|
|
129
|
+
slots,
|
|
130
130
|
streaming,
|
|
131
131
|
this.routeData
|
|
132
132
|
);
|
|
@@ -249,6 +249,7 @@ class RenderContext {
|
|
|
249
249
|
throw new AstroError(AstroErrorData.AstroResponseHeadersReassigned);
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
+
const actionResult = hasActionsInternal(this.locals) ? this.locals._actionsInternal?.actionResult : void 0;
|
|
252
253
|
const result = {
|
|
253
254
|
cancelled: false,
|
|
254
255
|
clientDirectives,
|
|
@@ -264,8 +265,10 @@ class RenderContext {
|
|
|
264
265
|
renderers,
|
|
265
266
|
resolve,
|
|
266
267
|
response,
|
|
268
|
+
request: this.request,
|
|
267
269
|
scripts,
|
|
268
270
|
styles,
|
|
271
|
+
actionResult,
|
|
269
272
|
_metadata: {
|
|
270
273
|
hasHydrationScript: false,
|
|
271
274
|
rendererSpecificHydrationScripts: /* @__PURE__ */ new Set(),
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { AstroSettings, ManifestData } from '../../../@types/astro.js';
|
|
2
|
+
import type { AstroConfig, AstroSettings, ManifestData, RoutePart } from '../../../@types/astro.js';
|
|
3
3
|
import type { Logger } from '../../logger/core.js';
|
|
4
4
|
import nodeFs from 'node:fs';
|
|
5
|
+
export declare function getParts(part: string, file: string): RoutePart[];
|
|
6
|
+
export declare function getPattern(segments: RoutePart[][], base: AstroConfig['base'], addTrailingSlash: AstroConfig['trailingSlash']): RegExp;
|
|
7
|
+
export declare function validateSegment(segment: string, file?: string): void;
|
|
5
8
|
export interface CreateRouteManifestParams {
|
|
6
9
|
/** Astro Settings object */
|
|
7
10
|
settings: AstroSettings;
|
|
@@ -39,8 +39,7 @@ function getParts(part, file) {
|
|
|
39
39
|
});
|
|
40
40
|
return result;
|
|
41
41
|
}
|
|
42
|
-
function getPattern(segments,
|
|
43
|
-
const base = config.base;
|
|
42
|
+
function getPattern(segments, base, addTrailingSlash) {
|
|
44
43
|
const pathname = segments.map((segment) => {
|
|
45
44
|
if (segment.length === 1 && segment[0].spread) {
|
|
46
45
|
return "(?:\\/(.*?))?";
|
|
@@ -187,7 +186,7 @@ function createFileBasedRoutes({ settings, cwd, fsMod }, logger) {
|
|
|
187
186
|
components.push(item.file);
|
|
188
187
|
const component = item.file;
|
|
189
188
|
const { trailingSlash } = settings.config;
|
|
190
|
-
const pattern = getPattern(segments, settings.config, trailingSlash);
|
|
189
|
+
const pattern = getPattern(segments, settings.config.base, trailingSlash);
|
|
191
190
|
const generate = getRouteGenerator(segments, trailingSlash);
|
|
192
191
|
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic) ? `/${segments.map((segment) => segment[0].content).join("/")}` : null;
|
|
193
192
|
const route = joinSegments(segments);
|
|
@@ -241,7 +240,7 @@ function createInjectedRoutes({ settings, cwd }) {
|
|
|
241
240
|
const type = resolved.endsWith(".astro") ? "page" : "endpoint";
|
|
242
241
|
const isPage = type === "page";
|
|
243
242
|
const trailingSlash = isPage ? config.trailingSlash : "never";
|
|
244
|
-
const pattern = getPattern(segments, settings.config, trailingSlash);
|
|
243
|
+
const pattern = getPattern(segments, settings.config.base, trailingSlash);
|
|
245
244
|
const generate = getRouteGenerator(segments, trailingSlash);
|
|
246
245
|
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic) ? `/${segments.map((segment) => segment[0].content).join("/")}` : null;
|
|
247
246
|
const params = segments.flat().filter((p) => p.dynamic).map((p) => p.content);
|
|
@@ -276,7 +275,7 @@ function createRedirectRoutes({ settings }, routeMap, logger) {
|
|
|
276
275
|
validateSegment(s);
|
|
277
276
|
return getParts(s, from);
|
|
278
277
|
});
|
|
279
|
-
const pattern = getPattern(segments, settings.config, trailingSlash);
|
|
278
|
+
const pattern = getPattern(segments, settings.config.base, trailingSlash);
|
|
280
279
|
const generate = getRouteGenerator(segments, trailingSlash);
|
|
281
280
|
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic) ? `/${segments.map((segment) => segment[0].content).join("/")}` : null;
|
|
282
281
|
const params = segments.flat().filter((p) => p.dynamic).map((p) => p.content);
|
|
@@ -450,7 +449,7 @@ function createRouteManifest(params, logger) {
|
|
|
450
449
|
pathname,
|
|
451
450
|
route,
|
|
452
451
|
segments,
|
|
453
|
-
pattern: getPattern(segments, config, config.trailingSlash),
|
|
452
|
+
pattern: getPattern(segments, config.base, config.trailingSlash),
|
|
454
453
|
type: "fallback"
|
|
455
454
|
});
|
|
456
455
|
}
|
|
@@ -504,7 +503,7 @@ function createRouteManifest(params, logger) {
|
|
|
504
503
|
route,
|
|
505
504
|
segments,
|
|
506
505
|
generate,
|
|
507
|
-
pattern: getPattern(segments, config, config.trailingSlash),
|
|
506
|
+
pattern: getPattern(segments, config.base, config.trailingSlash),
|
|
508
507
|
type: "fallback",
|
|
509
508
|
fallbackRoutes: []
|
|
510
509
|
};
|
|
@@ -534,5 +533,8 @@ function joinSegments(segments) {
|
|
|
534
533
|
return `/${arr.join("/")}`.toLowerCase();
|
|
535
534
|
}
|
|
536
535
|
export {
|
|
537
|
-
createRouteManifest
|
|
536
|
+
createRouteManifest,
|
|
537
|
+
getParts,
|
|
538
|
+
getPattern,
|
|
539
|
+
validateSegment
|
|
538
540
|
};
|
package/dist/i18n/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ type BrowserLocale = {
|
|
|
4
4
|
qualityValue: number | undefined;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
* Parses the value of the `Accept-
|
|
7
|
+
* Parses the value of the `Accept-Language` header:
|
|
8
8
|
*
|
|
9
9
|
* More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
|
|
10
10
|
*
|
|
@@ -38,7 +38,7 @@ function validateSupportedFeatures(adapterName, featureMap, config, adapterFeatu
|
|
|
38
38
|
() => config?.output === "server"
|
|
39
39
|
);
|
|
40
40
|
validationResult.assets = validateAssetsFeature(assets, adapterName, config, logger);
|
|
41
|
-
if (
|
|
41
|
+
if (!config.i18n?.domains) {
|
|
42
42
|
validationResult.i18nDomains = validateSupportKind(
|
|
43
43
|
i18nDomains,
|
|
44
44
|
adapterName,
|