astro 7.0.0-alpha.0 → 7.0.0-alpha.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/Code.astro +1 -1
- package/dist/actions/handler.d.ts +32 -0
- package/dist/actions/handler.js +45 -0
- package/dist/actions/runtime/server.js +1 -1
- package/dist/assets/build/generate.js +1 -1
- package/dist/assets/build/remote.d.ts +3 -2
- package/dist/assets/build/remote.js +16 -9
- package/dist/assets/endpoint/dev.js +1 -1
- package/dist/assets/endpoint/generic.js +8 -20
- package/dist/assets/endpoint/loadImage.d.ts +11 -0
- package/dist/assets/endpoint/loadImage.js +19 -0
- package/dist/assets/endpoint/shared.js +7 -2
- package/dist/assets/fonts/config.d.ts +4 -4
- package/dist/assets/fonts/core/optimize-fallbacks.js +38 -13
- package/dist/assets/fonts/definitions.d.ts +2 -2
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +2 -2
- package/dist/assets/fonts/infra/system-fallbacks-provider.js +46 -9
- package/dist/assets/fonts/types.d.ts +1 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.js +2 -0
- package/dist/assets/internal.js +22 -3
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +9 -9
- package/dist/assets/services/sharp.js +53 -18
- package/dist/assets/utils/generateImageStylesCSS.js +26 -6
- package/dist/assets/utils/index.d.ts +1 -0
- package/dist/assets/utils/index.js +2 -0
- package/dist/assets/utils/inferSourceFormat.d.ts +8 -3
- package/dist/assets/utils/inferSourceFormat.js +15 -4
- package/dist/assets/utils/metadata.js +1 -1
- package/dist/assets/utils/redirectValidation.d.ts +48 -0
- package/dist/assets/utils/redirectValidation.js +48 -0
- package/dist/assets/utils/remoteProbe.js +25 -2
- package/dist/assets/utils/vendor/image-size/types/svg.js +1 -1
- package/dist/cli/add/index.js +7 -58
- package/dist/cli/dev/background.d.ts +16 -0
- package/dist/cli/dev/background.js +116 -0
- package/dist/cli/dev/index.js +82 -3
- package/dist/cli/dev/logs.d.ts +6 -0
- package/dist/cli/dev/logs.js +72 -0
- package/dist/cli/dev/status.d.ts +15 -0
- package/dist/cli/dev/status.js +27 -0
- package/dist/cli/dev/stop.d.ts +12 -0
- package/dist/cli/dev/stop.js +43 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.js +18 -14
- package/dist/content/content-layer.js +16 -11
- package/dist/content/data-store.d.ts +1 -1
- package/dist/content/loaders/types.d.ts +1 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/runtime.d.ts +1 -1
- package/dist/content/runtime.js +9 -4
- package/dist/content/server-listeners.js +0 -4
- package/dist/content/types-generator.js +5 -1
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +1 -1
- package/dist/content/vite-plugin-content-assets.js +1 -0
- package/dist/content/vite-plugin-content-virtual-mod.js +9 -1
- package/dist/core/app/base.d.ts +42 -15
- package/dist/core/app/base.js +151 -375
- package/dist/core/app/dev/app.d.ts +3 -2
- package/dist/core/app/dev/app.js +4 -60
- package/dist/core/app/entrypoints/node.d.ts +1 -1
- package/dist/core/app/entrypoints/node.js +2 -0
- package/dist/core/app/entrypoints/virtual/dev.js +2 -0
- package/dist/core/app/entrypoints/virtual/prod.js +4 -1
- package/dist/core/app/node.d.ts +16 -0
- package/dist/core/app/node.js +59 -13
- package/dist/core/app/prepare-response.d.ts +11 -0
- package/dist/core/app/prepare-response.js +18 -0
- package/dist/core/app/render-options.d.ts +11 -0
- package/dist/core/app/render-options.js +11 -0
- package/dist/core/base-pipeline.d.ts +48 -1
- package/dist/core/base-pipeline.js +63 -8
- package/dist/core/build/app.d.ts +3 -4
- package/dist/core/build/app.js +3 -17
- package/dist/core/build/generate.js +8 -1
- package/dist/core/build/index.d.ts +0 -11
- package/dist/core/build/index.js +0 -3
- package/dist/core/build/internal.d.ts +7 -0
- package/dist/core/build/plugins/plugin-chunk-imports.d.ts +6 -0
- package/dist/core/build/plugins/plugin-chunk-imports.js +29 -17
- package/dist/core/build/plugins/plugin-css.js +40 -1
- package/dist/core/build/plugins/plugin-internals.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.js +11 -1
- package/dist/core/build/static-build.js +22 -141
- package/dist/core/build/types.d.ts +0 -1
- package/dist/core/build/util.js +8 -1
- package/dist/core/build/vite-build-config.d.ts +28 -0
- package/dist/core/build/vite-build-config.js +165 -0
- package/dist/core/cache/handler.d.ts +29 -0
- package/dist/core/cache/handler.js +81 -0
- package/dist/core/compile/style.js +18 -1
- package/dist/core/config/index.d.ts +1 -1
- package/dist/core/config/index.js +4 -1
- package/dist/core/config/merge.js +4 -0
- package/dist/core/config/schemas/base.d.ts +25 -13
- package/dist/core/config/schemas/base.js +39 -10
- package/dist/core/config/schemas/relative.d.ts +76 -49
- package/dist/core/config/schemas/relative.js +2 -3
- package/dist/core/config/settings.js +2 -4
- package/dist/core/config/tsconfig.d.ts +24 -9
- package/dist/core/config/tsconfig.js +54 -45
- package/dist/core/config/validate.js +59 -0
- package/dist/core/constants.d.ts +27 -1
- package/dist/core/constants.js +14 -1
- package/dist/core/cookies/cookies.d.ts +7 -2
- package/dist/core/cookies/cookies.js +11 -4
- package/dist/core/cookies/response.d.ts +1 -1
- package/dist/core/cookies/response.js +1 -2
- package/dist/core/create-vite.js +18 -1
- package/dist/core/csp/config.js +17 -5
- package/dist/core/csp/runtime.js +6 -4
- package/dist/core/dev/dev.d.ts +1 -0
- package/dist/core/dev/dev.js +4 -13
- package/dist/core/dev/lockfile.d.ts +54 -0
- package/dist/core/dev/lockfile.js +93 -0
- package/dist/core/errors/build-handler.d.ts +17 -0
- package/dist/core/errors/build-handler.js +22 -0
- package/dist/core/errors/default-handler.d.ts +14 -0
- package/dist/core/errors/default-handler.js +144 -0
- package/dist/core/errors/dev-handler.d.ts +21 -0
- package/dist/core/errors/dev-handler.js +82 -0
- package/dist/core/errors/errors-data.d.ts +43 -38
- package/dist/core/errors/errors-data.js +79 -73
- package/dist/core/errors/handler.d.ts +9 -0
- package/dist/core/errors/handler.js +0 -0
- package/dist/core/errors/zod-error-map.js +30 -1
- package/dist/core/fetch/default-handler.d.ts +17 -0
- package/dist/core/fetch/default-handler.js +45 -0
- package/dist/core/fetch/fetch-state.d.ts +230 -0
- package/dist/core/fetch/fetch-state.js +896 -0
- package/dist/core/fetch/index.d.ts +61 -0
- package/dist/core/fetch/index.js +121 -0
- package/dist/core/fetch/types.d.ts +25 -0
- package/dist/core/fetch/types.js +0 -0
- package/dist/core/fetch/vite-plugin.d.ts +5 -0
- package/dist/core/fetch/vite-plugin.js +76 -0
- package/dist/core/hono/index.d.ts +21 -0
- package/dist/core/hono/index.js +101 -0
- package/dist/core/i18n/domain.d.ts +12 -0
- package/dist/core/i18n/domain.js +66 -0
- package/dist/core/i18n/handler.d.ts +18 -0
- package/dist/core/i18n/handler.js +122 -0
- package/dist/core/logger/core.d.ts +9 -1
- package/dist/core/logger/core.js +17 -1
- package/dist/core/messages/runtime.d.ts +0 -3
- package/dist/core/messages/runtime.js +1 -9
- package/dist/core/middleware/astro-middleware.d.ts +27 -0
- package/dist/core/middleware/astro-middleware.js +51 -0
- package/dist/core/module-loader/vite.js +1 -2
- package/dist/core/pages/handler.d.ts +20 -0
- package/dist/core/pages/handler.js +75 -0
- package/dist/core/preview/index.js +6 -5
- package/dist/core/preview/static-preview-server.js +5 -2
- package/dist/core/redirects/render.d.ts +2 -2
- package/dist/core/redirects/render.js +7 -8
- package/dist/core/render/params-and-props.js +2 -2
- package/dist/core/render/route-cache.d.ts +1 -0
- package/dist/core/render/route-cache.js +4 -4
- package/dist/core/render/slots.js +9 -2
- package/dist/core/rewrites/handler.d.ts +37 -0
- package/dist/core/rewrites/handler.js +67 -0
- package/dist/core/routing/3xx.js +8 -4
- package/dist/core/routing/create-manifest.js +11 -1
- package/dist/core/routing/handler.d.ts +17 -0
- package/dist/core/routing/handler.js +171 -0
- package/dist/core/routing/match.d.ts +0 -7
- package/dist/core/routing/match.js +0 -5
- package/dist/core/routing/parse-route.js +1 -1
- package/dist/core/routing/pattern.js +1 -1
- package/dist/core/routing/rewrite.js +2 -5
- package/dist/core/routing/router.d.ts +8 -0
- package/dist/core/routing/router.js +28 -0
- package/dist/core/routing/trailing-slash-handler.d.ts +18 -0
- package/dist/core/routing/trailing-slash-handler.js +67 -0
- package/dist/core/routing/validation.js +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +6 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +13 -3
- package/dist/core/session/config.d.ts +1 -1
- package/dist/core/session/drivers.d.ts +1 -1
- package/dist/core/session/handler.d.ts +11 -0
- package/dist/core/session/handler.js +33 -0
- package/dist/core/session/runtime.js +7 -2
- package/dist/core/util/normalized-url.d.ts +10 -0
- package/dist/core/util/normalized-url.js +24 -0
- package/dist/core/util/pathname.d.ts +10 -1
- package/dist/core/util/pathname.js +13 -4
- package/dist/environments.js +1 -1
- package/dist/events/session.d.ts +8 -0
- package/dist/events/session.js +11 -0
- package/dist/i18n/middleware.d.ts +10 -0
- package/dist/i18n/middleware.js +4 -88
- package/dist/i18n/utils.js +2 -2
- package/dist/jsx/rehype.d.ts +1 -1
- package/dist/manifest/virtual-module.js +3 -1
- package/dist/markdown/index.d.ts +4 -0
- package/dist/markdown/index.js +14 -0
- package/dist/prefetch/index.js +12 -7
- package/dist/prerender/utils.js +5 -1
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js +9 -0
- package/dist/runtime/server/astro-island.js +57 -20
- package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
- package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -1
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/common.js +10 -4
- package/dist/runtime/server/render/component.js +8 -6
- package/dist/runtime/server/render/head.js +1 -5
- package/dist/runtime/server/render/server-islands.js +2 -1
- package/dist/runtime/server/render/util.js +2 -2
- package/dist/runtime/server/scripts.js +6 -0
- package/dist/runtime/server/transition.d.ts +1 -6
- package/dist/runtime/server/transition.js +0 -8
- package/dist/transitions/events.d.ts +0 -14
- package/dist/transitions/events.js +0 -14
- package/dist/transitions/index.d.ts +0 -1
- package/dist/transitions/index.js +0 -2
- package/dist/transitions/vite-plugin-transitions.js +2 -4
- package/dist/types/public/config.d.ts +96 -14
- package/dist/types/public/content.d.ts +5 -5
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +11 -3
- package/dist/types/public/internal.d.ts +1 -1
- package/dist/types/public/manifest.d.ts +1 -1
- package/dist/virtual-modules/i18n.d.ts +2 -2
- package/dist/virtual-modules/i18n.js +1 -1
- package/dist/vite-plugin-app/app.d.ts +13 -6
- package/dist/vite-plugin-app/app.js +51 -89
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +3 -1
- package/dist/vite-plugin-app/createAstroServerApp.js +4 -3
- package/dist/vite-plugin-astro-server/plugin.js +11 -5
- package/dist/vite-plugin-astro-server/route-guard.d.ts +33 -0
- package/dist/vite-plugin-astro-server/route-guard.js +42 -23
- package/dist/vite-plugin-dev-status/index.d.ts +2 -0
- package/dist/vite-plugin-dev-status/index.js +15 -0
- package/dist/vite-plugin-head/index.js +36 -19
- package/dist/vite-plugin-hmr-reload/index.d.ts +1 -1
- package/dist/vite-plugin-hmr-reload/index.js +23 -1
- package/dist/vite-plugin-integrations-container/index.js +15 -6
- package/dist/vite-plugin-markdown/content-entry-type.js +7 -4
- package/dist/vite-plugin-markdown/images.js +9 -11
- package/dist/vite-plugin-markdown/index.js +12 -11
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +10 -1
- package/package.json +23 -16
- package/templates/content/types.d.ts +1 -0
- package/types/transitions.d.ts +0 -7
- package/dist/core/render-context.d.ts +0 -77
- package/dist/core/render-context.js +0 -826
|
@@ -100,7 +100,8 @@ class ServerIslandComponent {
|
|
|
100
100
|
}
|
|
101
101
|
const componentPath = this.getComponentPath();
|
|
102
102
|
const componentExport = this.getComponentExport();
|
|
103
|
-
|
|
103
|
+
const serverIslandNameMap = await this.result.getServerIslandNameMap();
|
|
104
|
+
let componentId = serverIslandNameMap.get(componentPath);
|
|
104
105
|
if (!componentId) {
|
|
105
106
|
throw new Error(`Could not find server component name ${componentPath}`);
|
|
106
107
|
}
|
|
@@ -10,7 +10,7 @@ const toIdent = (k) => k.trim().replace(/(?!^)\b\w|\s+|\W+/g, (match, index) =>
|
|
|
10
10
|
if (/\W/.test(match)) return "";
|
|
11
11
|
return index === 0 ? match : match.toUpperCase();
|
|
12
12
|
});
|
|
13
|
-
const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(AMPERSAND_REGEX, "
|
|
13
|
+
const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(AMPERSAND_REGEX, "&").replace(DOUBLE_QUOTE_REGEX, """) : value;
|
|
14
14
|
const kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
15
15
|
const toStyleString = (obj) => Object.entries(obj).filter(([_, v]) => typeof v === "string" && v.trim() || typeof v === "number").map(([k, v]) => {
|
|
16
16
|
if (k[0] !== "-" && k[1] !== "-") return `${kebab(k)}:${v}`;
|
|
@@ -149,7 +149,7 @@ class BufferedRenderer {
|
|
|
149
149
|
function createBufferedRenderer(destination, renderFunction) {
|
|
150
150
|
return new BufferedRenderer(destination, renderFunction);
|
|
151
151
|
}
|
|
152
|
-
const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]";
|
|
152
|
+
const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]" && !(typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers");
|
|
153
153
|
const isDeno = typeof Deno !== "undefined";
|
|
154
154
|
function promiseWithResolvers() {
|
|
155
155
|
let resolve, reject;
|
|
@@ -2,12 +2,18 @@ import islandScript from "./astro-island.prebuilt.js";
|
|
|
2
2
|
import islandScriptDev from "./astro-island.prebuilt-dev.js";
|
|
3
3
|
import { ISLAND_STYLES } from "./astro-island-styles.js";
|
|
4
4
|
function determineIfNeedsHydrationScript(result) {
|
|
5
|
+
if (result._metadata.templateDepth > 0) {
|
|
6
|
+
return !result._metadata.hasHydrationScript;
|
|
7
|
+
}
|
|
5
8
|
if (result._metadata.hasHydrationScript) {
|
|
6
9
|
return false;
|
|
7
10
|
}
|
|
8
11
|
return result._metadata.hasHydrationScript = true;
|
|
9
12
|
}
|
|
10
13
|
function determinesIfNeedsDirectiveScript(result, directive) {
|
|
14
|
+
if (result._metadata.templateDepth > 0) {
|
|
15
|
+
return !result._metadata.hasDirectives.has(directive);
|
|
16
|
+
}
|
|
11
17
|
if (result._metadata.hasDirectives.has(directive)) {
|
|
12
18
|
return false;
|
|
13
19
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { SSRResult } from '../../types/public/internal.js';
|
|
2
|
-
import type { TransitionAnimation,
|
|
2
|
+
import type { TransitionAnimation, TransitionAnimationValue } from '../../types/public/view-transitions.js';
|
|
3
3
|
export declare function createTransitionScope(result: SSRResult, hash: string): string;
|
|
4
4
|
export declare function reEncode(s: string): string;
|
|
5
5
|
export declare function renderTransition(result: SSRResult, hash: string, animationName: TransitionAnimationValue | undefined, transitionName: string): string;
|
|
6
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
7
|
-
export declare function createAnimationScope(transitionName: string, animations: Record<string, TransitionAnimationPair>): {
|
|
8
|
-
scope: string;
|
|
9
|
-
styles: string;
|
|
10
|
-
};
|
|
11
6
|
export declare class ViewTransitionStyleSheet {
|
|
12
7
|
private modern;
|
|
13
8
|
private fallback;
|
|
@@ -60,13 +60,6 @@ function renderTransition(result, hash, animationName, transitionName) {
|
|
|
60
60
|
result._metadata.extraHead.push(markHTMLString(`<style>${css}</style>`));
|
|
61
61
|
return scope;
|
|
62
62
|
}
|
|
63
|
-
function createAnimationScope(transitionName, animations) {
|
|
64
|
-
const hash = Math.random().toString(36).slice(2, 8);
|
|
65
|
-
const scope = `astro-${hash}`;
|
|
66
|
-
const sheet = new ViewTransitionStyleSheet(scope, transitionName);
|
|
67
|
-
addPairs(animations, sheet);
|
|
68
|
-
return { scope, styles: sheet.toString().replaceAll('"', "") };
|
|
69
|
-
}
|
|
70
63
|
class ViewTransitionStyleSheet {
|
|
71
64
|
modern = [];
|
|
72
65
|
fallback = [];
|
|
@@ -177,7 +170,6 @@ function toTimeValue(num) {
|
|
|
177
170
|
}
|
|
178
171
|
export {
|
|
179
172
|
ViewTransitionStyleSheet,
|
|
180
|
-
createAnimationScope,
|
|
181
173
|
createTransitionScope,
|
|
182
174
|
reEncode,
|
|
183
175
|
renderTransition,
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import type { Direction, NavigationTypeString } from './types.js';
|
|
2
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
3
|
-
export declare const TRANSITION_BEFORE_PREPARATION = "astro:before-preparation";
|
|
4
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
5
|
-
export declare const TRANSITION_AFTER_PREPARATION = "astro:after-preparation";
|
|
6
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
7
|
-
export declare const TRANSITION_BEFORE_SWAP = "astro:before-swap";
|
|
8
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
9
|
-
export declare const TRANSITION_AFTER_SWAP = "astro:after-swap";
|
|
10
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
11
|
-
export declare const TRANSITION_PAGE_LOAD = "astro:page-load";
|
|
12
2
|
type Events = 'astro:after-preparation' | 'astro:after-swap' | 'astro:page-load';
|
|
13
3
|
export declare const triggerEvent: (name: Events) => boolean;
|
|
14
4
|
export declare const onPageLoad: () => boolean;
|
|
@@ -23,15 +13,11 @@ declare class BeforeEvent extends Event {
|
|
|
23
13
|
readonly signal: AbortSignal;
|
|
24
14
|
constructor(type: string, eventInitDict: EventInit | undefined, from: URL, to: URL, direction: Direction | string, navigationType: NavigationTypeString, sourceElement: Element | undefined, info: any, newDocument: Document, signal: AbortSignal);
|
|
25
15
|
}
|
|
26
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
27
|
-
export declare const isTransitionBeforePreparationEvent: (value: any) => value is TransitionBeforePreparationEvent;
|
|
28
16
|
export declare class TransitionBeforePreparationEvent extends BeforeEvent {
|
|
29
17
|
formData: FormData | undefined;
|
|
30
18
|
loader: () => Promise<void>;
|
|
31
19
|
constructor(from: URL, to: URL, direction: Direction | string, navigationType: NavigationTypeString, sourceElement: Element | undefined, info: any, newDocument: Document, signal: AbortSignal, formData: FormData | undefined, loader: (event: TransitionBeforePreparationEvent) => Promise<void>);
|
|
32
20
|
}
|
|
33
|
-
/** @deprecated This will be removed in Astro 7 */
|
|
34
|
-
export declare const isTransitionBeforeSwapEvent: (value: any) => value is TransitionBeforeSwapEvent;
|
|
35
21
|
export declare class TransitionBeforeSwapEvent extends BeforeEvent {
|
|
36
22
|
readonly direction: Direction | string;
|
|
37
23
|
readonly viewTransition: ViewTransition;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { swap } from "./swap-functions.js";
|
|
2
|
-
const TRANSITION_BEFORE_PREPARATION = "astro:before-preparation";
|
|
3
|
-
const TRANSITION_AFTER_PREPARATION = "astro:after-preparation";
|
|
4
|
-
const TRANSITION_BEFORE_SWAP = "astro:before-swap";
|
|
5
|
-
const TRANSITION_AFTER_SWAP = "astro:after-swap";
|
|
6
|
-
const TRANSITION_PAGE_LOAD = "astro:page-load";
|
|
7
2
|
const triggerEvent = (name) => document.dispatchEvent(new Event(name));
|
|
8
3
|
const onPageLoad = () => triggerEvent("astro:page-load");
|
|
9
4
|
class BeforeEvent extends Event {
|
|
@@ -37,7 +32,6 @@ class BeforeEvent extends Event {
|
|
|
37
32
|
});
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
|
-
const isTransitionBeforePreparationEvent = (value) => value.type === TRANSITION_BEFORE_PREPARATION;
|
|
41
35
|
class TransitionBeforePreparationEvent extends BeforeEvent {
|
|
42
36
|
formData;
|
|
43
37
|
loader;
|
|
@@ -62,7 +56,6 @@ class TransitionBeforePreparationEvent extends BeforeEvent {
|
|
|
62
56
|
});
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
|
-
const isTransitionBeforeSwapEvent = (value) => value.type === "astro:before-swap";
|
|
66
59
|
class TransitionBeforeSwapEvent extends BeforeEvent {
|
|
67
60
|
direction;
|
|
68
61
|
viewTransition;
|
|
@@ -130,17 +123,10 @@ async function doSwap(afterPreparation, viewTransition, afterDispatch) {
|
|
|
130
123
|
return event;
|
|
131
124
|
}
|
|
132
125
|
export {
|
|
133
|
-
TRANSITION_AFTER_PREPARATION,
|
|
134
|
-
TRANSITION_AFTER_SWAP,
|
|
135
|
-
TRANSITION_BEFORE_PREPARATION,
|
|
136
|
-
TRANSITION_BEFORE_SWAP,
|
|
137
|
-
TRANSITION_PAGE_LOAD,
|
|
138
126
|
TransitionBeforePreparationEvent,
|
|
139
127
|
TransitionBeforeSwapEvent,
|
|
140
128
|
doPreparation,
|
|
141
129
|
doSwap,
|
|
142
|
-
isTransitionBeforePreparationEvent,
|
|
143
|
-
isTransitionBeforeSwapEvent,
|
|
144
130
|
onPageLoad,
|
|
145
131
|
triggerEvent,
|
|
146
132
|
updateScrollPosition
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TransitionDirectionalAnimations } from '../types/public/view-transitions.js';
|
|
2
|
-
export { createAnimationScope } from '../runtime/server/transition.js';
|
|
3
2
|
export declare function slide({ duration, }?: {
|
|
4
3
|
duration?: string | number;
|
|
5
4
|
}): TransitionDirectionalAnimations;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createAnimationScope } from "../runtime/server/transition.js";
|
|
2
1
|
const EASE_IN_OUT_QUART = "cubic-bezier(0.76, 0, 0.24, 1)";
|
|
3
2
|
function slide({
|
|
4
3
|
duration
|
|
@@ -64,7 +63,6 @@ function fade({
|
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
65
|
export {
|
|
67
|
-
createAnimationScope,
|
|
68
66
|
fade,
|
|
69
67
|
slide
|
|
70
68
|
};
|
|
@@ -37,10 +37,8 @@ function astroTransitions({ settings }) {
|
|
|
37
37
|
export { navigate, supportsViewTransitions, transitionEnabledOnThisPage } from "astro/virtual-modules/transitions-router.js";
|
|
38
38
|
export * from "astro/virtual-modules/transitions-types.js";
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
TRANSITION_BEFORE_SWAP, isTransitionBeforeSwapEvent, TransitionBeforeSwapEvent,
|
|
43
|
-
TRANSITION_AFTER_SWAP, TRANSITION_PAGE_LOAD
|
|
40
|
+
TransitionBeforePreparationEvent,
|
|
41
|
+
TransitionBeforeSwapEvent,
|
|
44
42
|
} from "astro/virtual-modules/transitions-events.js";
|
|
45
43
|
export { swapFunctions } from "astro/virtual-modules/transitions-swap-functions.js";
|
|
46
44
|
`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
2
|
import type { RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
3
|
-
import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig, Smartypants, SyntaxHighlightConfigType } from '@astrojs/markdown
|
|
3
|
+
import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig, Smartypants, SyntaxHighlightConfigType } from '@astrojs/internal-helpers/markdown';
|
|
4
|
+
import type { MarkdownProcessor } from '../../markdown/index.js';
|
|
4
5
|
import type { UserConfig as OriginalViteUserConfig, SSROptions as ViteSSROptions } from 'vite';
|
|
5
6
|
import type { FontFamily, FontProvider } from '../../assets/fonts/types.js';
|
|
6
7
|
import type { ImageFit, ImageLayout } from '../../assets/types.js';
|
|
@@ -426,7 +427,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
426
427
|
*
|
|
427
428
|
* By default, Astro removes whitespace from your HTML, including line breaks, in a lossless manner from `.astro` components. Some whitespace may be preserved as needed to maintain the visual rendering of your HTML.
|
|
428
429
|
*
|
|
429
|
-
*
|
|
430
|
+
* Since 6.2.0, this option can also be set to `"jsx"`, Astro will apply the JSX whitespace stripping rules used by frameworks like React. Leading and trailing whitespace is only preserved when explicitly included in the source code through constructs such as `{" "}`, and is otherwise removed entirely.
|
|
430
431
|
*
|
|
431
432
|
* Setting this option to false disables HTML compression and preserves all whitespace.
|
|
432
433
|
*
|
|
@@ -1328,23 +1329,25 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1328
1329
|
* @description
|
|
1329
1330
|
*
|
|
1330
1331
|
* Configures session storage for your Astro project. This is used to store session data in a persistent way, so that it can be accessed across different requests.
|
|
1331
|
-
* Some adapters may provide a default session driver, but you can override it with your own configuration.
|
|
1332
1332
|
*
|
|
1333
|
-
*
|
|
1333
|
+
* Some adapters may provide a default session driver, but you can override it with your own configuration:
|
|
1334
1334
|
*
|
|
1335
1335
|
* ```js title="astro.config.mjs"
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1340
|
-
*
|
|
1341
|
-
* options
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1344
|
-
* ttl: 3600, // 1 hour
|
|
1345
|
-
* }
|
|
1336
|
+
* import { defineConfig, sessionDrivers } from 'astro/config';
|
|
1337
|
+
*
|
|
1338
|
+
* export default defineConfig({
|
|
1339
|
+
* session: {
|
|
1340
|
+
* driver: sessionDrivers.redis({
|
|
1341
|
+
* // The options are driver-dependent and some may be required.
|
|
1342
|
+
* url: process.env.REDIS_URL
|
|
1343
|
+
* }),
|
|
1346
1344
|
* }
|
|
1345
|
+
* });
|
|
1347
1346
|
* ```
|
|
1347
|
+
*
|
|
1348
|
+
* Session drivers are configured at build time. This means environment variables used in the driver configuration are inlined. You must create your own driver entrypoint to [override the configuration at runtime](https://docs.astro.build/en/guides/sessions/#overriding-the-configuration-at-runtime).
|
|
1349
|
+
*
|
|
1350
|
+
* See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information.
|
|
1348
1351
|
*/
|
|
1349
1352
|
session?: SessionConfig<TDriver>;
|
|
1350
1353
|
/**
|
|
@@ -1708,6 +1711,19 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1708
1711
|
* This can be used for options such as `compressionLevel`, `effort`, `palette`, or a default `quality`.
|
|
1709
1712
|
* Per-image `quality` values from `<Image />`, `<Picture />`, and `getImage()` still take precedence.
|
|
1710
1713
|
*/
|
|
1714
|
+
/**
|
|
1715
|
+
* @docs
|
|
1716
|
+
* @name image.dangerouslyProcessSVG
|
|
1717
|
+
* @type {boolean}
|
|
1718
|
+
* @default `false`
|
|
1719
|
+
* @version 6.3.0
|
|
1720
|
+
* @description
|
|
1721
|
+
*
|
|
1722
|
+
* Allows SVG source images to be processed by the image optimization pipeline.
|
|
1723
|
+
*
|
|
1724
|
+
* This is disabled by default as specifically formed SVGs can be prohibitively expensive to process and used by malicious actors to execute denial of service attacks. Only enable this option if you trust the source of your SVG images and understand the risks of processing them.
|
|
1725
|
+
*/
|
|
1726
|
+
dangerouslyProcessSVG?: boolean;
|
|
1711
1727
|
/**
|
|
1712
1728
|
* @docs
|
|
1713
1729
|
* @name image.domains
|
|
@@ -1766,6 +1782,8 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1766
1782
|
* `pathname` patterns:
|
|
1767
1783
|
* - End with `/**` to allow all sub-routes (like `startsWith`).
|
|
1768
1784
|
* - End with `/*` to allow only one level of sub-route.
|
|
1785
|
+
*
|
|
1786
|
+
* HTTP redirects are also followed when an image URL matches a remote pattern. The final destination URL must be among the allowed remote patterns to be loaded.
|
|
1769
1787
|
|
|
1770
1788
|
*/
|
|
1771
1789
|
remotePatterns?: Partial<RemotePattern>[];
|
|
@@ -1963,6 +1981,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1963
1981
|
* @docs
|
|
1964
1982
|
* @name markdown.remarkPlugins
|
|
1965
1983
|
* @type {RemarkPlugins}
|
|
1984
|
+
* @deprecated Pass `remarkPlugins` to `unified({ remarkPlugins })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major.
|
|
1966
1985
|
* @description
|
|
1967
1986
|
* Pass [remark plugins](https://github.com/remarkjs/remark) to customize how your Markdown is built. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
|
1968
1987
|
*
|
|
@@ -1980,6 +1999,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1980
1999
|
* @docs
|
|
1981
2000
|
* @name markdown.rehypePlugins
|
|
1982
2001
|
* @type {RehypePlugins}
|
|
2002
|
+
* @deprecated Pass `rehypePlugins` to `unified({ rehypePlugins })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major.
|
|
1983
2003
|
* @description
|
|
1984
2004
|
* Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
|
1985
2005
|
*
|
|
@@ -1999,6 +2019,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1999
2019
|
* @type {boolean}
|
|
2000
2020
|
* @default `true`
|
|
2001
2021
|
* @version 2.0.0
|
|
2022
|
+
* @deprecated Pass `gfm` to your processor instead (e.g. `unified({ gfm: false })`). Will be removed in a future major.
|
|
2002
2023
|
* @description
|
|
2003
2024
|
* Astro uses [GitHub-flavored Markdown](https://github.com/remarkjs/remark-gfm) by default. To disable this, set the `gfm` flag to `false`:
|
|
2004
2025
|
*
|
|
@@ -2017,6 +2038,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2017
2038
|
* @type {boolean | Smartypants}
|
|
2018
2039
|
* @default `true`
|
|
2019
2040
|
* @version 2.0.0
|
|
2041
|
+
* @deprecated Pass `smartypants` to your processor instead (e.g. `unified({ smartypants: false })`). Will be removed in a future major.
|
|
2020
2042
|
* @description
|
|
2021
2043
|
* Whether to use the [SmartyPants formatter](https://daringfireball.net/projects/smartypants/) to transform straight quotes into smart quotes, dashes into en/em dashes, and triple dots into ellipses.
|
|
2022
2044
|
*
|
|
@@ -2029,6 +2051,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2029
2051
|
* @docs
|
|
2030
2052
|
* @name markdown.remarkRehype
|
|
2031
2053
|
* @type {RemarkRehype}
|
|
2054
|
+
* @deprecated Pass `remarkRehype` to `unified({ remarkRehype })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major.
|
|
2032
2055
|
* @description
|
|
2033
2056
|
* Pass options to [remark-rehype](https://github.com/remarkjs/remark-rehype#api).
|
|
2034
2057
|
*
|
|
@@ -2042,6 +2065,31 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2042
2065
|
* ```
|
|
2043
2066
|
*/
|
|
2044
2067
|
remarkRehype?: RemarkRehype;
|
|
2068
|
+
/**
|
|
2069
|
+
* @docs
|
|
2070
|
+
* @name markdown.processor
|
|
2071
|
+
* @type {MarkdownProcessor}
|
|
2072
|
+
* @version 6.4.0
|
|
2073
|
+
* @description
|
|
2074
|
+
* Configures the Markdown processor used to render `.md` files. Defaults to `unified()` from
|
|
2075
|
+
* `@astrojs/markdown-remark` (the remark/rehype pipeline).
|
|
2076
|
+
*
|
|
2077
|
+
* ```js
|
|
2078
|
+
* // astro.config.mjs
|
|
2079
|
+
* import { defineConfig } from 'astro/config';
|
|
2080
|
+
* import { unified } from '@astrojs/markdown-remark';
|
|
2081
|
+
* import remarkToc from 'remark-toc';
|
|
2082
|
+
*
|
|
2083
|
+
* export default defineConfig({
|
|
2084
|
+
* markdown: {
|
|
2085
|
+
* processor: unified({
|
|
2086
|
+
* remarkPlugins: [remarkToc],
|
|
2087
|
+
* }),
|
|
2088
|
+
* },
|
|
2089
|
+
* });
|
|
2090
|
+
* ```
|
|
2091
|
+
*/
|
|
2092
|
+
processor?: MarkdownProcessor;
|
|
2045
2093
|
};
|
|
2046
2094
|
/**
|
|
2047
2095
|
* @docs
|
|
@@ -2628,6 +2676,40 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2628
2676
|
* These flags are not guaranteed to be stable.
|
|
2629
2677
|
*/
|
|
2630
2678
|
experimental?: {
|
|
2679
|
+
/**
|
|
2680
|
+
* @name experimental.advancedRouting
|
|
2681
|
+
* @type {boolean | object}
|
|
2682
|
+
* @default `false`
|
|
2683
|
+
* @description
|
|
2684
|
+
* Enables `src/app.ts` as an advanced routing entrypoint, allowing you to
|
|
2685
|
+
* compose Astro's request pipeline with the Web Fetch standard or your own Hono middleware.
|
|
2686
|
+
*
|
|
2687
|
+
* Pass `true` to enable with default settings, or an object to customize:
|
|
2688
|
+
*
|
|
2689
|
+
* ```js
|
|
2690
|
+
* export default defineConfig({
|
|
2691
|
+
* experimental: {
|
|
2692
|
+
* advancedRouting: {
|
|
2693
|
+
* fetchFile: 'fetch.ts',
|
|
2694
|
+
* },
|
|
2695
|
+
* },
|
|
2696
|
+
* });
|
|
2697
|
+
* ```
|
|
2698
|
+
*/
|
|
2699
|
+
advancedRouting?: boolean | {
|
|
2700
|
+
/**
|
|
2701
|
+
* @name experimental.advancedRouting.fetchFile
|
|
2702
|
+
* @type {string | null}
|
|
2703
|
+
* @default 'app'
|
|
2704
|
+
* @description
|
|
2705
|
+
*
|
|
2706
|
+
* Customizes the file used as the advanced routing entrypoint inside `srcDir`.
|
|
2707
|
+
* Defaults to `'app'`, meaning Astro looks for `src/app.ts`.
|
|
2708
|
+
*
|
|
2709
|
+
* If you already have a `src/app.ts` file in use for other purposes, define a different filename or set the value to `null` to disable the entrypoint.
|
|
2710
|
+
*/
|
|
2711
|
+
fetchFile?: string | null;
|
|
2712
|
+
};
|
|
2631
2713
|
/**
|
|
2632
2714
|
*
|
|
2633
2715
|
* @name experimental.clientPrerender
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MarkdownHeading } from '@astrojs/markdown
|
|
1
|
+
import type { MarkdownHeading } from '@astrojs/internal-helpers/markdown';
|
|
2
2
|
import type { DataEntry, RenderedContent } from '../../content/data-store.js';
|
|
3
3
|
import type { LiveCollectionError } from '../../content/loaders/errors.js';
|
|
4
4
|
import type { AstroComponentFactory } from '../../runtime/server/index.js';
|
|
@@ -142,7 +142,7 @@ export interface CacheHint {
|
|
|
142
142
|
/** Last modified time of the content */
|
|
143
143
|
lastModified?: Date;
|
|
144
144
|
}
|
|
145
|
-
export interface LiveDataEntry<TData extends Record<string, any> = Record<string,
|
|
145
|
+
export interface LiveDataEntry<TData extends Record<string, any> = Record<string, any>> {
|
|
146
146
|
/** The ID of the entry. Unique per collection. */
|
|
147
147
|
id: string;
|
|
148
148
|
/** The parsed entry data */
|
|
@@ -154,17 +154,17 @@ export interface LiveDataEntry<TData extends Record<string, any> = Record<string
|
|
|
154
154
|
/** A hint for how to cache this entry */
|
|
155
155
|
cacheHint?: CacheHint;
|
|
156
156
|
}
|
|
157
|
-
export interface LiveDataCollection<TData extends Record<string, any> = Record<string,
|
|
157
|
+
export interface LiveDataCollection<TData extends Record<string, any> = Record<string, any>> {
|
|
158
158
|
entries: Array<LiveDataEntry<TData>>;
|
|
159
159
|
/** A hint for how to cache this collection. Individual entries can also have cache hints */
|
|
160
160
|
cacheHint?: CacheHint;
|
|
161
161
|
}
|
|
162
|
-
export interface LiveDataCollectionResult<TData extends Record<string, any> = Record<string,
|
|
162
|
+
export interface LiveDataCollectionResult<TData extends Record<string, any> = Record<string, any>, TError extends Error = Error> {
|
|
163
163
|
entries?: Array<LiveDataEntry<TData>>;
|
|
164
164
|
error?: TError | LiveCollectionError;
|
|
165
165
|
cacheHint?: CacheHint;
|
|
166
166
|
}
|
|
167
|
-
export interface LiveDataEntryResult<TData extends Record<string, any> = Record<string,
|
|
167
|
+
export interface LiveDataEntryResult<TData extends Record<string, any> = Record<string, any>, TError extends Error = Error> {
|
|
168
168
|
entry?: LiveDataEntry<TData>;
|
|
169
169
|
error?: TError | LiveCollectionError;
|
|
170
170
|
cacheHint?: CacheHint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
2
|
-
export type { MarkdownHeading, RehypePlugins, RemarkPlugins, ShikiConfig, } from '@astrojs/markdown
|
|
2
|
+
export type { MarkdownHeading, RehypePlugins, RemarkPlugins, ShikiConfig, } from '@astrojs/internal-helpers/markdown';
|
|
3
3
|
export type { ExternalImageService, ImageService, LocalImageService, } from '../../assets/services/service.js';
|
|
4
4
|
export type { AssetsGlobalStaticImagesList, GetImageResult, ImageInputFormat, ImageMetadata, ImageOutputFormat, ImageQuality, ImageQualityPreset, ImageTransform, UnresolvedImageTransform, } from '../../assets/types.js';
|
|
5
5
|
export type { ContainerRenderer } from '../../container/index.js';
|
|
@@ -9,6 +9,7 @@ export type { AstroIntegrationLogger } from '../../core/logger/core.js';
|
|
|
9
9
|
export type { AstroSession } from '../../core/session/runtime.js';
|
|
10
10
|
export type { ToolbarServerHelpers } from '../../runtime/client/dev-toolbar/helpers.js';
|
|
11
11
|
export type { AstroEnvironmentNames } from '../../core/constants.js';
|
|
12
|
+
export type { Fetchable } from '../../core/fetch/types.js';
|
|
12
13
|
export type { SessionDriver, SessionDriverConfig } from '../../core/session/types.js';
|
|
13
14
|
export type { CacheProvider, CacheProviderConfig, CacheProviderFactory, CacheOptions, InvalidateOptions, } from '../../core/cache/types.js';
|
|
14
15
|
export type * from './common.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AddressInfo } from 'node:net';
|
|
2
|
-
import type { ViteDevServer, InlineConfig
|
|
2
|
+
import type { ViteDevServer, InlineConfig } from 'vite';
|
|
3
3
|
import type { SerializedSSRManifest } from '../../core/app/types.js';
|
|
4
4
|
import type { AssetsGlobalStaticImagesList } from '../../assets/types.js';
|
|
5
5
|
import type { PageBuildData } from '../../core/build/types.js';
|
|
@@ -102,6 +102,14 @@ export interface AstroAdapterFeatures {
|
|
|
102
102
|
* of the build output type.
|
|
103
103
|
*/
|
|
104
104
|
preserveBuildClientDir?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* When true, static builds will preserve the server directory structure
|
|
107
|
+
* instead of outputting to outDir. This ensures static builds use
|
|
108
|
+
* build.server for server output, maintaining consistency with server builds.
|
|
109
|
+
* Useful for adapters that require a specific directory structure regardless
|
|
110
|
+
* of the build output type.
|
|
111
|
+
*/
|
|
112
|
+
preserveBuildServerDir?: boolean;
|
|
105
113
|
}
|
|
106
114
|
interface AdapterExplicitProperties {
|
|
107
115
|
/**
|
|
@@ -320,10 +328,10 @@ export interface BaseIntegrationHooks {
|
|
|
320
328
|
setPrerenderer: (prerenderer: AstroPrerenderer | ((defaultPrerenderer: AstroPrerenderer) => AstroPrerenderer)) => void;
|
|
321
329
|
}) => void | Promise<void>;
|
|
322
330
|
'astro:build:setup': (options: {
|
|
323
|
-
vite:
|
|
331
|
+
vite: InlineConfig;
|
|
324
332
|
pages: Map<string, PageBuildData>;
|
|
325
333
|
target: 'client' | 'server';
|
|
326
|
-
updateConfig: (newConfig:
|
|
334
|
+
updateConfig: (newConfig: InlineConfig) => void;
|
|
327
335
|
logger: AstroIntegrationLogger;
|
|
328
336
|
}) => void | Promise<void>;
|
|
329
337
|
'astro:build:generated': (options: {
|
|
@@ -207,7 +207,7 @@ export interface SSRResult {
|
|
|
207
207
|
*/
|
|
208
208
|
pathname: string;
|
|
209
209
|
cookies: AstroCookies | undefined;
|
|
210
|
-
|
|
210
|
+
getServerIslandNameMap: () => Promise<Map<string, string>>;
|
|
211
211
|
trailingSlash: AstroConfig['trailingSlash'];
|
|
212
212
|
key: Promise<CryptoKey>;
|
|
213
213
|
_metadata: SSRMetadata;
|
|
@@ -13,7 +13,7 @@ type Dirs = Pick<SSRManifest, 'cacheDir' | 'outDir' | 'publicDir' | 'srcDir'>;
|
|
|
13
13
|
type DeserializedDirs = Extend<Dirs, URL>;
|
|
14
14
|
export type ServerDeserializedManifest = Pick<SSRManifest, 'base' | 'trailingSlash' | 'compressHTML' | 'site'> & DeserializedDirs & {
|
|
15
15
|
i18n: AstroConfig['i18n'];
|
|
16
|
-
build: Pick<AstroConfig['build'], 'server' | 'client' | 'format'>;
|
|
16
|
+
build: Pick<AstroConfig['build'], 'server' | 'client' | 'format' | 'assetsPrefix'>;
|
|
17
17
|
root: URL;
|
|
18
18
|
image: Pick<AstroConfig['image'], 'objectFit' | 'objectPosition' | 'layout'>;
|
|
19
19
|
};
|
|
@@ -207,9 +207,9 @@ export type I18nMiddlewareOptions = {
|
|
|
207
207
|
/**
|
|
208
208
|
* @param {AstroConfig['i18n']['routing']} customOptions
|
|
209
209
|
*
|
|
210
|
-
* A function that allows to programmatically create the Astro i18n middleware.
|
|
210
|
+
* A function that allows you to programmatically create the Astro i18n middleware.
|
|
211
211
|
*
|
|
212
|
-
* This is
|
|
212
|
+
* This is useful when you still want to use the default i18n logic, but add only a few exceptions to your website.
|
|
213
213
|
*
|
|
214
214
|
* ## Examples
|
|
215
215
|
*
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type http from 'node:http';
|
|
2
|
-
import { BaseApp
|
|
2
|
+
import { BaseApp } from '../core/app/entrypoints/index.js';
|
|
3
|
+
import type { ErrorHandler } from '../core/errors/handler.js';
|
|
3
4
|
import type { AstroLogger } from '../core/logger/core.js';
|
|
4
5
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
5
|
-
import type { CreateRenderContext, RenderContext } from '../core/render-context.js';
|
|
6
6
|
import type { AstroSettings, RoutesList } from '../types/astro.js';
|
|
7
7
|
import type { RouteData, SSRManifest } from '../types/public/index.js';
|
|
8
8
|
import type { DevServerController } from '../vite-plugin-astro-server/controller.js';
|
|
9
9
|
import { RunnablePipeline } from './pipeline.js';
|
|
10
10
|
import type { DevMatch, LogRequestPayload } from '../core/app/base.js';
|
|
11
11
|
export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
12
|
+
#private;
|
|
12
13
|
settings: AstroSettings;
|
|
13
14
|
loader: ModuleLoader;
|
|
14
15
|
manifestData: RoutesList;
|
|
15
|
-
currentRenderContext: RenderContext | undefined;
|
|
16
16
|
constructor(manifest: SSRManifest, streaming: boolean | undefined, logger: AstroLogger, manifestData: RoutesList, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>);
|
|
17
17
|
isDev(): boolean;
|
|
18
18
|
/**
|
|
@@ -33,10 +33,15 @@ export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
|
33
33
|
devMatch(pathname: string): Promise<DevMatch | undefined>;
|
|
34
34
|
static create(manifest: SSRManifest, routesList: RoutesList, logger: AstroLogger, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>): Promise<AstroServerApp>;
|
|
35
35
|
createPipeline(_streaming: boolean, manifest: SSRManifest, settings: AstroSettings, logger: AstroLogger, loader: ModuleLoader, manifestData: RoutesList, getDebugInfo: () => Promise<string>): RunnablePipeline;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Handle a request.
|
|
38
|
+
* @returns The return value indicates whether or not the request was handled
|
|
39
|
+
* by this handler. If the result is not `true`, then the request has not
|
|
40
|
+
* been handled yet and other handlers can be run.
|
|
41
|
+
*/
|
|
42
|
+
handleRequest({ controller, incomingRequest, incomingResponse, isHttps, prerenderOnly, }: HandleRequest): Promise<boolean>;
|
|
38
43
|
match(request: Request, _allowPrerenderedRoutes: boolean): RouteData | undefined;
|
|
39
|
-
|
|
44
|
+
protected createErrorHandler(): ErrorHandler;
|
|
40
45
|
logRequest({ pathname, method, statusCode, isRewrite, reqTime }: LogRequestPayload): void;
|
|
41
46
|
}
|
|
42
47
|
type HandleRequest = {
|
|
@@ -44,5 +49,7 @@ type HandleRequest = {
|
|
|
44
49
|
incomingRequest: http.IncomingMessage;
|
|
45
50
|
incomingResponse: http.ServerResponse;
|
|
46
51
|
isHttps: boolean;
|
|
52
|
+
/** When true, only handle prerendered routes. Returns false for SSR routes. */
|
|
53
|
+
prerenderOnly?: boolean;
|
|
47
54
|
};
|
|
48
55
|
export {};
|