astro 5.16.7 → 5.16.9
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/assets/fonts/config.d.ts +79 -5
- package/dist/assets/fonts/config.js +9 -4
- package/dist/assets/fonts/core/resolve-families.d.ts +4 -5
- package/dist/assets/fonts/core/resolve-families.js +8 -13
- package/dist/assets/fonts/definitions.d.ts +1 -7
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +11 -3
- package/dist/assets/fonts/infra/unifont-font-resolver.d.ts +2 -1
- package/dist/assets/fonts/infra/unifont-font-resolver.js +15 -2
- package/dist/assets/fonts/orchestrate.d.ts +3 -5
- package/dist/assets/fonts/orchestrate.js +3 -8
- package/dist/assets/fonts/providers/index.d.ts +7 -3
- package/dist/assets/fonts/providers/index.js +84 -8
- package/dist/assets/fonts/providers/local.d.ts +1 -3
- package/dist/assets/fonts/providers/local.js +40 -42
- package/dist/assets/fonts/types.d.ts +34 -15
- package/dist/assets/fonts/utils.d.ts +0 -1
- package/dist/assets/fonts/utils.js +0 -11
- package/dist/assets/fonts/vite-plugin-fonts.js +19 -22
- package/dist/assets/vite-plugin-assets.js +4 -4
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/config/schemas/base.d.ts +82 -15
- package/dist/core/config/schemas/relative.d.ts +100 -19
- 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/routing/manifest/create.js +9 -6
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +1 -0
- package/dist/runtime/server/jsx.js +18 -4
- package/dist/runtime/server/render/common.js +8 -0
- package/dist/runtime/server/render/component.js +28 -4
- package/dist/runtime/server/render/instruction.d.ts +6 -1
- package/dist/runtime/server/render/script.d.ts +5 -1
- package/dist/runtime/server/render/script.js +7 -10
- package/dist/runtime/server/render/slot.d.ts +5 -0
- package/dist/runtime/server/render/slot.js +9 -4
- package/dist/vite-plugin-astro-server/base.js +3 -2
- package/dist/vite-plugin-astro-server/request.js +3 -0
- package/dist/vite-plugin-astro-server/response.js +4 -6
- package/package.json +5 -6
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +0 -4
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +0 -8
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +0 -9
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +0 -14
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +0 -10
- package/dist/assets/fonts/infra/remote-font-provider-resolver.js +0 -49
- package/dist/assets/fonts/providers/entrypoints/adobe.d.ts +0 -2
- package/dist/assets/fonts/providers/entrypoints/adobe.js +0 -5
- package/dist/assets/fonts/providers/entrypoints/bunny.d.ts +0 -1
- package/dist/assets/fonts/providers/entrypoints/bunny.js +0 -5
- package/dist/assets/fonts/providers/entrypoints/fontshare.d.ts +0 -1
- package/dist/assets/fonts/providers/entrypoints/fontshare.js +0 -5
- package/dist/assets/fonts/providers/entrypoints/fontsource.d.ts +0 -1
- package/dist/assets/fonts/providers/entrypoints/fontsource.js +0 -5
- package/dist/assets/fonts/providers/entrypoints/google.d.ts +0 -2
- package/dist/assets/fonts/providers/entrypoints/google.js +0 -5
|
@@ -70,11 +70,11 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
70
70
|
entrypoint: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"astro/assets/services/sharp">, z.ZodString]>>;
|
|
71
71
|
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
72
72
|
}, "strip", z.ZodTypeAny, {
|
|
73
|
-
entrypoint: string;
|
|
74
73
|
config: Record<string, any>;
|
|
74
|
+
entrypoint: string;
|
|
75
75
|
}, {
|
|
76
|
-
entrypoint?: string | undefined;
|
|
77
76
|
config?: Record<string, any> | undefined;
|
|
77
|
+
entrypoint?: string | undefined;
|
|
78
78
|
}>>;
|
|
79
79
|
domains: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
80
80
|
remotePatterns: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -105,8 +105,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
105
105
|
entrypoint?: string | undefined;
|
|
106
106
|
};
|
|
107
107
|
service: {
|
|
108
|
-
entrypoint: string;
|
|
109
108
|
config: Record<string, any>;
|
|
109
|
+
entrypoint: string;
|
|
110
110
|
};
|
|
111
111
|
domains: string[];
|
|
112
112
|
remotePatterns: {
|
|
@@ -126,8 +126,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
126
126
|
route?: string | undefined;
|
|
127
127
|
} | undefined;
|
|
128
128
|
service?: {
|
|
129
|
-
entrypoint?: string | undefined;
|
|
130
129
|
config?: Record<string, any> | undefined;
|
|
130
|
+
entrypoint?: string | undefined;
|
|
131
131
|
} | undefined;
|
|
132
132
|
domains?: string[] | undefined;
|
|
133
133
|
remotePatterns?: {
|
|
@@ -733,14 +733,39 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
733
733
|
optimizedFallbacks?: boolean | undefined;
|
|
734
734
|
}>, z.ZodObject<{
|
|
735
735
|
provider: z.ZodObject<{
|
|
736
|
-
|
|
736
|
+
name: z.ZodString;
|
|
737
737
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
738
|
+
init: z.ZodOptional<z.ZodType<((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined, z.ZodTypeDef, ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined>>;
|
|
739
|
+
resolveFont: z.ZodType<(options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
740
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
741
|
+
} | Promise<{
|
|
742
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
743
|
+
} | undefined> | undefined, z.ZodTypeDef, (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
744
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
745
|
+
} | Promise<{
|
|
746
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
747
|
+
} | undefined> | undefined>;
|
|
748
|
+
listFonts: z.ZodOptional<z.ZodType<(() => string[] | Promise<string[] | undefined> | undefined) | undefined, z.ZodTypeDef, (() => string[] | Promise<string[] | undefined> | undefined) | undefined>>;
|
|
738
749
|
}, "strict", z.ZodTypeAny, {
|
|
739
|
-
|
|
750
|
+
name: string;
|
|
751
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
752
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
753
|
+
} | Promise<{
|
|
754
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
755
|
+
} | undefined> | undefined;
|
|
740
756
|
config?: Record<string, any> | undefined;
|
|
757
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
758
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
741
759
|
}, {
|
|
742
|
-
|
|
760
|
+
name: string;
|
|
761
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
762
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
763
|
+
} | Promise<{
|
|
764
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
765
|
+
} | undefined> | undefined;
|
|
743
766
|
config?: Record<string, any> | undefined;
|
|
767
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
768
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
744
769
|
}>;
|
|
745
770
|
weights: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "atleastone">>;
|
|
746
771
|
styles: z.ZodOptional<z.ZodArray<z.ZodEnum<["normal", "italic", "oblique"]>, "atleastone">>;
|
|
@@ -757,8 +782,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
757
782
|
cssVariable: z.ZodString;
|
|
758
783
|
}, "strict", z.ZodTypeAny, {
|
|
759
784
|
provider: {
|
|
760
|
-
|
|
785
|
+
name: string;
|
|
786
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
787
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
788
|
+
} | Promise<{
|
|
789
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
790
|
+
} | undefined> | undefined;
|
|
761
791
|
config?: Record<string, any> | undefined;
|
|
792
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
793
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
762
794
|
};
|
|
763
795
|
name: string;
|
|
764
796
|
cssVariable: string;
|
|
@@ -775,8 +807,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
775
807
|
unicodeRange?: [string, ...string[]] | undefined;
|
|
776
808
|
}, {
|
|
777
809
|
provider: {
|
|
778
|
-
|
|
810
|
+
name: string;
|
|
811
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
812
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
813
|
+
} | Promise<{
|
|
814
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
815
|
+
} | undefined> | undefined;
|
|
779
816
|
config?: Record<string, any> | undefined;
|
|
817
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
818
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
780
819
|
};
|
|
781
820
|
name: string;
|
|
782
821
|
cssVariable: string;
|
|
@@ -910,8 +949,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
910
949
|
optimizedFallbacks?: boolean | undefined;
|
|
911
950
|
} | {
|
|
912
951
|
provider: {
|
|
913
|
-
|
|
952
|
+
name: string;
|
|
953
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
954
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
955
|
+
} | Promise<{
|
|
956
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
957
|
+
} | undefined> | undefined;
|
|
914
958
|
config?: Record<string, any> | undefined;
|
|
959
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
960
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
915
961
|
};
|
|
916
962
|
name: string;
|
|
917
963
|
cssVariable: string;
|
|
@@ -967,8 +1013,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
967
1013
|
optimizedFallbacks?: boolean | undefined;
|
|
968
1014
|
} | {
|
|
969
1015
|
provider: {
|
|
970
|
-
|
|
1016
|
+
name: string;
|
|
1017
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
1018
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1019
|
+
} | Promise<{
|
|
1020
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1021
|
+
} | undefined> | undefined;
|
|
971
1022
|
config?: Record<string, any> | undefined;
|
|
1023
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
1024
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
972
1025
|
};
|
|
973
1026
|
name: string;
|
|
974
1027
|
cssVariable: string;
|
|
@@ -1206,8 +1259,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1206
1259
|
entrypoint?: string | undefined;
|
|
1207
1260
|
};
|
|
1208
1261
|
service: {
|
|
1209
|
-
entrypoint: string;
|
|
1210
1262
|
config: Record<string, any>;
|
|
1263
|
+
entrypoint: string;
|
|
1211
1264
|
};
|
|
1212
1265
|
domains: string[];
|
|
1213
1266
|
remotePatterns: {
|
|
@@ -1291,8 +1344,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1291
1344
|
optimizedFallbacks?: boolean | undefined;
|
|
1292
1345
|
} | {
|
|
1293
1346
|
provider: {
|
|
1294
|
-
|
|
1347
|
+
name: string;
|
|
1348
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
1349
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1350
|
+
} | Promise<{
|
|
1351
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1352
|
+
} | undefined> | undefined;
|
|
1295
1353
|
config?: Record<string, any> | undefined;
|
|
1354
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
1355
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
1296
1356
|
};
|
|
1297
1357
|
name: string;
|
|
1298
1358
|
cssVariable: string;
|
|
@@ -1475,8 +1535,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1475
1535
|
route?: string | undefined;
|
|
1476
1536
|
} | undefined;
|
|
1477
1537
|
service?: {
|
|
1478
|
-
entrypoint?: string | undefined;
|
|
1479
1538
|
config?: Record<string, any> | undefined;
|
|
1539
|
+
entrypoint?: string | undefined;
|
|
1480
1540
|
} | undefined;
|
|
1481
1541
|
domains?: string[] | undefined;
|
|
1482
1542
|
remotePatterns?: {
|
|
@@ -1552,8 +1612,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1552
1612
|
optimizedFallbacks?: boolean | undefined;
|
|
1553
1613
|
} | {
|
|
1554
1614
|
provider: {
|
|
1555
|
-
|
|
1615
|
+
name: string;
|
|
1616
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
1617
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1618
|
+
} | Promise<{
|
|
1619
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1620
|
+
} | undefined> | undefined;
|
|
1556
1621
|
config?: Record<string, any> | undefined;
|
|
1622
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
1623
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
1557
1624
|
};
|
|
1558
1625
|
name: string;
|
|
1559
1626
|
cssVariable: string;
|
|
@@ -1710,8 +1777,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1710
1777
|
entrypoint?: string | undefined;
|
|
1711
1778
|
};
|
|
1712
1779
|
service: {
|
|
1713
|
-
entrypoint: string;
|
|
1714
1780
|
config: Record<string, any>;
|
|
1781
|
+
entrypoint: string;
|
|
1715
1782
|
};
|
|
1716
1783
|
domains: string[];
|
|
1717
1784
|
remotePatterns: {
|
|
@@ -1795,8 +1862,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1795
1862
|
optimizedFallbacks?: boolean | undefined;
|
|
1796
1863
|
} | {
|
|
1797
1864
|
provider: {
|
|
1798
|
-
|
|
1865
|
+
name: string;
|
|
1866
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
1867
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1868
|
+
} | Promise<{
|
|
1869
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
1870
|
+
} | undefined> | undefined;
|
|
1799
1871
|
config?: Record<string, any> | undefined;
|
|
1872
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
1873
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
1800
1874
|
};
|
|
1801
1875
|
name: string;
|
|
1802
1876
|
cssVariable: string;
|
|
@@ -1979,8 +2053,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1979
2053
|
route?: string | undefined;
|
|
1980
2054
|
} | undefined;
|
|
1981
2055
|
service?: {
|
|
1982
|
-
entrypoint?: string | undefined;
|
|
1983
2056
|
config?: Record<string, any> | undefined;
|
|
2057
|
+
entrypoint?: string | undefined;
|
|
1984
2058
|
} | undefined;
|
|
1985
2059
|
domains?: string[] | undefined;
|
|
1986
2060
|
remotePatterns?: {
|
|
@@ -2056,8 +2130,15 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2056
2130
|
optimizedFallbacks?: boolean | undefined;
|
|
2057
2131
|
} | {
|
|
2058
2132
|
provider: {
|
|
2059
|
-
|
|
2133
|
+
name: string;
|
|
2134
|
+
resolveFont: (options: import("../../../assets/fonts/types.js").ResolveFontOptions) => {
|
|
2135
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
2136
|
+
} | Promise<{
|
|
2137
|
+
fonts: Array<import("unifont").FontFaceData>;
|
|
2138
|
+
} | undefined> | undefined;
|
|
2060
2139
|
config?: Record<string, any> | undefined;
|
|
2140
|
+
init?: ((context: import("../../../assets/fonts/types.js").FontProviderInitContext) => void | Promise<void>) | undefined;
|
|
2141
|
+
listFonts?: (() => string[] | Promise<string[] | undefined> | undefined) | undefined;
|
|
2061
2142
|
};
|
|
2062
2143
|
name: string;
|
|
2063
2144
|
cssVariable: string;
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.16.
|
|
25
|
+
const currentVersion = "5.16.9";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.16.
|
|
41
|
+
const version = "5.16.9";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -275,7 +275,7 @@ function printHelp({
|
|
|
275
275
|
message.push(
|
|
276
276
|
linebreak(),
|
|
277
277
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
278
|
-
`v${"5.16.
|
|
278
|
+
`v${"5.16.9"}`
|
|
279
279
|
)} ${headline}`
|
|
280
280
|
);
|
|
281
281
|
}
|
|
@@ -66,6 +66,7 @@ function createFileBasedRoutes({ settings, cwd, fsMod }, logger) {
|
|
|
66
66
|
...SUPPORTED_MARKDOWN_FILE_EXTENSIONS,
|
|
67
67
|
...settings.pageExtensions
|
|
68
68
|
]);
|
|
69
|
+
const invalidPotentialPages = /* @__PURE__ */ new Set([".tsx", ".jsx", ".vue", ".svelte"]);
|
|
69
70
|
const validEndpointExtensions = /* @__PURE__ */ new Set([".js", ".ts"]);
|
|
70
71
|
const localFs = fsMod ?? nodeFs;
|
|
71
72
|
const prerender = getPrerenderDefault(settings.config);
|
|
@@ -85,12 +86,14 @@ function createFileBasedRoutes({ settings, cwd, fsMod }, logger) {
|
|
|
85
86
|
continue;
|
|
86
87
|
}
|
|
87
88
|
if (!isDir && !validPageExtensions.has(ext) && !validEndpointExtensions.has(ext)) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
if (invalidPotentialPages.has(ext)) {
|
|
90
|
+
logger.warn(
|
|
91
|
+
null,
|
|
92
|
+
`Unsupported file type ${colors.bold(
|
|
93
|
+
resolved
|
|
94
|
+
)} found in pages directory. Only Astro files can be used as pages. Prefix filename with an underscore (\`_\`) to ignore this warning, or move the file outside of the pages directory.`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
94
97
|
continue;
|
|
95
98
|
}
|
|
96
99
|
const segment = isDir ? basename : name;
|
|
@@ -6,6 +6,7 @@ const perf = [
|
|
|
6
6
|
message: "This image could be replaced with the Image component to improve performance.",
|
|
7
7
|
selector: "img:not([data-image-component])",
|
|
8
8
|
async match(element) {
|
|
9
|
+
if (element.closest("astro-island")) return false;
|
|
9
10
|
const src = element.getAttribute("src");
|
|
10
11
|
if (!src) return false;
|
|
11
12
|
if (src.startsWith("data:")) return false;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "./index.js";
|
|
9
9
|
import { isAstroComponentFactory } from "./render/astro/factory.js";
|
|
10
10
|
import { renderComponentToString } from "./render/component.js";
|
|
11
|
+
import { mergeSlotInstructions, SlotString } from "./render/slot.js";
|
|
11
12
|
const ClientOnlyPlaceholder = "astro-client-only";
|
|
12
13
|
const hasTriedRenderComponentSymbol = Symbol("hasTriedRenderComponent");
|
|
13
14
|
async function renderJSX(result, vnode) {
|
|
@@ -23,10 +24,23 @@ async function renderJSX(result, vnode) {
|
|
|
23
24
|
return vnode;
|
|
24
25
|
case (!vnode && vnode !== 0):
|
|
25
26
|
return "";
|
|
26
|
-
case Array.isArray(vnode):
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
case Array.isArray(vnode): {
|
|
28
|
+
const renderedItems = await Promise.all(vnode.map((v) => renderJSX(result, v)));
|
|
29
|
+
let instructions = null;
|
|
30
|
+
let content = "";
|
|
31
|
+
for (const item of renderedItems) {
|
|
32
|
+
if (item instanceof SlotString) {
|
|
33
|
+
content += item;
|
|
34
|
+
instructions = mergeSlotInstructions(instructions, item);
|
|
35
|
+
} else {
|
|
36
|
+
content += item;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (instructions) {
|
|
40
|
+
return markHTMLString(new SlotString(content, instructions));
|
|
41
|
+
}
|
|
42
|
+
return markHTMLString(content);
|
|
43
|
+
}
|
|
30
44
|
}
|
|
31
45
|
return renderJSXVNode(result, vnode);
|
|
32
46
|
}
|
|
@@ -58,6 +58,14 @@ function stringifyChunk(result, chunk) {
|
|
|
58
58
|
result._metadata.hasRenderedServerIslandRuntime = true;
|
|
59
59
|
return renderServerIslandRuntime();
|
|
60
60
|
}
|
|
61
|
+
case "script": {
|
|
62
|
+
const { id, content } = instruction;
|
|
63
|
+
if (result._metadata.renderedScripts.has(id)) {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
result._metadata.renderedScripts.add(id);
|
|
67
|
+
return content;
|
|
68
|
+
}
|
|
61
69
|
default: {
|
|
62
70
|
throw new Error(`Unknown chunk type: ${chunk.type}`);
|
|
63
71
|
}
|
|
@@ -16,9 +16,17 @@ import {
|
|
|
16
16
|
} from "./common.js";
|
|
17
17
|
import { componentIsHTMLElement, renderHTMLElement } from "./dom.js";
|
|
18
18
|
import { maybeRenderHead } from "./head.js";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
createRenderInstruction,
|
|
21
|
+
isRenderInstruction
|
|
22
|
+
} from "./instruction.js";
|
|
20
23
|
import { containsServerDirective, ServerIslandComponent } from "./server-islands.js";
|
|
21
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
mergeSlotInstructions,
|
|
26
|
+
renderSlots,
|
|
27
|
+
renderSlotToString,
|
|
28
|
+
SlotString
|
|
29
|
+
} from "./slot.js";
|
|
22
30
|
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from "./util.js";
|
|
23
31
|
const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering");
|
|
24
32
|
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
@@ -397,6 +405,7 @@ function normalizeProps(props) {
|
|
|
397
405
|
}
|
|
398
406
|
async function renderComponentToString(result, displayName, Component, props, slots = {}, isPage = false, route) {
|
|
399
407
|
let str = "";
|
|
408
|
+
let instructions = null;
|
|
400
409
|
let renderedFirstPageChunk = false;
|
|
401
410
|
let head = "";
|
|
402
411
|
if (isPage && !result.partial && nonAstroPageNeedsHeadInjection(Component)) {
|
|
@@ -413,7 +422,19 @@ async function renderComponentToString(result, displayName, Component, props, sl
|
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
424
|
if (chunk instanceof Response) return;
|
|
416
|
-
|
|
425
|
+
if (isPage) {
|
|
426
|
+
str += chunkToString(result, chunk);
|
|
427
|
+
} else {
|
|
428
|
+
if (chunk instanceof SlotString) {
|
|
429
|
+
str += chunk;
|
|
430
|
+
instructions = mergeSlotInstructions(instructions, chunk);
|
|
431
|
+
} else if (isRenderInstruction(chunk)) {
|
|
432
|
+
instructions ??= [];
|
|
433
|
+
instructions.push(chunk);
|
|
434
|
+
} else {
|
|
435
|
+
str += chunkToString(result, chunk);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
417
438
|
}
|
|
418
439
|
};
|
|
419
440
|
const renderInstance = await renderComponent(result, displayName, Component, props, slots);
|
|
@@ -429,7 +450,10 @@ async function renderComponentToString(result, displayName, Component, props, sl
|
|
|
429
450
|
}
|
|
430
451
|
throw e;
|
|
431
452
|
}
|
|
432
|
-
|
|
453
|
+
if (isPage) {
|
|
454
|
+
return str;
|
|
455
|
+
}
|
|
456
|
+
return new SlotString(str, instructions);
|
|
433
457
|
}
|
|
434
458
|
function nonAstroPageNeedsHeadInjection(pageComponent) {
|
|
435
459
|
return !!pageComponent?.[needsHeadRenderingSymbol];
|
|
@@ -21,6 +21,11 @@ export type MaybeRenderHeadInstruction = {
|
|
|
21
21
|
export type ServerIslandRuntimeInstruction = {
|
|
22
22
|
type: 'server-island-runtime';
|
|
23
23
|
};
|
|
24
|
-
export type
|
|
24
|
+
export type RenderScriptInstruction = {
|
|
25
|
+
type: 'script';
|
|
26
|
+
id: string;
|
|
27
|
+
content: string;
|
|
28
|
+
};
|
|
29
|
+
export type RenderInstruction = RenderDirectiveInstruction | RenderHeadInstruction | MaybeRenderHeadInstruction | RendererHydrationScriptInstruction | ServerIslandRuntimeInstruction | RenderScriptInstruction;
|
|
25
30
|
export declare function createRenderInstruction<T extends RenderInstruction>(instruction: T): T;
|
|
26
31
|
export declare function isRenderInstruction(chunk: any): chunk is RenderInstruction;
|
|
@@ -3,4 +3,8 @@ import type { SSRResult } from '../../../types/public/internal.js';
|
|
|
3
3
|
* Relies on the `renderScript: true` compiler option
|
|
4
4
|
* @experimental
|
|
5
5
|
*/
|
|
6
|
-
export declare function renderScript(result: SSRResult, id: string): Promise<
|
|
6
|
+
export declare function renderScript(result: SSRResult, id: string): Promise<{
|
|
7
|
+
type: "script";
|
|
8
|
+
id: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRenderInstruction } from "./instruction.js";
|
|
2
2
|
async function renderScript(result, id) {
|
|
3
|
-
if (result._metadata.renderedScripts.has(id)) return;
|
|
4
|
-
result._metadata.renderedScripts.add(id);
|
|
5
3
|
const inlined = result.inlinedScripts.get(id);
|
|
4
|
+
let content = "";
|
|
6
5
|
if (inlined != null) {
|
|
7
6
|
if (inlined) {
|
|
8
|
-
|
|
9
|
-
} else {
|
|
10
|
-
return "";
|
|
7
|
+
content = `<script type="module">${inlined}</script>`;
|
|
11
8
|
}
|
|
9
|
+
} else {
|
|
10
|
+
const resolved = await result.resolve(id);
|
|
11
|
+
content = `<script type="module" src="${result.userAssetsBase ? (result.base === "/" ? "" : result.base) + result.userAssetsBase : ""}${resolved}"></script>`;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return markHTMLString(
|
|
15
|
-
`<script type="module" src="${result.userAssetsBase ? (result.base === "/" ? "" : result.base) + result.userAssetsBase : ""}${resolved}"></script>`
|
|
16
|
-
);
|
|
13
|
+
return createRenderInstruction({ type: "script", id, content });
|
|
17
14
|
}
|
|
18
15
|
export {
|
|
19
16
|
renderScript
|
|
@@ -13,6 +13,11 @@ export declare class SlotString extends HTMLString {
|
|
|
13
13
|
constructor(content: string, instructions: null | RenderInstruction[]);
|
|
14
14
|
}
|
|
15
15
|
export declare function isSlotString(str: string): str is any;
|
|
16
|
+
/**
|
|
17
|
+
* Collects instructions from a SlotString into the target array.
|
|
18
|
+
* Returns the (possibly newly created) instructions array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeSlotInstructions(target: RenderInstruction[] | null, source: SlotString): RenderInstruction[] | null;
|
|
16
21
|
export declare function renderSlot(result: SSRResult, slotted: ComponentSlotValue | RenderTemplateResult, fallback?: ComponentSlotValue | RenderTemplateResult): RenderInstance;
|
|
17
22
|
export declare function renderSlotToString(result: SSRResult, slotted: ComponentSlotValue | RenderTemplateResult, fallback?: ComponentSlotValue | RenderTemplateResult): Promise<string>;
|
|
18
23
|
interface RenderSlotsResult {
|
|
@@ -15,6 +15,13 @@ class SlotString extends HTMLString {
|
|
|
15
15
|
function isSlotString(str) {
|
|
16
16
|
return !!str[slotString];
|
|
17
17
|
}
|
|
18
|
+
function mergeSlotInstructions(target, source) {
|
|
19
|
+
if (source.instructions?.length) {
|
|
20
|
+
target ??= [];
|
|
21
|
+
target.push(...source.instructions);
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
}
|
|
18
25
|
function renderSlot(result, slotted, fallback) {
|
|
19
26
|
if (!slotted && fallback) {
|
|
20
27
|
return renderSlot(result, fallback);
|
|
@@ -32,10 +39,7 @@ async function renderSlotToString(result, slotted, fallback) {
|
|
|
32
39
|
write(chunk) {
|
|
33
40
|
if (chunk instanceof SlotString) {
|
|
34
41
|
content += chunk;
|
|
35
|
-
|
|
36
|
-
instructions ??= [];
|
|
37
|
-
instructions.push(...chunk.instructions);
|
|
38
|
-
}
|
|
42
|
+
instructions = mergeSlotInstructions(instructions, chunk);
|
|
39
43
|
} else if (chunk instanceof Response) return;
|
|
40
44
|
else if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") {
|
|
41
45
|
if (instructions === null) {
|
|
@@ -80,6 +84,7 @@ export {
|
|
|
80
84
|
SlotString,
|
|
81
85
|
createSlotValueFromString,
|
|
82
86
|
isSlotString,
|
|
87
|
+
mergeSlotInstructions,
|
|
83
88
|
renderSlot,
|
|
84
89
|
renderSlotToString,
|
|
85
90
|
renderSlots
|
|
@@ -6,8 +6,9 @@ import { notFoundTemplate, subpathNotUsedTemplate } from "../template/4xx.js";
|
|
|
6
6
|
import { writeHtmlResponse } from "./response.js";
|
|
7
7
|
function baseMiddleware(settings, logger) {
|
|
8
8
|
const { config } = settings;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const base = config.base || "/";
|
|
10
|
+
const site = config.site ? new URL(base, config.site) : void 0;
|
|
11
|
+
const devRootURL = new URL(base, "http://localhost");
|
|
11
12
|
const devRoot = site ? site.pathname : devRootURL.pathname;
|
|
12
13
|
const devRootReplacement = devRoot.endsWith("/") ? "/" : "";
|
|
13
14
|
return function devBaseMiddleware(req, res, next) {
|
|
@@ -27,6 +27,9 @@ async function handleRequest({
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
if (config.trailingSlash === "never" && pathname === "/" && config.base !== "/") {
|
|
31
|
+
pathname = "";
|
|
32
|
+
}
|
|
30
33
|
url.pathname = removeTrailingForwardSlash(config.base) + pathname;
|
|
31
34
|
if (config.trailingSlash === "never") {
|
|
32
35
|
url.pathname = removeTrailingForwardSlash(url.pathname);
|
|
@@ -43,13 +43,11 @@ function writeRedirectResponse(res, statusCode, location) {
|
|
|
43
43
|
}
|
|
44
44
|
async function writeWebResponse(res, webResponse) {
|
|
45
45
|
const { status, headers, body, statusText } = webResponse;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
res.setHeader("set-cookie", setCookieHeaders);
|
|
49
|
-
}
|
|
46
|
+
const setCookiesFromResponse = Array.from(getSetCookiesFromResponse(webResponse));
|
|
47
|
+
const setCookieHeaders = [...setCookiesFromResponse, ...headers.getSetCookie()];
|
|
50
48
|
const _headers = Object.fromEntries(headers.entries());
|
|
51
|
-
if (
|
|
52
|
-
_headers["set-cookie"] =
|
|
49
|
+
if (setCookieHeaders.length) {
|
|
50
|
+
_headers["set-cookie"] = setCookieHeaders;
|
|
53
51
|
}
|
|
54
52
|
if (!(res instanceof Http2ServerResponse)) {
|
|
55
53
|
res.statusMessage = statusText;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.16.
|
|
3
|
+
"version": "5.16.9",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"./assets/endpoint/*": "./dist/assets/endpoint/*.js",
|
|
64
64
|
"./assets/services/sharp": "./dist/assets/services/sharp.js",
|
|
65
65
|
"./assets/services/noop": "./dist/assets/services/noop.js",
|
|
66
|
-
"./assets/fonts/providers/*": "./dist/assets/fonts/providers/entrypoints/*.js",
|
|
67
66
|
"./assets/fonts/runtime": "./dist/assets/fonts/runtime.js",
|
|
68
67
|
"./loaders": "./dist/content/loaders/index.js",
|
|
69
68
|
"./content/config": "./dist/content/config.js",
|
|
@@ -154,9 +153,9 @@
|
|
|
154
153
|
"zod": "^3.25.76",
|
|
155
154
|
"zod-to-json-schema": "^3.25.1",
|
|
156
155
|
"zod-to-ts": "^1.2.0",
|
|
156
|
+
"@astrojs/internal-helpers": "0.7.5",
|
|
157
157
|
"@astrojs/markdown-remark": "6.3.10",
|
|
158
|
-
"@astrojs/telemetry": "3.3.0"
|
|
159
|
-
"@astrojs/internal-helpers": "0.7.5"
|
|
158
|
+
"@astrojs/telemetry": "3.3.0"
|
|
160
159
|
},
|
|
161
160
|
"optionalDependencies": {
|
|
162
161
|
"sharp": "^0.34.0"
|
|
@@ -195,8 +194,8 @@
|
|
|
195
194
|
"undici": "^6.22.0",
|
|
196
195
|
"unified": "^11.0.5",
|
|
197
196
|
"vitest": "^3.2.4",
|
|
198
|
-
"
|
|
199
|
-
"
|
|
197
|
+
"@astrojs/check": "0.9.6",
|
|
198
|
+
"astro-scripts": "0.0.14"
|
|
200
199
|
},
|
|
201
200
|
"engines": {
|
|
202
201
|
"node": "18.20.8 || ^20.3.0 || >=22.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ViteDevServer } from 'vite';
|
|
2
|
-
import type { RemoteFontProviderModResolver } from '../definitions.js';
|
|
3
|
-
export declare class DevServerRemoteFontProviderModResolver implements RemoteFontProviderModResolver {
|
|
4
|
-
#private;
|
|
5
|
-
constructor({ server, }: {
|
|
6
|
-
server: ViteDevServer;
|
|
7
|
-
});
|
|
8
|
-
resolve(id: string): Promise<any>;
|
|
9
|
-
}
|