astro 5.10.0 → 5.10.2
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/components/Image.astro +1 -1
- package/components/Picture.astro +1 -1
- package/dist/actions/integration.js +2 -2
- package/dist/actions/runtime/virtual/server.d.ts +1 -1
- package/dist/actions/runtime/virtual/server.js +1 -1
- package/dist/actions/runtime/virtual/shared.d.ts +1 -1
- package/dist/actions/runtime/virtual/shared.js +1 -1
- package/dist/assets/endpoint/node.js +1 -1
- package/dist/assets/fonts/definitions.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +1 -1
- package/dist/assets/internal.js +2 -2
- package/dist/assets/utils/index.d.ts +4 -4
- package/dist/assets/utils/index.js +4 -4
- package/dist/assets/utils/remotePattern.d.ts +1 -1
- package/dist/config/entrypoint.d.ts +4 -4
- package/dist/config/entrypoint.js +3 -3
- package/dist/content/config.d.ts +1 -1
- package/dist/content/config.js +17 -2
- package/dist/content/content-layer.js +4 -4
- package/dist/content/loaders/file.js +1 -1
- package/dist/content/loaders/glob.js +1 -1
- package/dist/content/mutable-data-store.js +1 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/runtime.js +22 -6
- package/dist/content/utils.d.ts +5 -5
- package/dist/content/utils.js +2 -2
- package/dist/core/app/common.d.ts +1 -1
- package/dist/core/app/index.js +2 -2
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/build/generate.js +2 -3
- package/dist/core/build/index.js +3 -4
- package/dist/core/build/plugins/plugin-css.js +1 -1
- package/dist/core/compile/index.d.ts +1 -1
- package/dist/core/config/schemas/base.d.ts +1 -1
- package/dist/core/config/schemas/index.d.ts +2 -2
- package/dist/core/config/schemas/index.js +3 -3
- package/dist/core/config/settings.js +1 -1
- package/dist/core/config/tsconfig.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/index.d.ts +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/csp/common.js +2 -2
- package/dist/core/dev/container.d.ts +2 -2
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +18 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +1 -1
- package/dist/core/errors/index.d.ts +2 -2
- package/dist/core/errors/index.js +4 -4
- package/dist/core/logger/console.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/sequence.js +7 -2
- package/dist/core/module-loader/index.d.ts +1 -1
- package/dist/core/render-context.js +37 -9
- package/dist/core/routing/default.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +1 -1
- package/dist/core/routing/rewrite.d.ts +1 -1
- package/dist/core/routing/rewrite.js +14 -2
- package/dist/core/viteUtils.js +1 -1
- package/dist/env/runtime.d.ts +1 -1
- package/dist/env/runtime.js +1 -1
- package/dist/env/setup.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/jsx-runtime/index.js +1 -1
- package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/ui-library/index.js +1 -1
- package/dist/runtime/compiler/index.d.ts +1 -1
- package/dist/runtime/compiler/index.js +1 -1
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/runtime/server/index.js +4 -4
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/astro/index.d.ts +3 -3
- package/dist/runtime/server/render/astro/index.js +1 -1
- package/dist/runtime/server/render/astro/instance.d.ts +2 -2
- package/dist/runtime/server/render/component.js +8 -6
- package/dist/runtime/server/render/index.d.ts +4 -4
- package/dist/runtime/server/render/index.js +2 -2
- package/dist/runtime/server/render/slot.d.ts +2 -2
- package/dist/runtime/server/render/slot.js +1 -1
- package/dist/runtime/server/render/util.d.ts +3 -3
- package/dist/runtime/server/render/util.js +17 -8
- package/dist/runtime/server/scripts.js +2 -2
- package/dist/template/4xx.js +1 -1
- package/dist/transitions/router.js +1 -1
- package/dist/types/public/config.d.ts +16 -15
- package/dist/types/public/content.d.ts +2 -0
- package/dist/types/public/context.d.ts +7 -7
- package/dist/types/public/index.d.ts +15 -15
- package/dist/types/public/internal.d.ts +1 -1
- package/dist/virtual-modules/i18n.d.ts +1 -1
- package/dist/vite-plugin-astro-server/base.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +1 -1
- package/dist/vite-plugin-astro-server/pipeline.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +3 -3
- package/dist/vite-plugin-head/index.d.ts +1 -1
- package/dist/vite-plugin-html/transform/slots.d.ts +1 -1
- package/package.json +3 -3
package/components/Image.astro
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { type LocalImageProps, type RemoteImageProps
|
|
2
|
+
import { getImage, imageConfig, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
|
|
3
3
|
import type { UnresolvedImageTransform } from '../dist/assets/types';
|
|
4
4
|
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
|
|
5
5
|
import type { HTMLAttributes } from '../types';
|
package/components/Picture.astro
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { type LocalImageProps, type RemoteImageProps
|
|
2
|
+
import { getImage, imageConfig, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
|
|
3
3
|
import * as mime from 'mrmime';
|
|
4
4
|
import { isESMImportedImage, resolveSrc } from '../dist/assets/utils/imageKind.js';
|
|
5
5
|
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ActionsWithoutServerOutputError } from "../core/errors/errors-data.js";
|
|
2
1
|
import { AstroError } from "../core/errors/errors.js";
|
|
2
|
+
import { ActionsWithoutServerOutputError } from "../core/errors/errors-data.js";
|
|
3
3
|
import { viteID } from "../core/util.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ACTION_RPC_ROUTE_PATTERN, ACTIONS_TYPES_FILE, VIRTUAL_MODULE_ID } from "./consts.js";
|
|
5
5
|
function astroIntegrationActionsRouteHandler({
|
|
6
6
|
settings,
|
|
7
7
|
filename
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { APIContext } from '../../../types/public/index.js';
|
|
3
3
|
import { type ActionAPIContext, type ErrorInferenceObject, type MaybePromise } from '../utils.js';
|
|
4
|
-
import { type SafeResult, type SerializedActionResult,
|
|
4
|
+
import { deserializeActionResult, type SafeResult, type SerializedActionResult, serializeActionResult } from './shared.js';
|
|
5
5
|
export * from './shared.js';
|
|
6
6
|
export type ActionAccept = 'form' | 'json';
|
|
7
7
|
export type ActionHandler<TInputSchema, TOutput> = TInputSchema extends z.ZodType ? (input: z.infer<TInputSchema>, context: ActionAPIContext) => MaybePromise<TOutput> : (input: any, context: ActionAPIContext) => MaybePromise<TOutput>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { shouldAppendForwardSlash } from "../../../core/build/util.js";
|
|
3
|
-
import { ActionCalledFromServerError } from "../../../core/errors/errors-data.js";
|
|
4
3
|
import { AstroError } from "../../../core/errors/errors.js";
|
|
4
|
+
import { ActionCalledFromServerError } from "../../../core/errors/errors-data.js";
|
|
5
5
|
import { removeTrailingForwardSlash } from "../../../core/path.js";
|
|
6
6
|
import { apiContextRoutesSymbol } from "../../../core/render-context.js";
|
|
7
7
|
import { ACTION_RPC_ROUTE_PATTERN } from "../../consts.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import { AstroError } from '../../../core/errors/errors.js';
|
|
3
3
|
import { appendForwardSlash as _appendForwardSlash } from '../../../core/path.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ActionAPIContext as _ActionAPIContext, ErrorInferenceObject, MaybePromise } from '../utils.js';
|
|
5
5
|
export type ActionAPIContext = _ActionAPIContext;
|
|
6
6
|
export declare const ACTION_QUERY_PARAMS: {
|
|
7
7
|
actionName: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parse as devalueParse, stringify as devalueStringify } from "devalue";
|
|
2
2
|
import { REDIRECT_STATUS_CODES } from "../../../core/constants.js";
|
|
3
|
+
import { AstroError } from "../../../core/errors/errors.js";
|
|
3
4
|
import {
|
|
4
5
|
ActionCalledFromServerError,
|
|
5
6
|
ActionsReturnedInvalidDataError
|
|
6
7
|
} from "../../../core/errors/errors-data.js";
|
|
7
|
-
import { AstroError } from "../../../core/errors/errors.js";
|
|
8
8
|
import { appendForwardSlash as _appendForwardSlash } from "../../../core/path.js";
|
|
9
9
|
import { ACTION_QUERY_PARAMS as _ACTION_QUERY_PARAMS } from "../../consts.js";
|
|
10
10
|
const ACTION_QUERY_PARAMS = _ACTION_QUERY_PARAMS;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { assetsDir, imageConfig, outDir } from "astro:assets";
|
|
1
2
|
import { readFile } from "node:fs/promises";
|
|
2
3
|
import os from "node:os";
|
|
3
4
|
import { isAbsolute } from "node:path";
|
|
4
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
-
import { assetsDir, imageConfig, outDir } from "astro:assets";
|
|
6
6
|
import { isRemotePath, removeQueryString } from "@astrojs/internal-helpers/path";
|
|
7
7
|
import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
|
|
8
8
|
import * as mime from "mrmime";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as unifont from 'unifont';
|
|
2
2
|
import type { CollectedFontForMetrics } from './logic/optimize-fallbacks.js';
|
|
3
|
-
import type { AstroFontProvider, FontFileData, FontType, PreloadData, ResolvedFontProvider, Style } from './types.js';
|
|
4
|
-
import type { FontFaceMetrics, GenericFallbackName } from './types.js';
|
|
3
|
+
import type { AstroFontProvider, FontFaceMetrics, FontFileData, FontType, GenericFallbackName, PreloadData, ResolvedFontProvider, Style } from './types.js';
|
|
5
4
|
export interface Hasher {
|
|
6
5
|
hashString: (input: string) => string;
|
|
7
6
|
hashObject: (input: Record<string, any>) => string;
|
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
import { createRemoteFontProviderResolver } from "./implementations/remote-font-provider-resolver.js";
|
|
31
31
|
import { createFsStorage } from "./implementations/storage.js";
|
|
32
32
|
import { createSystemFallbacksProvider } from "./implementations/system-fallbacks-provider.js";
|
|
33
|
+
import { createUrlProxy } from "./implementations/url-proxy.js";
|
|
33
34
|
import {
|
|
34
35
|
createLocalUrlProxyContentResolver,
|
|
35
36
|
createRemoteUrlProxyContentResolver
|
|
36
37
|
} from "./implementations/url-proxy-content-resolver.js";
|
|
37
|
-
import { createUrlProxy } from "./implementations/url-proxy.js";
|
|
38
38
|
import { createBuildUrlResolver, createDevUrlResolver } from "./implementations/url-resolver.js";
|
|
39
39
|
import { orchestrate } from "./orchestrate.js";
|
|
40
40
|
function fontsPlugin({ settings, sync, logger }) {
|
package/dist/assets/internal.js
CHANGED
|
@@ -3,9 +3,9 @@ import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
|
3
3
|
import { DEFAULT_HASH_PROPS } from "./consts.js";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_RESOLUTIONS,
|
|
6
|
-
LIMITED_RESOLUTIONS,
|
|
7
6
|
getSizesAttribute,
|
|
8
|
-
getWidths
|
|
7
|
+
getWidths,
|
|
8
|
+
LIMITED_RESOLUTIONS
|
|
9
9
|
} from "./layout.js";
|
|
10
10
|
import { isLocalService } from "./services/service.js";
|
|
11
11
|
import {
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* If some functions don't need to be exposed, just import the file that contains the functions.
|
|
6
6
|
*/
|
|
7
|
+
export { isESMImportedImage, isRemoteImage } from './imageKind.js';
|
|
8
|
+
export { imageMetadata } from './metadata.js';
|
|
7
9
|
export {
|
|
8
10
|
/**
|
|
9
11
|
* @deprecated
|
|
10
12
|
*/
|
|
11
13
|
emitESMImage, emitImageMetadata, } from './node/emitAsset.js';
|
|
12
|
-
export { isESMImportedImage, isRemoteImage } from './imageKind.js';
|
|
13
|
-
export { imageMetadata } from './metadata.js';
|
|
14
14
|
export { getOrigQueryParams } from './queryParams.js';
|
|
15
|
-
export { hashTransform, propsToFilename } from './transformToPath.js';
|
|
16
|
-
export { inferRemoteSize } from './remoteProbe.js';
|
|
17
15
|
export { isRemoteAllowed, matchHostname, matchPathname, matchPattern, matchPort, matchProtocol, type RemotePattern, } from './remotePattern.js';
|
|
16
|
+
export { inferRemoteSize } from './remoteProbe.js';
|
|
17
|
+
export { hashTransform, propsToFilename } from './transformToPath.js';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { isESMImportedImage, isRemoteImage } from "./imageKind.js";
|
|
2
|
+
import { imageMetadata } from "./metadata.js";
|
|
1
3
|
import {
|
|
2
4
|
emitESMImage,
|
|
3
5
|
emitImageMetadata
|
|
4
6
|
} from "./node/emitAsset.js";
|
|
5
|
-
import { isESMImportedImage, isRemoteImage } from "./imageKind.js";
|
|
6
|
-
import { imageMetadata } from "./metadata.js";
|
|
7
7
|
import { getOrigQueryParams } from "./queryParams.js";
|
|
8
|
-
import { hashTransform, propsToFilename } from "./transformToPath.js";
|
|
9
|
-
import { inferRemoteSize } from "./remoteProbe.js";
|
|
10
8
|
import {
|
|
11
9
|
isRemoteAllowed,
|
|
12
10
|
matchHostname,
|
|
@@ -15,6 +13,8 @@ import {
|
|
|
15
13
|
matchPort,
|
|
16
14
|
matchProtocol
|
|
17
15
|
} from "./remotePattern.js";
|
|
16
|
+
import { inferRemoteSize } from "./remoteProbe.js";
|
|
17
|
+
import { hashTransform, propsToFilename } from "./transformToPath.js";
|
|
18
18
|
export {
|
|
19
19
|
emitESMImage,
|
|
20
20
|
emitImageMetadata,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isRemoteAllowed, matchHostname, matchPathname, matchPattern, matchPort, matchProtocol, type RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
2
2
|
export { isRemoteAllowed, matchHostname, matchPort, matchPathname, matchProtocol, matchPattern };
|
|
3
3
|
export type { RemotePattern };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SharpImageServiceConfig } from '../assets/services/sharp.js';
|
|
2
2
|
import type { ImageServiceConfig } from '../types/public/index.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { defineAstroFontProvider, fontProviders } from '../assets/fonts/providers/index.js';
|
|
4
|
+
export type { AstroFontProvider } from '../assets/fonts/types.js';
|
|
5
5
|
export { mergeConfig } from '../core/config/merge.js';
|
|
6
6
|
export { validateConfig } from '../core/config/validate.js';
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
7
|
+
export { envField } from '../env/config.js';
|
|
8
|
+
export { defineConfig, getViteConfig } from './index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Return the configuration needed to use the Sharp-based image service
|
|
11
11
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { envField } from "../env/config.js";
|
|
1
|
+
import { defineAstroFontProvider, fontProviders } from "../assets/fonts/providers/index.js";
|
|
3
2
|
import { mergeConfig } from "../core/config/merge.js";
|
|
4
3
|
import { validateConfig } from "../core/config/validate.js";
|
|
5
|
-
import {
|
|
4
|
+
import { envField } from "../env/config.js";
|
|
5
|
+
import { defineConfig, getViteConfig } from "./index.js";
|
|
6
6
|
function sharpImageService(config = {}) {
|
|
7
7
|
return {
|
|
8
8
|
entrypoint: "astro/assets/services/sharp",
|
package/dist/content/config.d.ts
CHANGED
package/dist/content/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AstroError, AstroErrorData, AstroUserError } from "../core/errors/index
|
|
|
2
2
|
import { CONTENT_LAYER_TYPE, LIVE_CONTENT_TYPE } from "./consts.js";
|
|
3
3
|
function getImporterFilename() {
|
|
4
4
|
const stackLine = new Error().stack?.split("\n").find(
|
|
5
|
-
(line) => !line.includes("defineCollection") && !line.includes("defineLiveCollection") && !line.includes("getImporterFilename") && line
|
|
5
|
+
(line) => !line.includes("defineCollection") && !line.includes("defineLiveCollection") && !line.includes("getImporterFilename") && !line.startsWith("Error")
|
|
6
6
|
);
|
|
7
7
|
if (!stackLine) {
|
|
8
8
|
return void 0;
|
|
@@ -12,7 +12,7 @@ function getImporterFilename() {
|
|
|
12
12
|
}
|
|
13
13
|
function defineLiveCollection(config) {
|
|
14
14
|
const importerFilename = getImporterFilename();
|
|
15
|
-
if (!importerFilename
|
|
15
|
+
if (importerFilename && !importerFilename.includes("live.config")) {
|
|
16
16
|
throw new AstroError({
|
|
17
17
|
...AstroErrorData.LiveContentConfigError,
|
|
18
18
|
message: AstroErrorData.LiveContentConfigError.message(
|
|
@@ -21,6 +21,7 @@ function defineLiveCollection(config) {
|
|
|
21
21
|
)
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
config.type ??= LIVE_CONTENT_TYPE;
|
|
24
25
|
if (config.type !== LIVE_CONTENT_TYPE) {
|
|
25
26
|
throw new AstroError({
|
|
26
27
|
...AstroErrorData.LiveContentConfigError,
|
|
@@ -39,6 +40,15 @@ function defineLiveCollection(config) {
|
|
|
39
40
|
)
|
|
40
41
|
});
|
|
41
42
|
}
|
|
43
|
+
if (!config.loader.loadCollection || !config.loader.loadEntry) {
|
|
44
|
+
throw new AstroError({
|
|
45
|
+
...AstroErrorData.LiveContentConfigError,
|
|
46
|
+
message: AstroErrorData.LiveContentConfigError.message(
|
|
47
|
+
"Live collection loaders must have `loadCollection()` and `loadEntry()` methods. Please check that you are not using a loader intended for build-time collections",
|
|
48
|
+
importerFilename
|
|
49
|
+
)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
42
52
|
if (typeof config.schema === "function") {
|
|
43
53
|
throw new AstroError({
|
|
44
54
|
...AstroErrorData.LiveContentConfigError,
|
|
@@ -67,6 +77,11 @@ function defineCollection(config) {
|
|
|
67
77
|
`Collections that use the Content Layer API must have a \`loader\` defined and no \`type\` set. Check your collection definitions in ${importerFilename ?? "your content config file"}.`
|
|
68
78
|
);
|
|
69
79
|
}
|
|
80
|
+
if (typeof config.loader === "object" && typeof config.loader.load !== "function" && ("loadEntry" in config.loader || "loadCollection" in config.loader)) {
|
|
81
|
+
throw new AstroUserError(
|
|
82
|
+
`Live content collections must be defined in "src/live.config.ts" file. Check your collection definitions in "${importerFilename ?? "your content config file"}" to ensure you are not using a live loader.`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
70
85
|
config.type = CONTENT_LAYER_TYPE;
|
|
71
86
|
}
|
|
72
87
|
if (!config.type) config.type = "content";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs
|
|
1
|
+
import { existsSync, promises as fs } from "node:fs";
|
|
2
2
|
import { createMarkdownProcessor } from "@astrojs/markdown-remark";
|
|
3
3
|
import PQueue from "p-queue";
|
|
4
4
|
import xxhash from "xxhash-wasm";
|
|
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
|
|
|
164
164
|
logger.info("Content config changed");
|
|
165
165
|
shouldClear = true;
|
|
166
166
|
}
|
|
167
|
-
if (previousAstroVersion && previousAstroVersion !== "5.10.
|
|
167
|
+
if (previousAstroVersion && previousAstroVersion !== "5.10.2") {
|
|
168
168
|
logger.info("Astro version changed");
|
|
169
169
|
shouldClear = true;
|
|
170
170
|
}
|
|
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
|
|
|
172
172
|
logger.info("Clearing content store");
|
|
173
173
|
this.#store.clearAll();
|
|
174
174
|
}
|
|
175
|
-
if ("5.10.
|
|
176
|
-
await this.#store.metaStore().set("astro-version", "5.10.
|
|
175
|
+
if ("5.10.2") {
|
|
176
|
+
await this.#store.metaStore().set("astro-version", "5.10.2");
|
|
177
177
|
}
|
|
178
178
|
if (currentConfigDigest) {
|
|
179
179
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs
|
|
1
|
+
import { existsSync, promises as fs } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import yaml from "js-yaml";
|
|
4
4
|
import { FileGlobNotSupported, FileParserNotFound } from "../../core/errors/errors-data.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs
|
|
1
|
+
import { existsSync, promises as fs } from "node:fs";
|
|
2
2
|
import * as devalue from "devalue";
|
|
3
3
|
import { Traverse } from "neotraverse/modern";
|
|
4
4
|
import { imageSrcToImportId, importIdToSymbolName } from "../assets/utils/resolveImports.js";
|
|
@@ -2,10 +2,10 @@ import type { PluginContext } from 'rollup';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export declare function createImage(pluginContext: PluginContext, shouldEmitFile: boolean, entryFilePath: string, experimentalSvgEnabled: boolean): () => z.ZodEffects<z.ZodString, z.ZodNever | {
|
|
4
4
|
ASTRO_ASSET: string;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
5
|
src: string;
|
|
8
6
|
format: import("../assets/types.js").ImageInputFormat;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
9
|
fsPath: string;
|
|
10
10
|
orientation?: number | undefined;
|
|
11
11
|
}, string>;
|
package/dist/content/runtime.js
CHANGED
|
@@ -5,7 +5,6 @@ import { ZodIssueCode, z } from "zod";
|
|
|
5
5
|
import { imageSrcToImportId } from "../assets/utils/resolveImports.js";
|
|
6
6
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
7
7
|
import { prependForwardSlash } from "../core/path.js";
|
|
8
|
-
import { defineCollection as defineCollectionOrig } from "./config.js";
|
|
9
8
|
import {
|
|
10
9
|
createComponent,
|
|
11
10
|
createHeadAndContent,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
render as serverRender,
|
|
17
16
|
unescapeHTML
|
|
18
17
|
} from "../runtime/server/index.js";
|
|
18
|
+
import { defineCollection as defineCollectionOrig } from "./config.js";
|
|
19
19
|
import { IMAGE_IMPORT_PREFIX } from "./consts.js";
|
|
20
20
|
import { globalDataStore } from "./data-store.js";
|
|
21
21
|
import {
|
|
@@ -41,7 +41,8 @@ function createCollectionToGlobResultMap({
|
|
|
41
41
|
}
|
|
42
42
|
const cacheHintSchema = z.object({
|
|
43
43
|
tags: z.array(z.string()).optional(),
|
|
44
|
-
maxAge: z.number().optional()
|
|
44
|
+
maxAge: z.number().optional(),
|
|
45
|
+
lastModified: z.date().optional()
|
|
45
46
|
});
|
|
46
47
|
async function parseLiveEntry(entry, schema, collection) {
|
|
47
48
|
try {
|
|
@@ -381,24 +382,37 @@ function createGetLiveCollection({
|
|
|
381
382
|
if (processedEntries.length > 0) {
|
|
382
383
|
const entryTags = /* @__PURE__ */ new Set();
|
|
383
384
|
let minMaxAge;
|
|
385
|
+
let latestModified;
|
|
384
386
|
for (const entry of processedEntries) {
|
|
385
387
|
if (entry.cacheHint) {
|
|
386
388
|
if (entry.cacheHint.tags) {
|
|
387
389
|
entry.cacheHint.tags.forEach((tag) => entryTags.add(tag));
|
|
388
390
|
}
|
|
389
391
|
if (typeof entry.cacheHint.maxAge === "number") {
|
|
390
|
-
|
|
392
|
+
if (minMaxAge === void 0 || entry.cacheHint.maxAge < minMaxAge) {
|
|
393
|
+
minMaxAge = entry.cacheHint.maxAge;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (entry.cacheHint.lastModified instanceof Date) {
|
|
397
|
+
if (latestModified === void 0 || entry.cacheHint.lastModified > latestModified) {
|
|
398
|
+
latestModified = entry.cacheHint.lastModified;
|
|
399
|
+
}
|
|
391
400
|
}
|
|
392
401
|
}
|
|
393
402
|
}
|
|
394
|
-
if (entryTags.size > 0 || minMaxAge !== void 0 || cacheHint) {
|
|
403
|
+
if (entryTags.size > 0 || minMaxAge !== void 0 || latestModified || cacheHint) {
|
|
395
404
|
const mergedCacheHint = {};
|
|
396
405
|
if (cacheHint?.tags || entryTags.size > 0) {
|
|
397
|
-
mergedCacheHint.tags = [...cacheHint?.tags || [], ...entryTags];
|
|
406
|
+
mergedCacheHint.tags = [.../* @__PURE__ */ new Set([...cacheHint?.tags || [], ...entryTags])];
|
|
398
407
|
}
|
|
399
408
|
if (cacheHint?.maxAge !== void 0 || minMaxAge !== void 0) {
|
|
400
409
|
mergedCacheHint.maxAge = cacheHint?.maxAge !== void 0 && minMaxAge !== void 0 ? Math.min(cacheHint.maxAge, minMaxAge) : cacheHint?.maxAge ?? minMaxAge;
|
|
401
410
|
}
|
|
411
|
+
if (cacheHint?.lastModified && latestModified) {
|
|
412
|
+
mergedCacheHint.lastModified = cacheHint.lastModified > latestModified ? cacheHint.lastModified : latestModified;
|
|
413
|
+
} else if (cacheHint?.lastModified || latestModified) {
|
|
414
|
+
mergedCacheHint.lastModified = cacheHint?.lastModified ?? latestModified;
|
|
415
|
+
}
|
|
402
416
|
cacheHint = mergedCacheHint;
|
|
403
417
|
}
|
|
404
418
|
}
|
|
@@ -498,7 +512,9 @@ async function updateImageReferencesInBody(html, fileName) {
|
|
|
498
512
|
return Object.entries({
|
|
499
513
|
...attributes,
|
|
500
514
|
src: image.src,
|
|
501
|
-
srcset: image.srcSet.attribute
|
|
515
|
+
srcset: image.srcSet.attribute,
|
|
516
|
+
// This attribute is used by the toolbar audit
|
|
517
|
+
...import.meta.env.DEV ? { "data-image-component": "true" } : {}
|
|
502
518
|
}).map(([key, value]) => value ? `${key}="${escape(value)}"` : "").join(" ");
|
|
503
519
|
});
|
|
504
520
|
}
|
package/dist/content/utils.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
177
177
|
schema?: any;
|
|
178
178
|
_legacy?: boolean | undefined;
|
|
179
179
|
}>, z.ZodObject<{
|
|
180
|
-
type: z.ZodLiteral<"live"
|
|
180
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"live">>>;
|
|
181
181
|
schema: z.ZodOptional<z.ZodAny>;
|
|
182
182
|
loader: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
183
183
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -185,8 +185,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
|
|
|
185
185
|
loader: (...args: unknown[]) => unknown;
|
|
186
186
|
schema?: any;
|
|
187
187
|
}, {
|
|
188
|
-
type: "live";
|
|
189
188
|
loader: (...args: unknown[]) => unknown;
|
|
189
|
+
type?: "live" | undefined;
|
|
190
190
|
schema?: any;
|
|
191
191
|
}>]>;
|
|
192
192
|
declare const contentConfigParser: z.ZodObject<{
|
|
@@ -334,7 +334,7 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
334
334
|
schema?: any;
|
|
335
335
|
_legacy?: boolean | undefined;
|
|
336
336
|
}>, z.ZodObject<{
|
|
337
|
-
type: z.ZodLiteral<"live"
|
|
337
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"live">>>;
|
|
338
338
|
schema: z.ZodOptional<z.ZodAny>;
|
|
339
339
|
loader: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -342,8 +342,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
342
342
|
loader: (...args: unknown[]) => unknown;
|
|
343
343
|
schema?: any;
|
|
344
344
|
}, {
|
|
345
|
-
type: "live";
|
|
346
345
|
loader: (...args: unknown[]) => unknown;
|
|
346
|
+
type?: "live" | undefined;
|
|
347
347
|
schema?: any;
|
|
348
348
|
}>]>>;
|
|
349
349
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -410,8 +410,8 @@ declare const contentConfigParser: z.ZodObject<{
|
|
|
410
410
|
schema?: any;
|
|
411
411
|
_legacy?: boolean | undefined;
|
|
412
412
|
} | {
|
|
413
|
-
type: "live";
|
|
414
413
|
loader: (...args: unknown[]) => unknown;
|
|
414
|
+
type?: "live" | undefined;
|
|
415
415
|
schema?: any;
|
|
416
416
|
}>;
|
|
417
417
|
}>;
|
package/dist/content/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import { slug as githubSlug } from "github-slugger";
|
|
|
6
6
|
import { green } from "kleur/colors";
|
|
7
7
|
import xxhash from "xxhash-wasm";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { AstroError, AstroErrorData,
|
|
9
|
+
import { AstroError, AstroErrorData, errorMap, MarkdownError } from "../core/errors/index.js";
|
|
10
10
|
import { isYAMLException } from "../core/errors/utils.js";
|
|
11
11
|
import { appendForwardSlash } from "../core/path.js";
|
|
12
12
|
import { normalizePath } from "../core/viteUtils.js";
|
|
@@ -81,7 +81,7 @@ const collectionConfigParser = z.union([
|
|
|
81
81
|
_legacy: z.boolean().optional()
|
|
82
82
|
}),
|
|
83
83
|
z.object({
|
|
84
|
-
type: z.literal(LIVE_CONTENT_TYPE),
|
|
84
|
+
type: z.literal(LIVE_CONTENT_TYPE).optional().default(LIVE_CONTENT_TYPE),
|
|
85
85
|
schema: z.any().optional(),
|
|
86
86
|
loader: z.function()
|
|
87
87
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SerializedSSRManifest, SSRManifest } from './types.js';
|
|
2
2
|
export declare function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest;
|
package/dist/core/app/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { collapseDuplicateTrailingSlashes, hasFileExtension } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { normalizeTheLocale } from "../../i18n/index.js";
|
|
3
3
|
import {
|
|
4
|
+
clientAddressSymbol,
|
|
4
5
|
DEFAULT_404_COMPONENT,
|
|
5
6
|
REROUTABLE_STATUS_CODES,
|
|
6
7
|
REROUTE_DIRECTIVE_HEADER,
|
|
7
|
-
clientAddressSymbol,
|
|
8
8
|
responseSentSymbol
|
|
9
9
|
} from "../constants.js";
|
|
10
10
|
import { getSetCookiesFromResponse } from "../cookies/index.js";
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
prependForwardSlash,
|
|
19
19
|
removeTrailingForwardSlash
|
|
20
20
|
} from "../path.js";
|
|
21
|
-
import { RenderContext } from "../render-context.js";
|
|
22
21
|
import { createAssetLink } from "../render/ssr-element.js";
|
|
22
|
+
import { RenderContext } from "../render-context.js";
|
|
23
23
|
import { redirectTemplate } from "../routing/3xx.js";
|
|
24
24
|
import { ensure404Route } from "../routing/astro-designed-error-pages.js";
|
|
25
25
|
import { createDefaultRoutes } from "../routing/default.js";
|
package/dist/core/app/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import type { RouteData } from '../../types/public/internal.js';
|
|
3
|
-
import { App } from './index.js';
|
|
4
3
|
import type { RenderOptions } from './index.js';
|
|
4
|
+
import { App } from './index.js';
|
|
5
5
|
import type { SSRManifest } from './types.js';
|
|
6
6
|
export { apply as applyPolyfills } from '../polyfill.js';
|
|
7
7
|
/**
|
|
@@ -34,16 +34,15 @@ import { NoPrerenderedRoutesWithDomains } from "../errors/errors-data.js";
|
|
|
34
34
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
35
35
|
import { NOOP_MIDDLEWARE_FN } from "../middleware/noop-middleware.js";
|
|
36
36
|
import { getRedirectLocationOrThrow, routeIsRedirect } from "../redirects/index.js";
|
|
37
|
-
import { RenderContext } from "../render-context.js";
|
|
38
37
|
import { callGetStaticPaths } from "../render/route-cache.js";
|
|
38
|
+
import { RenderContext } from "../render-context.js";
|
|
39
39
|
import { createRequest } from "../request.js";
|
|
40
40
|
import { redirectTemplate } from "../routing/3xx.js";
|
|
41
41
|
import { matchRoute } from "../routing/match.js";
|
|
42
42
|
import { stringifyParams } from "../routing/params.js";
|
|
43
43
|
import { getOutputFilename } from "../util.js";
|
|
44
44
|
import { getOutFile, getOutFolder } from "./common.js";
|
|
45
|
-
import { hasPrerenderedPages } from "./internal.js";
|
|
46
|
-
import { cssOrder, mergeInlineCss } from "./internal.js";
|
|
45
|
+
import { cssOrder, hasPrerenderedPages, mergeInlineCss } from "./internal.js";
|
|
47
46
|
import { BuildPipeline } from "./pipeline.js";
|
|
48
47
|
import { getTimeStat, shouldAppendForwardSlash } from "./util.js";
|
|
49
48
|
async function generatePages(options, internals) {
|
package/dist/core/build/index.js
CHANGED
|
@@ -53,7 +53,6 @@ class AstroBuilder {
|
|
|
53
53
|
routesList;
|
|
54
54
|
timer;
|
|
55
55
|
teardownCompiler;
|
|
56
|
-
manifest;
|
|
57
56
|
constructor(settings, options) {
|
|
58
57
|
this.mode = options.mode;
|
|
59
58
|
this.runtimeMode = options.runtimeMode;
|
|
@@ -62,7 +61,6 @@ class AstroBuilder {
|
|
|
62
61
|
this.teardownCompiler = options.teardownCompiler ?? true;
|
|
63
62
|
this.origin = settings.config.site ? new URL(settings.config.site).origin : `http://localhost:${settings.config.server.port}`;
|
|
64
63
|
this.routesList = { routes: [] };
|
|
65
|
-
this.manifest = createDevelopmentManifest(settings);
|
|
66
64
|
this.timer = {};
|
|
67
65
|
}
|
|
68
66
|
/** Setup Vite and run any async setup logic that couldn't run inside of the constructor. */
|
|
@@ -75,6 +73,7 @@ class AstroBuilder {
|
|
|
75
73
|
command: "build",
|
|
76
74
|
logger
|
|
77
75
|
});
|
|
76
|
+
const manifest = createDevelopmentManifest(this.settings);
|
|
78
77
|
this.routesList = await createRoutesList({ settings: this.settings }, this.logger);
|
|
79
78
|
await runHookConfigDone({ settings: this.settings, logger, command: "build" });
|
|
80
79
|
if (!this.settings.config.adapter && this.settings.buildOutput === "server") {
|
|
@@ -94,7 +93,7 @@ class AstroBuilder {
|
|
|
94
93
|
command: "build",
|
|
95
94
|
sync: false,
|
|
96
95
|
routesList: this.routesList,
|
|
97
|
-
manifest
|
|
96
|
+
manifest
|
|
98
97
|
}
|
|
99
98
|
);
|
|
100
99
|
const { syncInternal } = await import("../sync/index.js");
|
|
@@ -105,7 +104,7 @@ class AstroBuilder {
|
|
|
105
104
|
fs,
|
|
106
105
|
routesList: this.routesList,
|
|
107
106
|
command: "build",
|
|
108
|
-
manifest
|
|
107
|
+
manifest
|
|
109
108
|
});
|
|
110
109
|
return { viteConfig };
|
|
111
110
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isBuildableCSSRequest } from "../../../vite-plugin-astro-server/util.js";
|
|
2
1
|
import { hasAssetPropagationFlag } from "../../../content/index.js";
|
|
2
|
+
import { isBuildableCSSRequest } from "../../../vite-plugin-astro-server/util.js";
|
|
3
3
|
import * as assetName from "../css-asset-name.js";
|
|
4
4
|
import {
|
|
5
5
|
getParentExtendedModuleInfos,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RehypePlugin as _RehypePlugin, RemarkPlugin as _RemarkPlugin, RemarkRehype as _RemarkRehype, ShikiConfig } from '@astrojs/markdown-remark';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import type { ViteUserConfig } from '../../../types/public/config.js';
|
|
5
5
|
/** @lintignore */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { createRelativeSchema } from './relative.js';
|
|
1
|
+
export { ASTRO_CONFIG_DEFAULTS, AstroConfigSchema, type AstroConfigType, } from './base.js';
|
|
3
2
|
export { AstroConfigRefinedSchema } from './refined.js';
|
|
3
|
+
export { createRelativeSchema } from './relative.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ASTRO_CONFIG_DEFAULTS,
|
|
3
|
+
AstroConfigSchema
|
|
4
4
|
} from "./base.js";
|
|
5
|
-
import { createRelativeSchema } from "./relative.js";
|
|
6
5
|
import { AstroConfigRefinedSchema } from "./refined.js";
|
|
6
|
+
import { createRelativeSchema } from "./relative.js";
|
|
7
7
|
export {
|
|
8
8
|
ASTRO_CONFIG_DEFAULTS,
|
|
9
9
|
AstroConfigRefinedSchema,
|
|
@@ -5,9 +5,9 @@ import { getContentPaths } from "../../content/index.js";
|
|
|
5
5
|
import createPreferences from "../../preferences/index.js";
|
|
6
6
|
import { markdownContentEntryType } from "../../vite-plugin-markdown/content-entry-type.js";
|
|
7
7
|
import { getDefaultClientDirectives } from "../client-directive/index.js";
|
|
8
|
+
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "./../constants.js";
|
|
8
9
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
9
10
|
import { formatYAMLException, isYAMLException } from "../errors/utils.js";
|
|
10
|
-
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "./../constants.js";
|
|
11
11
|
import { AstroTimer } from "./timer.js";
|
|
12
12
|
import { loadTSConfig } from "./tsconfig.js";
|
|
13
13
|
function createBaseSettings(config) {
|