Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: withastro/astro
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: astro@4.9.1
Choose a base ref
...
head repository: withastro/astro
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: astro@4.9.2
Choose a head ref
  • 5 commits
  • 40 files changed
  • 5 contributors

Commits on May 24, 2024

  1. fix(upgrade): use preferred-pm instead of which-pm-runs (#11139)

    Princesseuh authored May 24, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    IvanGoncharov Ivan Goncharov
    Copy the full SHA
    aaf0635 View commit details
  2. feat: pass props to container (#11138)

    ematipico authored May 24, 2024
    Copy the full SHA
    98e0372 View commit details
  3. [ci] format

    ematipico authored and astrobot-houston committed May 24, 2024
    Copy the full SHA
    5af99dc View commit details
  4. nit: update Node version in issue template (#11143)

    Princesseuh authored May 24, 2024
    Copy the full SHA
    33902e7 View commit details

Commits on May 27, 2024

  1. [ci] release (#11140)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    astrobot-houston and github-actions[bot] authored May 27, 2024
    Copy the full SHA
    cdf89a1 View commit details
Showing with 172 additions and 82 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE/---01-bug-report.yml
  2. +1 −1 examples/basics/package.json
  3. +1 −1 examples/blog/package.json
  4. +1 −1 examples/component/package.json
  5. +1 −1 examples/container-with-vitest/package.json
  6. +1 −1 examples/framework-alpine/package.json
  7. +1 −1 examples/framework-lit/package.json
  8. +1 −1 examples/framework-multiple/package.json
  9. +1 −1 examples/framework-preact/package.json
  10. +1 −1 examples/framework-react/package.json
  11. +1 −1 examples/framework-solid/package.json
  12. +1 −1 examples/framework-svelte/package.json
  13. +1 −1 examples/framework-vue/package.json
  14. +1 −1 examples/hackernews/package.json
  15. +1 −1 examples/integration/package.json
  16. +1 −1 examples/middleware/package.json
  17. +1 −1 examples/minimal/package.json
  18. +1 −1 examples/non-html-pages/package.json
  19. +1 −1 examples/portfolio/package.json
  20. +1 −1 examples/ssr/package.json
  21. +1 −1 examples/starlog/package.json
  22. +1 −1 examples/toolbar-app/package.json
  23. +1 −1 examples/view-transitions/package.json
  24. +1 −1 examples/with-markdoc/package.json
  25. +1 −1 examples/with-markdown-plugins/package.json
  26. +1 −1 examples/with-markdown-shiki/package.json
  27. +1 −1 examples/with-mdx/package.json
  28. +1 −1 examples/with-nanostores/package.json
  29. +1 −1 examples/with-tailwindcss/package.json
  30. +1 −1 examples/with-vitest/package.json
  31. +18 −0 packages/astro/CHANGELOG.md
  32. +1 −1 packages/astro/package.json
  33. +13 −0 packages/astro/src/container/index.ts
  34. +14 −9 packages/astro/src/core/render-context.ts
  35. +41 −0 packages/astro/test/container.test.js
  36. +6 −0 packages/upgrade/CHANGELOG.md
  37. +3 −3 packages/upgrade/package.json
  38. +2 −2 packages/upgrade/src/actions/context.ts
  39. +2 −2 packages/upgrade/src/messages.ts
  40. +42 −35 pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---01-bug-report.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ body:
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
✅ I am using the **latest version of Astro** and all plugins.
✅ I am using a version of Node that Astro supports (`>=18.14.1`)
✅ I am using a version of Node that Astro supports (`v18.17.1` or `v20.3.0` or higher.)
- type: textarea
id: astro-info
attributes:
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,6 @@
"@astrojs/mdx": "^3.0.1",
"@astrojs/rss": "^4.0.6",
"@astrojs/sitemap": "^3.1.5",
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
},
"peerDependencies": {
"astro": "^4.0.0"
2 changes: 1 addition & 1 deletion examples/container-with-vitest/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"test": "vitest run"
},
"dependencies": {
"astro": "^4.9.1",
"astro": "^4.9.2",
"@astrojs/react": "^3.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.13.10",
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^4.0.1",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.9.1",
"astro": "^4.9.2",
"lit": "^3.1.3"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
"@astrojs/vue": "^4.3.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"preact": "^10.21.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.3.0",
"@preact/signals": "^1.2.3",
"astro": "^4.9.1",
"astro": "^4.9.2",
"preact": "^10.21.0"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"@astrojs/react": "^3.4.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.2.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"solid-js": "^1.8.17"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^5.4.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"svelte": "^4.2.16"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^4.3.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"vue": "^3.4.27"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^8.2.5",
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
},
"peerDependencies": {
"astro": "^4.0.0"
2 changes: 1 addition & 1 deletion examples/middleware/package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^8.2.5",
"astro": "^4.9.1",
"astro": "^4.9.2",
"html-minifier": "^4.0.0"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"dependencies": {
"@astrojs/node": "^8.2.5",
"@astrojs/svelte": "^5.4.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"svelte": "^4.2.16"
}
}
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1",
"astro": "^4.9.2",
"sass": "^1.77.1",
"sharp": "^0.33.3"
}
2 changes: 1 addition & 1 deletion examples/toolbar-app/package.json
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@
"./app": "./dist/app.js"
},
"devDependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/view-transitions/package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@
"devDependencies": {
"@astrojs/tailwind": "^5.1.0",
"@astrojs/node": "^8.2.5",
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdoc/package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.11.0",
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^5.1.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"hast-util-select": "^6.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.9.1"
"astro": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/mdx": "^3.0.1",
"@astrojs/preact": "^3.3.0",
"astro": "^4.9.1",
"astro": "^4.9.2",
"preact": "^10.21.0"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.3.0",
"@nanostores/preact": "^0.5.1",
"astro": "^4.9.1",
"astro": "^4.9.2",
"nanostores": "^0.10.3",
"preact": "^10.21.0"
}
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"@astrojs/mdx": "^3.0.1",
"@astrojs/tailwind": "^5.1.0",
"@types/canvas-confetti": "^1.6.4",
"astro": "^4.9.1",
"astro": "^4.9.2",
"autoprefixer": "^10.4.19",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.38",
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^4.9.1",
"astro": "^4.9.2",
"vitest": "^1.6.0"
}
}
18 changes: 18 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# astro

## 4.9.2

### Patch Changes

- [#11138](https://github.com/withastro/astro/pull/11138) [`98e0372`](https://github.com/withastro/astro/commit/98e0372cfd47a3e025be2ac68d1e9ebf06cf548b) Thanks [@ematipico](https://github.com/ematipico)! - You can now pass `props` when rendering a component using the Container APIs:

```js
import { experimental_AstroContainer as AstroContainer } from 'astro/contaienr';
import Card from '../src/components/Card.astro';

const container = await AstroContainer.create();
const result = await container.renderToString(Card, {
props: {
someState: true,
},
});
```

## 4.9.1

### Patch Changes
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "4.9.1",
"version": "4.9.2",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
13 changes: 13 additions & 0 deletions packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import type {
AstroUserConfig,
ComponentInstance,
MiddlewareHandler,
Props,
RouteData,
RouteType,
SSRLoadedRenderer,
@@ -70,6 +71,15 @@ export type ContainerRenderOptions = {
* ```
*/
routeType?: RouteType;

/**
* Allows to pass `Astro.props` to an Astro component:
*
* ```js
* container.renderToString(Endpoint, { props: { "lorem": "ipsum" } });
* ```
*/
props?: Props;
};

function createManifest(
@@ -369,6 +379,9 @@ export class experimental_AstroContainer {
if (options.params) {
renderContext.params = options.params;
}
if (options.props) {
renderContext.props = options.props;
}

return renderContext.render(componentInstance, slots);
}
23 changes: 14 additions & 9 deletions packages/astro/src/core/render-context.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import type {
AstroGlobalPartial,
ComponentInstance,
MiddlewareHandler,
Props,
RewritePayload,
RouteData,
SSRResult,
@@ -47,7 +48,8 @@ export class RenderContext {
public status: number,
protected cookies = new AstroCookies(request),
public params = getParams(routeData, pathname),
protected url = new URL(request.url)
protected url = new URL(request.url),
public props: Props = {}
) {}

/**
@@ -97,14 +99,17 @@ export class RenderContext {
): Promise<Response> {
const { cookies, middleware, pathname, pipeline } = this;
const { logger, routeCache, serverLike, streaming } = pipeline;
const props = await getProps({
mod: componentInstance,
routeData: this.routeData,
routeCache,
pathname,
logger,
serverLike,
});
const props =
Object.keys(this.props).length > 0
? this.props
: await getProps({
mod: componentInstance,
routeData: this.routeData,
routeCache,
pathname,
logger,
serverLike,
});
const apiContext = this.createAPIContext(props);

this.counter++;
Loading