astro 5.6.1 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +3 -0
- package/components/Font.astro +32 -0
- package/dist/actions/plugins.js +2 -2
- package/dist/assets/fonts/config.d.ts +378 -0
- package/dist/assets/fonts/config.js +157 -0
- package/dist/assets/fonts/constants.d.ts +15 -0
- package/dist/assets/fonts/constants.js +41 -0
- package/dist/assets/fonts/load.d.ts +20 -0
- package/dist/assets/fonts/load.js +133 -0
- package/dist/assets/fonts/metrics.d.ts +10 -0
- package/dist/assets/fonts/metrics.js +84 -0
- package/dist/assets/fonts/providers/entrypoints/adobe.d.ts +2 -0
- package/dist/assets/fonts/providers/entrypoints/adobe.js +5 -0
- package/dist/assets/fonts/providers/entrypoints/bunny.d.ts +1 -0
- package/dist/assets/fonts/providers/entrypoints/bunny.js +5 -0
- package/dist/assets/fonts/providers/entrypoints/fontshare.d.ts +1 -0
- package/dist/assets/fonts/providers/entrypoints/fontshare.js +5 -0
- package/dist/assets/fonts/providers/entrypoints/fontsource.d.ts +1 -0
- package/dist/assets/fonts/providers/entrypoints/fontsource.js +5 -0
- package/dist/assets/fonts/providers/entrypoints/google.d.ts +2 -0
- package/dist/assets/fonts/providers/entrypoints/google.js +5 -0
- package/dist/assets/fonts/providers/index.d.ts +48 -0
- package/dist/assets/fonts/providers/index.js +40 -0
- package/dist/assets/fonts/providers/local.d.ts +10 -0
- package/dist/assets/fonts/providers/local.js +30 -0
- package/dist/assets/fonts/providers/utils.d.ts +9 -0
- package/dist/assets/fonts/providers/utils.js +37 -0
- package/dist/assets/fonts/sync.d.ts +2 -0
- package/dist/assets/fonts/sync.js +17 -0
- package/dist/assets/fonts/types.d.ts +45 -0
- package/dist/assets/fonts/types.js +0 -0
- package/dist/assets/fonts/utils.d.ts +95 -0
- package/dist/assets/fonts/utils.js +215 -0
- package/dist/assets/fonts/vite-plugin-fonts.d.ts +10 -0
- package/dist/assets/fonts/vite-plugin-fonts.js +217 -0
- package/dist/assets/utils/index.d.ts +5 -1
- package/dist/assets/utils/index.js +5 -1
- package/dist/assets/utils/node/emitAsset.d.ts +12 -2
- package/dist/assets/utils/node/emitAsset.js +46 -4
- package/dist/assets/utils/vendor/image-size/types/index.d.ts +2 -2
- package/dist/assets/vite-plugin-assets.d.ts +9 -2
- package/dist/assets/vite-plugin-assets.js +9 -6
- package/dist/cli/add/index.js +3 -1
- package/dist/cli/install-package.js +3 -0
- package/dist/config/entrypoint.d.ts +2 -0
- package/dist/config/entrypoint.js +3 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/content/content-layer.js +5 -4
- package/dist/content/runtime-assets.js +1 -0
- package/dist/content/utils.d.ts +10 -10
- package/dist/content/vite-plugin-content-imports.js +4 -2
- package/dist/core/build/generate.js +2 -2
- package/dist/core/build/pipeline.js +2 -2
- package/dist/core/build/plugins/plugin-prerender.js +0 -3
- package/dist/core/build/static-build.js +2 -2
- package/dist/core/config/schemas/base.d.ts +446 -49
- package/dist/core/config/schemas/base.js +3 -7
- package/dist/core/config/schemas/refined.js +12 -0
- package/dist/core/config/schemas/relative.d.ts +581 -77
- package/dist/core/config/schemas/relative.js +1 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +2 -2
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +82 -26
- package/dist/core/errors/errors-data.js +45 -16
- package/dist/core/logger/core.d.ts +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/vite-plugin.js +2 -2
- package/dist/core/render-context.js +39 -5
- package/dist/core/routing/rewrite.js +14 -5
- package/dist/core/session.d.ts +2 -4
- package/dist/core/session.js +4 -29
- package/dist/core/sync/index.js +2 -0
- package/dist/env/schema.d.ts +6 -6
- package/dist/integrations/hooks.js +2 -3
- package/dist/manifest/virtual-module.d.ts +1 -5
- package/dist/manifest/virtual-module.js +1 -18
- package/dist/prerender/utils.d.ts +5 -1
- package/dist/prerender/utils.js +8 -8
- package/dist/runtime/client/dev-toolbar/apps/audit/annotations.d.ts +6 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/annotations.js +27 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/index.js +10 -4
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.js +2 -2
- package/dist/runtime/server/render/common.js +8 -0
- package/dist/runtime/server/render/instruction.d.ts +5 -5
- package/dist/runtime/server/render/server-islands.d.ts +1 -0
- package/dist/runtime/server/render/server-islands.js +29 -31
- package/dist/transitions/swap-functions.d.ts +1 -1
- package/dist/transitions/swap-functions.js +7 -6
- package/dist/types/public/config.d.ts +155 -98
- package/dist/types/public/internal.d.ts +1 -0
- package/dist/vite-plugin-astro-server/plugin.js +1 -1
- package/package.json +9 -5
- package/types/fonts.d.ts +4 -0
|
@@ -2,6 +2,7 @@ import { defineConfig, getViteConfig } from "./index.js";
|
|
|
2
2
|
import { envField } from "../env/config.js";
|
|
3
3
|
import { mergeConfig } from "../core/config/merge.js";
|
|
4
4
|
import { validateConfig } from "../core/config/validate.js";
|
|
5
|
+
import { fontProviders, defineAstroFontProvider } from "../assets/fonts/providers/index.js";
|
|
5
6
|
function sharpImageService(config = {}) {
|
|
6
7
|
return {
|
|
7
8
|
entrypoint: "astro/assets/services/sharp",
|
|
@@ -15,8 +16,10 @@ function passthroughImageService() {
|
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
export {
|
|
19
|
+
defineAstroFontProvider,
|
|
18
20
|
defineConfig,
|
|
19
21
|
envField,
|
|
22
|
+
fontProviders,
|
|
20
23
|
getViteConfig,
|
|
21
24
|
mergeConfig,
|
|
22
25
|
passthroughImageService,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { UserConfig as ViteUserConfig, UserConfigFn as ViteUserConfigFn } from 'vite';
|
|
2
|
+
import type { FontFamily } from '../assets/fonts/types.js';
|
|
2
3
|
import type { AstroInlineConfig, AstroUserConfig, Locales, SessionDriverName } from '../types/public/config.js';
|
|
3
4
|
/**
|
|
4
5
|
* See the full Astro Configuration API Documentation
|
|
5
6
|
* https://astro.build/config
|
|
6
7
|
*/
|
|
7
|
-
export declare function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never>(config: AstroUserConfig<TLocales, TDriver>): AstroUserConfig<TLocales, TDriver>;
|
|
8
|
+
export declare function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never, const TFontFamilies extends FontFamily[] = never>(config: AstroUserConfig<TLocales, TDriver, TFontFamilies>): AstroUserConfig<TLocales, TDriver, TFontFamilies>;
|
|
8
9
|
/**
|
|
9
10
|
* Use Astro to generate a fully resolved Vite config
|
|
10
11
|
*/
|
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.7.0") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.
|
|
164
|
+
if ("5.7.0") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.7.0");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -202,7 +202,8 @@ ${contentConfig.error.message}`);
|
|
|
202
202
|
},
|
|
203
203
|
collectionWithResolvedSchema,
|
|
204
204
|
false,
|
|
205
|
-
|
|
205
|
+
// FUTURE: Remove in this in v6
|
|
206
|
+
id.endsWith(".svg")
|
|
206
207
|
);
|
|
207
208
|
return parsedData;
|
|
208
209
|
};
|
|
@@ -7,6 +7,7 @@ function createImage(pluginContext, shouldEmitFile, entryFilePath, experimentalS
|
|
|
7
7
|
const metadata = await emitESMImage(
|
|
8
8
|
resolvedFilePath,
|
|
9
9
|
pluginContext.meta.watchMode,
|
|
10
|
+
// FUTURE: Remove in this in v6
|
|
10
11
|
experimentalSvgEnabled,
|
|
11
12
|
shouldEmitFile ? pluginContext.emitFile : void 0
|
|
12
13
|
);
|
package/dist/content/utils.d.ts
CHANGED
|
@@ -106,8 +106,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
106
106
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
107
107
|
}) => unknown;
|
|
108
108
|
name: string;
|
|
109
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
110
109
|
schema?: any;
|
|
110
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
111
111
|
}, {
|
|
112
112
|
load: (args_0: {
|
|
113
113
|
collection: string;
|
|
@@ -122,8 +122,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
122
122
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
123
123
|
}) => unknown;
|
|
124
124
|
name: string;
|
|
125
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
126
125
|
schema?: any;
|
|
126
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
127
127
|
}>]>;
|
|
128
128
|
/** deprecated */
|
|
129
129
|
_legacy: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -143,8 +143,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
143
143
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
144
144
|
}) => unknown;
|
|
145
145
|
name: string;
|
|
146
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
147
146
|
schema?: any;
|
|
147
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
148
148
|
};
|
|
149
149
|
schema?: any;
|
|
150
150
|
_legacy?: boolean | undefined;
|
|
@@ -164,8 +164,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
164
164
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
165
165
|
}) => unknown;
|
|
166
166
|
name: string;
|
|
167
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
168
167
|
schema?: any;
|
|
168
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
169
169
|
};
|
|
170
170
|
schema?: any;
|
|
171
171
|
_legacy?: boolean | undefined;
|
|
@@ -244,8 +244,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
244
244
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
245
245
|
}) => unknown;
|
|
246
246
|
name: string;
|
|
247
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
248
247
|
schema?: any;
|
|
248
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
249
249
|
}, {
|
|
250
250
|
load: (args_0: {
|
|
251
251
|
collection: string;
|
|
@@ -260,8 +260,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
260
260
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
261
261
|
}) => unknown;
|
|
262
262
|
name: string;
|
|
263
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
264
263
|
schema?: any;
|
|
264
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
265
265
|
}>]>;
|
|
266
266
|
/** deprecated */
|
|
267
267
|
_legacy: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -281,8 +281,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
281
281
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
282
282
|
}) => unknown;
|
|
283
283
|
name: string;
|
|
284
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
285
284
|
schema?: any;
|
|
285
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
286
286
|
};
|
|
287
287
|
schema?: any;
|
|
288
288
|
_legacy?: boolean | undefined;
|
|
@@ -302,8 +302,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
302
302
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
303
303
|
}) => unknown;
|
|
304
304
|
name: string;
|
|
305
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
306
305
|
schema?: any;
|
|
306
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
307
307
|
};
|
|
308
308
|
schema?: any;
|
|
309
309
|
_legacy?: boolean | undefined;
|
|
@@ -331,8 +331,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
331
331
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
332
332
|
}) => unknown;
|
|
333
333
|
name: string;
|
|
334
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
335
334
|
schema?: any;
|
|
335
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
336
336
|
};
|
|
337
337
|
schema?: any;
|
|
338
338
|
_legacy?: boolean | undefined;
|
|
@@ -360,8 +360,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
360
360
|
refreshContextData?: Record<string, unknown> | undefined;
|
|
361
361
|
}) => unknown;
|
|
362
362
|
name: string;
|
|
363
|
-
render?: ((args_0: any) => unknown) | undefined;
|
|
364
363
|
schema?: any;
|
|
364
|
+
render?: ((args_0: any) => unknown) | undefined;
|
|
365
365
|
};
|
|
366
366
|
schema?: any;
|
|
367
367
|
_legacy?: boolean | undefined;
|
|
@@ -171,7 +171,8 @@ async function getContentEntryModule(params) {
|
|
|
171
171
|
{ id, collection, _internal, unvalidatedData },
|
|
172
172
|
collectionConfig,
|
|
173
173
|
params.shouldEmitFile,
|
|
174
|
-
|
|
174
|
+
// FUTURE: Remove in this in v6
|
|
175
|
+
id.endsWith(".svg"),
|
|
175
176
|
pluginContext
|
|
176
177
|
) : unvalidatedData;
|
|
177
178
|
const contentEntryModule = {
|
|
@@ -197,7 +198,8 @@ async function getDataEntryModule(params) {
|
|
|
197
198
|
{ id, collection, _internal, unvalidatedData },
|
|
198
199
|
collectionConfig,
|
|
199
200
|
params.shouldEmitFile,
|
|
200
|
-
|
|
201
|
+
// FUTURE: Remove in this in v6
|
|
202
|
+
id.endsWith(".svg"),
|
|
201
203
|
pluginContext
|
|
202
204
|
) : unvalidatedData;
|
|
203
205
|
const dataEntryModule = {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "../../core/path.js";
|
|
19
19
|
import { toFallbackType, toRoutingStrategy } from "../../i18n/utils.js";
|
|
20
20
|
import { runHookBuildGenerated } from "../../integrations/hooks.js";
|
|
21
|
-
import {
|
|
21
|
+
import { getServerOutputDirectory } from "../../prerender/utils.js";
|
|
22
22
|
import { NoPrerenderedRoutesWithDomains } from "../errors/errors-data.js";
|
|
23
23
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
24
24
|
import { NOOP_MIDDLEWARE_FN } from "../middleware/noop-middleware.js";
|
|
@@ -41,7 +41,7 @@ async function generatePages(options, internals) {
|
|
|
41
41
|
if (ssr) {
|
|
42
42
|
manifest = await BuildPipeline.retrieveManifest(options.settings, internals);
|
|
43
43
|
} else {
|
|
44
|
-
const baseDirectory =
|
|
44
|
+
const baseDirectory = getServerOutputDirectory(options.settings);
|
|
45
45
|
const renderersEntryUrl = new URL("renderers.mjs", baseDirectory);
|
|
46
46
|
const renderers = await import(renderersEntryUrl.toString());
|
|
47
47
|
const middleware = internals.middlewareEntryPoint ? await import(internals.middlewareEntryPoint.toString()).then((mod) => mod.onRequest) : NOOP_MIDDLEWARE_FN;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getServerOutputDirectory } from "../../prerender/utils.js";
|
|
2
2
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
|
|
3
3
|
import { routeIsFallback, routeIsRedirect } from "../redirects/helpers.js";
|
|
4
4
|
import { RedirectSinglePageBuiltModule } from "../redirects/index.js";
|
|
@@ -81,7 +81,7 @@ class BuildPipeline extends Pipeline {
|
|
|
81
81
|
* @param staticBuildOptions
|
|
82
82
|
*/
|
|
83
83
|
static async retrieveManifest(settings, internals) {
|
|
84
|
-
const baseDirectory =
|
|
84
|
+
const baseDirectory = getServerOutputDirectory(settings);
|
|
85
85
|
const manifestEntryUrl = new URL(
|
|
86
86
|
`${internals.manifestFileName}?time=${Date.now()}`,
|
|
87
87
|
baseDirectory
|
|
@@ -41,9 +41,6 @@ function getNonPrerenderOnlyChunks(bundle, internals) {
|
|
|
41
41
|
}
|
|
42
42
|
nonPrerenderOnlyEntryChunks.add(chunk);
|
|
43
43
|
}
|
|
44
|
-
if (chunk.type === "chunk" && chunk.isDynamicEntry) {
|
|
45
|
-
nonPrerenderOnlyEntryChunks.add(chunk);
|
|
46
|
-
}
|
|
47
44
|
}
|
|
48
45
|
const nonPrerenderOnlyChunks = new Set(nonPrerenderOnlyEntryChunks);
|
|
49
46
|
for (const chunk of nonPrerenderOnlyChunks) {
|
|
@@ -9,7 +9,7 @@ import { createBuildInternals } from "../../core/build/internal.js";
|
|
|
9
9
|
import { emptyDir, removeEmptyDirs } from "../../core/fs/index.js";
|
|
10
10
|
import { appendForwardSlash, prependForwardSlash } from "../../core/path.js";
|
|
11
11
|
import { runHookBuildSetup } from "../../integrations/hooks.js";
|
|
12
|
-
import {
|
|
12
|
+
import { getServerOutputDirectory } from "../../prerender/utils.js";
|
|
13
13
|
import { PAGE_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
|
|
14
14
|
import { routeIsRedirect } from "../redirects/index.js";
|
|
15
15
|
import { getOutDirWithinCwd } from "./common.js";
|
|
@@ -95,7 +95,7 @@ async function staticBuild(opts, internals, ssrOutputChunkNames) {
|
|
|
95
95
|
async function ssrBuild(opts, internals, input, container) {
|
|
96
96
|
const { allPages, settings, viteConfig } = opts;
|
|
97
97
|
const ssr = settings.buildOutput === "server";
|
|
98
|
-
const out =
|
|
98
|
+
const out = getServerOutputDirectory(settings);
|
|
99
99
|
const routes = Object.values(allPages).flatMap((pageData) => pageData.route);
|
|
100
100
|
const { lastVitePlugins, vitePlugins } = await container.runBeforeHook("server", input);
|
|
101
101
|
const viteBuildConfig = {
|