Skip to content

Commit

Permalink
Merge branch 'main' into arpan-withastro#12356-locale404
Browse files Browse the repository at this point in the history
  • Loading branch information
apatel369 authored Nov 5, 2024
2 parents 1356e25 + 493fe43 commit ec56574
Show file tree
Hide file tree
Showing 44 changed files with 116 additions and 82 deletions.
5 changes: 0 additions & 5 deletions .changeset/clean-plums-tap.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/friendly-radios-live.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/heavy-walls-rhyme.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/long-monkeys-exercise.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/many-eyes-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Improves error logs when executing commands
2 changes: 1 addition & 1 deletion benchmark/bench/cli-startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function benchmarkCommand(command, args, root) {

for (let i = 0; i < 10; i++) {
const start = performance.now();
await exec(command, args, { nodeOptions: { cwd: root } });
await exec(command, args, { nodeOptions: { cwd: root }, throwOnError: true });
durations.push(performance.now() - start);
}

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench/memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function run(projectDir, outputFile) {
ASTRO_TIMER_PATH: outputFilePath,
},
},
throwOnError: true,
});

console.log('Raw results written to', outputFilePath);
Expand Down
2 changes: 2 additions & 0 deletions benchmark/bench/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function run(projectDir, outputFile) {
cwd: root,
stdio: 'inherit',
},
throwOnError: true,
});

console.log('Previewing...');
Expand All @@ -33,6 +34,7 @@ export async function run(projectDir, outputFile) {
cwd: root,
stdio: 'inherit',
},
throwOnError: true,
});

console.log('Waiting for server ready...');
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench/server-stress.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function run(projectDir, outputFile) {
cwd: root,
stdio: 'inherit',
},
throwOnError: true,
});

console.log('Previewing...');
Expand Down
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.16.8"
"astro": "^4.16.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.9",
"@astrojs/rss": "^4.0.9",
"@astrojs/sitemap": "^3.2.1",
"astro": "^4.16.8"
"astro": "^4.16.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.16.8"
"astro": "^4.16.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.16.8",
"astro": "^4.16.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.3",
"astro": "^4.16.8"
"astro": "^4.16.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.16.8",
"astro": "^4.16.9",
"lit": "^3.2.1"
}
}
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.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^4.16.8",
"astro": "^4.16.9",
"preact": "^10.24.3",
"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.16.8",
"astro": "^4.16.9",
"preact": "^10.24.3"
}
}
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.12",
"@types/react-dom": "^18.3.1",
"astro": "^4.16.8",
"astro": "^4.16.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.16.8",
"astro": "^4.16.9",
"solid-js": "^1.9.3"
}
}
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.2",
"astro": "^4.16.8",
"astro": "^4.16.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.2",
"astro": "^4.16.8",
"astro": "^4.16.9",
"vue": "^3.5.12"
}
}
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.4",
"astro": "^4.16.8"
"astro": "^4.16.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.16.8"
"astro": "^4.16.9"
},
"peerDependencies": {
"astro": "^4.0.0"
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.16.8"
"astro": "^4.16.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.16.8"
"astro": "^4.16.9"
}
}
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.4",
"@astrojs/svelte": "^5.7.2",
"astro": "^4.16.8",
"astro": "^4.16.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.16.8",
"astro": "^4.16.9",
"sass": "^1.80.4",
"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.16.8"
"astro": "^4.16.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.5",
"astro": "^4.16.8"
"astro": "^4.16.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.9",
"@astrojs/preact": "^3.5.3",
"astro": "^4.16.8",
"astro": "^4.16.9",
"preact": "^10.24.3"
}
}
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.16.8",
"astro": "^4.16.9",
"nanostores": "^0.11.3",
"preact": "^10.24.3"
}
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.9",
"@astrojs/tailwind": "^5.1.2",
"@types/canvas-confetti": "^1.6.4",
"astro": "^4.16.8",
"astro": "^4.16.9",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.47",
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.16.8",
"astro": "^4.16.9",
"vitest": "^2.1.4"
}
}
16 changes: 16 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# astro

## 4.16.9

### Patch Changes

- [#12333](https://github.com/withastro/astro/pull/12333) [`836cd91`](https://github.com/withastro/astro/commit/836cd91c37cea8ae58dd04a326435fcb2c88f358) Thanks [@imattacus](https://github.com/imattacus)! - Destroy the server response stream if async error is thrown

- [#12358](https://github.com/withastro/astro/pull/12358) [`7680349`](https://github.com/withastro/astro/commit/76803498738f9e86e7948ce81e01e63607e03549) Thanks [@spacedawwwg](https://github.com/spacedawwwg)! - Honors `inlineAstroConfig` parameter in `getViteConfig` when creating a logger

- [#12353](https://github.com/withastro/astro/pull/12353) [`35795a1`](https://github.com/withastro/astro/commit/35795a1a54b2bfaf331c58ca91b47e5672e08c4e) Thanks [@hippotastic](https://github.com/hippotastic)! - Fixes an issue in dev server watch file handling that could cause multiple restarts for a single file change.

- [#12351](https://github.com/withastro/astro/pull/12351) [`5751488`](https://github.com/withastro/astro/commit/57514881655b62a0bc39ace1e1ed4b89b96f74ca) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Reverts a change made in `4.16.6` that prevented usage of `astro:env` secrets inside middleware in SSR

- [#12346](https://github.com/withastro/astro/pull/12346) [`20e5a84`](https://github.com/withastro/astro/commit/20e5a843c86e9328814615edf3e8a6fb5e4696cc) Thanks [@bluwy](https://github.com/bluwy)! - Fixes sourcemap generation when prefetch is enabled

- [#12349](https://github.com/withastro/astro/pull/12349) [`1fc83d3`](https://github.com/withastro/astro/commit/1fc83d3ba8315c31b2a3aadc77b20b1615d261a0) Thanks [@norskeld](https://github.com/norskeld)! - Fixes the `getImage` options type so it properly extends `ImageTransform`

## 4.16.8

### Patch 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": "4.16.8",
"version": "4.16.9",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import ora from 'ora';
import preferredPM from 'preferred-pm';
import prompts from 'prompts';
import maxSatisfying from 'semver/ranges/max-satisfying.js';
import { exec } from 'tinyexec';
import {
loadTSConfig,
resolveConfig,
Expand All @@ -30,6 +29,7 @@ import { appendForwardSlash } from '../../core/path.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { ensureProcessNodeEnv, parseNpmName } from '../../core/util.js';
import { eventCliSession, telemetry } from '../../events/index.js';
import { exec } from '../exec.js';
import { type Flags, createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { fetchPackageJson, fetchPackageVersions } from '../install-package.js';

Expand Down
3 changes: 2 additions & 1 deletion packages/astro/src/cli/docs/open.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Result, exec } from 'tinyexec';
import type { Result } from 'tinyexec';
import { exec } from '../exec.js';

/**
* Credit: Azhar22
Expand Down
26 changes: 26 additions & 0 deletions packages/astro/src/cli/exec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { NonZeroExitError, type Options, x } from 'tinyexec';

/**
* Improve tinyexec error logging and set `throwOnError` to `true` by default
*/
export function exec(command: string, args?: string[], options?: Partial<Options>) {
return x(command, args, {
throwOnError: true,
...options,
}).then(
(o) => o,
(e) => {
if (e instanceof NonZeroExitError) {
const fullCommand = args?.length
? `${command} ${args.map((a) => (a.includes(' ') ? `"${a}"` : a)).join(' ')}`
: command;
const message = `The command \`${fullCommand}\` exited with code ${e.exitCode}`;
const newError = new Error(message, e.cause ? { cause: e.cause } : undefined);
(newError as any).stderr = e.output?.stderr;
(newError as any).stdout = e.output?.stdout;
throw newError;
}
throw e;
},
);
}
2 changes: 1 addition & 1 deletion packages/astro/src/cli/install-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { bold, cyan, dim, magenta } from 'kleur/colors';
import ora from 'ora';
import preferredPM from 'preferred-pm';
import prompts from 'prompts';
import { exec } from 'tinyexec';
import whichPm from 'which-pm';
import type { Logger } from '../core/logger/core.js';
import { exec } from './exec.js';

const require = createRequire(import.meta.url);

Expand Down
Loading

0 comments on commit ec56574

Please sign in to comment.