Merge branch 'main' into test/e2e-hydration
This commit is contained in:
commit
2d833cecaa
40 changed files with 2414 additions and 73 deletions
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Include server CSS in the SSR manifest assets
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Expose `file` and `url` properties when fetching `.astro` files with `Astro.glob()`
|
|
@ -9,6 +9,6 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/preact": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"sass": "^1.51.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/preact": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"preact": "^10.7.2"
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@example/my-component": "workspace:*",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
"serve": "astro --root demo preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
"devDependencies": {
|
||||
"@astrojs/preact": "^0.1.2",
|
||||
"@astrojs/react": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"alpinejs": "^3.10.2"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/lit": "^0.1.3",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"@webcomponents/template-shadowroot": "^0.1.0",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"@astrojs/solid-js": "^0.1.2",
|
||||
"@astrojs/svelte": "^0.1.3",
|
||||
"@astrojs/vue": "^0.1.4",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"@webcomponents/template-shadowroot": "^0.1.0",
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/preact": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"preact": "^10.7.2"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/react": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/react": "^18.0.9",
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/solid-js": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"solid-js": "^1.4.2"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/svelte": "^0.1.3",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"svelte": "^3.48.0"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/vue": "^0.1.4",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.34"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"@astrojs/solid-js": "0.1.2",
|
||||
"@astrojs/tailwind": "^0.2.1",
|
||||
"@astrojs/turbolinks": "^0.1.3",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"solid-js": "^1.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/preact": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"sass": "^1.51.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"devDependencies": {
|
||||
"@astrojs/node": "^0.1.1",
|
||||
"@astrojs/svelte": "^0.1.3",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"concurrently": "^7.2.0",
|
||||
"lightcookie": "^1.0.25",
|
||||
"unocss": "^0.15.6",
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/react": "^0.1.2",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"sass": "^1.51.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/markdown-remark": "^0.9.4",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"hast-util-select": "5.0.1",
|
||||
"rehype-autolink-headings": "^6.1.1",
|
||||
"rehype-slug": "^5.0.1",
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/markdown-remark": "^0.9.4",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"@astrojs/react": "^0.1.2",
|
||||
"@astrojs/svelte": "^0.1.3",
|
||||
"@astrojs/vue": "^0.1.4",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"preact": "^10.7.2",
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
"@astrojs/solid-js": "^0.1.2",
|
||||
"@astrojs/svelte": "^0.1.3",
|
||||
"@astrojs/vue": "^0.1.4",
|
||||
"astro": "^1.0.0-beta.30"
|
||||
"astro": "^1.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/tailwind": "^0.2.1",
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"canvas-confetti": "^1.5.1",
|
||||
"postcss": "^8.4.14",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"preview": "astro preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^1.0.0-beta.30",
|
||||
"astro": "^1.0.0-beta.31",
|
||||
"vite-plugin-pwa": "0.11.11",
|
||||
"workbox-window": "^6.5.3"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
# astro
|
||||
|
||||
## 1.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#3402](https://github.com/withastro/astro/pull/3402) [`0c9f770e`](https://github.com/withastro/astro/commit/0c9f770e8ab361f11549f1e24114e557fdcca65d) Thanks [@matthewp](https://github.com/matthewp)! - Include server CSS in the SSR manifest assets
|
||||
|
||||
* [#3406](https://github.com/withastro/astro/pull/3406) [`4007aebc`](https://github.com/withastro/astro/commit/4007aebc6aba8d732abed7c001f59e61678ea3f2) Thanks [@matthewp](https://github.com/matthewp)! - Provides a better error message when using @adobe/react-spectrum
|
||||
|
||||
- [#3385](https://github.com/withastro/astro/pull/3385) [`d34859d7`](https://github.com/withastro/astro/commit/d34859d75008812fcd101e197ce835bcc1ee2017) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Expose `file` and `url` properties when fetching `.astro` files with `Astro.glob()`
|
||||
|
||||
## 1.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "astro",
|
||||
"version": "1.0.0-beta.30",
|
||||
"version": "1.0.0-beta.31",
|
||||
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
||||
"type": "module",
|
||||
"author": "withastro",
|
||||
|
|
|
@ -41,9 +41,20 @@ export function fixViteErrorMessage(_err: unknown, server: ViteDevServer) {
|
|||
return err;
|
||||
}
|
||||
|
||||
const incompatiblePackages = {
|
||||
'react-spectrum': `@adobe/react-spectrum is not compatible with Vite's server-side rendering mode at the moment. You can still use React Spectrum from the client. Create an island React component and use the client:only directive. From there you can use React Spectrum.`,
|
||||
};
|
||||
const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackages).join('|')})`);
|
||||
|
||||
function generateHint(err: ErrorWithMetadata): string | undefined {
|
||||
if (/Unknown file extension \"\.(jsx|vue|svelte|astro)\" for /.test(err.message)) {
|
||||
return 'You likely need to add this package to `vite.ssr.noExternal` in your astro config file.';
|
||||
} else {
|
||||
const res = incompatPackageExp.exec(err.stack);
|
||||
if (res) {
|
||||
const key = res[0] as keyof typeof incompatiblePackages;
|
||||
return incompatiblePackages[key];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ export default function template({
|
|||
statusCode ? `<span class="statusCode">${statusCode}: </span> ` : ''
|
||||
}<span class="statusMessage">${title}</span></h1>
|
||||
</header>
|
||||
<pre>${encode(error)}</pre>
|
||||
<pre class="error-message">${encode(error)}</pre>
|
||||
${url ? `<a target="_blank" href="${url}">${url}</a>` : ''}
|
||||
<pre>${encode(stack)}</pre>
|
||||
<pre class="error-stack">${encode(stack)}</pre>
|
||||
</main>
|
||||
</body>
|
||||
</html>`;
|
||||
|
|
|
@ -37,6 +37,14 @@ function removeViteHttpMiddleware(server: vite.Connect.Server) {
|
|||
}
|
||||
}
|
||||
|
||||
function truncateString(str: string, n: number) {
|
||||
if (str.length > n) {
|
||||
return str.substring(0, n) + '…';
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
function writeHtmlResponse(res: http.ServerResponse, statusCode: number, html: string) {
|
||||
res.writeHead(statusCode, {
|
||||
'Content-Type': 'text/html; charset=utf-8',
|
||||
|
@ -157,9 +165,9 @@ async function handle500Response(
|
|||
statusCode: 500,
|
||||
title: 'Internal Error',
|
||||
tabTitle: '500: Error',
|
||||
message: stripAnsi(err.message),
|
||||
message: stripAnsi(err.hint ?? err.message),
|
||||
url: err.url || undefined,
|
||||
stack: stripAnsi(err.stack),
|
||||
stack: truncateString(stripAnsi(err.stack), 500),
|
||||
});
|
||||
const transformedHtml = await viteServer.transformIndexHtml(pathname, html);
|
||||
writeHtmlResponse(res, 500, transformedHtml);
|
||||
|
|
29
packages/astro/test/error-react-spectrum.test.js
Normal file
29
packages/astro/test/error-react-spectrum.test.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { isWindows, loadFixture } from './test-utils.js';
|
||||
import { expect } from 'chai';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
describe('Error packages: react-spectrum', () => {
|
||||
if (isWindows) return;
|
||||
|
||||
/** @type {import('./test-utils').Fixture} */
|
||||
let fixture;
|
||||
/** @type {import('./test-utils').DevServer} */
|
||||
let devServer;
|
||||
|
||||
before(async () => {
|
||||
fixture = await loadFixture({
|
||||
root: './fixtures/error-react-spectrum',
|
||||
});
|
||||
});
|
||||
after(async () => {
|
||||
devServer && devServer.stop();
|
||||
});
|
||||
|
||||
it('properly detect syntax errors in template', async () => {
|
||||
devServer = await fixture.startDevServer();
|
||||
let html = await fixture.fetch('/').then((res) => res.text());
|
||||
let $ = cheerio.load(html);
|
||||
const msg = $('.error-message').text();
|
||||
expect(msg).to.match(/@adobe\/react-spectrum is not compatible/);
|
||||
});
|
||||
});
|
7
packages/astro/test/fixtures/error-react-spectrum/astro.config.mjs
vendored
Normal file
7
packages/astro/test/fixtures/error-react-spectrum/astro.config.mjs
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import react from '@astrojs/react';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
integrations: [react()],
|
||||
});
|
15
packages/astro/test/fixtures/error-react-spectrum/package.json
vendored
Normal file
15
packages/astro/test/fixtures/error-react-spectrum/package.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "@test/error-react-spectrum",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"astro": "workspace:*",
|
||||
"@astrojs/react": "workspace:*",
|
||||
"@adobe/react-spectrum": "^3.17.0",
|
||||
"react": "^17.0.0",
|
||||
"react-dom": "^17.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
19
packages/astro/test/fixtures/error-react-spectrum/src/pages/index.astro
vendored
Normal file
19
packages/astro/test/fixtures/error-react-spectrum/src/pages/index.astro
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
// Just importing causes a failure
|
||||
import '@adobe/react-spectrum';
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
testing
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
2312
pnpm-lock.yaml
2312
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue