astro 4.1.2 → 4.2.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/components/ViewTransitions.astro +6 -1
- package/dist/@types/astro.d.ts +127 -25
- package/dist/assets/internal.js +3 -2
- package/dist/assets/services/noop.js +1 -4
- package/dist/assets/types.d.ts +1 -1
- package/dist/assets/utils/emitAsset.js +1 -1
- package/dist/assets/utils/proxy.d.ts +2 -1
- package/dist/assets/utils/proxy.js +5 -1
- package/dist/assets/vite-plugin-assets.js +21 -14
- package/dist/content/runtime-assets.d.ts +1 -1
- package/dist/content/runtime-assets.js +1 -1
- package/dist/content/types-generator.js +0 -26
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +3 -10
- package/dist/content/vite-plugin-content-imports.js +1 -0
- package/dist/core/app/createOutgoingHttpHeaders.d.ts +9 -0
- package/dist/core/app/createOutgoingHttpHeaders.js +19 -0
- package/dist/core/app/index.d.ts +38 -1
- package/dist/core/app/index.js +38 -8
- package/dist/core/app/node.d.ts +42 -10
- package/dist/core/app/node.js +87 -46
- package/dist/core/app/types.d.ts +2 -1
- package/dist/core/config/schema.d.ts +146 -66
- package/dist/core/config/schema.js +24 -6
- package/dist/core/config/vite-load.js +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +3 -3
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/endpoint/index.d.ts +2 -1
- package/dist/core/errors/dev/vite.js +5 -11
- package/dist/core/errors/errors-data.d.ts +5 -0
- package/dist/core/errors/errors-data.js +7 -0
- package/dist/core/errors/overlay.js +2 -2
- package/dist/core/logger/vite.d.ts +0 -1
- package/dist/core/logger/vite.js +1 -2
- package/dist/core/messages.js +2 -2
- package/dist/core/render/context.d.ts +3 -2
- package/dist/core/render/context.js +1 -1
- package/dist/core/render/result.d.ts +2 -1
- package/dist/core/routing/manifest/create.d.ts +1 -1
- package/dist/core/routing/manifest/create.js +175 -117
- package/dist/core/sync/index.js +2 -2
- package/dist/i18n/index.d.ts +3 -2
- package/dist/i18n/index.js +4 -4
- package/dist/i18n/middleware.js +36 -19
- package/dist/prefetch/index.js +17 -1
- package/dist/prefetch/vite-plugin-prefetch.js +4 -1
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.js +2 -2
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.js +52 -4
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.js +3 -3
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.js +7 -7
- package/dist/runtime/client/dev-toolbar/apps/utils/highlight.d.ts +8 -0
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.js +4 -4
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.js +64 -68
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.d.ts +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.js +10 -5
- package/dist/runtime/client/dev-toolbar/toolbar.d.ts +45 -0
- package/dist/runtime/client/{dev-overlay/overlay.js → dev-toolbar/toolbar.js} +99 -103
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.js +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.js +3 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.js +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.js +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.js +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +8 -0
- package/dist/runtime/client/dev-toolbar/ui-library/index.js +18 -0
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.js +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.d.ts +3 -3
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.js +2 -2
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.d.ts +1 -1
- package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.js +3 -3
- package/dist/vite-plugin-astro/compile.js +0 -4
- package/dist/vite-plugin-astro/hmr.d.ts +3 -2
- package/dist/vite-plugin-astro/hmr.js +20 -41
- package/dist/vite-plugin-astro/index.js +36 -3
- package/dist/vite-plugin-astro/query.d.ts +0 -1
- package/dist/vite-plugin-astro/query.js +0 -5
- package/dist/vite-plugin-astro-server/route.js +3 -3
- package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.d.ts → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.d.ts} +1 -1
- package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.js → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js} +5 -5
- package/dist/vite-plugin-markdown/images.js +46 -19
- package/package.json +4 -3
- package/dist/runtime/client/dev-overlay/overlay.d.ts +0 -45
- package/dist/runtime/client/dev-overlay/plugins/utils/highlight.d.ts +0 -8
- package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +0 -8
- package/dist/runtime/client/dev-overlay/ui-library/index.js +0 -18
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/highlight.js +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.js +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.js +0 -0
- /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.d.ts +0 -0
- /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.js +0 -0
|
@@ -5,6 +5,7 @@ import { pathToFileURL } from "node:url";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } from "../path.js";
|
|
7
7
|
import "mdast-util-to-hast";
|
|
8
|
+
import "shikiji-core";
|
|
8
9
|
const ASTRO_CONFIG_DEFAULTS = {
|
|
9
10
|
root: ".",
|
|
10
11
|
srcDir: "./src",
|
|
@@ -41,7 +42,9 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
41
42
|
redirects: {},
|
|
42
43
|
experimental: {
|
|
43
44
|
optimizeHoistedScript: false,
|
|
44
|
-
contentCollectionCache: false
|
|
45
|
+
contentCollectionCache: false,
|
|
46
|
+
clientPrerender: false,
|
|
47
|
+
globalRoutePriority: false
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
50
|
const AstroConfigSchema = z.object({
|
|
@@ -161,7 +164,8 @@ const AstroConfigSchema = z.object({
|
|
|
161
164
|
experimentalThemes: z.record(
|
|
162
165
|
z.enum(Object.keys(bundledThemes)).or(z.custom())
|
|
163
166
|
).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.experimentalThemes),
|
|
164
|
-
wrap: z.boolean().or(z.null()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.wrap)
|
|
167
|
+
wrap: z.boolean().or(z.null()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.wrap),
|
|
168
|
+
transformers: z.custom().array().default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.transformers)
|
|
165
169
|
}).default({}),
|
|
166
170
|
remarkPlugins: z.union([
|
|
167
171
|
z.string(),
|
|
@@ -195,15 +199,27 @@ const AstroConfigSchema = z.object({
|
|
|
195
199
|
fallback: z.record(z.string(), z.string()).optional(),
|
|
196
200
|
routing: z.object({
|
|
197
201
|
prefixDefaultLocale: z.boolean().default(false),
|
|
202
|
+
redirectToDefaultLocale: z.boolean().default(true),
|
|
198
203
|
strategy: z.enum(["pathname"]).default("pathname")
|
|
199
|
-
}).default({}).
|
|
204
|
+
}).default({}).refine(
|
|
205
|
+
({ prefixDefaultLocale, redirectToDefaultLocale }) => {
|
|
206
|
+
return !(prefixDefaultLocale === false && redirectToDefaultLocale === false);
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
message: "The option `i18n.redirectToDefaultLocale` is only useful when the `i18n.prefixDefaultLocale` is set to `true`. Remove the option `i18n.redirectToDefaultLocale`, or change its value to `true`."
|
|
210
|
+
}
|
|
211
|
+
).transform((routing) => {
|
|
200
212
|
let strategy;
|
|
201
213
|
switch (routing.strategy) {
|
|
202
214
|
case "pathname": {
|
|
203
215
|
if (routing.prefixDefaultLocale === true) {
|
|
204
|
-
|
|
216
|
+
if (routing.redirectToDefaultLocale) {
|
|
217
|
+
strategy = "pathname-prefix-always";
|
|
218
|
+
} else {
|
|
219
|
+
strategy = "pathname-prefix-always-no-redirect";
|
|
220
|
+
}
|
|
205
221
|
} else {
|
|
206
|
-
strategy = "prefix-other-locales";
|
|
222
|
+
strategy = "pathname-prefix-other-locales";
|
|
207
223
|
}
|
|
208
224
|
}
|
|
209
225
|
}
|
|
@@ -252,7 +268,9 @@ const AstroConfigSchema = z.object({
|
|
|
252
268
|
),
|
|
253
269
|
experimental: z.object({
|
|
254
270
|
optimizeHoistedScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.optimizeHoistedScript),
|
|
255
|
-
contentCollectionCache: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionCache)
|
|
271
|
+
contentCollectionCache: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionCache),
|
|
272
|
+
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
273
|
+
globalRoutePriority: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.globalRoutePriority)
|
|
256
274
|
}).strict(
|
|
257
275
|
`Invalid or outdated experimental feature.
|
|
258
276
|
Check for incorrect spelling or outdated Astro version.
|
|
@@ -4,8 +4,8 @@ import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
|
|
|
4
4
|
import { debug } from "../logger/core.js";
|
|
5
5
|
async function createViteServer(root, fs) {
|
|
6
6
|
const viteServer = await createServer({
|
|
7
|
-
server: { middlewareMode: true, hmr: false, watch:
|
|
8
|
-
optimizeDeps: {
|
|
7
|
+
server: { middlewareMode: true, hmr: false, watch: null },
|
|
8
|
+
optimizeDeps: { noDiscovery: true },
|
|
9
9
|
clearScreen: false,
|
|
10
10
|
appType: "custom",
|
|
11
11
|
ssr: {
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -15,8 +15,9 @@ import astroPostprocessVitePlugin from "../vite-plugin-astro-postprocess/index.j
|
|
|
15
15
|
import { vitePluginAstroServer } from "../vite-plugin-astro-server/index.js";
|
|
16
16
|
import astroVitePlugin from "../vite-plugin-astro/index.js";
|
|
17
17
|
import configAliasVitePlugin from "../vite-plugin-config-alias/index.js";
|
|
18
|
-
import
|
|
18
|
+
import astroDevToolbar from "../vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js";
|
|
19
19
|
import envVitePlugin from "../vite-plugin-env/index.js";
|
|
20
|
+
import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
|
|
20
21
|
import astroHeadPlugin from "../vite-plugin-head/index.js";
|
|
21
22
|
import htmlVitePlugin from "../vite-plugin-html/index.js";
|
|
22
23
|
import { astroInjectEnvTsPlugin } from "../vite-plugin-inject-env-ts/index.js";
|
|
@@ -31,7 +32,6 @@ import { vitePluginSSRManifest } from "../vite-plugin-ssr-manifest/index.js";
|
|
|
31
32
|
import { createViteLogger } from "./logger/vite.js";
|
|
32
33
|
import { vitePluginMiddleware } from "./middleware/vite-plugin.js";
|
|
33
34
|
import { joinPaths } from "./path.js";
|
|
34
|
-
import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
|
|
35
35
|
const ALWAYS_NOEXTERNAL = [
|
|
36
36
|
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
|
|
37
37
|
"astro",
|
|
@@ -113,7 +113,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
113
113
|
astroAssetsPlugin({ settings, logger, mode }),
|
|
114
114
|
astroPrefetch({ settings }),
|
|
115
115
|
astroTransitions({ settings }),
|
|
116
|
-
|
|
116
|
+
astroDevToolbar({ settings, logger }),
|
|
117
117
|
vitePluginFileURL({}),
|
|
118
118
|
!!settings.config.i18n && astroInternationalization({ settings })
|
|
119
119
|
],
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.
|
|
26
|
+
const currentVersion = "4.2.0";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { APIContext, EndpointHandler, Locales, MiddlewareHandler, Params } from '../../@types/astro.js';
|
|
2
2
|
import { type Environment, type RenderContext } from '../render/index.js';
|
|
3
|
+
import type { RoutingStrategies } from '../config/schema.js';
|
|
3
4
|
type CreateAPIContext = {
|
|
4
5
|
request: Request;
|
|
5
6
|
params: Params;
|
|
@@ -7,7 +8,7 @@ type CreateAPIContext = {
|
|
|
7
8
|
props: Record<string, any>;
|
|
8
9
|
adapterName?: string;
|
|
9
10
|
locales: Locales | undefined;
|
|
10
|
-
routingStrategy:
|
|
11
|
+
routingStrategy: RoutingStrategies | undefined;
|
|
11
12
|
defaultLocale: string | undefined;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { replaceCssVariables } from "@astrojs/markdown-remark";
|
|
2
1
|
import * as fs from "node:fs";
|
|
3
2
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { codeToHtml } from "shikiji";
|
|
3
|
+
import { codeToHtml, createCssVariablesTheme } from "shikiji";
|
|
5
4
|
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from "../errors-data.js";
|
|
6
5
|
import { AstroError } from "../errors.js";
|
|
7
6
|
import { createSafeError } from "../utils.js";
|
|
@@ -70,7 +69,8 @@ function enhanceViteSSRError({
|
|
|
70
69
|
}
|
|
71
70
|
const ALTERNATIVE_JS_EXTS = ["cjs", "mjs"];
|
|
72
71
|
const ALTERNATIVE_MD_EXTS = ["mdoc"];
|
|
73
|
-
|
|
72
|
+
let _cssVariablesTheme;
|
|
73
|
+
const cssVariablesTheme = () => _cssVariablesTheme ?? (_cssVariablesTheme = createCssVariablesTheme({ variablePrefix: "--astro-code-" }));
|
|
74
74
|
async function getViteErrorPayload(err) {
|
|
75
75
|
let plugin = err.plugin;
|
|
76
76
|
if (!plugin && err.hint) {
|
|
@@ -86,18 +86,12 @@ async function getViteErrorPayload(err) {
|
|
|
86
86
|
if (ALTERNATIVE_MD_EXTS.includes(highlighterLang ?? "")) {
|
|
87
87
|
highlighterLang = "md";
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
const highlightedCode = err.fullCode ? await codeToHtml(err.fullCode, {
|
|
90
90
|
// @ts-expect-error always assume that shiki can accept the lang string
|
|
91
91
|
lang: highlighterLang,
|
|
92
|
-
theme:
|
|
92
|
+
theme: cssVariablesTheme(),
|
|
93
93
|
lineOptions: err.loc?.line ? [{ line: err.loc.line, classes: ["error-line"] }] : void 0
|
|
94
94
|
}) : void 0;
|
|
95
|
-
if (highlightedCode) {
|
|
96
|
-
highlightedCode = highlightedCode.replace(
|
|
97
|
-
INLINE_STYLE_SELECTOR_GLOBAL,
|
|
98
|
-
(m) => replaceCssVariables(m)
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
95
|
return {
|
|
102
96
|
type: "error",
|
|
103
97
|
err: {
|
|
@@ -893,6 +893,11 @@ export declare const MissingLocale: {
|
|
|
893
893
|
title: string;
|
|
894
894
|
message: (locale: string) => string;
|
|
895
895
|
};
|
|
896
|
+
export declare const MissingIndexForInternationalization: {
|
|
897
|
+
name: string;
|
|
898
|
+
title: string;
|
|
899
|
+
message: (src: string) => string;
|
|
900
|
+
};
|
|
896
901
|
/**
|
|
897
902
|
* @docs
|
|
898
903
|
* @description
|
|
@@ -313,6 +313,12 @@ const MissingLocale = {
|
|
|
313
313
|
title: "The provided locale does not exist.",
|
|
314
314
|
message: (locale) => `The locale/path \`${locale}\` does not exist in the configured \`i18n.locales\`.`
|
|
315
315
|
};
|
|
316
|
+
const MissingIndexForInternationalization = {
|
|
317
|
+
name: "MissingIndexForInternationalizationError",
|
|
318
|
+
title: "Index page not found.",
|
|
319
|
+
message: (src) => `Astro couldn't find the index URL. This index page is required to create a redirect from the index URL to the index URL of the default locale.
|
|
320
|
+
Create an index page in \`${src}\``
|
|
321
|
+
};
|
|
316
322
|
const CantRenderPage = {
|
|
317
323
|
name: "CantRenderPage",
|
|
318
324
|
title: "Astro can't render the route.",
|
|
@@ -502,6 +508,7 @@ export {
|
|
|
502
508
|
MiddlewareNoDataOrNextCalled,
|
|
503
509
|
MiddlewareNotAResponse,
|
|
504
510
|
MissingImageDimension,
|
|
511
|
+
MissingIndexForInternationalization,
|
|
505
512
|
MissingLocale,
|
|
506
513
|
MissingMediaQueryDirective,
|
|
507
514
|
MissingSharp,
|
|
@@ -68,7 +68,7 @@ const style = (
|
|
|
68
68
|
--toggle-border-color: #C3CADB;
|
|
69
69
|
|
|
70
70
|
/* Syntax Highlighting */
|
|
71
|
-
--astro-code-
|
|
71
|
+
--astro-code-foreground: #000000;
|
|
72
72
|
--astro-code-token-constant: #4ca48f;
|
|
73
73
|
--astro-code-token-string: #9f722a;
|
|
74
74
|
--astro-code-token-comment: #8490b5;
|
|
@@ -121,7 +121,7 @@ const style = (
|
|
|
121
121
|
--toggle-border-color: #3D4663;
|
|
122
122
|
|
|
123
123
|
/* Syntax Highlighting */
|
|
124
|
-
--astro-code-
|
|
124
|
+
--astro-code-foreground: #ffffff;
|
|
125
125
|
--astro-code-token-constant: #90f4e3;
|
|
126
126
|
--astro-code-token-string: #f4cf90;
|
|
127
127
|
--astro-code-token-comment: #8490b5;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Logger as ViteLogger, LogLevel } from 'vite';
|
|
2
2
|
import { type Logger as AstroLogger } from './core.js';
|
|
3
|
-
export declare function isAstroSrcFile(id: string | null): boolean | undefined;
|
|
4
3
|
export declare function createViteLogger(astroLogger: AstroLogger, viteLogLevel?: LogLevel): ViteLogger;
|
package/dist/core/logger/vite.js
CHANGED
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.
|
|
39
|
+
const version = "4.2.0";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -258,7 +258,7 @@ function printHelp({
|
|
|
258
258
|
message.push(
|
|
259
259
|
linebreak(),
|
|
260
260
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
261
|
-
`v${"4.
|
|
261
|
+
`v${"4.2.0"}`
|
|
262
262
|
)} ${headline}`
|
|
263
263
|
);
|
|
264
264
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentInstance, Locales, Params, Props, RouteData, SSRElement, SSRResult } from '../../@types/astro.js';
|
|
2
2
|
import type { Environment } from './environment.js';
|
|
3
|
+
import type { RoutingStrategies } from '../config/schema.js';
|
|
3
4
|
/**
|
|
4
5
|
* The RenderContext represents the parts of rendering that are specific to one request.
|
|
5
6
|
*/
|
|
@@ -17,7 +18,7 @@ export interface RenderContext {
|
|
|
17
18
|
locals?: object;
|
|
18
19
|
locales: Locales | undefined;
|
|
19
20
|
defaultLocale: string | undefined;
|
|
20
|
-
routing:
|
|
21
|
+
routing: RoutingStrategies | undefined;
|
|
21
22
|
}
|
|
22
23
|
export type CreateRenderContextArgs = Partial<Omit<RenderContext, 'params' | 'props' | 'locals'>> & {
|
|
23
24
|
route: RouteData;
|
|
@@ -47,5 +48,5 @@ export declare function parseLocale(header: string): BrowserLocale[];
|
|
|
47
48
|
*/
|
|
48
49
|
export declare function computePreferredLocale(request: Request, locales: Locales): string | undefined;
|
|
49
50
|
export declare function computePreferredLocaleList(request: Request, locales: Locales): string[];
|
|
50
|
-
export declare function computeCurrentLocale(request: Request, locales: Locales, routingStrategy:
|
|
51
|
+
export declare function computeCurrentLocale(request: Request, locales: Locales, routingStrategy: RoutingStrategies | undefined, defaultLocale: string | undefined): undefined | string;
|
|
51
52
|
export {};
|
|
@@ -162,7 +162,7 @@ function computeCurrentLocale(request, locales, routingStrategy, defaultLocale)
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
if (routingStrategy === "prefix-other-locales") {
|
|
165
|
+
if (routingStrategy === "pathname-prefix-other-locales") {
|
|
166
166
|
return defaultLocale;
|
|
167
167
|
}
|
|
168
168
|
return void 0;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Locales, Params, SSRElement, SSRLoadedRenderer, SSRResult } from '../../@types/astro.js';
|
|
2
2
|
import { AstroCookies } from '../cookies/index.js';
|
|
3
3
|
import type { Logger } from '../logger/core.js';
|
|
4
|
+
import type { RoutingStrategies } from '../config/schema.js';
|
|
4
5
|
export interface CreateResultArgs {
|
|
5
6
|
/**
|
|
6
7
|
* Used to provide better error messages for `Astro.clientAddress`
|
|
@@ -32,6 +33,6 @@ export interface CreateResultArgs {
|
|
|
32
33
|
cookies?: AstroCookies;
|
|
33
34
|
locales: Locales | undefined;
|
|
34
35
|
defaultLocale: string | undefined;
|
|
35
|
-
routingStrategy:
|
|
36
|
+
routingStrategy: RoutingStrategies | undefined;
|
|
36
37
|
}
|
|
37
38
|
export declare function createResult(args: CreateResultArgs): SSRResult;
|
|
@@ -11,4 +11,4 @@ export interface CreateRouteManifestParams {
|
|
|
11
11
|
fsMod?: typeof nodeFs;
|
|
12
12
|
}
|
|
13
13
|
/** Create manifest of all static routes */
|
|
14
|
-
export declare function createRouteManifest(
|
|
14
|
+
export declare function createRouteManifest(params: CreateRouteManifestParams, logger: Logger): ManifestData;
|