summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/astro/CHANGELOG.md55
-rw-r--r--packages/astro/e2e/astro-envs.test.js2
-rw-r--r--packages/astro/package.json2
-rw-r--r--packages/astro/src/cli/index.ts2
-rw-r--r--packages/astro/src/cli/preferences/index.ts122
-rw-r--r--packages/astro/src/core/app/index.ts25
-rw-r--r--packages/astro/src/core/app/node.ts14
-rw-r--r--packages/astro/src/core/dev/restart.ts9
-rw-r--r--packages/astro/src/core/messages.ts33
-rw-r--r--packages/astro/src/preferences/defaults.ts2
-rw-r--r--packages/astro/src/preferences/index.ts39
-rw-r--r--packages/astro/src/preferences/store.ts5
-rw-r--r--packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts9
-rw-r--r--packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts4
-rw-r--r--packages/astro/src/vite-plugin-astro-server/request.ts7
-rw-r--r--packages/astro/src/vite-plugin-astro-server/route.ts5
-rw-r--r--packages/integrations/node/CHANGELOG.md6
-rw-r--r--packages/integrations/node/package.json2
-rw-r--r--packages/integrations/vercel/CHANGELOG.md6
-rw-r--r--packages/integrations/vercel/package.json2
21 files changed, 269 insertions, 86 deletions
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md
index d698935e2..f5e1280f8 100644
--- a/packages/astro/CHANGELOG.md
+++ b/packages/astro/CHANGELOG.md
@@ -1,5 +1,60 @@
# astro
+## 4.0.0-beta.2
+
+### Major Changes
+
+- [#9225](https://github.com/withastro/astro/pull/9225) [`c421a3d17`](https://github.com/withastro/astro/commit/c421a3d17911aeda29b5204f6d568ae87e329eaf) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Removes the opt-in `handleForms` property for `<ViewTransitions />`. Form submissions are now handled by default and can be disabled by setting `data-astro-reload` on relevant `<form />` elements.
+
+- [#9199](https://github.com/withastro/astro/pull/9199) [`49aa215a0`](https://github.com/withastro/astro/commit/49aa215a01ee1c4805316c85bb0aea6cfbc25a31) Thanks [@lilnasy](https://github.com/lilnasy)! - This change only affects maintainers of third-party adapters. In the Integration API, the `app.render()` method of the `App` class has been simplified.
+
+ Instead of two optional arguments, it now takes a single optional argument that is an object with two optional properties: `routeData` and `locals`.
+
+ ```diff
+ app.render(request)
+
+ - app.render(request, routeData)
+ + app.render(request, { routeData })
+
+ - app.render(request, routeData, locals)
+ + app.render(request, { routeData, locals })
+
+ - app.render(request, undefined, locals)
+ + app.render(request, { locals })
+ ```
+
+ The current signature is deprecated but will continue to function until next major version.
+
+- [#9212](https://github.com/withastro/astro/pull/9212) [`c0383ea0c`](https://github.com/withastro/astro/commit/c0383ea0c102cb62b7235823c706a090ba08715f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Removes deprecated `app.match()` option, `matchNotFound`
+
+### Minor Changes
+
+- [#9115](https://github.com/withastro/astro/pull/9115) [`3b77889b4`](https://github.com/withastro/astro/commit/3b77889b47750ed6e17c7858780dc4aae9201b58) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Adds the `astro preferences` command to manage user preferences. User preferences are specific to individual Astro users, unlike the `astro.config.mjs` file which changes behavior for everyone working on a project.
+
+ User preferences are scoped to the current project by default, stored in a local `.astro/settings.json` file. Using the `--global` flag, user preferences can also be applied to every Astro project on the current machine. Global user preferences are stored in an operating system-specific location.
+
+ ```sh
+ # Disable the dev overlay for the current user in the current project
+ npm run astro preferences disable devOverlay
+ # Disable the dev overlay for the current user in all Astro projects on this machine
+ npm run astro preferences --global disable devOverlay
+
+ # Check if the dev overlay is enabled for the current user
+ npm run astro preferences list devOverlay
+ ```
+
+- [#9129](https://github.com/withastro/astro/pull/9129) [`8bfc20511`](https://github.com/withastro/astro/commit/8bfc20511918d675202cdc100d4efab293e5cbac) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Update error log formatting
+
+### Patch Changes
+
+- [#9222](https://github.com/withastro/astro/pull/9222) [`279e3c1b3`](https://github.com/withastro/astro/commit/279e3c1b3d06e7b48f01c0ef8285c3719ac74ace) Thanks [@matthewp](https://github.com/matthewp)! - Ensure the dev-overlay-window is anchored to the bottom
+
+- [#9218](https://github.com/withastro/astro/pull/9218) [`f4401c8c1`](https://github.com/withastro/astro/commit/f4401c8c1fa203431b4e7b2e89381a91b4ef1ac6) Thanks [@matthewp](https://github.com/matthewp)! - Improve high contrast mode with the Dev Overlay
+
+- [#9227](https://github.com/withastro/astro/pull/9227) [`4b8a42406`](https://github.com/withastro/astro/commit/4b8a42406bbdcc68604ea4ecc2a926721fbc4d52) Thanks [@matthewp](https://github.com/matthewp)! - Ensure overlay x-ray z-index is higher than the island
+
+- [#9214](https://github.com/withastro/astro/pull/9214) [`4fe523b00`](https://github.com/withastro/astro/commit/4fe523b0064b323ee46b2574339d96ea8bdb7b2d) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fixes a number of small user experience bugs with the dev overlay
+
## 4.0.0-beta.1
### Patch Changes
diff --git a/packages/astro/e2e/astro-envs.test.js b/packages/astro/e2e/astro-envs.test.js
index 2ebff460a..6cffc2d82 100644
--- a/packages/astro/e2e/astro-envs.test.js
+++ b/packages/astro/e2e/astro-envs.test.js
@@ -5,7 +5,7 @@ const test = testFactory({
root: './fixtures/astro-envs/',
devOverlay: {
enabled: false,
- }
+ },
});
let devServer;
diff --git a/packages/astro/package.json b/packages/astro/package.json
index ee0ac59ba..b0f95ac83 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -1,6 +1,6 @@
{
"name": "astro",
- "version": "4.0.0-beta.1",
+ "version": "4.0.0-beta.2",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts
index 83dd960c6..7ca4d21a9 100644
--- a/packages/astro/src/cli/index.ts
+++ b/packages/astro/src/cli/index.ts
@@ -119,7 +119,7 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
}
case 'preferences': {
const { preferences } = await import('./preferences/index.js');
- const [subcommand, key, value] = flags._.slice(3).map(v => v.toString());
+ const [subcommand, key, value] = flags._.slice(3).map((v) => v.toString());
const exitCode = await preferences(subcommand, key, value, { flags });
return process.exit(exitCode);
}
diff --git a/packages/astro/src/cli/preferences/index.ts b/packages/astro/src/cli/preferences/index.ts
index 2a01bbae2..48d6a298d 100644
--- a/packages/astro/src/cli/preferences/index.ts
+++ b/packages/astro/src/cli/preferences/index.ts
@@ -21,14 +21,27 @@ interface PreferencesOptions {
flags: yargs.Arguments;
}
-const PREFERENCES_SUBCOMMANDS = ['get', 'set', 'enable', 'disable', 'delete', 'reset', 'list'] as const;
-export type Subcommand = typeof PREFERENCES_SUBCOMMANDS[number];
+const PREFERENCES_SUBCOMMANDS = [
+ 'get',
+ 'set',
+ 'enable',
+ 'disable',
+ 'delete',
+ 'reset',
+ 'list',
+] as const;
+export type Subcommand = (typeof PREFERENCES_SUBCOMMANDS)[number];
function isValidSubcommand(subcommand: string): subcommand is Subcommand {
return PREFERENCES_SUBCOMMANDS.includes(subcommand as Subcommand);
}
-export async function preferences(subcommand: string, key: string, value: string | undefined, { flags }: PreferencesOptions): Promise<number> {
+export async function preferences(
+ subcommand: string,
+ key: string,
+ value: string | undefined,
+ { flags }: PreferencesOptions
+): Promise<number> {
if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) {
msg.printHelp({
commandName: 'astro preferences',
@@ -44,7 +57,10 @@ export async function preferences(subcommand: string, key: string, value: string
['disable [key]', 'Set a boolean preference to false'],
],
Flags: [
- ['--global', 'Scope command to global preferences (all Astro projects) rather than the current project'],
+ [
+ '--global',
+ 'Scope command to global preferences (all Astro projects) rather than the current project',
+ ],
],
},
});
@@ -57,8 +73,8 @@ export async function preferences(subcommand: string, key: string, value: string
const settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
const opts: SubcommandOptions = {
location: flags.global ? 'global' : undefined,
- json: flags.json
- }
+ json: flags.json,
+ };
if (subcommand === 'list') {
return listPreferences(settings, opts);
@@ -75,17 +91,27 @@ export async function preferences(subcommand: string, key: string, value: string
if (subcommand === 'set' && value === undefined) {
const type = typeof dlv(DEFAULT_PREFERENCES, key);
- console.error(msg.formatErrorMessage(collectErrorMetadata(new Error(`Please provide a ${type} value for "${key}"`)), true));
+ console.error(
+ msg.formatErrorMessage(
+ collectErrorMetadata(new Error(`Please provide a ${type} value for "${key}"`)),
+ true
+ )
+ );
return 1;
}
switch (subcommand) {
- case 'get': return getPreference(settings, key, opts);
- case 'set': return setPreference(settings, key, value, opts);
+ case 'get':
+ return getPreference(settings, key, opts);
+ case 'set':
+ return setPreference(settings, key, value, opts);
case 'reset':
- case 'delete': return resetPreference(settings, key, opts);
- case 'enable': return enablePreference(settings, key, opts);
- case 'disable': return disablePreference(settings, key, opts);
+ case 'delete':
+ return resetPreference(settings, key, opts);
+ case 'enable':
+ return enablePreference(settings, key, opts);
+ case 'disable':
+ return disablePreference(settings, key, opts);
}
}
@@ -95,7 +121,11 @@ interface SubcommandOptions {
}
// Default `location` to "project" to avoid reading default preferencesa
-async function getPreference(settings: AstroSettings, key: PreferenceKey, { location = 'project' }: SubcommandOptions) {
+async function getPreference(
+ settings: AstroSettings,
+ key: PreferenceKey,
+ { location = 'project' }: SubcommandOptions
+) {
try {
let value = await settings.preferences.get(key, { location });
if (value && typeof value === 'object' && !Array.isArray(value)) {
@@ -117,15 +147,20 @@ async function getPreference(settings: AstroSettings, key: PreferenceKey, { loca
return 1;
}
-async function setPreference(settings: AstroSettings, key: PreferenceKey, value: unknown, { location }: SubcommandOptions) {
+async function setPreference(
+ settings: AstroSettings,
+ key: PreferenceKey,
+ value: unknown,
+ { location }: SubcommandOptions
+) {
try {
const defaultType = typeof dlv(DEFAULT_PREFERENCES, key);
if (typeof coerce(key, value) !== defaultType) {
- throw new Error(`${key} expects a "${defaultType}" value!`)
+ throw new Error(`${key} expects a "${defaultType}" value!`);
}
await settings.preferences.set(key, coerce(key, value), { location });
- console.log(msg.preferenceSet(key, value))
+ console.log(msg.preferenceSet(key, value));
return 0;
} catch (e) {
if (e instanceof Error) {
@@ -136,34 +171,45 @@ async function setPreference(settings: AstroSettings, key: PreferenceKey, value:
}
}
-async function enablePreference(settings: AstroSettings, key: PreferenceKey, { location }: SubcommandOptions) {
+async function enablePreference(
+ settings: AstroSettings,
+ key: PreferenceKey,
+ { location }: SubcommandOptions
+) {
try {
await settings.preferences.set(key, true, { location });
- console.log(msg.preferenceEnabled(key.replace('.enabled', '')))
+ console.log(msg.preferenceEnabled(key.replace('.enabled', '')));
return 0;
} catch {}
return 1;
}
-async function disablePreference(settings: AstroSettings, key: PreferenceKey, { location }: SubcommandOptions) {
+async function disablePreference(
+ settings: AstroSettings,
+ key: PreferenceKey,
+ { location }: SubcommandOptions
+) {
try {
await settings.preferences.set(key, false, { location });
- console.log(msg.preferenceDisabled(key.replace('.enabled', '')))
+ console.log(msg.preferenceDisabled(key.replace('.enabled', '')));
return 0;
} catch {}
return 1;
}
-async function resetPreference(settings: AstroSettings, key: PreferenceKey, { location }: SubcommandOptions) {
+async function resetPreference(
+ settings: AstroSettings,
+ key: PreferenceKey,
+ { location }: SubcommandOptions
+) {
try {
await settings.preferences.set(key, undefined as any, { location });
- console.log(msg.preferenceReset(key))
+ console.log(msg.preferenceReset(key));
return 0;
} catch {}
return 1;
}
-
async function listPreferences(settings: AstroSettings, { location, json }: SubcommandOptions) {
const store = await settings.preferences.getAll({ location });
if (json) {
@@ -195,18 +241,34 @@ const chars = {
topRight: '╮',
bottomLeft: '╰',
bottomRight: '╯',
-}
+};
-function formatTable(object: Record<string, string | number | boolean>, columnLabels: [string, string]) {
+function formatTable(
+ object: Record<string, string | number | boolean>,
+ columnLabels: [string, string]
+) {
const [colA, colB] = columnLabels;
const colALength = [colA, ...Object.keys(object)].reduce(longest, 0) + 3;
const colBLength = [colB, ...Object.values(object)].reduce(longest, 0) + 3;
- function formatRow(i: number, a: string, b: string | number | boolean, style: (value: string | number | boolean) => string = (v) => v.toString()): string {
- return `${chars.v} ${style(a)} ${space(colALength - a.length - 2)} ${chars.v} ${style(b)} ${space(colBLength - b.toString().length - 3)} ${chars.v}`
+ function formatRow(
+ i: number,
+ a: string,
+ b: string | number | boolean,
+ style: (value: string | number | boolean) => string = (v) => v.toString()
+ ): string {
+ return `${chars.v} ${style(a)} ${space(colALength - a.length - 2)} ${chars.v} ${style(
+ b
+ )} ${space(colBLength - b.toString().length - 3)} ${chars.v}`;
}
- const top = `${chars.topLeft}${chars.h.repeat(colALength + 1)}${chars.hBottom}${chars.h.repeat(colBLength)}${chars.topRight}`
- const bottom = `${chars.bottomLeft}${chars.h.repeat(colALength + 1)}${chars.hTop}${chars.h.repeat(colBLength)}${chars.bottomRight}`
- const divider = `${chars.vRightThick}${chars.hThick.repeat(colALength + 1)}${chars.hThickCross}${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`
+ const top = `${chars.topLeft}${chars.h.repeat(colALength + 1)}${chars.hBottom}${chars.h.repeat(
+ colBLength
+ )}${chars.topRight}`;
+ const bottom = `${chars.bottomLeft}${chars.h.repeat(colALength + 1)}${chars.hTop}${chars.h.repeat(
+ colBLength
+ )}${chars.bottomRight}`;
+ const divider = `${chars.vRightThick}${chars.hThick.repeat(colALength + 1)}${
+ chars.hThickCross
+ }${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`;
const rows: string[] = [top, formatRow(-1, colA, colB, bold), divider];
let i = 0;
for (const [key, value] of Object.entries(object)) {
diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts
index ee50fc343..f3fa3fa7b 100644
--- a/packages/astro/src/core/app/index.ts
+++ b/packages/astro/src/core/app/index.ts
@@ -147,25 +147,31 @@ export class App {
return routeData;
}
- async render(request: Request, options?: RenderOptions): Promise<Response>
+ async render(request: Request, options?: RenderOptions): Promise<Response>;
/**
* @deprecated Instead of passing `RouteData` and locals individually, pass an object with `routeData` and `locals` properties.
* See https://github.com/withastro/astro/pull/9199 for more information.
*/
- async render(request: Request, routeData?: RouteData, locals?: object): Promise<Response>
- async render(request: Request, routeDataOrOptions?: RouteData | RenderOptions, maybeLocals?: object): Promise<Response> {
+ async render(request: Request, routeData?: RouteData, locals?: object): Promise<Response>;
+ async render(
+ request: Request,
+ routeDataOrOptions?: RouteData | RenderOptions,
+ maybeLocals?: object
+ ): Promise<Response> {
let routeData: RouteData | undefined;
let locals: object | undefined;
-
- if (routeDataOrOptions && ('routeData' in routeDataOrOptions || 'locals' in routeDataOrOptions)) {
+
+ if (
+ routeDataOrOptions &&
+ ('routeData' in routeDataOrOptions || 'locals' in routeDataOrOptions)
+ ) {
if ('routeData' in routeDataOrOptions) {
routeData = routeDataOrOptions.routeData;
}
if ('locals' in routeDataOrOptions) {
locals = routeDataOrOptions.locals;
}
- }
- else {
+ } else {
routeData = routeDataOrOptions as RouteData | undefined;
locals = maybeLocals;
if (routeDataOrOptions || locals) {
@@ -242,7 +248,10 @@ export class App {
#logRenderOptionsDeprecationWarning() {
if (this.#renderOptionsDeprecationWarningShown) return;
- this.#logger.warn("deprecated", `The adapter ${this.#manifest.adapterName} is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See https://github.com/withastro/astro/pull/9199 for more information.`)
+ this.#logger.warn(
+ 'deprecated',
+ `The adapter ${this.#manifest.adapterName} is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See https://github.com/withastro/astro/pull/9199 for more information.`
+ );
this.#renderOptionsDeprecationWarningShown = true;
}
diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts
index 1c4ced2b4..46882f58e 100644
--- a/packages/astro/src/core/app/node.ts
+++ b/packages/astro/src/core/app/node.ts
@@ -117,13 +117,21 @@ export class NodeApp extends App {
}
return super.match(req);
}
- render(request: NodeIncomingMessage | Request, options?: RenderOptions): Promise<Response>
+ render(request: NodeIncomingMessage | Request, options?: RenderOptions): Promise<Response>;
/**
* @deprecated Instead of passing `RouteData` and locals individually, pass an object with `routeData` and `locals` properties.
* See https://github.com/withastro/astro/pull/9199 for more information.
*/
- render(request: NodeIncomingMessage | Request, routeData?: RouteData, locals?: object): Promise<Response>
- render(req: NodeIncomingMessage | Request, routeDataOrOptions?: RouteData | RenderOptions, maybeLocals?: object) {
+ render(
+ request: NodeIncomingMessage | Request,
+ routeData?: RouteData,
+ locals?: object
+ ): Promise<Response>;
+ render(
+ req: NodeIncomingMessage | Request,
+ routeDataOrOptions?: RouteData | RenderOptions,
+ maybeLocals?: object
+ ) {
if (!(req instanceof Request)) {
req = createRequestFromNodeRequest(req);
}
diff --git a/packages/astro/src/core/dev/restart.ts b/packages/astro/src/core/dev/restart.ts
index 49cd185d8..b19eae4ac 100644
--- a/packages/astro/src/core/dev/restart.ts
+++ b/packages/astro/src/core/dev/restart.ts
@@ -47,8 +47,8 @@ export function shouldRestartContainer(
// Otherwise, watch for any astro.config.* file changes in project root
else {
const normalizedChangedFile = vite.normalizePath(changedFile);
- shouldRestart = configRE.test(normalizedChangedFile) || preferencesRE.test(normalizedChangedFile);
-
+ shouldRestart =
+ configRE.test(normalizedChangedFile) || preferencesRE.test(normalizedChangedFile);
}
if (!shouldRestart && settings.watchFiles.length > 0) {
@@ -74,7 +74,10 @@ export async function restartContainer(container: Container): Promise<Container
const error = createSafeError(_err);
// Print all error messages except ZodErrors from AstroConfig as the pre-logged error is sufficient
if (!isAstroConfigZodError(_err)) {
- logger.error('config', formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n');
+ logger.error(
+ 'config',
+ formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n'
+ );
}
// Inform connected clients of the config error
container.viteServer.ws.send({
diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts
index 935ed1bdc..135aa5813 100644
--- a/packages/astro/src/core/messages.ts
+++ b/packages/astro/src/core/messages.ts
@@ -128,7 +128,9 @@ export function preferenceDefaultIntro(name: string) {
}
export function preferenceDefault(name: string, value: any) {
- return `${yellow('◯')} ${name} has not been set. It defaults to ${bgYellow(black(` ${JSON.stringify(value)} `))}\n`;
+ return `${yellow('◯')} ${name} has not been set. It defaults to ${bgYellow(
+ black(` ${JSON.stringify(value)} `)
+ )}\n`;
}
export function preferenceDisabled(name: string) {
@@ -219,7 +221,10 @@ export function formatConfigErrorMessage(err: ZodError) {
// a regex to match the first line of a stack trace
const STACK_LINE_REGEXP = /^\s+at /g;
const IRRELEVANT_STACK_REGEXP = /(node_modules|astro[\/\\]dist)/g;
-function formatErrorStackTrace(err: Error | ErrorWithMetadata, showFullStacktrace: boolean): string {
+function formatErrorStackTrace(
+ err: Error | ErrorWithMetadata,
+ showFullStacktrace: boolean
+): string {
const stackLines = (err.stack || '').split('\n').filter((line) => STACK_LINE_REGEXP.test(line));
// If full details are required, just return the entire stack trace.
if (showFullStacktrace) {
@@ -230,18 +235,23 @@ function formatErrorStackTrace(err: Error | ErrorWithMetadata, showFullStacktrac
if (irrelevantStackIndex <= 0) {
const errorId = (err as ErrorWithMetadata).id;
const errorLoc = (err as ErrorWithMetadata).loc;
- if (errorId|| errorLoc?.file) {
- const prettyLocation = ` at ${errorId?? errorLoc?.file}${
+ if (errorId || errorLoc?.file) {
+ const prettyLocation = ` at ${errorId ?? errorLoc?.file}${
errorLoc?.line && errorLoc.column ? `:${errorLoc.line}:${errorLoc.column}` : ''
}`;
- return prettyLocation + '\n [...] See full stack trace in the browser, or rerun with --verbose.';
+ return (
+ prettyLocation + '\n [...] See full stack trace in the browser, or rerun with --verbose.'
+ );
} else {
return stackLines.join('\n');
}
}
// If the error occurred inside of a dependency, grab the entire stack.
// Otherwise, only grab the part of the stack that is relevant to the user's codebase.
- return stackLines.splice(0, irrelevantStackIndex).join('\n') + '\n [...] See full stack trace in the browser, or rerun with --verbose.';
+ return (
+ stackLines.splice(0, irrelevantStackIndex).join('\n') +
+ '\n [...] See full stack trace in the browser, or rerun with --verbose.'
+ );
}
export function formatErrorMessage(err: ErrorWithMetadata, showFullStacktrace: boolean): string {
@@ -256,9 +266,7 @@ export function formatErrorMessage(err: ErrorWithMetadata, showFullStacktrace: b
if (err.hint) {
output.push(` ${bold('Hint:')}`);
- output.push(
- yellow(padMultilineString(renderErrorMarkdown(err.hint, 'cli'), 4))
- );
+ output.push(yellow(padMultilineString(renderErrorMarkdown(err.hint, 'cli'), 4)));
}
const docsLink = getDocsForError(err);
@@ -276,13 +284,14 @@ export function formatErrorMessage(err: ErrorWithMetadata, showFullStacktrace: b
output.push(` ${bold('Caused by:')}`);
let causeMessage = ' ';
if (err.cause instanceof Error) {
- causeMessage += err.cause.message + '\n' + formatErrorStackTrace(err.cause, showFullStacktrace);
+ causeMessage +=
+ err.cause.message + '\n' + formatErrorStackTrace(err.cause, showFullStacktrace);
} else {
- causeMessage += (JSON.stringify(err.cause));
+ causeMessage += JSON.stringify(err.cause);
}
output.push(dim(causeMessage));
}
-
+
return output.join('\n');
}
diff --git a/packages/astro/src/preferences/defaults.ts b/packages/astro/src/preferences/defaults.ts
index 74ae7b2dc..db9cfde87 100644
--- a/packages/astro/src/preferences/defaults.ts
+++ b/packages/astro/src/preferences/defaults.ts
@@ -3,6 +3,6 @@ export const DEFAULT_PREFERENCES = {
/** Specifies whether the user has the Dev Overlay enabled */
enabled: true,
},
-}
+};
export type Preferences = typeof DEFAULT_PREFERENCES;
diff --git a/packages/astro/src/preferences/index.ts b/packages/astro/src/preferences/index.ts
index 86faf1cc8..91b942101 100644
--- a/packages/astro/src/preferences/index.ts
+++ b/packages/astro/src/preferences/index.ts
@@ -9,14 +9,18 @@ import dget from 'dlv';
import { DEFAULT_PREFERENCES, type Preferences } from './defaults.js';
import { PreferenceStore } from './store.js';
-type DotKeys<T> = T extends object ? { [K in keyof T]:
- `${Exclude<K, symbol>}${DotKeys<T[K]> extends never ? "" : `.${DotKeys<T[K]>}`}`
-}[keyof T] : never
+type DotKeys<T> = T extends object
+ ? {
+ [K in keyof T]: `${Exclude<K, symbol>}${DotKeys<T[K]> extends never
+ ? ''
+ : `.${DotKeys<T[K]>}`}`;
+ }[keyof T]
+ : never;
export type GetDotKey<
- T extends Record<string | number, any>,
- K extends string
-> = K extends `${infer U}.${infer Rest}` ? GetDotKey<T[U], Rest> : T[K]
+ T extends Record<string | number, any>,
+ K extends string,
+> = K extends `${infer U}.${infer Rest}` ? GetDotKey<T[U], Rest> : T[K];
export interface PreferenceOptions {
location?: 'global' | 'project';
@@ -25,8 +29,15 @@ export interface PreferenceOptions {
export type PreferenceKey = DotKeys<Preferences>;
export interface AstroPreferences {
- get<Key extends PreferenceKey>(key: Key, opts?: PreferenceOptions): Promise<GetDotKey<Preferences, Key>>;
- set<Key extends PreferenceKey>(key: Key, value: GetDotKey<Preferences, Key>, opts?: PreferenceOptions): Promise<void>;
+ get<Key extends PreferenceKey>(
+ key: Key,
+ opts?: PreferenceOptions
+ ): Promise<GetDotKey<Preferences, Key>>;
+ set<Key extends PreferenceKey>(
+ key: Key,
+ value: GetDotKey<Preferences, Key>,
+ opts?: PreferenceOptions
+ ): Promise<void>;
getAll(opts?: PreferenceOptions): Promise<Record<string, any>>;
}
@@ -36,8 +47,10 @@ export function isValidKey(key: string): key is PreferenceKey {
export function coerce(key: string, value: unknown) {
const type = typeof dget(DEFAULT_PREFERENCES, key);
switch (type) {
- case 'string': return value;
- case 'number': return Number(value);
+ case 'string':
+ return value;
+ case 'number':
+ return Number(value);
case 'boolean': {
if (value === 'true' || value === 1) return true;
if (value === 'false' || value === 0) return false;
@@ -60,13 +73,13 @@ export default function createPreferences(config: AstroConfig): AstroPreferences
stores[location].set(key, value);
},
async getAll({ location } = {}) {
- if (!location) return Object.assign({}, stores['global'].getAll(), stores['project'].getAll());
+ if (!location)
+ return Object.assign({}, stores['global'].getAll(), stores['project'].getAll());
return stores[location].getAll();
},
- }
+ };
}
-
// Adapted from https://github.com/sindresorhus/env-paths
export function getGlobalPreferenceDir() {
const name = 'astro';
diff --git a/packages/astro/src/preferences/store.ts b/packages/astro/src/preferences/store.ts
index 4dabbba1c..1bf9c46c7 100644
--- a/packages/astro/src/preferences/store.ts
+++ b/packages/astro/src/preferences/store.ts
@@ -6,7 +6,10 @@ import path from 'node:path';
export class PreferenceStore {
private file: string;
- constructor(private dir: string, filename = 'settings.json') {
+ constructor(
+ private dir: string,
+ filename = 'settings.json'
+ ) {
this.file = path.join(this.dir, filename);
}
diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts
index 31c70b724..e2d74c0ff 100644
--- a/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts
+++ b/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts
@@ -18,9 +18,9 @@ export function createHighlight(rect: DOMRect, icon?: Icon) {
export function getHighlightZIndex(el: Element) {
let highestZIndex = 0;
let current: Element | ParentNode | null = el;
- while(current instanceof Element) {
+ while (current instanceof Element) {
let zIndex = Number(getComputedStyle(current).zIndex);
- if(!Number.isNaN(zIndex) && zIndex > highestZIndex) {
+ if (!Number.isNaN(zIndex) && zIndex > highestZIndex) {
highestZIndex = zIndex;
}
current = current.parentNode;
diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts
index aff02fc9c..08a510d98 100644
--- a/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts
+++ b/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts
@@ -1,6 +1,11 @@
import type { DevOverlayMetadata, DevOverlayPlugin } from '../../../../@types/astro.js';
import type { DevOverlayHighlight } from '../ui-library/highlight.js';
-import { attachTooltipToHighlight, createHighlight, getHighlightZIndex, positionHighlight } from './utils/highlight.js';
+import {
+ attachTooltipToHighlight,
+ createHighlight,
+ getHighlightZIndex,
+ positionHighlight,
+} from './utils/highlight.js';
const icon =
'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#fff" d="M7.9 1.5v-.4a1.1 1.1 0 0 1 2.2 0v.4a1.1 1.1 0 1 1-2.2 0Zm-6.4 8.6a1.1 1.1 0 1 0 0-2.2h-.4a1.1 1.1 0 0 0 0 2.2h.4ZM12 3.7a1.1 1.1 0 0 0 1.4-.7l.4-1.1a1.1 1.1 0 0 0-2.1-.8l-.4 1.2a1.1 1.1 0 0 0 .7 1.4Zm-9.7 7.6-1.2.4a1.1 1.1 0 1 0 .8 2.1l1-.4a1.1 1.1 0 1 0-.6-2ZM20.8 17a1.9 1.9 0 0 1 0 2.6l-1.2 1.2a1.9 1.9 0 0 1-2.6 0l-4.3-4.2-1.6 3.6a1.9 1.9 0 0 1-1.7 1.2A1.9 1.9 0 0 1 7.5 20L2.7 5a1.9 1.9 0 0 1 2.4-2.4l15 5a1.9 1.9 0 0 1 .2 3.4l-3.7 1.6 4.2 4.3ZM19 18.3 14.6 14a1.9 1.9 0 0 1 .6-3l3.2-1.5L5.1 5.1l4.3 13.3 1.5-3.2a1.9 1.9 0 0 1 3-.6l4.4 4.4.7-.7Z"/></svg>';
@@ -43,7 +48,7 @@ export default {
// Set the z-index to be 1 higher than the greatest z-index in the stack.
const zIndex = getHighlightZIndex(islandElement);
- tooltip.style.zIndex = highlight.style.zIndex = zIndex+'';
+ tooltip.style.zIndex = highlight.style.zIndex = zIndex + '';
canvas.append(highlight);
islandsOverlays.push({ highlightElement: highlight, island: islandElement });
diff --git a/packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts b/packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts
index 34cf3150d..3211e1857 100644
--- a/packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts
+++ b/packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts
@@ -46,8 +46,6 @@ export class DevOverlayIcon extends HTMLElement {
fill: black;
}
}
- </style>\n${this.getIconHTML(
- this._icon
- )}`;
+ </style>\n${this.getIconHTML(this._icon)}`;
}
}
diff --git a/packages/astro/src/vite-plugin-astro-server/request.ts b/packages/astro/src/vite-plugin-astro-server/request.ts
index dea514c28..aa9124fb4 100644
--- a/packages/astro/src/vite-plugin-astro-server/request.ts
+++ b/packages/astro/src/vite-plugin-astro-server/request.ts
@@ -2,7 +2,7 @@ import type http from 'node:http';
import type { ManifestData, SSRManifest } from '../@types/astro.js';
import { collectErrorMetadata } from '../core/errors/dev/index.js';
import { createSafeError } from '../core/errors/index.js';
-import {formatErrorMessage} from '../core/messages.js';
+import { formatErrorMessage } from '../core/messages.js';
import { collapseDuplicateSlashes, removeTrailingForwardSlash } from '../core/path.js';
import { eventError, telemetry } from '../events/index.js';
import { isServerLikeOutput } from '../prerender/utils.js';
@@ -102,7 +102,10 @@ export async function handleRequest({
telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false }));
- pipeline.logger.error(null, formatErrorMessage(errorWithMetadata, pipeline.logger.level() === 'debug'));
+ pipeline.logger.error(
+ null,
+ formatErrorMessage(errorWithMetadata, pipeline.logger.level() === 'debug')
+ );
handle500Response(moduleLoader, incomingResponse, errorWithMetadata);
return err;
diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts
index a8f9efa04..aa9036810 100644
--- a/packages/astro/src/vite-plugin-astro-server/route.ts
+++ b/packages/astro/src/vite-plugin-astro-server/route.ts
@@ -384,7 +384,10 @@ async function getScriptsAndStyles({ pipeline, filePath }: GetScriptsAndStylesPa
children: '',
});
- if (settings.config.devOverlay.enabled && await settings.preferences.get('devOverlay.enabled')) {
+ if (
+ settings.config.devOverlay.enabled &&
+ (await settings.preferences.get('devOverlay.enabled'))
+ ) {
scripts.add({
props: {
type: 'module',
diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md
index 87a115fcd..732122ecf 100644
--- a/packages/integrations/node/CHANGELOG.md
+++ b/packages/integrations/node/CHANGELOG.md
@@ -1,5 +1,11 @@
# @astrojs/node
+## 7.0.0-beta.1
+
+### Major Changes
+
+- [#9199](https://github.com/withastro/astro/pull/9199) [`49aa215a0`](https://github.com/withastro/astro/commit/49aa215a01ee1c4805316c85bb0aea6cfbc25a31) Thanks [@lilnasy](https://github.com/lilnasy)! - The internals of the integration have been updated to support Astro 4.0. Make sure to upgrade your Astro version as Astro 3.0 is no longer supported.
+
## 7.0.0-beta.0
### Patch Changes
diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json
index babc33a8a..9981db3c5 100644
--- a/packages/integrations/node/package.json
+++ b/packages/integrations/node/package.json
@@ -1,7 +1,7 @@
{
"name": "@astrojs/node",
"description": "Deploy your site to a Node.js server",
- "version": "7.0.0-beta.0",
+ "version": "7.0.0-beta.1",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md
index 6d26f2c11..1cb378ee3 100644
--- a/packages/integrations/vercel/CHANGELOG.md
+++ b/packages/integrations/vercel/CHANGELOG.md
@@ -1,5 +1,11 @@
# @astrojs/vercel
+## 6.0.0-beta.1
+
+### Major Changes
+
+- [#9199](https://github.com/withastro/astro/pull/9199) [`49aa215a0`](https://github.com/withastro/astro/commit/49aa215a01ee1c4805316c85bb0aea6cfbc25a31) Thanks [@lilnasy](https://github.com/lilnasy)! - The internals of the integration have been updated to support Astro 4.0. Make sure to upgrade your Astro version as Astro 3.0 is no longer supported.
+
## 6.0.0-beta.0
### Major Changes
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index c398bee25..8e770376c 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -1,7 +1,7 @@
{
"name": "@astrojs/vercel",
"description": "Deploy your site to Vercel",
- "version": "6.0.0-beta.0",
+ "version": "6.0.0-beta.1",
"type": "module",
"author": "withastro",
"license": "MIT",