astro 4.15.12 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro-jsx.d.ts +0 -1
- package/dist/@types/astro.d.ts +28 -1
- package/dist/actions/runtime/virtual/shared.d.ts +1 -1
- package/dist/cli/preferences/index.js +2 -2
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/node.js +18 -9
- package/dist/core/build/generate.js +31 -19
- package/dist/core/build/internal.d.ts +1 -1
- package/dist/core/build/internal.js +1 -1
- package/dist/core/build/pipeline.js +2 -2
- package/dist/core/config/schema.d.ts +40 -0
- package/dist/core/config/schema.js +7 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/index.d.ts +5 -1
- package/dist/core/middleware/index.js +3 -2
- package/dist/core/preview/vite-plugin-astro-preview.js +1 -1
- package/dist/core/render-context.js +1 -1
- package/dist/events/error.js +1 -1
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/i18n/utils.js +12 -1
- package/dist/i18n/vite-plugin-i18n.js +1 -1
- package/dist/vite-plugin-astro-server/response.js +4 -1
- package/package.json +2 -2
- package/templates/env/module.mjs +1 -2
package/astro-jsx.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
/* eslint @typescript-eslint/no-unused-vars: off */
|
|
3
2
|
/**
|
|
4
3
|
* Adapted from babel-plugin-react-html-attrs's TypeScript definition from DefinitelyTyped.
|
|
5
4
|
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/babel-plugin-react-html-attrs/index.d.ts
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -979,6 +979,33 @@ export interface AstroUserConfig {
|
|
|
979
979
|
* ```
|
|
980
980
|
*/
|
|
981
981
|
inlineStylesheets?: 'always' | 'auto' | 'never';
|
|
982
|
+
/**
|
|
983
|
+
* @docs
|
|
984
|
+
* @name build.concurrency
|
|
985
|
+
* @type { number }
|
|
986
|
+
* @default `1`
|
|
987
|
+
* @version 4.16.0
|
|
988
|
+
* @description
|
|
989
|
+
* The number of pages to build in parallel.
|
|
990
|
+
*
|
|
991
|
+
* **In most cases, you should not change the default value of `1`.**
|
|
992
|
+
*
|
|
993
|
+
* Use this option only when other attempts to reduce the overall rendering time (e.g. batch or cache long running tasks like fetch calls or data access) are not possible or are insufficient.
|
|
994
|
+
* If the number is set too high, page rendering may slow down due to insufficient memory resources and because JS is single-threaded.
|
|
995
|
+
*
|
|
996
|
+
* ```js
|
|
997
|
+
* {
|
|
998
|
+
* build: {
|
|
999
|
+
* concurrency: 2
|
|
1000
|
+
* }
|
|
1001
|
+
* }
|
|
1002
|
+
* ```
|
|
1003
|
+
*
|
|
1004
|
+
* :::caution[Breaking changes possible]
|
|
1005
|
+
* This feature is stable and is not considered experimental. However, this feature is only intended to address difficult performance issues, and breaking changes may occur in a [minor release](https://docs.astro.build/en/upgrade-astro/#semantic-versioning) to keep this option as performant as possible. Please check the [Astro CHANGELOG](https://github.com/withastro/astro/blob/refs/heads/next/packages/astro/CHANGELOG.md) for every minor release if you are using this feature.
|
|
1006
|
+
* :::
|
|
1007
|
+
*/
|
|
1008
|
+
concurrency?: number;
|
|
982
1009
|
};
|
|
983
1010
|
/**
|
|
984
1011
|
* @docs
|
|
@@ -1997,7 +2024,7 @@ export interface AstroUserConfig {
|
|
|
1997
2024
|
* }
|
|
1998
2025
|
* ```
|
|
1999
2026
|
*
|
|
2000
|
-
* To use this feature with the Astro VS Code extension, you must also enable the `astro.content-intellisense` option in your VS Code settings. For editors using the Astro language server directly, pass the `contentIntellisense: true` initialization parameter to enable this feature.
|
|
2027
|
+
* To use this feature with the Astro VS Code extension, you must also enable the `astro.content-intellisense` option in your VS Code settings. For editors using the Astro language server directly, pass the `contentIntellisense: true` initialization parameter to enable this feature. See the [content Intellisense implementation PR](https://github.com/withastro/language-tools/pull/915) for more details about this early feature.
|
|
2001
2028
|
*/
|
|
2002
2029
|
contentIntellisense?: boolean;
|
|
2003
2030
|
/**
|
|
@@ -8,7 +8,7 @@ export declare const ACTION_QUERY_PARAMS: {
|
|
|
8
8
|
};
|
|
9
9
|
export declare const ACTION_ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "TIMEOUT", "CONFLICT", "PRECONDITION_FAILED", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "UNPROCESSABLE_CONTENT", "TOO_MANY_REQUESTS", "CLIENT_CLOSED_REQUEST", "INTERNAL_SERVER_ERROR"];
|
|
10
10
|
export type ActionErrorCode = (typeof ACTION_ERROR_CODES)[number];
|
|
11
|
-
export declare class ActionError<
|
|
11
|
+
export declare class ActionError<_T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
|
|
12
12
|
type: string;
|
|
13
13
|
code: ActionErrorCode;
|
|
14
14
|
status: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
-
import { bgGreen, black, bold, dim, yellow } from "kleur/colors";
|
|
3
2
|
import { formatWithOptions } from "node:util";
|
|
4
3
|
import dlv from "dlv";
|
|
5
4
|
import { flattie } from "flattie";
|
|
5
|
+
import { bgGreen, black, bold, dim, yellow } from "kleur/colors";
|
|
6
6
|
import { resolveConfig } from "../../core/config/config.js";
|
|
7
7
|
import { createSettings } from "../../core/config/settings.js";
|
|
8
8
|
import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
|
|
@@ -257,7 +257,7 @@ function formatTable(object, columnLabels) {
|
|
|
257
257
|
const [colA, colB] = columnLabels;
|
|
258
258
|
const colALength = [colA, ...Object.keys(object)].reduce(longest, 0) + 3;
|
|
259
259
|
const colBLength = [colB, ...Object.values(object).map(annotatedFormat)].reduce(longest, 0) + 3;
|
|
260
|
-
function formatRow(
|
|
260
|
+
function formatRow(_i, a, b, style = (v) => v.toString()) {
|
|
261
261
|
return `${dim(chars.v)} ${style(a)} ${space(colALength - a.length - 2)} ${dim(
|
|
262
262
|
chars.v
|
|
263
263
|
)} ${formatAnnotated(b, style)} ${space(colBLength - annotatedFormat(b).length - 3)} ${dim(
|
|
@@ -121,7 +121,7 @@ class ContentLayer {
|
|
|
121
121
|
logger.info("Content config changed");
|
|
122
122
|
shouldClear = true;
|
|
123
123
|
}
|
|
124
|
-
if (previousAstroVersion !== "4.
|
|
124
|
+
if (previousAstroVersion !== "4.16.0") {
|
|
125
125
|
logger.info("Astro version changed");
|
|
126
126
|
shouldClear = true;
|
|
127
127
|
}
|
|
@@ -129,8 +129,8 @@ class ContentLayer {
|
|
|
129
129
|
logger.info("Clearing content store");
|
|
130
130
|
this.#store.clearAll();
|
|
131
131
|
}
|
|
132
|
-
if ("4.
|
|
133
|
-
await this.#store.metaStore().set("astro-version", "4.
|
|
132
|
+
if ("4.16.0") {
|
|
133
|
+
await this.#store.metaStore().set("astro-version", "4.16.0");
|
|
134
134
|
}
|
|
135
135
|
if (currentConfigDigest) {
|
|
136
136
|
await this.#store.metaStore().set("config-digest", currentConfigDigest);
|
package/dist/core/app/node.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { Http2ServerResponse } from "node:http2";
|
|
2
3
|
import { deserializeManifest } from "./common.js";
|
|
3
4
|
import { createOutgoingHttpHeaders } from "./createOutgoingHttpHeaders.js";
|
|
4
5
|
import { App } from "./index.js";
|
|
@@ -33,11 +34,18 @@ class NodeApp extends App {
|
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
35
36
|
static createRequest(req, { skipBody = false } = {}) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
37
|
+
const isEncrypted = "encrypted" in req.socket && req.socket.encrypted;
|
|
38
|
+
const getFirstForwardedValue = (multiValueHeader) => {
|
|
39
|
+
return multiValueHeader?.toString()?.split(",").map((e) => e.trim())?.[0];
|
|
40
|
+
};
|
|
41
|
+
const forwardedProtocol = getFirstForwardedValue(req.headers["x-forwarded-proto"]);
|
|
42
|
+
const protocol = forwardedProtocol ?? (isEncrypted ? "https" : "http");
|
|
43
|
+
const forwardedHostname = getFirstForwardedValue(req.headers["x-forwarded-host"]);
|
|
44
|
+
const hostname = forwardedHostname ?? req.headers.host ?? req.headers[":authority"];
|
|
45
|
+
const forwardedPort = getFirstForwardedValue(req.headers["x-forwarded-port"]);
|
|
46
|
+
const port = forwardedPort ?? req.socket?.remotePort?.toString() ?? (isEncrypted ? "443" : "80");
|
|
47
|
+
const portInHostname = typeof hostname === "string" && /:\d+$/.test(hostname);
|
|
48
|
+
const hostnamePort = portInHostname ? hostname : `${hostname}:${port}`;
|
|
41
49
|
const url = `${protocol}://${hostnamePort}${req.url}`;
|
|
42
50
|
const options = {
|
|
43
51
|
method: req.method || "GET",
|
|
@@ -48,11 +56,10 @@ class NodeApp extends App {
|
|
|
48
56
|
Object.assign(options, makeRequestBody(req));
|
|
49
57
|
}
|
|
50
58
|
const request = new Request(url, options);
|
|
51
|
-
const
|
|
59
|
+
const forwardedClientIp = getFirstForwardedValue(req.headers["x-forwarded-for"]);
|
|
60
|
+
const clientIp = forwardedClientIp || req.socket?.remoteAddress;
|
|
52
61
|
if (clientIp) {
|
|
53
62
|
Reflect.set(request, clientAddressSymbol, clientIp);
|
|
54
|
-
} else if (req.socket?.remoteAddress) {
|
|
55
|
-
Reflect.set(request, clientAddressSymbol, req.socket.remoteAddress);
|
|
56
63
|
}
|
|
57
64
|
return request;
|
|
58
65
|
}
|
|
@@ -73,7 +80,9 @@ class NodeApp extends App {
|
|
|
73
80
|
*/
|
|
74
81
|
static async writeResponse(source, destination) {
|
|
75
82
|
const { status, headers, body, statusText } = source;
|
|
76
|
-
destination
|
|
83
|
+
if (!(destination instanceof Http2ServerResponse)) {
|
|
84
|
+
destination.statusMessage = statusText;
|
|
85
|
+
}
|
|
77
86
|
destination.writeHead(status, createOutgoingHttpHeaders(headers));
|
|
78
87
|
if (!body) return destination.end();
|
|
79
88
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import { bgGreen, black, blue, bold, dim, green, magenta, red } from "kleur/colors";
|
|
4
|
+
import PLimit from "p-limit";
|
|
4
5
|
import PQueue from "p-queue";
|
|
5
6
|
import {
|
|
6
7
|
generateImagesForPath,
|
|
@@ -146,30 +147,41 @@ async function generatePage(pageData, ssrEntry, builtPaths, pipeline) {
|
|
|
146
147
|
styles,
|
|
147
148
|
mod: pageModule
|
|
148
149
|
};
|
|
150
|
+
async function generatePathWithLogs(path, route, index, paths, isConcurrent) {
|
|
151
|
+
const timeStart = performance.now();
|
|
152
|
+
pipeline.logger.debug("build", `Generating: ${path}`);
|
|
153
|
+
const filePath = getOutputFilename(config, path, pageData.route.type);
|
|
154
|
+
const lineIcon = index === paths.length - 1 && !isConcurrent || paths.length === 1 ? "\u2514\u2500" : "\u251C\u2500";
|
|
155
|
+
if (!isConcurrent) {
|
|
156
|
+
logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)}`, false);
|
|
157
|
+
}
|
|
158
|
+
await generatePath(path, pipeline, generationOptions, route);
|
|
159
|
+
const timeEnd = performance.now();
|
|
160
|
+
const isSlow = timeEnd - timeStart > THRESHOLD_SLOW_RENDER_TIME_MS;
|
|
161
|
+
const timeIncrease = (isSlow ? red : dim)(`(+${getTimeStat(timeStart, timeEnd)})`);
|
|
162
|
+
if (isConcurrent) {
|
|
163
|
+
logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)} ${timeIncrease}`);
|
|
164
|
+
} else {
|
|
165
|
+
logger.info("SKIP_FORMAT", ` ${timeIncrease}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
149
168
|
for (const route of eachRouteInRouteData(pageData)) {
|
|
150
169
|
const icon = route.type === "page" || route.type === "redirect" || route.type === "fallback" ? green("\u25B6") : magenta("\u03BB");
|
|
151
170
|
logger.info(null, `${icon} ${getPrettyRouteName(route)}`);
|
|
152
171
|
const paths = await getPathsForRoute(route, pageModule, pipeline, builtPaths);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
let timeIncreaseLabel;
|
|
166
|
-
if (timeEnd - prevTimeEnd > THRESHOLD_SLOW_RENDER_TIME_MS) {
|
|
167
|
-
timeIncreaseLabel = red(timeIncrease);
|
|
168
|
-
} else {
|
|
169
|
-
timeIncreaseLabel = dim(timeIncrease);
|
|
172
|
+
if (config.build.concurrency > 1) {
|
|
173
|
+
const limit = PLimit(config.build.concurrency);
|
|
174
|
+
const promises = [];
|
|
175
|
+
for (let i = 0; i < paths.length; i++) {
|
|
176
|
+
const path = paths[i];
|
|
177
|
+
promises.push(limit(() => generatePathWithLogs(path, route, i, paths, true)));
|
|
178
|
+
}
|
|
179
|
+
await Promise.allSettled(promises);
|
|
180
|
+
} else {
|
|
181
|
+
for (let i = 0; i < paths.length; i++) {
|
|
182
|
+
const path = paths[i];
|
|
183
|
+
await generatePathWithLogs(path, route, i, paths, false);
|
|
170
184
|
}
|
|
171
|
-
logger.info("SKIP_FORMAT", ` ${timeIncreaseLabel}`);
|
|
172
|
-
prevTimeEnd = timeEnd;
|
|
173
185
|
}
|
|
174
186
|
}
|
|
175
187
|
}
|
|
@@ -89,7 +89,7 @@ export interface BuildInternals {
|
|
|
89
89
|
* @returns {BuildInternals}
|
|
90
90
|
*/
|
|
91
91
|
export declare function createBuildInternals(): BuildInternals;
|
|
92
|
-
export declare function trackPageData(internals: BuildInternals,
|
|
92
|
+
export declare function trackPageData(internals: BuildInternals, _component: string, pageData: PageBuildData, componentModuleId: string, componentURL: URL): void;
|
|
93
93
|
/**
|
|
94
94
|
* Tracks client-only components to the pages they are associated with.
|
|
95
95
|
*/
|
|
@@ -27,7 +27,7 @@ function createBuildInternals() {
|
|
|
27
27
|
prerenderOnlyChunks: []
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function trackPageData(internals,
|
|
30
|
+
function trackPageData(internals, _component, pageData, componentModuleId, componentURL) {
|
|
31
31
|
pageData.moduleSpecifier = componentModuleId;
|
|
32
32
|
internals.pagesByKeys.set(pageData.key, pageData);
|
|
33
33
|
internals.pagesByViteID.set(viteID(componentURL), pageData);
|
|
@@ -246,7 +246,7 @@ class BuildPipeline extends Pipeline {
|
|
|
246
246
|
this.#componentsInterner.set(route, entry);
|
|
247
247
|
return entry;
|
|
248
248
|
}
|
|
249
|
-
async #getEntryForFallbackRoute(route,
|
|
249
|
+
async #getEntryForFallbackRoute(route, _internals, outFolder) {
|
|
250
250
|
if (route.type !== "fallback") {
|
|
251
251
|
throw new Error(`Expected a redirect route.`);
|
|
252
252
|
}
|
|
@@ -260,7 +260,7 @@ class BuildPipeline extends Pipeline {
|
|
|
260
260
|
}
|
|
261
261
|
return RedirectSinglePageBuiltModule;
|
|
262
262
|
}
|
|
263
|
-
async #getEntryForRedirectRoute(route,
|
|
263
|
+
async #getEntryForRedirectRoute(route, _internals, outFolder) {
|
|
264
264
|
if (route.type !== "redirect") {
|
|
265
265
|
throw new Error(`Expected a redirect route.`);
|
|
266
266
|
}
|
|
@@ -28,6 +28,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
28
28
|
serverEntry: string;
|
|
29
29
|
redirects: true;
|
|
30
30
|
inlineStylesheets: "auto";
|
|
31
|
+
concurrency: number;
|
|
31
32
|
};
|
|
32
33
|
image: {
|
|
33
34
|
service: {
|
|
@@ -123,6 +124,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
123
124
|
serverEntry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
124
125
|
redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
125
126
|
inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
|
|
127
|
+
concurrency: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
126
128
|
}, "strip", z.ZodTypeAny, {
|
|
127
129
|
format: "file" | "directory" | "preserve";
|
|
128
130
|
client: URL;
|
|
@@ -131,6 +133,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
131
133
|
serverEntry: string;
|
|
132
134
|
redirects: boolean;
|
|
133
135
|
inlineStylesheets: "always" | "never" | "auto";
|
|
136
|
+
concurrency: number;
|
|
134
137
|
assetsPrefix?: string | ({
|
|
135
138
|
fallback: string;
|
|
136
139
|
} & Record<string, string>) | undefined;
|
|
@@ -142,6 +145,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
142
145
|
serverEntry?: string | undefined;
|
|
143
146
|
redirects?: boolean | undefined;
|
|
144
147
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
148
|
+
concurrency?: number | undefined;
|
|
145
149
|
assetsPrefix?: string | ({
|
|
146
150
|
fallback: string;
|
|
147
151
|
} & Record<string, string>) | undefined;
|
|
@@ -254,6 +258,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
254
258
|
syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
|
|
255
259
|
shikiConfig: z.ZodDefault<z.ZodObject<{
|
|
256
260
|
langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
|
|
261
|
+
langAlias: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
257
262
|
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>;
|
|
258
263
|
themes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>>;
|
|
259
264
|
defaultColor: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"light">, z.ZodLiteral<"dark">, z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -261,6 +266,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
261
266
|
transformers: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiTransformer, z.ZodTypeDef, ShikiTransformer>, "many">, ShikiTransformer[], ShikiTransformer[]>>;
|
|
262
267
|
}, "strip", z.ZodTypeAny, {
|
|
263
268
|
langs: ShikiLang[];
|
|
269
|
+
langAlias: Record<string, string>;
|
|
264
270
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
265
271
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
266
272
|
wrap: boolean | null;
|
|
@@ -268,6 +274,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
268
274
|
defaultColor?: string | false | undefined;
|
|
269
275
|
}, {
|
|
270
276
|
langs?: ShikiLang[] | undefined;
|
|
277
|
+
langAlias?: Record<string, string> | undefined;
|
|
271
278
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
272
279
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
273
280
|
defaultColor?: string | false | undefined;
|
|
@@ -283,6 +290,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
283
290
|
syntaxHighlight: false | "shiki" | "prism";
|
|
284
291
|
shikiConfig: {
|
|
285
292
|
langs: ShikiLang[];
|
|
293
|
+
langAlias: Record<string, string>;
|
|
286
294
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
287
295
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
288
296
|
wrap: boolean | null;
|
|
@@ -298,6 +306,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
298
306
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
299
307
|
shikiConfig?: {
|
|
300
308
|
langs?: ShikiLang[] | undefined;
|
|
309
|
+
langAlias?: Record<string, string> | undefined;
|
|
301
310
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
302
311
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
303
312
|
defaultColor?: string | false | undefined;
|
|
@@ -775,6 +784,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
775
784
|
serverEntry: string;
|
|
776
785
|
redirects: boolean;
|
|
777
786
|
inlineStylesheets: "always" | "never" | "auto";
|
|
787
|
+
concurrency: number;
|
|
778
788
|
assetsPrefix?: string | ({
|
|
779
789
|
fallback: string;
|
|
780
790
|
} & Record<string, string>) | undefined;
|
|
@@ -786,6 +796,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
786
796
|
syntaxHighlight: false | "shiki" | "prism";
|
|
787
797
|
shikiConfig: {
|
|
788
798
|
langs: ShikiLang[];
|
|
799
|
+
langAlias: Record<string, string>;
|
|
789
800
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
790
801
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
791
802
|
wrap: boolean | null;
|
|
@@ -923,6 +934,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
923
934
|
serverEntry?: string | undefined;
|
|
924
935
|
redirects?: boolean | undefined;
|
|
925
936
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
937
|
+
concurrency?: number | undefined;
|
|
926
938
|
assetsPrefix?: string | ({
|
|
927
939
|
fallback: string;
|
|
928
940
|
} & Record<string, string>) | undefined;
|
|
@@ -938,6 +950,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
938
950
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
939
951
|
shikiConfig?: {
|
|
940
952
|
langs?: ShikiLang[] | undefined;
|
|
953
|
+
langAlias?: Record<string, string> | undefined;
|
|
941
954
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
942
955
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
943
956
|
defaultColor?: string | false | undefined;
|
|
@@ -1082,6 +1095,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1082
1095
|
serverEntry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
1083
1096
|
redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1084
1097
|
inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
|
|
1098
|
+
concurrency: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
1085
1099
|
}, "strip", z.ZodTypeAny, {
|
|
1086
1100
|
format: "file" | "directory" | "preserve";
|
|
1087
1101
|
client: URL;
|
|
@@ -1090,6 +1104,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1090
1104
|
serverEntry: string;
|
|
1091
1105
|
redirects: boolean;
|
|
1092
1106
|
inlineStylesheets: "always" | "never" | "auto";
|
|
1107
|
+
concurrency: number;
|
|
1093
1108
|
assetsPrefix?: string | ({
|
|
1094
1109
|
fallback: string;
|
|
1095
1110
|
} & Record<string, string>) | undefined;
|
|
@@ -1101,6 +1116,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1101
1116
|
serverEntry?: string | undefined;
|
|
1102
1117
|
redirects?: boolean | undefined;
|
|
1103
1118
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
1119
|
+
concurrency?: number | undefined;
|
|
1104
1120
|
assetsPrefix?: string | ({
|
|
1105
1121
|
fallback: string;
|
|
1106
1122
|
} & Record<string, string>) | undefined;
|
|
@@ -1213,6 +1229,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1213
1229
|
syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
|
|
1214
1230
|
shikiConfig: z.ZodDefault<z.ZodObject<{
|
|
1215
1231
|
langs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiLang, z.ZodTypeDef, ShikiLang>, "many">, ShikiLang[], ShikiLang[]>>;
|
|
1232
|
+
langAlias: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
1216
1233
|
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>;
|
|
1217
1234
|
themes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<[import("shiki").BundledTheme, ...import("shiki").BundledTheme[]]>, z.ZodType<ShikiTheme, z.ZodTypeDef, ShikiTheme>]>>>;
|
|
1218
1235
|
defaultColor: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"light">, z.ZodLiteral<"dark">, z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -1220,6 +1237,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1220
1237
|
transformers: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodType<ShikiTransformer, z.ZodTypeDef, ShikiTransformer>, "many">, ShikiTransformer[], ShikiTransformer[]>>;
|
|
1221
1238
|
}, "strip", z.ZodTypeAny, {
|
|
1222
1239
|
langs: ShikiLang[];
|
|
1240
|
+
langAlias: Record<string, string>;
|
|
1223
1241
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
1224
1242
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1225
1243
|
wrap: boolean | null;
|
|
@@ -1227,6 +1245,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1227
1245
|
defaultColor?: string | false | undefined;
|
|
1228
1246
|
}, {
|
|
1229
1247
|
langs?: ShikiLang[] | undefined;
|
|
1248
|
+
langAlias?: Record<string, string> | undefined;
|
|
1230
1249
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1231
1250
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1232
1251
|
defaultColor?: string | false | undefined;
|
|
@@ -1242,6 +1261,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1242
1261
|
syntaxHighlight: false | "shiki" | "prism";
|
|
1243
1262
|
shikiConfig: {
|
|
1244
1263
|
langs: ShikiLang[];
|
|
1264
|
+
langAlias: Record<string, string>;
|
|
1245
1265
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
1246
1266
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1247
1267
|
wrap: boolean | null;
|
|
@@ -1257,6 +1277,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1257
1277
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
1258
1278
|
shikiConfig?: {
|
|
1259
1279
|
langs?: ShikiLang[] | undefined;
|
|
1280
|
+
langAlias?: Record<string, string> | undefined;
|
|
1260
1281
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1261
1282
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1262
1283
|
defaultColor?: string | false | undefined;
|
|
@@ -1711,6 +1732,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1711
1732
|
serverEntry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
1712
1733
|
redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1713
1734
|
inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "auto", "never"]>>>;
|
|
1735
|
+
concurrency: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
1714
1736
|
}, "strip", z.ZodTypeAny, {
|
|
1715
1737
|
format: "file" | "directory" | "preserve";
|
|
1716
1738
|
client: import("url").URL;
|
|
@@ -1719,6 +1741,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1719
1741
|
serverEntry: string;
|
|
1720
1742
|
redirects: boolean;
|
|
1721
1743
|
inlineStylesheets: "always" | "never" | "auto";
|
|
1744
|
+
concurrency: number;
|
|
1722
1745
|
assetsPrefix?: string | ({
|
|
1723
1746
|
fallback: string;
|
|
1724
1747
|
} & Record<string, string>) | undefined;
|
|
@@ -1730,6 +1753,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1730
1753
|
serverEntry?: string | undefined;
|
|
1731
1754
|
redirects?: boolean | undefined;
|
|
1732
1755
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
1756
|
+
concurrency?: number | undefined;
|
|
1733
1757
|
assetsPrefix?: string | ({
|
|
1734
1758
|
fallback: string;
|
|
1735
1759
|
} & Record<string, string>) | undefined;
|
|
@@ -1809,6 +1833,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1809
1833
|
serverEntry: string;
|
|
1810
1834
|
redirects: boolean;
|
|
1811
1835
|
inlineStylesheets: "always" | "never" | "auto";
|
|
1836
|
+
concurrency: number;
|
|
1812
1837
|
assetsPrefix?: string | ({
|
|
1813
1838
|
fallback: string;
|
|
1814
1839
|
} & Record<string, string>) | undefined;
|
|
@@ -1820,6 +1845,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1820
1845
|
syntaxHighlight: false | "shiki" | "prism";
|
|
1821
1846
|
shikiConfig: {
|
|
1822
1847
|
langs: ShikiLang[];
|
|
1848
|
+
langAlias: Record<string, string>;
|
|
1823
1849
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
1824
1850
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
1825
1851
|
wrap: boolean | null;
|
|
@@ -1957,6 +1983,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1957
1983
|
serverEntry?: string | undefined;
|
|
1958
1984
|
redirects?: boolean | undefined;
|
|
1959
1985
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
1986
|
+
concurrency?: number | undefined;
|
|
1960
1987
|
assetsPrefix?: string | ({
|
|
1961
1988
|
fallback: string;
|
|
1962
1989
|
} & Record<string, string>) | undefined;
|
|
@@ -1972,6 +1999,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1972
1999
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
1973
2000
|
shikiConfig?: {
|
|
1974
2001
|
langs?: ShikiLang[] | undefined;
|
|
2002
|
+
langAlias?: Record<string, string> | undefined;
|
|
1975
2003
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
1976
2004
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
1977
2005
|
defaultColor?: string | false | undefined;
|
|
@@ -2104,6 +2132,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2104
2132
|
serverEntry: string;
|
|
2105
2133
|
redirects: boolean;
|
|
2106
2134
|
inlineStylesheets: "always" | "never" | "auto";
|
|
2135
|
+
concurrency: number;
|
|
2107
2136
|
assetsPrefix?: string | ({
|
|
2108
2137
|
fallback: string;
|
|
2109
2138
|
} & Record<string, string>) | undefined;
|
|
@@ -2115,6 +2144,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2115
2144
|
syntaxHighlight: false | "shiki" | "prism";
|
|
2116
2145
|
shikiConfig: {
|
|
2117
2146
|
langs: ShikiLang[];
|
|
2147
|
+
langAlias: Record<string, string>;
|
|
2118
2148
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
2119
2149
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2120
2150
|
wrap: boolean | null;
|
|
@@ -2252,6 +2282,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2252
2282
|
serverEntry?: string | undefined;
|
|
2253
2283
|
redirects?: boolean | undefined;
|
|
2254
2284
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
2285
|
+
concurrency?: number | undefined;
|
|
2255
2286
|
assetsPrefix?: string | ({
|
|
2256
2287
|
fallback: string;
|
|
2257
2288
|
} & Record<string, string>) | undefined;
|
|
@@ -2267,6 +2298,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2267
2298
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
2268
2299
|
shikiConfig?: {
|
|
2269
2300
|
langs?: ShikiLang[] | undefined;
|
|
2301
|
+
langAlias?: Record<string, string> | undefined;
|
|
2270
2302
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2271
2303
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2272
2304
|
defaultColor?: string | false | undefined;
|
|
@@ -2399,6 +2431,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2399
2431
|
serverEntry: string;
|
|
2400
2432
|
redirects: boolean;
|
|
2401
2433
|
inlineStylesheets: "always" | "never" | "auto";
|
|
2434
|
+
concurrency: number;
|
|
2402
2435
|
assetsPrefix?: string | ({
|
|
2403
2436
|
fallback: string;
|
|
2404
2437
|
} & Record<string, string>) | undefined;
|
|
@@ -2410,6 +2443,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2410
2443
|
syntaxHighlight: false | "shiki" | "prism";
|
|
2411
2444
|
shikiConfig: {
|
|
2412
2445
|
langs: ShikiLang[];
|
|
2446
|
+
langAlias: Record<string, string>;
|
|
2413
2447
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
2414
2448
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2415
2449
|
wrap: boolean | null;
|
|
@@ -2547,6 +2581,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2547
2581
|
serverEntry?: string | undefined;
|
|
2548
2582
|
redirects?: boolean | undefined;
|
|
2549
2583
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
2584
|
+
concurrency?: number | undefined;
|
|
2550
2585
|
assetsPrefix?: string | ({
|
|
2551
2586
|
fallback: string;
|
|
2552
2587
|
} & Record<string, string>) | undefined;
|
|
@@ -2562,6 +2597,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2562
2597
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
2563
2598
|
shikiConfig?: {
|
|
2564
2599
|
langs?: ShikiLang[] | undefined;
|
|
2600
|
+
langAlias?: Record<string, string> | undefined;
|
|
2565
2601
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2566
2602
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2567
2603
|
defaultColor?: string | false | undefined;
|
|
@@ -2694,6 +2730,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2694
2730
|
serverEntry: string;
|
|
2695
2731
|
redirects: boolean;
|
|
2696
2732
|
inlineStylesheets: "always" | "never" | "auto";
|
|
2733
|
+
concurrency: number;
|
|
2697
2734
|
assetsPrefix?: string | ({
|
|
2698
2735
|
fallback: string;
|
|
2699
2736
|
} & Record<string, string>) | undefined;
|
|
@@ -2705,6 +2742,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2705
2742
|
syntaxHighlight: false | "shiki" | "prism";
|
|
2706
2743
|
shikiConfig: {
|
|
2707
2744
|
langs: ShikiLang[];
|
|
2745
|
+
langAlias: Record<string, string>;
|
|
2708
2746
|
theme: import("shiki").BundledTheme | ShikiTheme;
|
|
2709
2747
|
themes: Record<string, import("shiki").BundledTheme | ShikiTheme>;
|
|
2710
2748
|
wrap: boolean | null;
|
|
@@ -2842,6 +2880,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2842
2880
|
serverEntry?: string | undefined;
|
|
2843
2881
|
redirects?: boolean | undefined;
|
|
2844
2882
|
inlineStylesheets?: "always" | "never" | "auto" | undefined;
|
|
2883
|
+
concurrency?: number | undefined;
|
|
2845
2884
|
assetsPrefix?: string | ({
|
|
2846
2885
|
fallback: string;
|
|
2847
2886
|
} & Record<string, string>) | undefined;
|
|
@@ -2857,6 +2896,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2857
2896
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
2858
2897
|
shikiConfig?: {
|
|
2859
2898
|
langs?: ShikiLang[] | undefined;
|
|
2899
|
+
langAlias?: Record<string, string> | undefined;
|
|
2860
2900
|
theme?: import("shiki").BundledTheme | ShikiTheme | undefined;
|
|
2861
2901
|
themes?: Record<string, import("shiki").BundledTheme | ShikiTheme> | undefined;
|
|
2862
2902
|
defaultColor?: string | false | undefined;
|
|
@@ -20,7 +20,8 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
20
20
|
assets: "_astro",
|
|
21
21
|
serverEntry: "entry.mjs",
|
|
22
22
|
redirects: true,
|
|
23
|
-
inlineStylesheets: "auto"
|
|
23
|
+
inlineStylesheets: "auto",
|
|
24
|
+
concurrency: 1
|
|
24
25
|
},
|
|
25
26
|
image: {
|
|
26
27
|
service: { entrypoint: "astro/assets/services/sharp", config: {} }
|
|
@@ -92,7 +93,8 @@ const AstroConfigSchema = z.object({
|
|
|
92
93
|
),
|
|
93
94
|
serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
|
|
94
95
|
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
|
|
95
|
-
inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets)
|
|
96
|
+
inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets),
|
|
97
|
+
concurrency: z.number().min(1).optional().default(ASTRO_CONFIG_DEFAULTS.build.concurrency)
|
|
96
98
|
}).default({}),
|
|
97
99
|
server: z.preprocess(
|
|
98
100
|
// preprocess
|
|
@@ -178,6 +180,7 @@ const AstroConfigSchema = z.object({
|
|
|
178
180
|
}
|
|
179
181
|
return langs;
|
|
180
182
|
}).default([]),
|
|
183
|
+
langAlias: z.record(z.string(), z.string()).optional().default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.langAlias),
|
|
181
184
|
theme: z.enum(Object.keys(bundledThemes)).or(z.custom()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.theme),
|
|
182
185
|
themes: z.record(
|
|
183
186
|
z.enum(Object.keys(bundledThemes)).or(z.custom())
|
|
@@ -371,7 +374,8 @@ function createRelativeSchema(cmd, fileProtocolRoot) {
|
|
|
371
374
|
),
|
|
372
375
|
serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
|
|
373
376
|
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
|
|
374
|
-
inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets)
|
|
377
|
+
inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets),
|
|
378
|
+
concurrency: z.number().min(1).optional().default(ASTRO_CONFIG_DEFAULTS.build.concurrency)
|
|
375
379
|
}).optional().default({}),
|
|
376
380
|
server: z.preprocess(
|
|
377
381
|
// preprocess
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "4.
|
|
25
|
+
const currentVersion = "4.16.0";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/dev/restart.js
CHANGED
|
@@ -20,7 +20,7 @@ async function createRestartedContainer(container, settings) {
|
|
|
20
20
|
await startContainer(newContainer);
|
|
21
21
|
return newContainer;
|
|
22
22
|
}
|
|
23
|
-
const configRE = /.*astro.config.(?:mjs|cjs|js|ts)$/;
|
|
23
|
+
const configRE = /.*astro.config.(?:mjs|mts|cjs|cts|js|ts)$/;
|
|
24
24
|
function shouldRestartContainer({ settings, inlineConfig, restartInFlight }, changedFile) {
|
|
25
25
|
if (restartInFlight) return false;
|
|
26
26
|
let shouldRestart = false;
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "4.
|
|
41
|
+
const version = "4.16.0";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -270,7 +270,7 @@ function printHelp({
|
|
|
270
270
|
message.push(
|
|
271
271
|
linebreak(),
|
|
272
272
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
273
|
-
`v${"4.
|
|
273
|
+
`v${"4.16.0"}`
|
|
274
274
|
)} ${headline}`
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -17,11 +17,15 @@ export type CreateContext = {
|
|
|
17
17
|
* A list of locales that are supported by the user
|
|
18
18
|
*/
|
|
19
19
|
userDefinedLocales?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* User defined default locale
|
|
22
|
+
*/
|
|
23
|
+
defaultLocale: string;
|
|
20
24
|
};
|
|
21
25
|
/**
|
|
22
26
|
* Creates a context to be passed to Astro middleware `onRequest` function.
|
|
23
27
|
*/
|
|
24
|
-
declare function createContext({ request, params, userDefinedLocales, }: CreateContext): APIContext;
|
|
28
|
+
declare function createContext({ request, params, userDefinedLocales, defaultLocale, }: CreateContext): APIContext;
|
|
25
29
|
/**
|
|
26
30
|
* It attempts to serialize `value` and return it as a string.
|
|
27
31
|
*
|
|
@@ -14,7 +14,8 @@ function defineMiddleware(fn) {
|
|
|
14
14
|
function createContext({
|
|
15
15
|
request,
|
|
16
16
|
params = {},
|
|
17
|
-
userDefinedLocales = []
|
|
17
|
+
userDefinedLocales = [],
|
|
18
|
+
defaultLocale = ""
|
|
18
19
|
}) {
|
|
19
20
|
let preferredLocale = void 0;
|
|
20
21
|
let preferredLocaleList = void 0;
|
|
@@ -47,7 +48,7 @@ function createContext({
|
|
|
47
48
|
return preferredLocaleList ??= computePreferredLocaleList(request, userDefinedLocales);
|
|
48
49
|
},
|
|
49
50
|
get currentLocale() {
|
|
50
|
-
return currentLocale ??= computeCurrentLocale(route, userDefinedLocales);
|
|
51
|
+
return currentLocale ??= computeCurrentLocale(route, userDefinedLocales, defaultLocale);
|
|
51
52
|
},
|
|
52
53
|
url,
|
|
53
54
|
get clientAddress() {
|
|
@@ -50,7 +50,7 @@ function vitePluginAstroPreview(settings) {
|
|
|
50
50
|
next();
|
|
51
51
|
});
|
|
52
52
|
return () => {
|
|
53
|
-
server.middlewares.use((req,
|
|
53
|
+
server.middlewares.use((req, _res, next) => {
|
|
54
54
|
const pathname = cleanUrl(req.url);
|
|
55
55
|
if (pathname.endsWith("/")) {
|
|
56
56
|
const pathnameWithoutSlash = pathname.slice(0, -1);
|
|
@@ -428,7 +428,7 @@ class RenderContext {
|
|
|
428
428
|
if (!i18n) return;
|
|
429
429
|
const { defaultLocale, locales, strategy } = i18n;
|
|
430
430
|
const fallbackTo = strategy === "pathname-prefix-other-locales" || strategy === "domains-prefix-other-locales" ? defaultLocale : void 0;
|
|
431
|
-
return this.#currentLocale ??= computeCurrentLocale(routeData.route, locales) ?? computeCurrentLocale(url.pathname, locales) ?? fallbackTo;
|
|
431
|
+
return this.#currentLocale ??= computeCurrentLocale(routeData.route, locales, defaultLocale) ?? computeCurrentLocale(url.pathname, locales, defaultLocale) ?? fallbackTo;
|
|
432
432
|
}
|
|
433
433
|
#preferredLocale;
|
|
434
434
|
computePreferredLocale() {
|
package/dist/events/error.js
CHANGED
|
@@ -49,7 +49,7 @@ function getSafeErrorMessage(message) {
|
|
|
49
49
|
const arrowIndex = func.indexOf("=>") + "=>".length;
|
|
50
50
|
return func.slice(arrowIndex).trim().slice(1, -1).replace(
|
|
51
51
|
/\$\{([^}]+)\}/g,
|
|
52
|
-
(
|
|
52
|
+
(_str, match1) => `${match1.split(/\.?(?=[A-Z])/).join("_").toUpperCase()}`
|
|
53
53
|
).replace(/\\`/g, "`");
|
|
54
54
|
}
|
|
55
55
|
}
|
package/dist/i18n/utils.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function parseLocale(header: string): BrowserLocale[];
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function computePreferredLocale(request: Request, locales: Locales): string | undefined;
|
|
22
22
|
export declare function computePreferredLocaleList(request: Request, locales: Locales): string[];
|
|
23
|
-
export declare function computeCurrentLocale(pathname: string, locales: Locales):
|
|
23
|
+
export declare function computeCurrentLocale(pathname: string, locales: Locales, defaultLocale: string): string | undefined;
|
|
24
24
|
export type RoutingStrategies = 'manual' | 'pathname-prefix-always' | 'pathname-prefix-other-locales' | 'pathname-prefix-always-no-redirect' | 'domains-prefix-always' | 'domains-prefix-other-locales' | 'domains-prefix-always-no-redirect';
|
|
25
25
|
export declare function toRoutingStrategy(routing: NonNullable<AstroConfig['i18n']>['routing'], domains: NonNullable<AstroConfig['i18n']>['domains']): RoutingStrategies;
|
|
26
26
|
export declare function toFallbackType(routing: NonNullable<AstroConfig['i18n']>['routing']): 'redirect' | 'rewrite';
|
package/dist/i18n/utils.js
CHANGED
|
@@ -105,7 +105,7 @@ function computePreferredLocaleList(request, locales) {
|
|
|
105
105
|
}
|
|
106
106
|
return result;
|
|
107
107
|
}
|
|
108
|
-
function computeCurrentLocale(pathname, locales) {
|
|
108
|
+
function computeCurrentLocale(pathname, locales, defaultLocale) {
|
|
109
109
|
for (const segment of pathname.split("/")) {
|
|
110
110
|
for (const locale of locales) {
|
|
111
111
|
if (typeof locale === "string") {
|
|
@@ -126,6 +126,17 @@ function computeCurrentLocale(pathname, locales) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
for (const locale of locales) {
|
|
130
|
+
if (typeof locale === "string") {
|
|
131
|
+
if (locale === defaultLocale) {
|
|
132
|
+
return locale;
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
if (locale.path === defaultLocale) {
|
|
136
|
+
return locale.codes.at(0);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
129
140
|
}
|
|
130
141
|
function toRoutingStrategy(routing, domains) {
|
|
131
142
|
let strategy;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Http2ServerResponse } from "node:http2";
|
|
1
2
|
import { Readable } from "node:stream";
|
|
2
3
|
import { getSetCookiesFromResponse } from "../core/cookies/index.js";
|
|
3
4
|
import { getViteErrorPayload } from "../core/errors/dev/index.js";
|
|
@@ -46,7 +47,9 @@ async function writeWebResponse(res, webResponse) {
|
|
|
46
47
|
if (headers.has("set-cookie")) {
|
|
47
48
|
_headers["set-cookie"] = headers.getSetCookie();
|
|
48
49
|
}
|
|
49
|
-
res
|
|
50
|
+
if (!(res instanceof Http2ServerResponse)) {
|
|
51
|
+
res.statusMessage = statusText;
|
|
52
|
+
}
|
|
50
53
|
res.writeHead(status, _headers);
|
|
51
54
|
if (body) {
|
|
52
55
|
if (Symbol.for("astro.responseBody") in webResponse) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.0",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"zod-to-json-schema": "^3.23.3",
|
|
171
171
|
"zod-to-ts": "^1.2.0",
|
|
172
172
|
"@astrojs/internal-helpers": "0.4.1",
|
|
173
|
-
"@astrojs/markdown-remark": "5.
|
|
173
|
+
"@astrojs/markdown-remark": "5.3.0",
|
|
174
174
|
"@astrojs/telemetry": "3.1.0"
|
|
175
175
|
},
|
|
176
176
|
"optionalDependencies": {
|
package/templates/env/module.mjs
CHANGED