astro 4.4.5 → 4.4.7
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 +3 -3
- package/components/ViewTransitions.astro +5 -0
- package/dist/@types/astro.d.ts +10 -4
- package/dist/assets/build/generate.js +1 -1
- package/dist/assets/endpoint/generic.js +1 -1
- package/dist/assets/endpoint/node.js +39 -9
- package/dist/assets/utils/metadata.js +1 -1
- package/dist/assets/utils/transformToPath.js +1 -1
- package/dist/assets/vite-plugin-assets.js +2 -1
- package/dist/cli/add/index.js +4 -4
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/db/index.js +2 -2
- package/dist/cli/info/index.js +2 -2
- package/dist/cli/install-package.js +2 -2
- package/dist/cli/preferences/index.js +5 -5
- package/dist/content/server-listeners.js +1 -1
- package/dist/content/types-generator.js +2 -2
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +2 -2
- package/dist/content/vite-plugin-content-imports.js +1 -1
- package/dist/content/vite-plugin-content-virtual-mod.js +1 -1
- package/dist/core/app/common.d.ts +1 -1
- package/dist/core/app/index.js +10 -10
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/app/node.js +1 -1
- package/dist/core/app/types.d.ts +2 -2
- package/dist/core/base-pipeline.js +1 -1
- package/dist/core/build/generate.js +14 -13
- package/dist/core/build/index.js +2 -2
- package/dist/core/build/pipeline.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.js +3 -3
- package/dist/core/build/plugins/plugin-ssr.js +1 -1
- package/dist/core/build/plugins/util.d.ts +1 -1
- package/dist/core/build/static-build.js +3 -3
- package/dist/core/client-directive/build.js +1 -1
- package/dist/core/compile/compile.js +1 -1
- package/dist/core/config/config.js +1 -1
- package/dist/core/config/settings.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.d.ts +1 -1
- package/dist/core/dev/dev.js +3 -3
- package/dist/core/endpoint/index.d.ts +1 -1
- package/dist/core/endpoint/index.js +2 -2
- package/dist/core/errors/dev/utils.js +2 -2
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/logger/vite.d.ts +1 -1
- package/dist/core/logger/vite.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/index.js +4 -4
- package/dist/core/middleware/loadMiddleware.js +1 -1
- package/dist/core/preview/index.js +2 -2
- package/dist/core/render/result.d.ts +1 -1
- package/dist/core/render/result.js +5 -5
- package/dist/core/render/route-cache.d.ts +1 -0
- package/dist/core/render/route-cache.js +8 -4
- package/dist/core/render-context.js +11 -11
- package/dist/core/request.d.ts +10 -3
- package/dist/core/request.js +9 -6
- package/dist/core/routing/manifest/create.js +2 -2
- package/dist/core/sync/index.js +3 -3
- package/dist/i18n/middleware.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/jsx-runtime/index.js +1 -1
- package/dist/preferences/store.js +2 -2
- package/dist/runtime/server/index.js +1 -1
- package/dist/runtime/server/render/astro/render.js +1 -1
- package/dist/runtime/server/render/page.js +1 -1
- package/dist/runtime/server/scripts.js +1 -1
- package/dist/runtime/server/transition.js +2 -1
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.js +1 -1
- package/dist/vite-plugin-astro-server/pipeline.d.ts +1 -1
- package/dist/vite-plugin-astro-server/pipeline.js +6 -6
- package/dist/vite-plugin-astro-server/plugin.js +6 -6
- package/dist/vite-plugin-astro-server/request.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +10 -11
- package/dist/vite-plugin-env/index.js +1 -1
- package/dist/vite-plugin-inject-env-ts/index.js +1 -1
- package/dist/vite-plugin-markdown/index.js +5 -5
- package/dist/vite-plugin-scanner/index.js +1 -1
- package/dist/vite-plugin-utils/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as colors from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import * as colors from "kleur/colors";
|
|
5
5
|
import { ZodError } from "zod";
|
|
6
6
|
import { eventConfigError, telemetry } from "../../events/index.js";
|
|
7
7
|
import { trackAstroConfigZodError } from "../errors/errors.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import yaml from "js-yaml";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import yaml from "js-yaml";
|
|
4
4
|
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";
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import type * as vite from 'vite';
|
|
4
3
|
import type http from 'node:http';
|
|
5
4
|
import type { AddressInfo } from 'node:net';
|
|
5
|
+
import type * as vite from 'vite';
|
|
6
6
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
|
7
7
|
export interface DevServer {
|
|
8
8
|
address: AddressInfo;
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { green } from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
2
|
+
import { green } from "kleur/colors";
|
|
3
3
|
import { performance } from "perf_hooks";
|
|
4
4
|
import { attachContentServerListeners } from "../../content/index.js";
|
|
5
5
|
import { telemetry } from "../../events/index.js";
|
|
6
6
|
import * as msg from "../messages.js";
|
|
7
|
+
import { ensureProcessNodeEnv } from "../util.js";
|
|
7
8
|
import { startContainer } from "./container.js";
|
|
8
9
|
import { createContainerWithAutomaticRestart } from "./restart.js";
|
|
9
|
-
import { ensureProcessNodeEnv } from "../util.js";
|
|
10
10
|
async function dev(inlineConfig) {
|
|
11
11
|
ensureProcessNodeEnv("development");
|
|
12
12
|
const devStart = performance.now();
|
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.4.
|
|
26
|
+
const currentVersion = "4.4.7";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { APIContext, Locales, Params } from '../../@types/astro.js';
|
|
2
|
-
import type { AstroCookies } from '../cookies/index.js';
|
|
3
2
|
import { type RoutingStrategies } from '../../i18n/utils.js';
|
|
3
|
+
import type { AstroCookies } from '../cookies/index.js';
|
|
4
4
|
type CreateAPIContext = {
|
|
5
5
|
request: Request;
|
|
6
6
|
params: Params;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from "../constants.js";
|
|
2
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
3
1
|
import {
|
|
4
2
|
computeCurrentLocale,
|
|
5
3
|
computePreferredLocale,
|
|
6
4
|
computePreferredLocaleList
|
|
7
5
|
} from "../../i18n/utils.js";
|
|
6
|
+
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from "../constants.js";
|
|
7
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
8
8
|
function createAPIContext({
|
|
9
9
|
request,
|
|
10
10
|
params,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { escape } from "html-escaper";
|
|
2
|
-
import { bold, underline } from "kleur/colors";
|
|
3
1
|
import * as fs from "node:fs";
|
|
4
2
|
import { isAbsolute, join } from "node:path";
|
|
5
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { escape } from "html-escaper";
|
|
5
|
+
import { bold, underline } from "kleur/colors";
|
|
6
6
|
import stripAnsi from "strip-ansi";
|
|
7
7
|
import { normalizePath } from "vite";
|
|
8
8
|
import { removeLeadingForwardSlashWindows } from "../../path.js";
|
|
@@ -259,7 +259,7 @@ const LocalsNotAnObject = {
|
|
|
259
259
|
const MiddlewareCantBeLoaded = {
|
|
260
260
|
name: "MiddlewareCantBeLoaded",
|
|
261
261
|
title: "Can't load the middleware.",
|
|
262
|
-
message: "
|
|
262
|
+
message: "An unknown error was thrown while loading your middleware."
|
|
263
263
|
};
|
|
264
264
|
const LocalImageUsedWrongly = {
|
|
265
265
|
name: "LocalImageUsedWrongly",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Logger as ViteLogger
|
|
1
|
+
import type { LogLevel, Logger as ViteLogger } from 'vite';
|
|
2
2
|
import { type Logger as AstroLogger } from './core.js';
|
|
3
3
|
export declare function createViteLogger(astroLogger: AstroLogger, viteLogLevel?: LogLevel): ViteLogger;
|
package/dist/core/logger/vite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fileURLToPath } from "url";
|
|
2
2
|
import stripAnsi from "strip-ansi";
|
|
3
3
|
import { isAstroError } from "../errors/errors.js";
|
|
4
|
-
import { isLogLevelEnabled } from "./core.js";
|
|
5
4
|
import { serverShortcuts as formatServerShortcuts } from "../messages.js";
|
|
5
|
+
import { isLogLevelEnabled } from "./core.js";
|
|
6
6
|
const PKG_PREFIX = fileURLToPath(new URL("../../../", import.meta.url));
|
|
7
7
|
const E2E_PREFIX = fileURLToPath(new URL("../../../e2e", import.meta.url));
|
|
8
8
|
function isAstroSrcFile(id) {
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.4.
|
|
39
|
+
const version = "4.4.7";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -261,7 +261,7 @@ function printHelp({
|
|
|
261
261
|
message.push(
|
|
262
262
|
linebreak(),
|
|
263
263
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
264
|
-
`v${"4.4.
|
|
264
|
+
`v${"4.4.7"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AstroCookies } from "../cookies/index.js";
|
|
2
|
-
import { sequence } from "./sequence.js";
|
|
3
|
-
import { ASTRO_VERSION } from "../constants.js";
|
|
4
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
5
1
|
import {
|
|
6
2
|
computeCurrentLocale,
|
|
7
3
|
computePreferredLocale,
|
|
8
4
|
computePreferredLocaleList
|
|
9
5
|
} from "../../i18n/utils.js";
|
|
6
|
+
import { ASTRO_VERSION } from "../constants.js";
|
|
7
|
+
import { AstroCookies } from "../cookies/index.js";
|
|
8
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
9
|
+
import { sequence } from "./sequence.js";
|
|
10
10
|
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
11
11
|
const clientLocalsSymbol = Symbol.for("astro.locals");
|
|
12
12
|
function defineMiddleware(fn) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MIDDLEWARE_MODULE_ID } from "./vite-plugin.js";
|
|
2
1
|
import { MiddlewareCantBeLoaded } from "../errors/errors-data.js";
|
|
3
2
|
import { AstroError } from "../errors/index.js";
|
|
3
|
+
import { MIDDLEWARE_MODULE_ID } from "./vite-plugin.js";
|
|
4
4
|
async function loadMiddleware(moduleLoader) {
|
|
5
5
|
try {
|
|
6
6
|
return await moduleLoader.import(MIDDLEWARE_MODULE_ID);
|
|
@@ -8,10 +8,10 @@ import { runHookConfigDone, runHookConfigSetup } from "../../integrations/index.
|
|
|
8
8
|
import { resolveConfig } from "../config/config.js";
|
|
9
9
|
import { createNodeLogger } from "../config/logging.js";
|
|
10
10
|
import { createSettings } from "../config/settings.js";
|
|
11
|
+
import { apply as applyPolyfills } from "../polyfill.js";
|
|
12
|
+
import { ensureProcessNodeEnv } from "../util.js";
|
|
11
13
|
import createStaticPreviewServer from "./static-preview-server.js";
|
|
12
14
|
import { getResolvedHostForHttpServer } from "./util.js";
|
|
13
|
-
import { ensureProcessNodeEnv } from "../util.js";
|
|
14
|
-
import { apply as applyPolyfills } from "../polyfill.js";
|
|
15
15
|
async function preview(inlineConfig) {
|
|
16
16
|
applyPolyfills();
|
|
17
17
|
ensureProcessNodeEnv("production");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Locales, Params, SSRElement, SSRLoadedRenderer, SSRResult } from '../../@types/astro.js';
|
|
2
|
+
import { type RoutingStrategies } from '../../i18n/utils.js';
|
|
2
3
|
import { AstroCookies } from '../cookies/index.js';
|
|
3
4
|
import type { Logger } from '../logger/core.js';
|
|
4
|
-
import { type RoutingStrategies } from '../../i18n/utils.js';
|
|
5
5
|
export interface CreateResultArgs {
|
|
6
6
|
/**
|
|
7
7
|
* Used to provide better error messages for `Astro.clientAddress`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { renderSlotToString } from "../../runtime/server/index.js";
|
|
2
|
-
import { renderJSX } from "../../runtime/server/jsx.js";
|
|
3
|
-
import { chunkToString } from "../../runtime/server/render/index.js";
|
|
4
|
-
import { AstroCookies } from "../cookies/index.js";
|
|
5
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
6
1
|
import {
|
|
7
2
|
computeCurrentLocale,
|
|
8
3
|
computePreferredLocale,
|
|
9
4
|
computePreferredLocaleList
|
|
10
5
|
} from "../../i18n/utils.js";
|
|
6
|
+
import { renderSlotToString } from "../../runtime/server/index.js";
|
|
7
|
+
import { renderJSX } from "../../runtime/server/jsx.js";
|
|
8
|
+
import { chunkToString } from "../../runtime/server/render/index.js";
|
|
11
9
|
import { clientAddressSymbol, responseSentSymbol } from "../constants.js";
|
|
10
|
+
import { AstroCookies } from "../cookies/index.js";
|
|
11
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
12
12
|
function getFunctionExpression(slot) {
|
|
13
13
|
if (!slot)
|
|
14
14
|
return;
|
|
@@ -25,6 +25,7 @@ export declare class RouteCache {
|
|
|
25
25
|
clearAll(): void;
|
|
26
26
|
set(route: RouteData, entry: RouteCacheEntry): void;
|
|
27
27
|
get(route: RouteData): RouteCacheEntry | undefined;
|
|
28
|
+
key(route: RouteData): string;
|
|
28
29
|
}
|
|
29
30
|
export declare function findPathItemByKey(staticPaths: GetStaticPathsResultKeyed, params: Params, route: RouteData, logger: Logger): GetStaticPathsItem | undefined;
|
|
30
31
|
export {};
|
|
@@ -53,13 +53,17 @@ class RouteCache {
|
|
|
53
53
|
this.cache = {};
|
|
54
54
|
}
|
|
55
55
|
set(route, entry) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const key = this.key(route);
|
|
57
|
+
if (this.mode === "production" && this.cache[key]?.staticPaths) {
|
|
58
|
+
this.logger.warn(null, `Internal Warning: route cache overwritten. (${key})`);
|
|
58
59
|
}
|
|
59
|
-
this.cache[
|
|
60
|
+
this.cache[key] = entry;
|
|
60
61
|
}
|
|
61
62
|
get(route) {
|
|
62
|
-
return this.cache[route
|
|
63
|
+
return this.cache[this.key(route)];
|
|
64
|
+
}
|
|
65
|
+
key(route) {
|
|
66
|
+
return `${route.route}_${route.component}`;
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
function findPathItemByKey(staticPaths, params, route, logger) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeCurrentLocale,
|
|
3
|
+
computePreferredLocale,
|
|
4
|
+
computePreferredLocaleList
|
|
5
|
+
} from "../i18n/utils.js";
|
|
1
6
|
import { renderEndpoint } from "../runtime/server/endpoint.js";
|
|
2
|
-
import { attachCookiesToResponse } from "./cookies/index.js";
|
|
3
|
-
import { callMiddleware } from "./middleware/callMiddleware.js";
|
|
4
|
-
import { sequence } from "./middleware/index.js";
|
|
5
|
-
import { AstroCookies } from "./cookies/index.js";
|
|
6
|
-
import { createResult } from "./render/index.js";
|
|
7
7
|
import { renderPage } from "../runtime/server/index.js";
|
|
8
8
|
import {
|
|
9
9
|
ASTRO_VERSION,
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
clientAddressSymbol,
|
|
12
12
|
clientLocalsSymbol
|
|
13
13
|
} from "./constants.js";
|
|
14
|
-
import {
|
|
14
|
+
import { attachCookiesToResponse } from "./cookies/index.js";
|
|
15
|
+
import { AstroCookies } from "./cookies/index.js";
|
|
15
16
|
import { AstroError, AstroErrorData } from "./errors/index.js";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
computePreferredLocale,
|
|
19
|
-
computePreferredLocaleList
|
|
20
|
-
} from "../i18n/utils.js";
|
|
17
|
+
import { callMiddleware } from "./middleware/callMiddleware.js";
|
|
18
|
+
import { sequence } from "./middleware/index.js";
|
|
21
19
|
import { renderRedirect } from "./redirects/render.js";
|
|
20
|
+
import { createResult } from "./render/index.js";
|
|
21
|
+
import { getParams, getProps } from "./render/index.js";
|
|
22
22
|
class RenderContext {
|
|
23
23
|
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url)) {
|
|
24
24
|
this.pipeline = pipeline;
|
package/dist/core/request.d.ts
CHANGED
|
@@ -4,15 +4,22 @@ import type { Logger } from './logger/core.js';
|
|
|
4
4
|
type HeaderType = Headers | Record<string, any> | IncomingHttpHeaders;
|
|
5
5
|
type RequestBody = ArrayBuffer | Blob | ReadableStream | URLSearchParams | FormData;
|
|
6
6
|
export interface CreateRequestOptions {
|
|
7
|
+
base: string;
|
|
7
8
|
url: URL | string;
|
|
8
9
|
clientAddress?: string | undefined;
|
|
9
10
|
headers: HeaderType;
|
|
10
11
|
method?: string;
|
|
11
12
|
body?: RequestBody | undefined;
|
|
12
13
|
logger: Logger;
|
|
13
|
-
ssr: boolean;
|
|
14
14
|
locals?: object | undefined;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Whether the request is being created for a static build or for a prerendered page within a hybrid/SSR build, or for emulating one of those in dev mode.
|
|
17
|
+
*
|
|
18
|
+
* When `true`, the request will not include search parameters or body, and warn when headers are accessed.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
staticLike?: boolean;
|
|
16
23
|
}
|
|
17
|
-
export declare function createRequest({ url, headers, clientAddress, method, body, logger,
|
|
24
|
+
export declare function createRequest({ base, url, headers, clientAddress, method, body, logger, locals, staticLike, }: CreateRequestOptions): Request;
|
|
18
25
|
export {};
|
package/dist/core/request.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
import { appendForwardSlash, prependForwardSlash } from "./path.js";
|
|
1
2
|
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
2
3
|
const clientLocalsSymbol = Symbol.for("astro.locals");
|
|
3
4
|
function createRequest({
|
|
5
|
+
base,
|
|
4
6
|
url,
|
|
5
7
|
headers,
|
|
6
8
|
clientAddress,
|
|
7
9
|
method = "GET",
|
|
8
10
|
body = void 0,
|
|
9
11
|
logger,
|
|
10
|
-
ssr,
|
|
11
12
|
locals,
|
|
12
|
-
|
|
13
|
+
staticLike = false
|
|
13
14
|
}) {
|
|
14
|
-
|
|
15
|
+
const headersObj = staticLike ? void 0 : headers instanceof Headers ? headers : new Headers(Object.entries(headers));
|
|
15
16
|
if (typeof url === "string")
|
|
16
17
|
url = new URL(url);
|
|
17
|
-
|
|
18
|
+
const imageEndpoint = prependForwardSlash(appendForwardSlash(base)) + "_image";
|
|
19
|
+
if (staticLike && url.pathname !== imageEndpoint) {
|
|
18
20
|
url.search = "";
|
|
19
21
|
}
|
|
20
22
|
const request = new Request(url, {
|
|
21
23
|
method,
|
|
22
24
|
headers: headersObj,
|
|
23
|
-
body
|
|
25
|
+
// body is made available only if the request is for a page that will be on-demand rendered
|
|
26
|
+
body: staticLike ? null : body
|
|
24
27
|
});
|
|
25
|
-
if (
|
|
28
|
+
if (staticLike) {
|
|
26
29
|
const _headers = request.headers;
|
|
27
30
|
const headersDesc = Object.getOwnPropertyDescriptor(request, "headers") || {};
|
|
28
31
|
Object.defineProperty(request, "headers", {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { bold } from "kleur/colors";
|
|
2
1
|
import { createRequire } from "module";
|
|
3
2
|
import nodeFs from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { bold } from "kleur/colors";
|
|
6
|
+
import { toRoutingStrategy } from "../../../i18n/utils.js";
|
|
6
7
|
import { getPrerenderDefault } from "../../../prerender/utils.js";
|
|
7
8
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "../../constants.js";
|
|
8
9
|
import { MissingIndexForInternationalization } from "../../errors/errors-data.js";
|
|
@@ -10,7 +11,6 @@ import { AstroError } from "../../errors/index.js";
|
|
|
10
11
|
import { removeLeadingForwardSlash, slash } from "../../path.js";
|
|
11
12
|
import { resolvePages } from "../../util.js";
|
|
12
13
|
import { getRouteGenerator } from "./generator.js";
|
|
13
|
-
import { toRoutingStrategy } from "../../../i18n/utils.js";
|
|
14
14
|
const require2 = createRequire(import.meta.url);
|
|
15
15
|
function countOccurrences(needle, haystack) {
|
|
16
16
|
let count = 0;
|
package/dist/core/sync/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { dim } from "kleur/colors";
|
|
2
1
|
import fsMod from "node:fs";
|
|
3
2
|
import { performance } from "node:perf_hooks";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dim } from "kleur/colors";
|
|
5
5
|
import { createServer } from "vite";
|
|
6
6
|
import { createContentTypesGenerator } from "../../content/index.js";
|
|
7
7
|
import { globalContentConfigObserver } from "../../content/utils.js";
|
|
@@ -14,10 +14,10 @@ import { resolveConfig } from "../config/config.js";
|
|
|
14
14
|
import { createNodeLogger } from "../config/logging.js";
|
|
15
15
|
import { createSettings } from "../config/settings.js";
|
|
16
16
|
import { createVite } from "../create-vite.js";
|
|
17
|
+
import { collectErrorMetadata } from "../errors/dev/utils.js";
|
|
17
18
|
import { AstroError, AstroErrorData, createSafeError, isAstroError } from "../errors/index.js";
|
|
18
|
-
import { ensureProcessNodeEnv } from "../util.js";
|
|
19
19
|
import { formatErrorMessage } from "../messages.js";
|
|
20
|
-
import {
|
|
20
|
+
import { ensureProcessNodeEnv } from "../util.js";
|
|
21
21
|
async function sync(inlineConfig, options) {
|
|
22
22
|
ensureProcessNodeEnv("production");
|
|
23
23
|
const logger = createNodeLogger(inlineConfig);
|
package/dist/i18n/middleware.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { appendForwardSlash, joinPaths } from "@astrojs/internal-helpers/path";
|
|
2
|
-
import { getPathByLocale, normalizeTheLocale } from "./index.js";
|
|
3
2
|
import { shouldAppendForwardSlash } from "../core/build/util.js";
|
|
4
3
|
import { ROUTE_TYPE_HEADER } from "../core/constants.js";
|
|
4
|
+
import { getPathByLocale, normalizeTheLocale } from "./index.js";
|
|
5
5
|
function pathnameHasLocale(pathname, locales) {
|
|
6
6
|
const segments = pathname.split("/");
|
|
7
7
|
for (const segment of segments) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { bold } from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { bold } from "kleur/colors";
|
|
4
4
|
import { buildClientDirectiveEntrypoint } from "../core/client-directive/index.js";
|
|
5
5
|
import { mergeConfig } from "../core/config/index.js";
|
|
6
6
|
import { isServerLikeOutput } from "../prerender/utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment,
|
|
1
|
+
import { Fragment, Renderer, markHTMLString } from "../runtime/server/index.js";
|
|
2
2
|
const AstroJSX = "astro:jsx";
|
|
3
3
|
const Empty = Symbol("empty");
|
|
4
4
|
const toSlotName = (slotAttr) => slotAttr;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import dget from "dlv";
|
|
2
|
-
import { dset } from "dset";
|
|
3
1
|
import fs from "node:fs";
|
|
4
2
|
import path from "node:path";
|
|
3
|
+
import dget from "dlv";
|
|
4
|
+
import { dset } from "dset";
|
|
5
5
|
class PreferenceStore {
|
|
6
6
|
constructor(dir, filename = "settings.json") {
|
|
7
7
|
this.dir = dir;
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
} from "./render/index.js";
|
|
33
33
|
import { createTransitionScope, renderTransition } from "./transition.js";
|
|
34
34
|
import { markHTMLString as markHTMLString2 } from "./escape.js";
|
|
35
|
-
import {
|
|
35
|
+
import { Renderer as Renderer2, addAttribute as addAttribute2 } from "./render/index.js";
|
|
36
36
|
function mergeSlots(...slotted) {
|
|
37
37
|
const slots = {};
|
|
38
38
|
for (const slot of slotted) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AstroError, AstroErrorData } from "../../../../core/errors/index.js";
|
|
2
2
|
import { chunkToByteArray, chunkToString, encoder } from "../common.js";
|
|
3
|
+
import { promiseWithResolvers } from "../util.js";
|
|
3
4
|
import { isHeadAndContent } from "./head-and-content.js";
|
|
4
5
|
import { isRenderTemplateResult } from "./render-template.js";
|
|
5
|
-
import { promiseWithResolvers } from "../util.js";
|
|
6
6
|
const DOCTYPE_EXP = /<!doctype html/i;
|
|
7
7
|
async function renderToString(result, componentFactory, props, children, isPage = false, route) {
|
|
8
8
|
const templateResult = await callComponentAsTemplateResultOrResponse(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderComponentToString } from "./component.js";
|
|
2
2
|
import { isAstroComponentFactory } from "./astro/index.js";
|
|
3
|
-
import { renderToReadableStream, renderToString
|
|
3
|
+
import { renderToAsyncIterable, renderToReadableStream, renderToString } from "./astro/render.js";
|
|
4
4
|
import { encoder } from "./common.js";
|
|
5
5
|
import { isNode } from "./util.js";
|
|
6
6
|
async function renderPage(result, componentFactory, props, children, streaming, route) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import islandScript from "./astro-island.prebuilt.js";
|
|
2
1
|
import islandScriptDev from "./astro-island.prebuilt-dev.js";
|
|
2
|
+
import islandScript from "./astro-island.prebuilt.js";
|
|
3
3
|
const ISLAND_STYLES = `<style>astro-island,astro-slot,astro-static-slot{display:contents}</style>`;
|
|
4
4
|
function determineIfNeedsHydrationScript(result) {
|
|
5
5
|
if (result._metadata.hasHydrationScript) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import cssesc from "cssesc";
|
|
1
2
|
import { fade, slide } from "../../transitions/index.js";
|
|
2
3
|
import { markHTMLString } from "./escape.js";
|
|
3
|
-
import cssesc from "cssesc";
|
|
4
4
|
const transitionNameMap = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function incrementTransitionNumber(result) {
|
|
6
6
|
let num = 1;
|
|
@@ -58,6 +58,7 @@ function renderTransition(result, hash, animationName, transitionName) {
|
|
|
58
58
|
sheet.addFallback("old", "animation: none; mix-blend-mode: normal;");
|
|
59
59
|
sheet.addModern("old", "animation: none; opacity: 0; mix-blend-mode: normal;");
|
|
60
60
|
sheet.addAnimationRaw("new", "animation: none; mix-blend-mode: normal;");
|
|
61
|
+
sheet.addModern("group", "animation: none");
|
|
61
62
|
}
|
|
62
63
|
result._metadata.extraHead.push(markHTMLString(`<style>${sheet.toString()}</style>`));
|
|
63
64
|
return scope;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { bold } from "kleur/colors";
|
|
2
1
|
import * as fs from "node:fs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { appendForwardSlash } from "@astrojs/internal-helpers/path";
|
|
4
|
+
import { bold } from "kleur/colors";
|
|
5
5
|
import notFoundTemplate, { subpathNotUsedTemplate } from "../template/4xx.js";
|
|
6
6
|
import { writeHtmlResponse } from "./response.js";
|
|
7
7
|
function baseMiddleware(settings, logger) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
2
1
|
import type { AstroConfig } from '../@types/astro.js';
|
|
2
|
+
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
3
3
|
import type { DevPipeline } from './pipeline.js';
|
|
4
4
|
export declare function recordServerError(loader: ModuleLoader, config: AstroConfig, { logger }: DevPipeline, _err: unknown): {
|
|
5
5
|
error: Error;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectErrorMetadata } from "../core/errors/dev/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AstroErrorData, createSafeError } from "../core/errors/index.js";
|
|
3
3
|
import { formatErrorMessage } from "../core/messages.js";
|
|
4
4
|
import { eventError, telemetry } from "../events/index.js";
|
|
5
5
|
function recordServerError(loader, config, { logger }, _err) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AstroSettings, ComponentInstance, RouteData, SSRLoadedRenderer, SSRManifest } from '../@types/astro.js';
|
|
2
|
+
import type { HeadElements } from '../core/base-pipeline.js';
|
|
2
3
|
import type { Logger } from '../core/logger/core.js';
|
|
3
4
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
4
5
|
import { Pipeline } from '../core/render/index.js';
|
|
5
|
-
import type { HeadElements } from '../core/base-pipeline.js';
|
|
6
6
|
export declare class DevPipeline extends Pipeline {
|
|
7
7
|
readonly loader: ModuleLoader;
|
|
8
8
|
readonly logger: Logger;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import url from "node:url";
|
|
2
|
+
import { getInfoOutput } from "../cli/info/index.js";
|
|
3
|
+
import { ASTRO_VERSION } from "../core/constants.js";
|
|
4
|
+
import { enhanceViteSSRError } from "../core/errors/dev/index.js";
|
|
5
|
+
import { AggregateError, CSSError, MarkdownError } from "../core/errors/index.js";
|
|
2
6
|
import { Pipeline, loadRenderer } from "../core/render/index.js";
|
|
3
7
|
import { isPage, resolveIdToUrl, viteID } from "../core/util.js";
|
|
4
8
|
import { isServerLikeOutput } from "../prerender/utils.js";
|
|
5
|
-
import { createResolve } from "./resolve.js";
|
|
6
|
-
import { AggregateError, CSSError, MarkdownError } from "../core/errors/index.js";
|
|
7
|
-
import { enhanceViteSSRError } from "../core/errors/dev/index.js";
|
|
8
|
-
import { getScriptsForURL } from "./scripts.js";
|
|
9
|
-
import { ASTRO_VERSION } from "../core/constants.js";
|
|
10
|
-
import { getInfoOutput } from "../cli/info/index.js";
|
|
11
9
|
import { PAGE_SCRIPT_ID } from "../vite-plugin-scripts/index.js";
|
|
12
10
|
import { getStylesForURL } from "./css.js";
|
|
13
11
|
import { getComponentMetadata } from "./metadata.js";
|
|
12
|
+
import { createResolve } from "./resolve.js";
|
|
13
|
+
import { getScriptsForURL } from "./scripts.js";
|
|
14
14
|
class DevPipeline extends Pipeline {
|
|
15
15
|
constructor(loader, logger, manifest, settings, config = settings.config) {
|
|
16
16
|
const mode = "development";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { IncomingMessage } from "node:http";
|
|
3
|
+
import { getViteErrorPayload } from "../core/errors/dev/index.js";
|
|
4
|
+
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
1
5
|
import { patchOverlay } from "../core/errors/overlay.js";
|
|
2
6
|
import { createViteLoader } from "../core/module-loader/index.js";
|
|
3
7
|
import { createRouteManifest } from "../core/routing/index.js";
|
|
8
|
+
import { toRoutingStrategy } from "../i18n/utils.js";
|
|
4
9
|
import { baseMiddleware } from "./base.js";
|
|
5
10
|
import { createController } from "./controller.js";
|
|
11
|
+
import { recordServerError } from "./error.js";
|
|
6
12
|
import { DevPipeline } from "./pipeline.js";
|
|
7
13
|
import { handleRequest } from "./request.js";
|
|
8
|
-
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
9
|
-
import { getViteErrorPayload } from "../core/errors/dev/index.js";
|
|
10
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
11
|
-
import { IncomingMessage } from "node:http";
|
|
12
14
|
import { setRouteError } from "./server-state.js";
|
|
13
|
-
import { recordServerError } from "./error.js";
|
|
14
|
-
import { toRoutingStrategy } from "../i18n/utils.js";
|
|
15
15
|
function createVitePluginAstroServer({
|
|
16
16
|
settings,
|
|
17
17
|
logger,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { collapseDuplicateSlashes, removeTrailingForwardSlash } from "../core/path.js";
|
|
2
2
|
import { isServerLikeOutput } from "../prerender/utils.js";
|
|
3
3
|
import { runWithErrorHandling } from "./controller.js";
|
|
4
|
+
import { recordServerError } from "./error.js";
|
|
4
5
|
import { handle500Response } from "./response.js";
|
|
5
6
|
import { handleRoute, matchRoute } from "./route.js";
|
|
6
|
-
import { recordServerError } from "./error.js";
|
|
7
7
|
async function handleRequest({
|
|
8
8
|
pipeline,
|
|
9
9
|
manifestData,
|