From 5c3c672d2657d29e96aaaf7d9b1529f2ea432ce0 Mon Sep 17 00:00:00 2001 From: matthewp Date: Wed, 17 May 2023 13:26:03 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/assets/generate.ts | 2 +- packages/astro/src/assets/internal.ts | 1 - packages/astro/src/core/build/generate.ts | 2 +- packages/astro/src/core/build/index.ts | 2 +- packages/astro/src/core/build/plugins/plugin-pages.ts | 2 +- packages/astro/src/core/build/plugins/plugin-ssr.ts | 2 +- packages/astro/src/core/build/static-build.ts | 2 +- packages/astro/src/core/config/config.ts | 2 +- packages/astro/src/core/config/settings.ts | 2 +- packages/astro/src/core/endpoint/index.ts | 2 +- packages/astro/src/core/routing/manifest/create.ts | 2 +- packages/astro/src/core/util.ts | 2 +- packages/astro/src/integrations/index.ts | 2 +- packages/astro/src/vite-plugin-astro-server/request.ts | 2 +- packages/astro/src/vite-plugin-astro-server/route.ts | 2 +- packages/astro/src/vite-plugin-scanner/index.ts | 2 +- packages/astro/src/vite-plugin-scanner/scan.ts | 1 - packages/integrations/image/src/index.ts | 2 +- packages/integrations/vercel/src/static/adapter.ts | 2 +- .../integrations/vercel/test/serverless-prerender.test.js | 8 ++++---- 20 files changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/astro/src/assets/generate.ts b/packages/astro/src/assets/generate.ts index da602e80f..a7a9ddd2d 100644 --- a/packages/astro/src/assets/generate.ts +++ b/packages/astro/src/assets/generate.ts @@ -3,10 +3,10 @@ import { basename, join } from 'node:path/posix'; import type { StaticBuildOptions } from '../core/build/types.js'; import { warn } from '../core/logger/core.js'; import { prependForwardSlash } from '../core/path.js'; +import { isHybridOutput } from '../prerender/utils.js'; import { getConfiguredImageService, isESMImportedImage } from './internal.js'; import type { LocalImageService } from './services/service.js'; import type { ImageTransform } from './types.js'; -import { isHybridOutput } from '../prerender/utils.js'; interface GenerationDataUncached { cached: false; diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index aedb3f2fb..2d4d18ea7 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -1,7 +1,6 @@ import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { isLocalService, type ImageService } from './services/service.js'; import type { GetImageResult, ImageMetadata, ImageTransform } from './types.js'; -import { isHybridOutput } from '../prerender/utils.js'; export function isESMImportedImage(src: ImageMetadata | string): src is ImageMetadata { return typeof src === 'object'; diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 2c5921893..452a902ca 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -27,6 +27,7 @@ import { removeTrailingForwardSlash, } from '../../core/path.js'; import { runHookBuildGenerated } from '../../integrations/index.js'; +import { isHybridOutput } from '../../prerender/utils.js'; import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { callEndpoint, createAPIContext, throwIfRedirectNotAllowed } from '../endpoint/index.js'; import { AstroError } from '../errors/index.js'; @@ -51,7 +52,6 @@ import type { StylesheetAsset, } from './types'; import { getTimeStat } from './util.js'; -import { isHybridOutput } from '../../prerender/utils.js'; function shouldSkipDraft(pageModule: ComponentInstance, settings: AstroSettings): boolean { return ( diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 5cd33a73c..9e72e6e36 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -19,7 +19,7 @@ import { runHookConfigSetup, } from '../../integrations/index.js'; import { createVite } from '../create-vite.js'; -import { debug, info, levels, timerMessage, warn, type LogOptions } from '../logger/core.js'; +import { debug, info, levels, timerMessage, type LogOptions } from '../logger/core.js'; import { printHelp } from '../messages.js'; import { apply as applyPolyfill } from '../polyfill.js'; import { RouteCache } from '../render/route-cache.js'; diff --git a/packages/astro/src/core/build/plugins/plugin-pages.ts b/packages/astro/src/core/build/plugins/plugin-pages.ts index 1162a902b..ba4f0df32 100644 --- a/packages/astro/src/core/build/plugins/plugin-pages.ts +++ b/packages/astro/src/core/build/plugins/plugin-pages.ts @@ -2,7 +2,7 @@ import type { Plugin as VitePlugin } from 'vite'; import { pagesVirtualModuleId, resolvedPagesVirtualModuleId } from '../../app/index.js'; import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../../constants.js'; import { addRollupInput } from '../add-rollup-input.js'; -import { eachPageData, hasPrerenderedPages, type BuildInternals } from '../internal.js'; +import { eachPageData, type BuildInternals } from '../internal.js'; import type { AstroBuildPlugin } from '../plugin'; import type { StaticBuildOptions } from '../types'; diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 34967cdf3..ca186a727 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -6,6 +6,7 @@ import type { StaticBuildOptions } from '../types'; import glob from 'fast-glob'; import { fileURLToPath } from 'url'; import { runHookBuildSsr } from '../../../integrations/index.js'; +import { isHybridOutput } from '../../../prerender/utils.js'; import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js'; import { pagesVirtualModuleId } from '../../app/index.js'; import { joinPaths, prependForwardSlash } from '../../path.js'; @@ -14,7 +15,6 @@ import { addRollupInput } from '../add-rollup-input.js'; import { getOutFile, getOutFolder } from '../common.js'; import { cssOrder, eachPageData, mergeInlineCss, type BuildInternals } from '../internal.js'; import type { AstroBuildPlugin } from '../plugin'; -import { isHybridOutput } from '../../../prerender/utils.js'; export const virtualModuleId = '@astrojs-ssr-virtual-entry'; const resolvedVirtualModuleId = '\0' + virtualModuleId; diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 36d4f1e15..7d5424eb4 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -15,6 +15,7 @@ import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js'; import { appendForwardSlash, prependForwardSlash } from '../../core/path.js'; import { isModeServerWithNoAdapter } from '../../core/util.js'; import { runHookBuildSetup } from '../../integrations/index.js'; +import { isHybridOutput } from '../../prerender/utils.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { resolvedPagesVirtualModuleId } from '../app/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; @@ -26,7 +27,6 @@ import { createPluginContainer, type AstroBuildPluginContainer } from './plugin. import { registerAllPlugins } from './plugins/index.js'; import type { PageBuildData, StaticBuildOptions } from './types'; import { getTimeStat } from './util.js'; -import { isHybridOutput } from '../../prerender/utils.js'; export async function viteBuild(opts: StaticBuildOptions) { const { allPages, settings } = opts; diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index 370912e88..0ca13a220 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -6,12 +6,12 @@ import * as colors from 'kleur/colors'; import path from 'path'; import { fileURLToPath, pathToFileURL } from 'url'; import { mergeConfig as mergeViteConfig } from 'vite'; +import { isHybridMalconfigured } from '../../prerender/utils.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; import type { LogOptions } from '../logger/core.js'; import { arraify, isObject, isURL } from '../util.js'; import { createRelativeSchema } from './schema.js'; import { loadConfigWithVite } from './vite-load.js'; -import { isHybridMalconfigured } from '../../prerender/utils.js'; export const LEGACY_ASTRO_CONFIG_KEYS = new Set([ 'projectRoot', diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts index 69ef0354f..7939516da 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -3,12 +3,12 @@ import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js'; import { fileURLToPath, pathToFileURL } from 'url'; import jsxRenderer from '../../jsx/renderer.js'; +import { isHybridOutput } from '../../prerender/utils.js'; import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js'; import { getDefaultClientDirectives } from '../client-directive/index.js'; import { createDefaultDevConfig } from './config.js'; import { AstroTimer } from './timer.js'; import { loadTSConfig } from './tsconfig.js'; -import { isHybridOutput } from '../../prerender/utils.js'; export function createBaseSettings(config: AstroConfig): AstroSettings { return { diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index 4c44832f1..c005efb1f 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -9,6 +9,7 @@ import type { } from '../../@types/astro'; import type { Environment, RenderContext } from '../render/index'; +import { isHybridOutput } from '../../prerender/utils.js'; import { renderEndpoint } from '../../runtime/server/index.js'; import { ASTRO_VERSION } from '../constants.js'; import { AstroCookies, attachToResponse } from '../cookies/index.js'; @@ -16,7 +17,6 @@ import { AstroError, AstroErrorData } from '../errors/index.js'; import { warn, type LogOptions } from '../logger/core.js'; import { callMiddleware } from '../middleware/callMiddleware.js'; import { isValueSerializable } from '../render/core.js'; -import { isHybridOutput } from '../../prerender/utils.js'; const clientAddressSymbol = Symbol.for('astro.clientAddress'); const clientLocalsSymbol = Symbol.for('astro.locals'); diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index a729cf707..472822109 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -13,12 +13,12 @@ import { createRequire } from 'module'; import path from 'path'; import slash from 'slash'; import { fileURLToPath } from 'url'; +import { isHybridOutput } from '../../../prerender/utils.js'; import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js'; import { warn } from '../../logger/core.js'; import { removeLeadingForwardSlash } from '../../path.js'; import { resolvePages } from '../../util.js'; import { getRouteGenerator } from './generator.js'; -import { isHybridOutput } from '../../../prerender/utils.js'; const require = createRequire(import.meta.url); interface Item { diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index b7208236f..c12bd03ad 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -4,10 +4,10 @@ import slash from 'slash'; import { fileURLToPath } from 'url'; import { normalizePath } from 'vite'; import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro'; +import { isHybridOutput } from '../prerender/utils.js'; import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './constants.js'; import type { ModuleLoader } from './module-loader'; import { prependForwardSlash, removeTrailingForwardSlash } from './path.js'; -import { isHybridOutput } from '../prerender/utils.js'; /** Returns true if argument is an object of any prototype/class (but not null). */ export function isObject(value: unknown): value is Record { diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 01c0fe498..e53e37e42 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -17,8 +17,8 @@ import type { PageBuildData } from '../core/build/types'; import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.js'; import { mergeConfig } from '../core/config/config.js'; import { info, type LogOptions } from '../core/logger/core.js'; -import { mdxContentEntryType } from '../vite-plugin-markdown/content-entry-type.js'; import { isHybridOutput } from '../prerender/utils.js'; +import { mdxContentEntryType } from '../vite-plugin-markdown/content-entry-type.js'; async function withTakingALongTimeMsg({ name, diff --git a/packages/astro/src/vite-plugin-astro-server/request.ts b/packages/astro/src/vite-plugin-astro-server/request.ts index 738cbfea1..865c5b401 100644 --- a/packages/astro/src/vite-plugin-astro-server/request.ts +++ b/packages/astro/src/vite-plugin-astro-server/request.ts @@ -9,10 +9,10 @@ import { error } from '../core/logger/core.js'; import * as msg from '../core/messages.js'; import { removeTrailingForwardSlash } from '../core/path.js'; import { eventError, telemetry } from '../events/index.js'; +import { isHybridOutput } from '../prerender/utils.js'; import { runWithErrorHandling } from './controller.js'; import { handle500Response } from './response.js'; import { handleRoute, matchRoute } from './route.js'; -import { isHybridOutput } from '../prerender/utils.js'; /** The main logic to route dev server requests to pages in Astro. */ export async function handleRequest( diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 79d5d6a6a..259acd2eb 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -16,9 +16,9 @@ import { preload, renderPage } from '../core/render/dev/index.js'; import { getParamsAndProps, GetParamsAndPropsError } from '../core/render/index.js'; import { createRequest } from '../core/request.js'; import { matchAllRoutes } from '../core/routing/index.js'; +import { isHybridOutput } from '../prerender/utils.js'; import { log404 } from './common.js'; import { handle404Response, writeSSRResult, writeWebResponse } from './response.js'; -import { isHybridOutput } from '../prerender/utils.js'; type AsyncReturnType Promise> = T extends ( ...args: any diff --git a/packages/astro/src/vite-plugin-scanner/index.ts b/packages/astro/src/vite-plugin-scanner/index.ts index c7d6595da..a349e7fa6 100644 --- a/packages/astro/src/vite-plugin-scanner/index.ts +++ b/packages/astro/src/vite-plugin-scanner/index.ts @@ -2,8 +2,8 @@ import { normalizePath, type Plugin as VitePlugin } from 'vite'; import type { AstroSettings } from '../@types/astro.js'; import { isEndpoint, isPage } from '../core/util.js'; -import { scan } from './scan.js'; import { isHybridOutput } from '../prerender/utils.js'; +import { scan } from './scan.js'; export default function astroScannerPlugin({ settings }: { settings: AstroSettings }): VitePlugin { return { diff --git a/packages/astro/src/vite-plugin-scanner/scan.ts b/packages/astro/src/vite-plugin-scanner/scan.ts index afb3585d5..7723c3fd6 100644 --- a/packages/astro/src/vite-plugin-scanner/scan.ts +++ b/packages/astro/src/vite-plugin-scanner/scan.ts @@ -1,7 +1,6 @@ import * as eslexer from 'es-module-lexer'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import type { PageOptions } from '../vite-plugin-astro/types.js'; -import type { AstroSettings } from '../@types/astro.js'; const BOOLEAN_EXPORTS = new Set(['prerender']); diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index ce70e3c8a..b2bc11447 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -3,8 +3,8 @@ import { ssgBuild } from './build/ssg.js'; import type { ImageService, SSRImageService, TransformOptions } from './loaders/index.js'; import type { LoggerLevel } from './utils/logger.js'; import { joinPaths, prependForwardSlash, propsToFilename } from './utils/paths.js'; -import { createPlugin } from './vite-plugin-astro-image.js'; import { isHybridOutput } from './utils/prerender.js'; +import { createPlugin } from './vite-plugin-astro-image.js'; export { getImage } from './lib/get-image.js'; export { getPicture } from './lib/get-picture.js'; diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts index a7b7e5f94..0b3579cdd 100644 --- a/packages/integrations/vercel/src/static/adapter.ts +++ b/packages/integrations/vercel/src/static/adapter.ts @@ -8,8 +8,8 @@ import { } from '../image/shared.js'; import { exposeEnv } from '../lib/env.js'; import { emptyDir, getVercelOutput, writeJson } from '../lib/fs.js'; -import { getRedirects } from '../lib/redirects.js'; import { isHybridOutput } from '../lib/prerender.js'; +import { getRedirects } from '../lib/redirects.js'; const PACKAGE_NAME = '@astrojs/vercel/static'; diff --git a/packages/integrations/vercel/test/serverless-prerender.test.js b/packages/integrations/vercel/test/serverless-prerender.test.js index ec9887bdb..94d9081f4 100644 --- a/packages/integrations/vercel/test/serverless-prerender.test.js +++ b/packages/integrations/vercel/test/serverless-prerender.test.js @@ -26,10 +26,10 @@ describe('Serverless hybrid rendering', () => { process.env.PRERENDER = true; fixture = await loadFixture({ root: './fixtures/serverless-prerender/', - output:'hybrid', - experimental:{ - hybridOutput: true - } + output: 'hybrid', + experimental: { + hybridOutput: true, + }, }); });