Skip to content

Commit

Permalink
Merge pull request #231 from withastro/main
Browse files Browse the repository at this point in the history
a2908
  • Loading branch information
akshit20421 authored Sep 23, 2024
2 parents 5ac9752 + 7814a6c commit f998cf8
Show file tree
Hide file tree
Showing 52 changed files with 163 additions and 124 deletions.
5 changes: 0 additions & 5 deletions .changeset/clever-vans-flash.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fast-queens-try.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/sixty-oranges-walk.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/mdx": "^3.1.7",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/container-with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest run"
},
"dependencies": {
"astro": "^4.15.8",
"astro": "^4.15.9",
"@astrojs/react": "^3.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.1",
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^4.3.0",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.15.8",
"astro": "^4.15.9",
"lit": "^3.2.0"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@astrojs/vue": "^4.5.1",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^4.15.8",
"astro": "^4.15.9",
"preact": "^10.23.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.5.3",
"@preact/signals": "^1.3.0",
"astro": "^4.15.8",
"astro": "^4.15.9",
"preact": "^10.23.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.6.2",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^4.15.8",
"astro": "^4.15.9",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.4.2",
"astro": "^4.15.8",
"astro": "^4.15.9",
"solid-js": "^1.8.22"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^5.7.1",
"astro": "^4.15.8",
"astro": "^4.15.9",
"svelte": "^4.2.19"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^4.5.1",
"astro": "^4.15.8",
"astro": "^4.15.9",
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.8",
"astro": "^4.15.9",
"html-minifier": "^4.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/server-islands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@tailwindcss/forms": "^0.5.9",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^4.15.8",
"astro": "^4.15.9",
"postcss": "^8.4.45",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@astrojs/node": "^8.3.3",
"@astrojs/svelte": "^5.7.1",
"astro": "^4.15.8",
"astro": "^4.15.9",
"svelte": "^4.2.19"
}
}
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8",
"astro": "^4.15.9",
"sass": "^1.78.0",
"sharp": "^0.33.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/toolbar-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"./app": "./dist/app.js"
},
"devDependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/view-transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"devDependencies": {
"@astrojs/tailwind": "^5.1.1",
"@astrojs/node": "^8.3.3",
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.11.4",
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^5.2.0",
"astro": "^4.15.8",
"astro": "^4.15.9",
"hast-util-select": "^6.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.8"
"astro": "^4.15.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/mdx": "^3.1.7",
"@astrojs/preact": "^3.5.3",
"astro": "^4.15.8",
"astro": "^4.15.9",
"preact": "^10.23.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.5.3",
"@nanostores/preact": "^0.5.2",
"astro": "^4.15.8",
"astro": "^4.15.9",
"nanostores": "^0.11.3",
"preact": "^10.23.2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/mdx": "^3.1.7",
"@astrojs/tailwind": "^5.1.1",
"@types/canvas-confetti": "^1.6.4",
"astro": "^4.15.8",
"astro": "^4.15.9",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.45",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^4.15.8",
"astro": "^4.15.9",
"vitest": "^2.0.5"
}
}
12 changes: 12 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# astro

## 4.15.9

### Patch Changes

- [#12034](https://github.com/withastro/astro/pull/12034) [`5b3ddfa`](https://github.com/withastro/astro/commit/5b3ddfadcb2d09b6cbd9cd42641f30ca565d0f58) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the middleware wasn't called when a project uses `404.astro`.

- [#12042](https://github.com/withastro/astro/pull/12042) [`243ecb6`](https://github.com/withastro/astro/commit/243ecb6d6146dc483b4726d0e76142fb25e56243) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments where `crypto` isn't supported.

- [#12038](https://github.com/withastro/astro/pull/12038) [`26ea5e8`](https://github.com/withastro/astro/commit/26ea5e814ab8c973e683fff62389fda28c180940) Thanks [@ascorbic](https://github.com/ascorbic)! - Resolves image paths in content layer with initial slash as project-relative

When using the `image()` schema helper, previously paths with an initial slash were treated as public URLs. This was to match the behavior of markdown images. However this is a change from before, where paths with an initial slash were treated as project-relative. This change restores the previous behavior, so that paths with an initial slash are treated as project-relative.

## 4.15.8

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "4.15.8",
"version": "4.15.9",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down Expand Up @@ -129,7 +129,7 @@
"@babel/core": "^7.25.2",
"@babel/plugin-transform-react-jsx": "^7.25.2",
"@babel/types": "^7.25.6",
"@oslojs/encoding": "^0.4.1",
"@oslojs/encoding": "^1.0.0",
"@rollup/pluginutils": "^5.1.0",
"@types/babel__core": "^7.20.5",
"@types/cookie": "^0.6.0",
Expand Down
15 changes: 9 additions & 6 deletions packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './polyfill.js';
import { posix } from 'node:path';
import type {
AstroConfig,
AstroMiddlewareInstance,
AstroUserConfig,
ComponentInstance,
ContainerImportRendererFn,
Expand All @@ -21,6 +22,7 @@ import { validateConfig } from '../core/config/validate.js';
import { createKey } from '../core/encryption.js';
import { Logger } from '../core/logger/core.js';
import { nodeLogDestination } from '../core/logger/node.js';
import { NOOP_MIDDLEWARE_FN } from '../core/middleware/noop-middleware.js';
import { removeLeadingForwardSlash } from '../core/path.js';
import { RenderContext } from '../core/render-context.js';
import { getParts, validateSegment } from '../core/routing/manifest/create.js';
Expand Down Expand Up @@ -109,9 +111,11 @@ function createManifest(
renderers?: SSRLoadedRenderer[],
middleware?: MiddlewareHandler,
): SSRManifest {
const defaultMiddleware: MiddlewareHandler = (_, next) => {
return next();
};
function middlewareInstance(): AstroMiddlewareInstance {
return {
onRequest: middleware ?? NOOP_MIDDLEWARE_FN,
};
}

return {
hrefRoot: import.meta.url,
Expand All @@ -130,7 +134,7 @@ function createManifest(
inlinedScripts: manifest?.inlinedScripts ?? new Map(),
i18n: manifest?.i18n,
checkOrigin: false,
middleware: manifest?.middleware ?? middleware ?? defaultMiddleware,
middleware: manifest?.middleware ?? middlewareInstance,
experimentalEnvGetSecretEnabled: false,
key: createKey(),
};
Expand Down Expand Up @@ -476,11 +480,10 @@ export class experimental_AstroContainer {
params: options.params,
type: routeType,
});
const renderContext = RenderContext.create({
const renderContext = await RenderContext.create({
pipeline: this.#pipeline,
routeData,
status: 200,
middleware: this.#pipeline.middleware,
request,
pathname: url.pathname,
locals: options?.locals ?? {},
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/container/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ContainerPipeline extends Pipeline {
return Promise.resolve(componentInstance);
},
renderers: this.manifest.renderers,
onRequest: this.manifest.middleware,
onRequest: this.resolvedMiddleware,
});
}

Expand Down
5 changes: 3 additions & 2 deletions packages/astro/src/core/app/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { decodeKey } from '../encryption.js';
import { NOOP_MIDDLEWARE_FN } from '../middleware/noop-middleware.js';
import { deserializeRouteData } from '../routing/manifest/serialization.js';
import type { RouteInfo, SSRManifest, SerializedSSRManifest } from './types.js';

Expand All @@ -23,8 +24,8 @@ export function deserializeManifest(serializedManifest: SerializedSSRManifest):

return {
// in case user middleware exists, this no-op middleware will be reassigned (see plugin-ssr.ts)
middleware(_, next) {
return next();
middleware() {
return { onRequest: NOOP_MIDDLEWARE_FN };
},
...serializedManifest,
assets,
Expand Down
Loading

0 comments on commit f998cf8

Please sign in to comment.