Skip to content

Commit

Permalink
Merge branch 'main' into fix-integration-defined-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Nov 10, 2023
2 parents f65f700 + 1e97708 commit bddfd68
Show file tree
Hide file tree
Showing 47 changed files with 182 additions and 113 deletions.
5 changes: 0 additions & 5 deletions .changeset/blue-mice-hide.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/silent-experts-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Fixes an issue where a successful "Dependencies installed" message is displayed even when installing dependencies fails.
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": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^1.1.4",
"@astrojs/rss": "^3.0.0",
"@astrojs/sitemap": "^3.0.3",
"astro": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.5.0"
"astro": "^3.5.1"
},
"peerDependencies": {
"astro": "^3.0.0"
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.3.1",
"@types/alpinejs": "^3.7.2",
"alpinejs": "^3.12.3",
"astro": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.0.3",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^3.5.0",
"astro": "^3.5.1",
"lit": "^2.8.0"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/solid-js": "^3.0.2",
"@astrojs/svelte": "^4.0.3",
"@astrojs/vue": "^3.0.4",
"astro": "^3.5.0",
"astro": "^3.5.1",
"preact": "^10.17.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
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.0.1",
"@preact/signals": "^1.2.1",
"astro": "^3.5.0",
"astro": "^3.5.1",
"preact": "^10.17.1"
}
}
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.0.4",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"astro": "^3.5.0",
"astro": "^3.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
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": "^3.0.2",
"astro": "^3.5.0",
"astro": "^3.5.1",
"solid-js": "^1.7.11"
}
}
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": "^4.0.3",
"astro": "^3.5.0",
"astro": "^3.5.1",
"svelte": "^4.2.0"
}
}
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": "^3.0.4",
"astro": "^3.5.0",
"astro": "^3.5.1",
"vue": "^3.3.4"
}
}
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": "^6.0.3",
"astro": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.5.0"
"astro": "^3.5.1"
},
"peerDependencies": {
"astro": "^3.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": "^6.0.3",
"astro": "^3.5.0",
"astro": "^3.5.1",
"html-minifier": "^4.0.0"
}
}
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": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^6.0.3",
"@astrojs/svelte": "^4.0.3",
"astro": "^3.5.0",
"astro": "^3.5.1",
"svelte": "^4.2.0"
}
}
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.0.2",
"@astrojs/node": "^6.0.3",
"astro": "^3.5.0"
"astro": "^3.5.1"
}
}
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.7.1",
"astro": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^3.4.0",
"astro": "^3.5.0",
"astro": "^3.5.1",
"hast-util-select": "^5.0.5",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.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": "^3.5.0"
"astro": "^3.5.1"
}
}
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": "^1.1.4",
"@astrojs/preact": "^3.0.1",
"astro": "^3.5.0",
"astro": "^3.5.1",
"preact": "^10.17.1"
}
}
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.0.1",
"@nanostores/preact": "^0.5.0",
"astro": "^3.5.0",
"astro": "^3.5.1",
"nanostores": "^0.9.3",
"preact": "^10.17.1"
}
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": "^1.1.4",
"@astrojs/tailwind": "^5.0.2",
"@types/canvas-confetti": "^1.6.0",
"astro": "^3.5.0",
"astro": "^3.5.1",
"autoprefixer": "^10.4.15",
"canvas-confetti": "^1.6.0",
"postcss": "^8.4.28",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.5.0",
"astro": "^3.5.1",
"vite-plugin-pwa": "0.16.4",
"workbox-window": "^7.0.0"
}
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": "^3.5.0",
"astro": "^3.5.1",
"vitest": "^0.34.2"
}
}
14 changes: 14 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# astro

## 3.5.1

### Patch Changes

- [#9037](https://github.com/withastro/astro/pull/9037) [`ea71975ec`](https://github.com/withastro/astro/commit/ea71975ec0c99f407f0e2fd0c248a959284d2068) Thanks [@sarah11918](https://github.com/sarah11918)! - Updates i18n configuration reference

- [#9051](https://github.com/withastro/astro/pull/9051) [`15b84ccb9`](https://github.com/withastro/astro/commit/15b84ccb9859b070e30030015fca0de090a7b079) Thanks [@ematipico](https://github.com/ematipico)! - Fix a regression where endpoints were incorrectly processed during SSG build when `trailingSlash: "always"`

- [#9042](https://github.com/withastro/astro/pull/9042) [`7dedd17fc`](https://github.com/withastro/astro/commit/7dedd17fc4c48aba31d9d39a10a94cd271b19746) Thanks [@rishi-raj-jain](https://github.com/rishi-raj-jain)! - Safely bail when the `xclip` command does not exist on Linux when trying to copy to clipboard with `astro info`

- [#9050](https://github.com/withastro/astro/pull/9050) [`bf0286e50`](https://github.com/withastro/astro/commit/bf0286e50c09f8b5a08af63d7837add69af9b7e4) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix --verbose flag not working

- [#9049](https://github.com/withastro/astro/pull/9049) [`49b82edb2`](https://github.com/withastro/astro/commit/49b82edb2c0d5058ec1adaed33d8b027220091c1) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix image errors when images were used on the client

## 3.5.0

### Minor Changes
Expand Down
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": "3.5.0",
"version": "3.5.1",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down
16 changes: 13 additions & 3 deletions packages/astro/src/assets/vite-plugin-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default function assets({
configResolved(viteConfig) {
resolvedConfig = viteConfig;
},
async load(id) {
async load(id, options) {
// If our import has any query params, we'll let Vite handle it
// See https://github.com/withastro/astro/issues/8333
if (id !== removeQueryString(id)) {
Expand All @@ -191,8 +191,18 @@ export default function assets({
});
}

return `
export default ${getProxyCode(meta, isServerLikeOutput(settings.config))}`;
// We can only reliably determine if an image is used on the server, as we need to track its usage throughout the entire build.
// Since you cannot use image optimization on the client anyway, it's safe to assume that if the user imported
// an image on the client, it should be present in the final build.
if (options?.ssr) {
return `export default ${getProxyCode(meta, isServerLikeOutput(settings.config))}`;
} else {
if (!globalThis.astroAsset.referencedImages)
globalThis.astroAsset.referencedImages = new Set();

globalThis.astroAsset.referencedImages.add(meta.fsPath);
return `export default ${JSON.stringify(meta)}`;
}
}
},
},
Expand Down
15 changes: 10 additions & 5 deletions packages/astro/src/cli/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ async function copyToClipboard(text: string) {
} else if (system === 'win32') {
command = 'clip';
} else {
// Unix: check if `xclip` is installed
const output = execSync('which xclip', { encoding: 'utf8' });
if (output[0] !== '/') {
// Did not find a path for xclip, bail out!
try {
// Unix: check if `xclip` is installed
const output = execSync('which xclip', { encoding: 'utf8' });
if (output[0] !== '/') {
// Did not find a path for xclip, bail out!
return;
}
command = 'xclip -sel clipboard -l 1';
} catch (e) {
// Did not find xclip, bail out!
return;
}
command = 'xclip -sel clipboard -l 1';
}

console.log();
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/core/logger/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const logger = {
};

export function enableVerboseLogging() {
debugPackage.enable('*,-babel');
debug('cli', '--verbose flag enabled! Enabling: DEBUG="*,-babel"');
debug(
'cli',
Expand Down
39 changes: 19 additions & 20 deletions packages/astro/src/core/render/route-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ export async function callGetStaticPaths({
ssr,
}: CallGetStaticPathsOptions): Promise<GetStaticPathsResultKeyed> {
const cached = routeCache.get(route);
if (cached?.staticPaths) return cached.staticPaths;

if (mod) {
validateDynamicRouteModule(mod, { ssr, route });
if (!mod) {
throw new Error('This is an error caused by Astro and not your code. Please file an issue.');
}
if (cached?.staticPaths) {
return cached.staticPaths;
}

validateDynamicRouteModule(mod, { ssr, route });

// No static paths in SSR mode. Return an empty RouteCacheEntry.
if (ssr && !route.prerender) {
const entry: GetStaticPathsResultKeyed = Object.assign([], { keyed: new Map() });
Expand All @@ -47,24 +50,20 @@ export async function callGetStaticPaths({
let staticPaths: GetStaticPathsResult = [];
// Add a check here to make TypeScript happy.
// This is already checked in validateDynamicRouteModule().
if (mod) {
if (!mod.getStaticPaths) {
throw new Error('Unexpected Error.');
}

if (mod) {
// Calculate your static paths.
staticPaths = await mod.getStaticPaths({
// Q: Why the cast?
// A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
paginate: generatePaginateFunction(route) as PaginateFunction,
rss() {
throw new AstroError(AstroErrorData.GetStaticPathsRemovedRSSHelper);
},
});
}
if (!mod.getStaticPaths) {
throw new Error('Unexpected Error.');
}

// Calculate your static paths.
staticPaths = await mod.getStaticPaths({
// Q: Why the cast?
// A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
paginate: generatePaginateFunction(route) as PaginateFunction,
rss() {
throw new AstroError(AstroErrorData.GetStaticPathsRemovedRSSHelper);
},
});

validateGetStaticPathsResult(staticPaths, logger, route);

const keyedStaticPaths = staticPaths as GetStaticPathsResultKeyed;
Expand Down
Loading

0 comments on commit bddfd68

Please sign in to comment.