From fc097e81a85795701c21eaab8a53582e7de0fb45 Mon Sep 17 00:00:00 2001 From: Erika Date: Wed, 24 Apr 2024 15:57:16 +0000 Subject: [PATCH] [ci] format --- examples/toolbar-app/README.md | 10 +++++----- packages/astro/src/@types/astro.ts | 10 +++++----- packages/astro/src/cli/add/index.ts | 2 +- packages/astro/src/core/create-vite.ts | 2 +- .../runtime/client/dev-toolbar/entrypoint.ts | 4 ++-- .../src/runtime/client/dev-toolbar/helpers.ts | 18 +++++++++++------- .../src/runtime/client/dev-toolbar/toolbar.ts | 2 +- .../src/toolbar/vite-plugin-dev-toolbar.ts | 8 ++++++-- 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/examples/toolbar-app/README.md b/examples/toolbar-app/README.md index 87021b5b50..8b879a01e5 100644 --- a/examples/toolbar-app/README.md +++ b/examples/toolbar-app/README.md @@ -29,11 +29,11 @@ The `integration.ts` file is a simple Astro integration file that will be used t All commands are run from the root of the project, from a terminal: -| Command | Action | -| :------------------------ | :------------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Watch for changes and build your app automatically | -| `npm run build` | Build your app to `./dist/` | +| Command | Action | +| :-------------- | :------------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Watch for changes and build your app automatically | +| `npm run build` | Build your app to `./dist/` | ## 👀 Want to learn more? diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 1cf6c31df9..d9c8a9489c 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -19,7 +19,12 @@ import type { AstroTimer } from '../core/config/timer.js'; import type { TSConfig } from '../core/config/tsconfig.js'; import type { AstroCookies } from '../core/cookies/index.js'; import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js'; +import type { getToolbarServerCommunicationHelpers } from '../integrations/index.js'; import type { AstroPreferences } from '../preferences/index.js'; +import type { + ToolbarAppEventTarget, + ToolbarServerHelpers, +} from '../runtime/client/dev-toolbar/helpers.js'; import type { AstroDevToolbar, DevToolbarCanvas } from '../runtime/client/dev-toolbar/toolbar.js'; import type { Icon } from '../runtime/client/dev-toolbar/ui-library/icons.js'; import type { @@ -40,11 +45,6 @@ import type { } from '../transitions/events.js'; import type { DeepPartial, OmitIndexSignature, Simplify, WithRequired } from '../type-utils.js'; import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js'; -import type { - ToolbarAppEventTarget, - ToolbarServerHelpers, -} from '../runtime/client/dev-toolbar/helpers.js'; -import type { getToolbarServerCommunicationHelpers } from '../integrations/index.js'; export type { AstroIntegrationLogger, ToolbarServerHelpers }; diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index ec793b2668..e452f08d68 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -30,10 +30,10 @@ import { apply as applyPolyfill } from '../../core/polyfill.js'; import { ensureProcessNodeEnv, parseNpmName } from '../../core/util.js'; import { eventCliSession, telemetry } from '../../events/index.js'; import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js'; +import { fetchPackageJson, fetchPackageVersions } from '../install-package.js'; import { generate, parse, t, visit } from './babel.js'; import { ensureImport } from './imports.js'; import { wrapDefaultExport } from './wrapper.js'; -import { fetchPackageVersions, fetchPackageJson } from '../install-package.js'; interface AddOptions { flags: yargs.Arguments; diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 18d4775032..dfa2281d60 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -13,12 +13,12 @@ import { } from '../content/index.js'; import astroInternationalization from '../i18n/vite-plugin-i18n.js'; import astroPrefetch from '../prefetch/vite-plugin-prefetch.js'; +import astroDevToolbar from '../toolbar/vite-plugin-dev-toolbar.js'; import astroTransitions from '../transitions/vite-plugin-transitions.js'; import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js'; import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js'; import astroVitePlugin from '../vite-plugin-astro/index.js'; import configAliasVitePlugin from '../vite-plugin-config-alias/index.js'; -import astroDevToolbar from '../toolbar/vite-plugin-dev-toolbar.js'; import envVitePlugin from '../vite-plugin-env/index.js'; import vitePluginFileURL from '../vite-plugin-fileurl/index.js'; import astroHeadPlugin from '../vite-plugin-head/index.js'; diff --git a/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts b/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts index 8bef6e3601..dc8d043a25 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts @@ -1,9 +1,9 @@ +// @ts-expect-error - This module is private and untyped +import { loadDevToolbarApps } from 'astro:toolbar:internal'; import type { ResolvedDevToolbarApp as DevToolbarAppDefinition } from '../../../@types/astro.js'; import { ToolbarAppEventTarget } from './helpers.js'; import { settings } from './settings.js'; import type { AstroDevToolbar, DevToolbarApp } from './toolbar.js'; -// @ts-expect-error - This module is private and untyped -import { loadDevToolbarApps } from 'astro:toolbar:internal'; let overlay: AstroDevToolbar; diff --git a/packages/astro/src/runtime/client/dev-toolbar/helpers.ts b/packages/astro/src/runtime/client/dev-toolbar/helpers.ts index 7d97123355..9fcb5af798 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/helpers.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/helpers.ts @@ -1,9 +1,11 @@ -type NotificationPayload = { - state: true; - level?: 'error' | 'warn' | 'info'; -} | { - state: false -}; +type NotificationPayload = + | { + state: true; + level?: 'error' | 'warn' | 'info'; + } + | { + state: false; + }; type AppStatePayload = { state: boolean; @@ -11,7 +13,9 @@ type AppStatePayload = { type AppToggledEvent = (opts: { state: boolean }) => void; -type ToolbarPlacementUpdatedEvent = (opts: { placement: 'bottom-left' | 'bottom-center' | 'bottom-right' }) => void; +type ToolbarPlacementUpdatedEvent = (opts: { + placement: 'bottom-left' | 'bottom-center' | 'bottom-right'; +}) => void; export class ToolbarAppEventTarget extends EventTarget { constructor() { diff --git a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts index 17154927b8..13505f11cd 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import type { ResolvedDevToolbarApp as DevToolbarAppDefinition } from '../../../@types/astro.js'; -import { serverHelpers, type ToolbarAppEventTarget } from './helpers.js'; +import { type ToolbarAppEventTarget, serverHelpers } from './helpers.js'; import { settings } from './settings.js'; import { type Icon, getIconElement, isDefinedIcon } from './ui-library/icons.js'; import { type Placement } from './ui-library/window.js'; diff --git a/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts b/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts index 56ffcedacc..bb3c6fcb72 100644 --- a/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts +++ b/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts @@ -63,9 +63,13 @@ export default function astroDevToolbar({ settings, logger }: AstroPluginOptions return (await Promise.all([${settings.devToolbarApps .map( (plugin) => - `safeLoadPlugin(${JSON.stringify(plugin)}, async () => (await import(${JSON.stringify( + `safeLoadPlugin(${JSON.stringify( + plugin + )}, async () => (await import(${JSON.stringify( typeof plugin === 'string' ? plugin : plugin.entrypoint - )})).default, ${JSON.stringify(typeof plugin === 'string' ? plugin : plugin.entrypoint)})` + )})).default, ${JSON.stringify( + typeof plugin === 'string' ? plugin : plugin.entrypoint + )})` ) .join(',')}])); };