Merge branch 'main' into add-minification2
This commit is contained in:
commit
62568aa397
57 changed files with 913 additions and 985 deletions
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/mdx": "^0.19.1",
|
||||||
"@astrojs/mdx": "^0.19.0",
|
"@astrojs/rss": "^2.4.1",
|
||||||
"@astrojs/rss": "^2.4.0",
|
"@astrojs/sitemap": "^1.3.0",
|
||||||
"@astrojs/sitemap": "^1.2.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/deno": "^4.1.0"
|
"@astrojs/deno": "^4.1.0"
|
||||||
|
|
|
@ -11,18 +11,18 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@algolia/client-search": "^4.17.0",
|
||||||
"preact": "^10.7.3",
|
|
||||||
"react": "^18.1.0",
|
|
||||||
"react-dom": "^18.1.0",
|
|
||||||
"@astrojs/react": "^2.1.1",
|
|
||||||
"@astrojs/preact": "^2.1.0",
|
"@astrojs/preact": "^2.1.0",
|
||||||
"@algolia/client-search": "^4.13.1",
|
"@astrojs/react": "^2.1.3",
|
||||||
"@docsearch/css": "^3.1.0",
|
"@docsearch/css": "^3.3.4",
|
||||||
"@docsearch/react": "^3.1.0",
|
"@docsearch/react": "^3.3.4",
|
||||||
"@types/react": "^17.0.45",
|
"@types/node": "^18.16.3",
|
||||||
"@types/node": "^18.0.0",
|
"@types/react": "^18.2.5",
|
||||||
"@types/react-dom": "^18.0.0"
|
"@types/react-dom": "^18.2.3",
|
||||||
|
"astro": "^2.4.1",
|
||||||
|
"preact": "^10.13.2",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"html-escaper": "^3.0.3"
|
"html-escaper": "^3.0.3"
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
|
||||||
"alpinejs": "^3.10.2",
|
|
||||||
"@astrojs/alpinejs": "^0.2.1",
|
"@astrojs/alpinejs": "^0.2.1",
|
||||||
"@types/alpinejs": "^3.7.0"
|
"@types/alpinejs": "^3.7.1",
|
||||||
|
"alpinejs": "^3.12.0",
|
||||||
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
|
||||||
"lit": "^2.7.0",
|
|
||||||
"@astrojs/lit": "^2.0.1",
|
"@astrojs/lit": "^2.0.1",
|
||||||
"@webcomponents/template-shadowroot": "^0.2.1"
|
"@webcomponents/template-shadowroot": "^0.2.1",
|
||||||
|
"astro": "^2.4.1",
|
||||||
|
"lit": "^2.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,17 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
|
||||||
"preact": "^10.7.3",
|
|
||||||
"react": "^18.1.0",
|
|
||||||
"react-dom": "^18.1.0",
|
|
||||||
"solid-js": "^1.4.3",
|
|
||||||
"svelte": "^3.48.0",
|
|
||||||
"vue": "^3.2.37",
|
|
||||||
"@astrojs/preact": "^2.1.0",
|
"@astrojs/preact": "^2.1.0",
|
||||||
"@astrojs/react": "^2.1.1",
|
"@astrojs/react": "^2.1.3",
|
||||||
"@astrojs/solid-js": "^2.1.0",
|
"@astrojs/solid-js": "^2.1.1",
|
||||||
"@astrojs/svelte": "^2.1.0",
|
"@astrojs/svelte": "^2.1.1",
|
||||||
"@astrojs/vue": "^2.1.1"
|
"@astrojs/vue": "^2.1.1",
|
||||||
|
"astro": "^2.4.1",
|
||||||
|
"preact": "^10.13.2",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"solid-js": "^1.7.4",
|
||||||
|
"svelte": "^3.58.0",
|
||||||
|
"vue": "^3.2.47"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
|
||||||
"preact": "^10.7.3",
|
|
||||||
"@astrojs/preact": "^2.1.0",
|
"@astrojs/preact": "^2.1.0",
|
||||||
"@preact/signals": "^1.1.0"
|
"@preact/signals": "^1.1.3",
|
||||||
|
"astro": "^2.4.1",
|
||||||
|
"preact": "^10.13.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/react": "^2.1.3",
|
||||||
"react": "^18.1.0",
|
"@types/react": "^18.2.5",
|
||||||
"react-dom": "^18.1.0",
|
"@types/react-dom": "^18.2.3",
|
||||||
"@astrojs/react": "^2.1.1",
|
"astro": "^2.4.1",
|
||||||
"@types/react": "^18.0.10",
|
"react": "^18.2.0",
|
||||||
"@types/react-dom": "^18.0.5"
|
"react-dom": "^18.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/solid-js": "^2.1.1",
|
||||||
"solid-js": "^1.4.3",
|
"astro": "^2.4.1",
|
||||||
"@astrojs/solid-js": "^2.1.0"
|
"solid-js": "^1.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"svelte": "^3.48.0",
|
"@astrojs/svelte": "^2.1.1",
|
||||||
"@astrojs/svelte": "^2.1.0",
|
"astro": "^2.4.1",
|
||||||
"astro": "^2.3.2"
|
"svelte": "^3.58.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/vue": "^2.1.1",
|
||||||
"vue": "^3.2.37",
|
"astro": "^2.4.1",
|
||||||
"@astrojs/vue": "^2.1.1"
|
"vue": "^3.2.47"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^5.1.1",
|
"@astrojs/node": "^5.1.2",
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -12,12 +12,8 @@
|
||||||
"server": "node dist/server/entry.mjs"
|
"server": "node dist/server/entry.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "workspace:*",
|
"@astrojs/node": "^5.1.2",
|
||||||
"svelte": "^3.48.0",
|
"astro": "^2.4.1",
|
||||||
"@astrojs/node": "workspace:*",
|
|
||||||
"concurrently": "^7.2.1",
|
|
||||||
"unocss": "^0.15.6",
|
|
||||||
"vite-imagetools": "^4.0.4",
|
|
||||||
"html-minifier": "^4.0.0"
|
"html-minifier": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
examples/middleware/src/env.d.ts
vendored
6
examples/middleware/src/env.d.ts
vendored
|
@ -1,6 +1,5 @@
|
||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client" />
|
||||||
declare global {
|
declare namespace App {
|
||||||
namespace AstroMiddleware {
|
|
||||||
interface Locals {
|
interface Locals {
|
||||||
user: {
|
user: {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -8,6 +7,3 @@ declare global {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export {};
|
|
||||||
|
|
|
@ -63,9 +63,7 @@ const validation = defineMiddleware(async (context, next) => {
|
||||||
return context.redirect('/admin');
|
return context.redirect('/admin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we don't really care about awaiting the response in this case
|
return next();
|
||||||
next();
|
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const onRequest = sequence(validation, minifier);
|
export const onRequest = sequence(validation, minifier);
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { APIRoute } from 'astro';
|
|
||||||
|
|
||||||
export const post: APIRoute = async ({ request }) => {
|
|
||||||
const data = await request.formData();
|
|
||||||
const username = data.get('username');
|
|
||||||
const password = data.get('password');
|
|
||||||
return new Response(
|
|
||||||
JSON.stringify({
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'content-type': 'application/json',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,9 @@
|
||||||
"server": "node dist/server/entry.mjs"
|
"server": "node dist/server/entry.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/node": "^5.1.2",
|
||||||
"svelte": "^3.48.0",
|
"@astrojs/svelte": "^2.1.1",
|
||||||
"@astrojs/svelte": "^2.1.0",
|
"astro": "^2.4.1",
|
||||||
"@astrojs/node": "^5.1.1",
|
"svelte": "^3.58.0"
|
||||||
"concurrently": "^7.2.1",
|
|
||||||
"unocss": "^0.15.6",
|
|
||||||
"vite-imagetools": "^4.0.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdoc": "^0.1.1",
|
"@astrojs/markdoc": "^0.1.2",
|
||||||
"astro": "^2.3.2",
|
"astro": "^2.4.1",
|
||||||
"kleur": "^4.1.5"
|
"kleur": "^4.1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/markdown-remark": "^2.2.0",
|
||||||
"@astrojs/markdown-remark": "^2.1.4",
|
"astro": "^2.4.1",
|
||||||
"hast-util-select": "5.0.1",
|
"hast-util-select": "^5.0.5",
|
||||||
"rehype-autolink-headings": "^6.1.1",
|
"rehype-autolink-headings": "^6.1.1",
|
||||||
"rehype-slug": "^5.0.1",
|
"rehype-slug": "^5.1.0",
|
||||||
"rehype-toc": "^3.0.2",
|
"rehype-toc": "^3.0.2",
|
||||||
"remark-code-titles": "^0.1.2"
|
"remark-code-titles": "^0.1.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2"
|
"astro": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"@astrojs/mdx": "^0.19.1",
|
||||||
"preact": "^10.6.5",
|
|
||||||
"@astrojs/preact": "^2.1.0",
|
"@astrojs/preact": "^2.1.0",
|
||||||
"@astrojs/mdx": "^0.19.0"
|
"astro": "^2.4.1",
|
||||||
|
"preact": "^10.13.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
|
||||||
"preact": "^10.7.3",
|
|
||||||
"@astrojs/preact": "^2.1.0",
|
"@astrojs/preact": "^2.1.0",
|
||||||
"nanostores": "^0.5.12",
|
"@nanostores/preact": "^0.4.1",
|
||||||
"@nanostores/preact": "^0.1.3"
|
"astro": "^2.4.1",
|
||||||
|
"nanostores": "^0.8.1",
|
||||||
|
"preact": "^10.13.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^0.19.0",
|
"@astrojs/mdx": "^0.19.1",
|
||||||
"@astrojs/tailwind": "^3.1.1",
|
"@astrojs/tailwind": "^3.1.2",
|
||||||
"@types/canvas-confetti": "^1.4.3",
|
"@types/canvas-confetti": "^1.6.0",
|
||||||
"astro": "^2.3.2",
|
"astro": "^2.4.1",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"canvas-confetti": "^1.5.1",
|
"canvas-confetti": "^1.6.0",
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"tailwindcss": "^3.3.2"
|
"tailwindcss": "^3.3.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"astro": "^2.4.1",
|
||||||
"vite-plugin-pwa": "0.11.11",
|
"vite-plugin-pwa": "0.14.7",
|
||||||
"workbox-window": "^6.5.3"
|
"workbox-window": "^6.5.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.3.2",
|
"astro": "^2.4.1",
|
||||||
"vitest": "^0.20.3"
|
"vitest": "^0.31.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
# astro
|
# astro
|
||||||
|
|
||||||
|
## 2.4.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7034](https://github.com/withastro/astro/pull/7034) [`c00997033`](https://github.com/withastro/astro/commit/c0099703338cf81e2b381e6e754c73b442db4eab) Thanks [@bluwy](https://github.com/bluwy)! - Fix `astro:assets` SSR error
|
||||||
|
|
||||||
|
- [#7032](https://github.com/withastro/astro/pull/7032) [`157357e1f`](https://github.com/withastro/astro/commit/157357e1fb6ff2c14a717230cc485fb76a3fea03) Thanks [@raulfdm](https://github.com/raulfdm)! - fix middleware typing export for "moduleResolution: node"
|
||||||
|
|
||||||
|
## 2.4.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7009](https://github.com/withastro/astro/pull/7009) [`1d4db68e6`](https://github.com/withastro/astro/commit/1d4db68e64b7c3faf8863bf67f8332aa28e2f34b) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix types from `astro/client` not working properly due to `client-base.d.ts` being an non-ambient declaration file
|
||||||
|
|
||||||
|
- [#7010](https://github.com/withastro/astro/pull/7010) [`e9f0dd9b4`](https://github.com/withastro/astro/commit/e9f0dd9b473c4793c958a6c81e743fd9b02b4f64) Thanks [@ematipico](https://github.com/ematipico)! - Call `next()` without return anything should work, with a warning
|
||||||
|
|
||||||
## 2.4.1
|
## 2.4.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
2
packages/astro/client-base.d.ts
vendored
2
packages/astro/client-base.d.ts
vendored
|
@ -389,7 +389,7 @@ declare module '*?inline' {
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
export namespace App {
|
declare namespace App {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
export interface Locals {}
|
export interface Locals {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "astro",
|
"name": "astro",
|
||||||
"version": "2.4.1",
|
"version": "2.4.3",
|
||||||
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -20,6 +20,9 @@
|
||||||
],
|
],
|
||||||
"app/*": [
|
"app/*": [
|
||||||
"./dist/core/app/*"
|
"./dist/core/app/*"
|
||||||
|
],
|
||||||
|
"middleware": [
|
||||||
|
"./dist/core/middleware/index.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,7 @@ import fs from 'node:fs';
|
||||||
import { basename, join } from 'node:path/posix';
|
import { basename, join } from 'node:path/posix';
|
||||||
import type { StaticBuildOptions } from '../core/build/types.js';
|
import type { StaticBuildOptions } from '../core/build/types.js';
|
||||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||||
|
import { warn } from '../core/logger/core.js';
|
||||||
import { prependForwardSlash } from '../core/path.js';
|
import { prependForwardSlash } from '../core/path.js';
|
||||||
import { isLocalService, type ImageService, type LocalImageService } from './services/service.js';
|
import { isLocalService, type ImageService, type LocalImageService } from './services/service.js';
|
||||||
import type { GetImageResult, ImageMetadata, ImageTransform } from './types.js';
|
import type { GetImageResult, ImageMetadata, ImageTransform } from './types.js';
|
||||||
|
@ -103,9 +104,10 @@ export async function generateImage(
|
||||||
try {
|
try {
|
||||||
await fs.promises.mkdir(assetsCacheDir, { recursive: true });
|
await fs.promises.mkdir(assetsCacheDir, { recursive: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(
|
warn(
|
||||||
'An error was encountered while creating the cache directory. Proceeding without caching. Error: ',
|
buildOpts.logging,
|
||||||
err
|
'astro:assets',
|
||||||
|
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${err}`
|
||||||
);
|
);
|
||||||
useCache = false;
|
useCache = false;
|
||||||
}
|
}
|
||||||
|
@ -160,9 +162,10 @@ export async function generateImage(
|
||||||
await fs.promises.writeFile(cachedFileURL, resultData.data);
|
await fs.promises.writeFile(cachedFileURL, resultData.data);
|
||||||
await fs.promises.copyFile(cachedFileURL, finalFileURL);
|
await fs.promises.copyFile(cachedFileURL, finalFileURL);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
warn(
|
||||||
`There was an error creating the cache entry for ${filepath}. Attempting to write directly to output directory. Error: `,
|
buildOpts.logging,
|
||||||
e
|
'astro:assets',
|
||||||
|
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${e}`
|
||||||
);
|
);
|
||||||
await fs.promises.writeFile(finalFileURL, resultData.data);
|
await fs.promises.writeFile(finalFileURL, resultData.data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ const ONLY_DEV_EXTERNAL = [
|
||||||
'shiki',
|
'shiki',
|
||||||
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
|
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
|
||||||
'prismjs/components/index.js',
|
'prismjs/components/index.js',
|
||||||
|
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
|
||||||
|
'string-width',
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Return a common starting point for all Vite actions */
|
/** Return a common starting point for all Vite actions */
|
||||||
|
|
|
@ -46,9 +46,11 @@ export async function callMiddleware<R>(
|
||||||
});
|
});
|
||||||
|
|
||||||
let nextCalled = false;
|
let nextCalled = false;
|
||||||
|
let responseFunctionPromise: Promise<R> | undefined = undefined;
|
||||||
const next: MiddlewareNext<R> = async () => {
|
const next: MiddlewareNext<R> = async () => {
|
||||||
nextCalled = true;
|
nextCalled = true;
|
||||||
return await responseFunction();
|
responseFunctionPromise = responseFunction();
|
||||||
|
return responseFunctionPromise;
|
||||||
};
|
};
|
||||||
|
|
||||||
let middlewarePromise = onRequest(apiContext, next);
|
let middlewarePromise = onRequest(apiContext, next);
|
||||||
|
@ -74,8 +76,11 @@ export async function callMiddleware<R>(
|
||||||
/**
|
/**
|
||||||
* Here we handle the case where `next` was called and returned nothing.
|
* Here we handle the case where `next` was called and returned nothing.
|
||||||
*/
|
*/
|
||||||
const responseResult = await responseFunction();
|
if (responseFunctionPromise) {
|
||||||
return responseResult;
|
return responseFunctionPromise;
|
||||||
|
} else {
|
||||||
|
throw new AstroError(AstroErrorData.MiddlewareNotAResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (typeof value === 'undefined') {
|
} else if (typeof value === 'undefined') {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,7 @@ const third = defineMiddleware(async (context, next) => {
|
||||||
} else if (context.request.url.includes('/does-nothing')) {
|
} else if (context.request.url.includes('/does-nothing')) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
export const onRequest = sequence(first, second, third);
|
export const onRequest = sequence(first, second, third);
|
||||||
|
|
11
packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs
vendored
Normal file
11
packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
import tailwind from '@astrojs/tailwind';
|
||||||
|
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
integrations: [tailwind()],
|
||||||
|
experimental: {
|
||||||
|
middleware: true,
|
||||||
|
}
|
||||||
|
});
|
9
packages/astro/test/fixtures/middleware-tailwind/package.json
vendored
Normal file
9
packages/astro/test/fixtures/middleware-tailwind/package.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "@test/middleware-tailwind",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"astro": "workspace:*",
|
||||||
|
"@astrojs/tailwind": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
3
packages/astro/test/fixtures/middleware-tailwind/src/middleware.js
vendored
Normal file
3
packages/astro/test/fixtures/middleware-tailwind/src/middleware.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export const onRequest = (_, next) => {
|
||||||
|
next();
|
||||||
|
}
|
7
packages/astro/test/fixtures/middleware-tailwind/src/pages/index.astro
vendored
Normal file
7
packages/astro/test/fixtures/middleware-tailwind/src/pages/index.astro
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<h1 class="text-blue-500 text-2xl font-bold">Hello world</h1>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -77,8 +77,6 @@ describe('Middleware in DEV mode', () => {
|
||||||
describe('Middleware in PROD mode, SSG', () => {
|
describe('Middleware in PROD mode, SSG', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
let fixture;
|
let fixture;
|
||||||
/** @type {import('./test-utils').PreviewServer} */
|
|
||||||
let previewServer;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
|
@ -200,3 +198,25 @@ describe('Middleware API in PROD mode, SSR', () => {
|
||||||
expect($('title').html()).to.not.equal('MiddlewareNoDataReturned');
|
expect($('title').html()).to.not.equal('MiddlewareNoDataReturned');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Middleware with tailwind', () => {
|
||||||
|
/** @type {import('./test-utils').Fixture} */
|
||||||
|
let fixture;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
fixture = await loadFixture({
|
||||||
|
root: './fixtures/middleware-tailwind/',
|
||||||
|
});
|
||||||
|
await fixture.build();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly emit the tailwind CSS file', async () => {
|
||||||
|
const html = await fixture.readFile('/index.html');
|
||||||
|
const $ = cheerio.load(html);
|
||||||
|
const bundledCSSHREF = $('link[rel=stylesheet][href^=/_astro/]').attr('href');
|
||||||
|
const bundledCSS = (await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/')))
|
||||||
|
.replace(/\s/g, '')
|
||||||
|
.replace('/n', '');
|
||||||
|
expect(bundledCSS.includes('--tw-content')).to.be.true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
"tiny-glob": "^0.2.9"
|
"tiny-glob": "^0.2.9"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "workspace:*",
|
"astro": "workspace:*",
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
"esbuild": "^0.15.18"
|
"esbuild": "^0.15.18"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "workspace:*",
|
"astro": "workspace:*",
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
"vite": "^4.3.1"
|
"vite": "^4.3.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1",
|
"astro": "workspace:^2.4.3",
|
||||||
"sharp": ">=0.31.0"
|
"sharp": ">=0.31.0"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"zod": "^3.17.3"
|
"zod": "^3.17.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.1",
|
"@types/chai": "^4.3.1",
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"esbuild": "^0.15.18"
|
"esbuild": "^0.15.18"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@netlify/edge-functions": "^2.0.0",
|
"@netlify/edge-functions": "^2.0.0",
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"server-destroy": "^1.0.1"
|
"server-destroy": "^1.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/send": "^0.17.1",
|
"@types/send": "^0.17.1",
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# @astrojs/partytown
|
# @astrojs/partytown
|
||||||
|
|
||||||
|
## 1.2.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7001](https://github.com/withastro/astro/pull/7001) [`ad5c75447`](https://github.com/withastro/astro/commit/ad5c75447af9cfbdcb1f288c5c17229fbd3d6dd2) Thanks [@Waxer59](https://github.com/Waxer59)! - Fixed a code example that was wrongly closed
|
||||||
|
|
||||||
## 1.2.0
|
## 1.2.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default defineConfig({
|
||||||
integrations: [partytown({
|
integrations: [partytown({
|
||||||
// Example: Disable debug mode.
|
// Example: Disable debug mode.
|
||||||
config: { debug: false },
|
config: { debug: false },
|
||||||
|
})]
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/partytown",
|
"name": "@astrojs/partytown",
|
||||||
"description": "Use Partytown to move scripts into a web worker in your Astro project",
|
"description": "Use Partytown to move scripts into a web worker in your Astro project",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
"vite": "^4.3.1"
|
"vite": "^4.3.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1",
|
"astro": "workspace:^2.4.3",
|
||||||
"svelte": "^3.54.0"
|
"svelte": "^3.54.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
"vite": "^4.3.1"
|
"vite": "^4.3.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1",
|
"astro": "workspace:^2.4.3",
|
||||||
"tailwindcss": "^3.0.24"
|
"tailwindcss": "^3.0.24"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
"web-vitals": "^3.1.1"
|
"web-vitals": "^3.1.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1"
|
"astro": "workspace:^2.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/set-cookie-parser": "^2.4.2",
|
"@types/set-cookie-parser": "^2.4.2",
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
"vue": "^3.2.37"
|
"vue": "^3.2.37"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^2.4.1",
|
"astro": "workspace:^2.4.3",
|
||||||
"vue": "^3.2.30"
|
"vue": "^3.2.30"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
1538
pnpm-lock.yaml
1538
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue