astro 5.10.0 → 5.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Image.astro +1 -1
- package/components/Picture.astro +1 -1
- package/dist/actions/integration.js +2 -2
- package/dist/actions/runtime/virtual/server.d.ts +1 -1
- package/dist/actions/runtime/virtual/server.js +1 -1
- package/dist/actions/runtime/virtual/shared.d.ts +1 -1
- package/dist/actions/runtime/virtual/shared.js +1 -1
- package/dist/assets/endpoint/node.js +1 -1
- package/dist/assets/fonts/definitions.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +1 -1
- package/dist/assets/internal.js +2 -2
- package/dist/assets/utils/index.d.ts +4 -4
- package/dist/assets/utils/index.js +4 -4
- package/dist/assets/utils/remotePattern.d.ts +1 -1
- package/dist/config/entrypoint.d.ts +4 -4
- package/dist/config/entrypoint.js +3 -3
- package/dist/content/config.d.ts +1 -1
- package/dist/content/config.js +17 -2
- package/dist/content/content-layer.js +4 -4
- package/dist/content/loaders/file.js +1 -1
- package/dist/content/loaders/glob.js +1 -1
- package/dist/content/mutable-data-store.js +1 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/runtime.js +22 -6
- package/dist/content/utils.d.ts +5 -5
- package/dist/content/utils.js +2 -2
- package/dist/core/app/common.d.ts +1 -1
- package/dist/core/app/index.js +2 -2
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/build/generate.js +2 -3
- package/dist/core/build/index.js +3 -4
- package/dist/core/build/plugins/plugin-css.js +1 -1
- package/dist/core/compile/index.d.ts +1 -1
- package/dist/core/config/schemas/base.d.ts +1 -1
- package/dist/core/config/schemas/index.d.ts +2 -2
- package/dist/core/config/schemas/index.js +3 -3
- package/dist/core/config/settings.js +1 -1
- package/dist/core/config/tsconfig.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/index.d.ts +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/csp/common.js +2 -2
- package/dist/core/dev/container.d.ts +2 -2
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +18 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +1 -1
- package/dist/core/errors/index.d.ts +2 -2
- package/dist/core/errors/index.js +4 -4
- package/dist/core/logger/console.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/sequence.js +7 -2
- package/dist/core/module-loader/index.d.ts +1 -1
- package/dist/core/render-context.js +37 -9
- package/dist/core/routing/default.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +1 -1
- package/dist/core/routing/rewrite.d.ts +1 -1
- package/dist/core/routing/rewrite.js +14 -2
- package/dist/core/viteUtils.js +1 -1
- package/dist/env/runtime.d.ts +1 -1
- package/dist/env/runtime.js +1 -1
- package/dist/env/setup.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/jsx-runtime/index.js +1 -1
- package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/ui-library/index.js +1 -1
- package/dist/runtime/compiler/index.d.ts +1 -1
- package/dist/runtime/compiler/index.js +1 -1
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/runtime/server/index.js +4 -4
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/astro/index.d.ts +3 -3
- package/dist/runtime/server/render/astro/index.js +1 -1
- package/dist/runtime/server/render/astro/instance.d.ts +2 -2
- package/dist/runtime/server/render/component.js +8 -6
- package/dist/runtime/server/render/index.d.ts +4 -4
- package/dist/runtime/server/render/index.js +2 -2
- package/dist/runtime/server/render/slot.d.ts +2 -2
- package/dist/runtime/server/render/slot.js +1 -1
- package/dist/runtime/server/render/util.d.ts +3 -3
- package/dist/runtime/server/render/util.js +17 -8
- package/dist/runtime/server/scripts.js +2 -2
- package/dist/template/4xx.js +1 -1
- package/dist/transitions/router.js +1 -1
- package/dist/types/public/config.d.ts +16 -15
- package/dist/types/public/content.d.ts +2 -0
- package/dist/types/public/context.d.ts +7 -7
- package/dist/types/public/index.d.ts +15 -15
- package/dist/types/public/internal.d.ts +1 -1
- package/dist/virtual-modules/i18n.d.ts +1 -1
- package/dist/vite-plugin-astro-server/base.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +1 -1
- package/dist/vite-plugin-astro-server/pipeline.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +3 -3
- package/dist/vite-plugin-head/index.d.ts +1 -1
- package/dist/vite-plugin-html/transform/slots.d.ts +1 -1
- package/package.json +3 -3
package/dist/core/constants.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
export type { AstroCookieGetOptions, AstroCookieSetOptions } from './cookies.js';
|
|
1
2
|
export { AstroCookies } from './cookies.js';
|
|
2
3
|
export { attachCookiesToResponse, getSetCookiesFromResponse, } from './response.js';
|
|
3
|
-
export type { AstroCookieSetOptions, AstroCookieGetOptions } from './cookies.js';
|
package/dist/core/create-vite.js
CHANGED
|
@@ -20,9 +20,9 @@ import astroVirtualManifestPlugin from "../manifest/virtual-module.js";
|
|
|
20
20
|
import astroPrefetch from "../prefetch/vite-plugin-prefetch.js";
|
|
21
21
|
import astroDevToolbar from "../toolbar/vite-plugin-dev-toolbar.js";
|
|
22
22
|
import astroTransitions from "../transitions/vite-plugin-transitions.js";
|
|
23
|
+
import astroVitePlugin from "../vite-plugin-astro/index.js";
|
|
23
24
|
import astroPostprocessVitePlugin from "../vite-plugin-astro-postprocess/index.js";
|
|
24
25
|
import { vitePluginAstroServer } from "../vite-plugin-astro-server/index.js";
|
|
25
|
-
import astroVitePlugin from "../vite-plugin-astro/index.js";
|
|
26
26
|
import configAliasVitePlugin from "../vite-plugin-config-alias/index.js";
|
|
27
27
|
import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
|
|
28
28
|
import astroHeadPlugin from "../vite-plugin-head/index.js";
|
package/dist/core/csp/common.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { ISLAND_STYLES } from "../../runtime/server/astro-island-styles.js";
|
|
4
|
-
import astroIslandPrebuiltDev from "../../runtime/server/astro-island.prebuilt-dev.js";
|
|
5
3
|
import astroIslandPrebuilt from "../../runtime/server/astro-island.prebuilt.js";
|
|
4
|
+
import astroIslandPrebuiltDev from "../../runtime/server/astro-island.prebuilt-dev.js";
|
|
5
|
+
import { ISLAND_STYLES } from "../../runtime/server/astro-island-styles.js";
|
|
6
6
|
import { generateCspDigest } from "../encryption.js";
|
|
7
7
|
function shouldTrackCspHashes(csp) {
|
|
8
8
|
return csp === true || typeof csp === "object";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import nodeFs from 'node:fs';
|
|
1
2
|
import type * as http from 'node:http';
|
|
2
3
|
import type { AddressInfo } from 'node:net';
|
|
3
|
-
import type { AstroSettings } from '../../types/astro.js';
|
|
4
|
-
import nodeFs from 'node:fs';
|
|
5
4
|
import * as vite from 'vite';
|
|
5
|
+
import type { AstroSettings } from '../../types/astro.js';
|
|
6
6
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
|
7
7
|
import type { Logger } from '../logger/core.js';
|
|
8
8
|
export interface Container {
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -12,8 +12,8 @@ import { ensureProcessNodeEnv } from "../util.js";
|
|
|
12
12
|
import { startContainer } from "./container.js";
|
|
13
13
|
import { createContainerWithAutomaticRestart } from "./restart.js";
|
|
14
14
|
import {
|
|
15
|
-
MAX_PATCH_DISTANCE,
|
|
16
15
|
fetchLatestAstroVersion,
|
|
16
|
+
MAX_PATCH_DISTANCE,
|
|
17
17
|
shouldCheckForUpdates
|
|
18
18
|
} from "./update-check.js";
|
|
19
19
|
async function dev(inlineConfig) {
|
|
@@ -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 = "5.10.
|
|
25
|
+
const currentVersion = "5.10.2";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/dev/restart.js
CHANGED
|
@@ -51,6 +51,12 @@ async function restartContainer(container) {
|
|
|
51
51
|
container.restartInFlight = true;
|
|
52
52
|
try {
|
|
53
53
|
const { astroConfig } = await resolveConfig(container.inlineConfig, "dev", container.fs);
|
|
54
|
+
if (astroConfig.experimental.csp) {
|
|
55
|
+
logger.warn(
|
|
56
|
+
"config",
|
|
57
|
+
"Astro's Content Security Policy (CSP) does not work in development mode. To verify your CSP implementation, build the project and run the preview server."
|
|
58
|
+
);
|
|
59
|
+
}
|
|
54
60
|
const settings = await createSettings(astroConfig, fileURLToPath(existingSettings.config.root));
|
|
55
61
|
await close();
|
|
56
62
|
return await createRestartedContainer(container, settings);
|
|
@@ -80,9 +86,20 @@ async function createContainerWithAutomaticRestart({
|
|
|
80
86
|
}) {
|
|
81
87
|
const logger = createNodeLogger(inlineConfig ?? {});
|
|
82
88
|
const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, "dev", fs);
|
|
89
|
+
if (astroConfig.experimental.csp) {
|
|
90
|
+
logger.warn(
|
|
91
|
+
"config",
|
|
92
|
+
"Astro's Content Security Policy (CSP) does not work in development mode. To verify your CSP implementation, build the project and run the preview server."
|
|
93
|
+
);
|
|
94
|
+
}
|
|
83
95
|
telemetry.record(eventCliSession("dev", userConfig));
|
|
84
96
|
const settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
|
|
85
|
-
const initialContainer = await createContainer({
|
|
97
|
+
const initialContainer = await createContainer({
|
|
98
|
+
settings,
|
|
99
|
+
logger,
|
|
100
|
+
inlineConfig,
|
|
101
|
+
fs
|
|
102
|
+
});
|
|
86
103
|
let resolveRestart;
|
|
87
104
|
let restartComplete = new Promise((resolve) => {
|
|
88
105
|
resolveRestart = resolve;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { codeToHtml, createCssVariablesTheme } from "shiki";
|
|
4
|
-
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from "../errors-data.js";
|
|
5
4
|
import { AstroError } from "../errors.js";
|
|
5
|
+
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from "../errors-data.js";
|
|
6
6
|
import { createSafeError } from "../utils.js";
|
|
7
7
|
import { getDocsForError, renderErrorMarkdown } from "./utils.js";
|
|
8
8
|
function enhanceViteSSRError({
|
|
@@ -1517,7 +1517,7 @@ export declare const ContentEntryDataError: {
|
|
|
1517
1517
|
* @description
|
|
1518
1518
|
* Error in live content config.
|
|
1519
1519
|
* @see
|
|
1520
|
-
* - [Experimental live content](https://astro.build/en/reference/experimental-flags/live-content-collections/)
|
|
1520
|
+
* - [Experimental live content](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/)
|
|
1521
1521
|
*/
|
|
1522
1522
|
export declare const LiveContentConfigError: {
|
|
1523
1523
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as AstroErrorData from './errors-data.js';
|
|
2
|
-
export { AggregateError, AstroError, AstroUserError, CSSError, CompilerError, MarkdownError, isAstroError, } from './errors.js';
|
|
3
1
|
export type { ErrorWithMetadata } from './errors.js';
|
|
2
|
+
export { AggregateError, AstroError, AstroUserError, CompilerError, CSSError, isAstroError, MarkdownError, } from './errors.js';
|
|
3
|
+
export * as AstroErrorData from './errors-data.js';
|
|
4
4
|
export { createSafeError, positionAt } from './utils.js';
|
|
5
5
|
export { errorMap } from './zod-error-map.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as AstroErrorData from "./errors-data.js";
|
|
2
1
|
import {
|
|
3
2
|
AggregateError,
|
|
4
3
|
AstroError,
|
|
5
4
|
AstroUserError,
|
|
6
|
-
CSSError,
|
|
7
5
|
CompilerError,
|
|
8
|
-
|
|
9
|
-
isAstroError
|
|
6
|
+
CSSError,
|
|
7
|
+
isAstroError,
|
|
8
|
+
MarkdownError
|
|
10
9
|
} from "./errors.js";
|
|
10
|
+
import * as AstroErrorData from "./errors-data.js";
|
|
11
11
|
import { createSafeError, positionAt } from "./utils.js";
|
|
12
12
|
import { errorMap } from "./zod-error-map.js";
|
|
13
13
|
export {
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "5.10.
|
|
40
|
+
const version = "5.10.2";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -274,7 +274,7 @@ function printHelp({
|
|
|
274
274
|
message.push(
|
|
275
275
|
linebreak(),
|
|
276
276
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
277
|
-
`v${"5.10.
|
|
277
|
+
`v${"5.10.2"}`
|
|
278
278
|
)} ${headline}`
|
|
279
279
|
);
|
|
280
280
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AstroCookies } from "../cookies/cookies.js";
|
|
2
2
|
import { ForbiddenRewrite } from "../errors/errors-data.js";
|
|
3
3
|
import { AstroError } from "../errors/index.js";
|
|
4
|
-
import { apiContextRoutesSymbol } from "../render-context.js";
|
|
5
4
|
import { getParams } from "../render/index.js";
|
|
5
|
+
import { apiContextRoutesSymbol } from "../render-context.js";
|
|
6
6
|
import { setOriginPathname } from "../routing/rewrite.js";
|
|
7
7
|
import { defineMiddleware } from "./index.js";
|
|
8
8
|
function sequence(...handlers) {
|
|
@@ -54,7 +54,12 @@ function sequence(...handlers) {
|
|
|
54
54
|
handleContext.url = new URL(newRequest.url);
|
|
55
55
|
handleContext.cookies = new AstroCookies(newRequest);
|
|
56
56
|
handleContext.params = getParams(routeData, pathname);
|
|
57
|
-
setOriginPathname(
|
|
57
|
+
setOriginPathname(
|
|
58
|
+
handleContext.request,
|
|
59
|
+
oldPathname,
|
|
60
|
+
pipeline.manifest.trailingSlash,
|
|
61
|
+
pipeline.manifest.buildFormat
|
|
62
|
+
);
|
|
58
63
|
}
|
|
59
64
|
return applyHandle(i + 1, handleContext);
|
|
60
65
|
} else {
|
|
@@ -11,21 +11,22 @@ import { renderEndpoint } from "../runtime/server/endpoint.js";
|
|
|
11
11
|
import { renderPage } from "../runtime/server/index.js";
|
|
12
12
|
import {
|
|
13
13
|
ASTRO_VERSION,
|
|
14
|
+
clientAddressSymbol,
|
|
14
15
|
REROUTE_DIRECTIVE_HEADER,
|
|
15
16
|
REWRITE_DIRECTIVE_HEADER_KEY,
|
|
16
17
|
REWRITE_DIRECTIVE_HEADER_VALUE,
|
|
17
18
|
ROUTE_TYPE_HEADER,
|
|
18
|
-
clientAddressSymbol,
|
|
19
19
|
responseSentSymbol
|
|
20
20
|
} from "./constants.js";
|
|
21
21
|
import { AstroCookies, attachCookiesToResponse } from "./cookies/index.js";
|
|
22
22
|
import { getCookiesFromResponse } from "./cookies/response.js";
|
|
23
|
+
import { generateCspDigest } from "./encryption.js";
|
|
23
24
|
import { CspNotEnabled, ForbiddenRewrite } from "./errors/errors-data.js";
|
|
24
25
|
import { AstroError, AstroErrorData } from "./errors/index.js";
|
|
25
26
|
import { callMiddleware } from "./middleware/callMiddleware.js";
|
|
26
27
|
import { sequence } from "./middleware/index.js";
|
|
27
28
|
import { renderRedirect } from "./redirects/render.js";
|
|
28
|
-
import {
|
|
29
|
+
import { getParams, getProps, Slots } from "./render/index.js";
|
|
29
30
|
import { isRoute404or500, isRouteExternalRedirect, isRouteServerIsland } from "./routing/match.js";
|
|
30
31
|
import { copyRequest, getOriginPathname, setOriginPathname } from "./routing/rewrite.js";
|
|
31
32
|
import { AstroSession } from "./session.js";
|
|
@@ -72,7 +73,12 @@ class RenderContext {
|
|
|
72
73
|
}) {
|
|
73
74
|
const pipelineMiddleware = await pipeline.getMiddleware();
|
|
74
75
|
const pipelineActions = actions ?? await pipeline.getActions();
|
|
75
|
-
setOriginPathname(
|
|
76
|
+
setOriginPathname(
|
|
77
|
+
request,
|
|
78
|
+
pathname,
|
|
79
|
+
pipeline.manifest.trailingSlash,
|
|
80
|
+
pipeline.manifest.buildFormat
|
|
81
|
+
);
|
|
76
82
|
return new RenderContext(
|
|
77
83
|
pipeline,
|
|
78
84
|
locals,
|
|
@@ -159,7 +165,12 @@ class RenderContext {
|
|
|
159
165
|
this.params = getParams(routeData, pathname);
|
|
160
166
|
this.pathname = pathname;
|
|
161
167
|
this.status = 200;
|
|
162
|
-
setOriginPathname(
|
|
168
|
+
setOriginPathname(
|
|
169
|
+
this.request,
|
|
170
|
+
oldPathname,
|
|
171
|
+
this.pipeline.manifest.trailingSlash,
|
|
172
|
+
this.pipeline.manifest.buildFormat
|
|
173
|
+
);
|
|
163
174
|
}
|
|
164
175
|
let response2;
|
|
165
176
|
if (!ctx.isPrerendered) {
|
|
@@ -268,7 +279,12 @@ class RenderContext {
|
|
|
268
279
|
this.pathname = pathname;
|
|
269
280
|
this.isRewriting = true;
|
|
270
281
|
this.status = 200;
|
|
271
|
-
setOriginPathname(
|
|
282
|
+
setOriginPathname(
|
|
283
|
+
this.request,
|
|
284
|
+
oldPathname,
|
|
285
|
+
this.pipeline.manifest.trailingSlash,
|
|
286
|
+
this.pipeline.manifest.buildFormat
|
|
287
|
+
);
|
|
272
288
|
return await this.render(componentInstance);
|
|
273
289
|
}
|
|
274
290
|
createActionAPIContext() {
|
|
@@ -362,6 +378,18 @@ class RenderContext {
|
|
|
362
378
|
const { cookies, pathname, pipeline, routeData, status } = this;
|
|
363
379
|
const { clientDirectives, inlinedScripts, compressHTML, manifest, renderers, resolve } = pipeline;
|
|
364
380
|
const { links, scripts, styles } = await pipeline.headElements(routeData);
|
|
381
|
+
const extraStyleHashes = [];
|
|
382
|
+
const extraScriptHashes = [];
|
|
383
|
+
const shouldInjectCspMetaTags = !!manifest.csp;
|
|
384
|
+
const cspAlgorithm = manifest.csp?.algorithm ?? "SHA-256";
|
|
385
|
+
if (shouldInjectCspMetaTags) {
|
|
386
|
+
for (const style of styles) {
|
|
387
|
+
extraStyleHashes.push(await generateCspDigest(style.children, cspAlgorithm));
|
|
388
|
+
}
|
|
389
|
+
for (const script of scripts) {
|
|
390
|
+
extraScriptHashes.push(await generateCspDigest(script.children, cspAlgorithm));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
365
393
|
const componentMetadata = await pipeline.componentMetadata(routeData) ?? manifest.componentMetadata;
|
|
366
394
|
const headers = new Headers({ "Content-Type": "text/html" });
|
|
367
395
|
const partial = typeof this.partial === "boolean" ? this.partial : Boolean(mod.partial);
|
|
@@ -411,13 +439,13 @@ class RenderContext {
|
|
|
411
439
|
hasRenderedServerIslandRuntime: false,
|
|
412
440
|
headInTree: false,
|
|
413
441
|
extraHead: [],
|
|
414
|
-
extraStyleHashes
|
|
415
|
-
extraScriptHashes
|
|
442
|
+
extraStyleHashes,
|
|
443
|
+
extraScriptHashes,
|
|
416
444
|
propagators: /* @__PURE__ */ new Set()
|
|
417
445
|
},
|
|
418
446
|
cspDestination: manifest.csp?.cspDestination ?? (routeData.prerender ? "meta" : "header"),
|
|
419
|
-
shouldInjectCspMetaTags
|
|
420
|
-
cspAlgorithm
|
|
447
|
+
shouldInjectCspMetaTags,
|
|
448
|
+
cspAlgorithm,
|
|
421
449
|
// The following arrays must be cloned, otherwise they become mutable across routes.
|
|
422
450
|
scriptHashes: manifest.csp?.scriptHashes ? [...manifest.csp.scriptHashes] : [],
|
|
423
451
|
scriptResources: manifest.csp?.scriptResources ? [...manifest.csp.scriptResources] : [],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_404_COMPONENT } from "../constants.js";
|
|
2
2
|
import {
|
|
3
|
+
createEndpoint as createServerIslandEndpoint,
|
|
3
4
|
SERVER_ISLAND_COMPONENT,
|
|
4
|
-
SERVER_ISLAND_ROUTE
|
|
5
|
-
createEndpoint as createServerIslandEndpoint
|
|
5
|
+
SERVER_ISLAND_ROUTE
|
|
6
6
|
} from "../server-islands/endpoint.js";
|
|
7
7
|
import { DEFAULT_404_ROUTE, default404Instance } from "./astro-designed-error-pages.js";
|
|
8
8
|
const DEFAULT_COMPONENTS = [DEFAULT_404_COMPONENT, SERVER_ISLAND_COMPONENT];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import nodeFs from 'node:fs';
|
|
1
2
|
import type { AstroSettings, RoutesList } from '../../../types/astro.js';
|
|
2
3
|
import type { Logger } from '../../logger/core.js';
|
|
3
|
-
import nodeFs from 'node:fs';
|
|
4
4
|
interface CreateRouteManifestParams {
|
|
5
5
|
/** Astro Settings object */
|
|
6
6
|
settings: AstroSettings;
|
|
@@ -32,6 +32,6 @@ export declare function findRouteToRewrite({ payload, routes, request, trailingS
|
|
|
32
32
|
* @param routePattern
|
|
33
33
|
*/
|
|
34
34
|
export declare function copyRequest(newUrl: URL, oldRequest: Request, isPrerendered: boolean, logger: Logger, routePattern: string): Request;
|
|
35
|
-
export declare function setOriginPathname(request: Request, pathname: string): void;
|
|
35
|
+
export declare function setOriginPathname(request: Request, pathname: string, trailingSlash: AstroConfig['trailingSlash'], buildFormat: AstroConfig['build']['format']): void;
|
|
36
36
|
export declare function getOriginPathname(request: Request): string;
|
|
37
37
|
export {};
|
|
@@ -110,8 +110,20 @@ function copyRequest(newUrl, oldRequest, isPrerendered, logger, routePattern) {
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
function setOriginPathname(request, pathname) {
|
|
114
|
-
|
|
113
|
+
function setOriginPathname(request, pathname, trailingSlash, buildFormat) {
|
|
114
|
+
if (!pathname) {
|
|
115
|
+
pathname = "/";
|
|
116
|
+
}
|
|
117
|
+
const shouldAppendSlash = shouldAppendForwardSlash(trailingSlash, buildFormat);
|
|
118
|
+
let finalPathname;
|
|
119
|
+
if (pathname === "/") {
|
|
120
|
+
finalPathname = "/";
|
|
121
|
+
} else if (shouldAppendSlash) {
|
|
122
|
+
finalPathname = appendForwardSlash(pathname);
|
|
123
|
+
} else {
|
|
124
|
+
finalPathname = removeTrailingForwardSlash(pathname);
|
|
125
|
+
}
|
|
126
|
+
Reflect.set(request, originPathnameSymbol, encodeURIComponent(finalPathname));
|
|
115
127
|
}
|
|
116
128
|
function getOriginPathname(request) {
|
|
117
129
|
const origin = Reflect.get(request, originPathnameSymbol);
|
package/dist/core/viteUtils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { prependForwardSlash, slash } from "../core/path.js";
|
|
4
|
-
import {
|
|
4
|
+
import { resolveJsToTs, unwrapId, VALID_ID_PREFIX, viteID } from "./util.js";
|
|
5
5
|
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
6
6
|
function normalizePath(id) {
|
|
7
7
|
return path.posix.normalize(isWindows ? slash(id) : id);
|
package/dist/env/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstroError } from '../core/errors/index.js';
|
|
2
2
|
import type { ValidationResultInvalid } from './validators.js';
|
|
3
|
-
export {
|
|
3
|
+
export { getEnvFieldType, validateEnvVariable } from './validators.js';
|
|
4
4
|
export type GetEnv = (key: string) => string | undefined;
|
|
5
5
|
type OnSetGetEnv = () => void;
|
|
6
6
|
export declare function setGetEnv(fn: GetEnv): void;
|
package/dist/env/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
2
2
|
import { invalidVariablesToError } from "./errors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getEnvFieldType, validateEnvVariable } from "./validators.js";
|
|
4
4
|
let _getEnv = (key) => process.env[key];
|
|
5
5
|
function setGetEnv(fn) {
|
|
6
6
|
_getEnv = fn;
|
package/dist/env/setup.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type GetEnv, setGetEnv } from './runtime.js';
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { appendForwardSlash, joinPaths } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { shouldAppendForwardSlash } from "../core/build/util.js";
|
|
3
3
|
import { REROUTE_DIRECTIVE_HEADER } from "../core/constants.js";
|
|
4
|
-
import {
|
|
4
|
+
import { i18nNoLocaleFoundInPath, MissingLocale } from "../core/errors/errors-data.js";
|
|
5
5
|
import { AstroError } from "../core/errors/index.js";
|
|
6
6
|
import { createI18nMiddleware } from "./middleware.js";
|
|
7
7
|
function requestHasLocale(locales) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment,
|
|
1
|
+
import { Fragment, markHTMLString, Renderer } from "../runtime/server/index.js";
|
|
2
2
|
const AstroJSX = "astro:jsx";
|
|
3
3
|
const Empty = Symbol("empty");
|
|
4
4
|
const toSlotName = (slotAttr) => slotAttr;
|
|
@@ -3,8 +3,8 @@ export { DevToolbarButton } from './button.js';
|
|
|
3
3
|
export { DevToolbarCard } from './card.js';
|
|
4
4
|
export { DevToolbarHighlight } from './highlight.js';
|
|
5
5
|
export { DevToolbarIcon } from './icon.js';
|
|
6
|
+
export { DevToolbarRadioCheckbox } from './radio-checkbox.js';
|
|
6
7
|
export { DevToolbarSelect } from './select.js';
|
|
7
8
|
export { DevToolbarToggle } from './toggle.js';
|
|
8
9
|
export { DevToolbarTooltip } from './tooltip.js';
|
|
9
10
|
export { DevToolbarWindow } from './window.js';
|
|
10
|
-
export { DevToolbarRadioCheckbox } from './radio-checkbox.js';
|
|
@@ -3,11 +3,11 @@ import { DevToolbarButton } from "./button.js";
|
|
|
3
3
|
import { DevToolbarCard } from "./card.js";
|
|
4
4
|
import { DevToolbarHighlight } from "./highlight.js";
|
|
5
5
|
import { DevToolbarIcon } from "./icon.js";
|
|
6
|
+
import { DevToolbarRadioCheckbox } from "./radio-checkbox.js";
|
|
6
7
|
import { DevToolbarSelect } from "./select.js";
|
|
7
8
|
import { DevToolbarToggle } from "./toggle.js";
|
|
8
9
|
import { DevToolbarTooltip } from "./tooltip.js";
|
|
9
10
|
import { DevToolbarWindow } from "./window.js";
|
|
10
|
-
import { DevToolbarRadioCheckbox } from "./radio-checkbox.js";
|
|
11
11
|
export {
|
|
12
12
|
DevToolbarBadge,
|
|
13
13
|
DevToolbarButton,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { addAttribute, createAstro, createComponent, createTransitionScope, defineScriptVars, defineStyleVars, Fragment, maybeRenderHead, mergeSlots, render, renderComponent, renderHead, renderScript, renderSlot, renderTransition, spreadAttributes, unescapeHTML, } from '../server/index.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bold } from "kleur/colors";
|
|
2
2
|
import { REROUTABLE_STATUS_CODES, REROUTE_DIRECTIVE_HEADER } from "../../core/constants.js";
|
|
3
|
-
import { EndpointDidNotReturnAResponse } from "../../core/errors/errors-data.js";
|
|
4
3
|
import { AstroError } from "../../core/errors/errors.js";
|
|
4
|
+
import { EndpointDidNotReturnAResponse } from "../../core/errors/errors-data.js";
|
|
5
5
|
async function renderEndpoint(mod, context, isPrerendered, logger) {
|
|
6
6
|
const { request, url } = context;
|
|
7
7
|
const method = request.method.toUpperCase();
|
|
@@ -3,8 +3,8 @@ export { createAstro } from './astro-global.js';
|
|
|
3
3
|
export { renderEndpoint } from './endpoint.js';
|
|
4
4
|
export { escapeHTML, HTMLBytes, HTMLString, isHTMLString, markHTMLString, unescapeHTML, } from './escape.js';
|
|
5
5
|
export { renderJSX } from './jsx.js';
|
|
6
|
-
export { addAttribute, createHeadAndContent, defineScriptVars, Fragment, maybeRenderHead, renderTemplate as render, renderComponent, Renderer as Renderer, renderHead, renderHTMLElement, renderPage, renderScript, renderScriptElement, renderSlot, renderSlotToString, renderTemplate, renderToString, renderUniqueStylesheet, voidElementNames, } from './render/index.js';
|
|
7
6
|
export type { AstroComponentFactory, AstroComponentInstance, ComponentSlots, RenderInstruction, } from './render/index.js';
|
|
7
|
+
export { addAttribute, createHeadAndContent, defineScriptVars, Fragment, maybeRenderHead, Renderer as Renderer, renderComponent, renderHead, renderHTMLElement, renderPage, renderScript, renderScriptElement, renderSlot, renderSlotToString, renderTemplate as render, renderTemplate, renderToString, renderUniqueStylesheet, voidElementNames, } from './render/index.js';
|
|
8
8
|
export type { ServerIslandComponent } from './render/server-islands.js';
|
|
9
9
|
export { createTransitionScope, renderTransition } from './transition.js';
|
|
10
10
|
export declare function mergeSlots(...slotted: unknown[]): Record<string, () => any>;
|
|
@@ -16,9 +16,8 @@ import {
|
|
|
16
16
|
defineScriptVars,
|
|
17
17
|
Fragment,
|
|
18
18
|
maybeRenderHead,
|
|
19
|
-
renderTemplate,
|
|
20
|
-
renderComponent,
|
|
21
19
|
Renderer,
|
|
20
|
+
renderComponent,
|
|
22
21
|
renderHead,
|
|
23
22
|
renderHTMLElement,
|
|
24
23
|
renderPage,
|
|
@@ -26,6 +25,7 @@ import {
|
|
|
26
25
|
renderScriptElement,
|
|
27
26
|
renderSlot,
|
|
28
27
|
renderSlotToString,
|
|
28
|
+
renderTemplate,
|
|
29
29
|
renderTemplate as renderTemplate2,
|
|
30
30
|
renderToString,
|
|
31
31
|
renderUniqueStylesheet,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from "./render/index.js";
|
|
34
34
|
import { createTransitionScope, renderTransition } from "./transition.js";
|
|
35
35
|
import { markHTMLString as markHTMLString2 } from "./escape.js";
|
|
36
|
-
import {
|
|
36
|
+
import { addAttribute as addAttribute2, Renderer as Renderer2 } from "./render/index.js";
|
|
37
37
|
function mergeSlots(...slotted) {
|
|
38
38
|
const slots = {};
|
|
39
39
|
for (const slot of slotted) {
|
|
@@ -67,7 +67,7 @@ function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
for (const [key, value] of Object.entries(values)) {
|
|
70
|
-
output += addAttribute2(value, key, true);
|
|
70
|
+
output += addAttribute2(value, key, true, _name);
|
|
71
71
|
}
|
|
72
72
|
return markHTMLString2(output);
|
|
73
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { isAstroComponentFactory } from './factory.js';
|
|
2
1
|
export type { AstroComponentFactory } from './factory.js';
|
|
2
|
+
export { isAstroComponentFactory } from './factory.js';
|
|
3
3
|
export { createHeadAndContent, isHeadAndContent } from './head-and-content.js';
|
|
4
|
-
export { createAstroComponentInstance, isAstroComponentInstance } from './instance.js';
|
|
5
4
|
export type { AstroComponentInstance } from './instance.js';
|
|
6
|
-
export {
|
|
5
|
+
export { createAstroComponentInstance, isAstroComponentInstance } from './instance.js';
|
|
7
6
|
export { renderToReadableStream, renderToString } from './render.js';
|
|
7
|
+
export { isRenderTemplateResult, renderTemplate } from './render-template.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isAstroComponentFactory } from "./factory.js";
|
|
2
2
|
import { createHeadAndContent, isHeadAndContent } from "./head-and-content.js";
|
|
3
3
|
import { createAstroComponentInstance, isAstroComponentInstance } from "./instance.js";
|
|
4
|
-
import { isRenderTemplateResult, renderTemplate } from "./render-template.js";
|
|
5
4
|
import { renderToReadableStream, renderToString } from "./render.js";
|
|
5
|
+
import { isRenderTemplateResult, renderTemplate } from "./render-template.js";
|
|
6
6
|
export {
|
|
7
7
|
createAstroComponentInstance,
|
|
8
8
|
createHeadAndContent,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ComponentSlots } from '../slot.js';
|
|
2
|
-
import type { AstroComponentFactory, AstroFactoryReturnValue } from './factory.js';
|
|
3
1
|
import type { SSRResult } from '../../../../types/public/internal.js';
|
|
4
2
|
import type { RenderDestination } from '../common.js';
|
|
3
|
+
import type { ComponentSlots } from '../slot.js';
|
|
4
|
+
import type { AstroComponentFactory, AstroFactoryReturnValue } from './factory.js';
|
|
5
5
|
type ComponentProps = Record<string | number, any>;
|
|
6
6
|
declare const astroComponentInstanceSym: unique symbol;
|
|
7
7
|
export declare class AstroComponentInstance {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRenderInstruction } from "./instruction.js";
|
|
2
1
|
import { clsx } from "clsx";
|
|
3
2
|
import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
|
|
4
3
|
import { markHTMLString } from "../escape.js";
|
|
@@ -11,14 +10,15 @@ import { renderTemplate } from "./astro/index.js";
|
|
|
11
10
|
import { createAstroComponentInstance } from "./astro/instance.js";
|
|
12
11
|
import { bufferHeadContent } from "./astro/render.js";
|
|
13
12
|
import {
|
|
13
|
+
chunkToString,
|
|
14
14
|
Fragment,
|
|
15
|
-
Renderer
|
|
16
|
-
chunkToString
|
|
15
|
+
Renderer
|
|
17
16
|
} from "./common.js";
|
|
18
17
|
import { componentIsHTMLElement, renderHTMLElement } from "./dom.js";
|
|
19
18
|
import { maybeRenderHead } from "./head.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
19
|
+
import { createRenderInstruction } from "./instruction.js";
|
|
20
|
+
import { containsServerDirective, ServerIslandComponent } from "./server-islands.js";
|
|
21
|
+
import { renderSlots, renderSlotToString } from "./slot.js";
|
|
22
22
|
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from "./util.js";
|
|
23
23
|
const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering");
|
|
24
24
|
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
@@ -228,7 +228,9 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
|
|
|
228
228
|
const Tag = sanitizeElementName(Component);
|
|
229
229
|
const childSlots = Object.values(children).join("");
|
|
230
230
|
const renderTemplateResult = renderTemplate`<${Tag}${internalSpreadAttributes(
|
|
231
|
-
props
|
|
231
|
+
props,
|
|
232
|
+
true,
|
|
233
|
+
Tag
|
|
232
234
|
)}${markHTMLString(
|
|
233
235
|
childSlots === "" && voidElementNames.test(Tag) ? `/>` : `>${childSlots}</${Tag}>`
|
|
234
236
|
)}`;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { createHeadAndContent, renderTemplate, renderToString } from './astro/index.js';
|
|
2
1
|
export type { AstroComponentFactory, AstroComponentInstance } from './astro/index.js';
|
|
3
|
-
export {
|
|
2
|
+
export { createHeadAndContent, renderTemplate, renderToString } from './astro/index.js';
|
|
3
|
+
export { chunkToByteArray, chunkToString, Fragment, Renderer } from './common.js';
|
|
4
4
|
export { renderComponent, renderComponentToString } from './component.js';
|
|
5
|
-
export { renderScript } from './script.js';
|
|
6
5
|
export { renderHTMLElement } from './dom.js';
|
|
7
6
|
export { maybeRenderHead, renderHead } from './head.js';
|
|
8
7
|
export type { RenderInstruction } from './instruction.js';
|
|
9
8
|
export { renderPage } from './page.js';
|
|
10
|
-
export {
|
|
9
|
+
export { renderScript } from './script.js';
|
|
10
|
+
export { type ComponentSlots, renderSlot, renderSlotToString } from './slot.js';
|
|
11
11
|
export { renderScriptElement, renderUniqueStylesheet } from './tags.js';
|
|
12
12
|
export { addAttribute, defineScriptVars, voidElementNames } from './util.js';
|