astro 4.9.0 → 4.9.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/dist/container/index.d.ts +9 -1
- package/dist/container/index.js +3 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.d.ts +2 -1
- package/dist/core/render-context.js +3 -2
- package/dist/integrations/features-validation.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AstroRenderer, AstroUserConfig, RouteType } from '../@types/astro.js';
|
|
1
|
+
import type { AstroRenderer, AstroUserConfig, Props, RouteType } from '../@types/astro.js';
|
|
2
2
|
import type { AstroComponentFactory } from '../runtime/server/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Options to be passed when rendering a route
|
|
@@ -50,6 +50,14 @@ export type ContainerRenderOptions = {
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
routeType?: RouteType;
|
|
53
|
+
/**
|
|
54
|
+
* Allows to pass `Astro.props` to an Astro component:
|
|
55
|
+
*
|
|
56
|
+
* ```js
|
|
57
|
+
* container.renderToString(Endpoint, { props: { "lorem": "ipsum" } });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
props?: Props;
|
|
53
61
|
};
|
|
54
62
|
export type AstroContainerUserConfig = Omit<AstroUserConfig, 'integrations' | 'adapter'>;
|
|
55
63
|
/**
|
package/dist/container/index.js
CHANGED
|
@@ -185,6 +185,9 @@ class experimental_AstroContainer {
|
|
|
185
185
|
if (options.params) {
|
|
186
186
|
renderContext.params = options.params;
|
|
187
187
|
}
|
|
188
|
+
if (options.props) {
|
|
189
|
+
renderContext.props = options.props;
|
|
190
|
+
}
|
|
188
191
|
return renderContext.render(componentInstance, slots);
|
|
189
192
|
}
|
|
190
193
|
#createRoute(url, params, type) {
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
|
|
|
19
19
|
await telemetry.record([]);
|
|
20
20
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
21
21
|
const logger = restart.container.logger;
|
|
22
|
-
const currentVersion = "4.9.
|
|
22
|
+
const currentVersion = "4.9.2";
|
|
23
23
|
const isPrerelease = currentVersion.includes("-");
|
|
24
24
|
if (!isPrerelease) {
|
|
25
25
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "4.9.
|
|
40
|
+
const version = "4.9.2";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -269,7 +269,7 @@ function printHelp({
|
|
|
269
269
|
message.push(
|
|
270
270
|
linebreak(),
|
|
271
271
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
272
|
-
`v${"4.9.
|
|
272
|
+
`v${"4.9.2"}`
|
|
273
273
|
)} ${headline}`
|
|
274
274
|
);
|
|
275
275
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { APIContext, AstroGlobal, AstroGlobalPartial, ComponentInstance, MiddlewareHandler, RouteData, SSRResult } from '../@types/astro.js';
|
|
1
|
+
import type { APIContext, AstroGlobal, AstroGlobalPartial, ComponentInstance, MiddlewareHandler, Props, RouteData, SSRResult } from '../@types/astro.js';
|
|
2
2
|
import type { ActionAPIContext } from '../actions/runtime/store.js';
|
|
3
3
|
import { AstroCookies } from './cookies/index.js';
|
|
4
4
|
import { type Pipeline } from './render/index.js';
|
|
@@ -18,6 +18,7 @@ export declare class RenderContext {
|
|
|
18
18
|
protected cookies: AstroCookies;
|
|
19
19
|
params: import("../@types/astro.js").Params;
|
|
20
20
|
protected url: URL;
|
|
21
|
+
props: Props;
|
|
21
22
|
private constructor();
|
|
22
23
|
/**
|
|
23
24
|
* A flag that tells the render content if the rewriting was triggered
|
|
@@ -21,7 +21,7 @@ import { sequence } from "./middleware/index.js";
|
|
|
21
21
|
import { renderRedirect } from "./redirects/render.js";
|
|
22
22
|
import { Slots, getParams, getProps } from "./render/index.js";
|
|
23
23
|
class RenderContext {
|
|
24
|
-
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url)) {
|
|
24
|
+
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url), props = {}) {
|
|
25
25
|
this.pipeline = pipeline;
|
|
26
26
|
this.locals = locals;
|
|
27
27
|
this.middleware = middleware;
|
|
@@ -32,6 +32,7 @@ class RenderContext {
|
|
|
32
32
|
this.cookies = cookies;
|
|
33
33
|
this.params = params;
|
|
34
34
|
this.url = url;
|
|
35
|
+
this.props = props;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* A flag that tells the render content if the rewriting was triggered
|
|
@@ -74,7 +75,7 @@ class RenderContext {
|
|
|
74
75
|
async render(componentInstance, slots = {}) {
|
|
75
76
|
const { cookies, middleware, pathname, pipeline } = this;
|
|
76
77
|
const { logger, routeCache, serverLike, streaming } = pipeline;
|
|
77
|
-
const props = await getProps({
|
|
78
|
+
const props = Object.keys(this.props).length > 0 ? this.props : await getProps({
|
|
78
79
|
mod: componentInstance,
|
|
79
80
|
routeData: this.routeData,
|
|
80
81
|
routeCache,
|
|
@@ -38,7 +38,7 @@ function validateSupportedFeatures(adapterName, featureMap, config, adapterFeatu
|
|
|
38
38
|
() => config?.output === "server"
|
|
39
39
|
);
|
|
40
40
|
validationResult.assets = validateAssetsFeature(assets, adapterName, config, logger);
|
|
41
|
-
if (
|
|
41
|
+
if (config.i18n?.domains) {
|
|
42
42
|
validationResult.i18nDomains = validateSupportKind(
|
|
43
43
|
i18nDomains,
|
|
44
44
|
adapterName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.2",
|
|
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,8 +170,8 @@
|
|
|
170
170
|
"zod": "^3.23.8",
|
|
171
171
|
"zod-to-json-schema": "^3.23.0",
|
|
172
172
|
"@astrojs/internal-helpers": "0.4.0",
|
|
173
|
-
"@astrojs/
|
|
174
|
-
"@astrojs/
|
|
173
|
+
"@astrojs/markdown-remark": "5.1.0",
|
|
174
|
+
"@astrojs/telemetry": "3.1.0"
|
|
175
175
|
},
|
|
176
176
|
"optionalDependencies": {
|
|
177
177
|
"sharp": "^0.33.3"
|