From 4264b7c564ff403333d065bd466230a401a49754 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Wed, 17 May 2023 15:38:46 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/content/runtime.ts | 4 ++-- .../src/content/template/virtual-mod.mjs | 6 ++--- packages/astro/src/content/types-generator.ts | 22 +++++++++---------- packages/astro/src/content/utils.ts | 6 ++--- .../content/vite-plugin-content-imports.ts | 18 +++++++-------- .../vite-plugin-content-virtual-mod.ts | 14 ++++++------ packages/astro/src/core/config/settings.ts | 12 +++++----- packages/astro/src/core/errors/index.ts | 2 +- packages/astro/src/core/errors/utils.ts | 4 ++-- packages/astro/src/core/sync/index.ts | 3 +-- 10 files changed, 45 insertions(+), 46 deletions(-) diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts index c3c39da87..f38d9192a 100644 --- a/packages/astro/src/content/runtime.ts +++ b/packages/astro/src/content/runtime.ts @@ -1,6 +1,7 @@ +import type { MarkdownHeading } from '@astrojs/markdown-remark'; +import { string as zodString, ZodIssueCode } from 'zod'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { prependForwardSlash } from '../core/path.js'; -import { ZodIssueCode, string as zodString, type z } from 'zod'; import { createComponent, createHeadAndContent, @@ -12,7 +13,6 @@ import { type AstroComponentFactory, } from '../runtime/server/index.js'; import type { ContentLookupMap } from './utils.js'; -import type { MarkdownHeading } from '@astrojs/markdown-remark'; type LazyImport = () => Promise; type GlobResult = Record; diff --git a/packages/astro/src/content/template/virtual-mod.mjs b/packages/astro/src/content/template/virtual-mod.mjs index aab50bf6b..491e594a6 100644 --- a/packages/astro/src/content/template/virtual-mod.mjs +++ b/packages/astro/src/content/template/virtual-mod.mjs @@ -2,10 +2,10 @@ import { createCollectionToGlobResultMap, createGetCollection, - createGetEntryBySlug, - createGetEntry, - createGetEntries, createGetDataEntryById, + createGetEntries, + createGetEntry, + createGetEntryBySlug, createReference, } from 'astro/content/runtime'; diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts index 0b93a4e93..aa8c7369d 100644 --- a/packages/astro/src/content/types-generator.ts +++ b/packages/astro/src/content/types-generator.ts @@ -5,25 +5,25 @@ import * as path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import { normalizePath, type ViteDevServer } from 'vite'; import type { AstroSettings, ContentEntryType } from '../@types/astro.js'; +import { AstroErrorData } from '../core/errors/errors-data.js'; +import { AstroError } from '../core/errors/errors.js'; import { info, warn, type LogOptions } from '../core/logger/core.js'; import { isRelativePath } from '../core/path.js'; import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js'; import { + getContentEntryConfigByExtMap, + getContentEntryIdAndSlug, + getContentPaths, + getDataEntryExts, + getDataEntryId, + getEntryCollectionName, + getEntrySlug, + getEntryType, + reloadContentConfigObserver, type ContentConfig, type ContentObservable, type ContentPaths, - getContentEntryConfigByExtMap, - getContentPaths, - getEntryType, - getContentEntryIdAndSlug, - getEntrySlug, - getEntryCollectionName, - getDataEntryExts, - getDataEntryId, - reloadContentConfigObserver, } from './utils.js'; -import { AstroError } from '../core/errors/errors.js'; -import { AstroErrorData } from '../core/errors/errors-data.js'; type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'; type RawContentEvent = { name: ChokidarEvent; entry: string }; diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 7252ca931..831b25fb4 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -4,7 +4,7 @@ import fsMod from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import type { PluginContext } from 'rollup'; -import { normalizePath, type ErrorPayload as ViteErrorPayload, type ViteDevServer } from 'vite'; +import { normalizePath, type ViteDevServer } from 'vite'; import { z } from 'zod'; import type { AstroConfig, @@ -14,10 +14,10 @@ import type { } from '../@types/astro.js'; import { VALID_INPUT_FORMATS } from '../assets/consts.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; -import { CONTENT_TYPES_FILE, CONTENT_FLAGS } from './consts.js'; +import { formatYAMLException, isYAMLException } from '../core/errors/utils.js'; +import { CONTENT_FLAGS, CONTENT_TYPES_FILE } from './consts.js'; import { errorMap } from './error-map.js'; import { createImage } from './runtime-assets.js'; -import { formatYAMLException, isYAMLException } from '../core/errors/utils.js'; /** * Amap from a collection + slug to the local file path. diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts index 466f4bd00..c0d0571e3 100644 --- a/packages/astro/src/content/vite-plugin-content-imports.ts +++ b/packages/astro/src/content/vite-plugin-content-imports.ts @@ -16,21 +16,21 @@ import { AstroError } from '../core/errors/errors.js'; import { escapeViteEnvReferences, getFileInfo } from '../vite-plugin-utils/index.js'; import { CONTENT_FLAG, DATA_FLAG } from './consts.js'; import { - type ContentConfig, - type ContentPaths, + getContentEntryConfigByExtMap, getContentEntryExts, - getContentPaths, - getEntryData, - parseEntrySlug, getContentEntryIdAndSlug, + getContentPaths, + getDataEntryExts, + getDataEntryId, + getEntryCollectionName, + getEntryData, getEntryType, globalContentConfigObserver, - getContentEntryConfigByExtMap, - getEntryCollectionName, - getDataEntryExts, hasContentFlag, - getDataEntryId, + parseEntrySlug, reloadContentConfigObserver, + type ContentConfig, + type ContentPaths, } from './utils.js'; function getContentRendererByViteId( diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index 3f5b463ab..51ac99315 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -4,21 +4,21 @@ import { extname } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import type { Plugin } from 'vite'; import type { AstroSettings } from '../@types/astro.js'; -import { rootRelativePath } from '../core/util.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; +import { rootRelativePath } from '../core/util.js'; import { VIRTUAL_MODULE_ID } from './consts.js'; import { getContentEntryConfigByExtMap, - getDataEntryExts, - getContentPaths, - getExtGlob, - getEntryCollectionName, getContentEntryIdAndSlug, - getEntrySlug, + getContentPaths, + getDataEntryExts, getDataEntryId, + getEntryCollectionName, + getEntrySlug, getEntryType, - type ContentPaths, + getExtGlob, type ContentLookupMap, + type ContentPaths, } from './utils.js'; interface AstroContentVirtualModPluginParams { diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts index b4565b1c4..22f796981 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -1,18 +1,18 @@ -import type { AstroConfig, AstroSettings, AstroUserConfig } from '../../@types/astro'; -import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js'; +import yaml from 'js-yaml'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'url'; +import type { AstroConfig, AstroSettings, AstroUserConfig } from '../../@types/astro'; +import { getContentPaths } from '../../content/index.js'; 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 { AstroError, AstroErrorData } from '../errors/index.js'; +import { formatYAMLException, isYAMLException } from '../errors/utils.js'; +import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js'; import { createDefaultDevConfig } from './config.js'; import { AstroTimer } from './timer.js'; import { loadTSConfig } from './tsconfig.js'; -import yaml from 'js-yaml'; -import { formatYAMLException, isYAMLException } from '../errors/utils.js'; -import { AstroError, AstroErrorData } from '../errors/index.js'; -import { getContentPaths } from '../../content/index.js'; export function createBaseSettings(config: AstroConfig): AstroSettings { const { contentDir } = getContentPaths(config); diff --git a/packages/astro/src/core/errors/index.ts b/packages/astro/src/core/errors/index.ts index 438a77b39..56a6af8c2 100644 --- a/packages/astro/src/core/errors/index.ts +++ b/packages/astro/src/core/errors/index.ts @@ -5,8 +5,8 @@ export { AstroError, CompilerError, CSSError, - MarkdownError, isAstroError, + MarkdownError, } from './errors.js'; export { codeFrame } from './printer.js'; export { createSafeError, positionAt } from './utils.js'; diff --git a/packages/astro/src/core/errors/utils.ts b/packages/astro/src/core/errors/utils.ts index e7f6f2643..f4408c305 100644 --- a/packages/astro/src/core/errors/utils.ts +++ b/packages/astro/src/core/errors/utils.ts @@ -1,8 +1,8 @@ import type { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js'; -import type { SSRError } from '../../@types/astro.js'; -import { AstroErrorData, type AstroErrorCodes, type ErrorData } from './errors-data.js'; import type { YAMLException } from 'js-yaml'; import type { ErrorPayload as ViteErrorPayload } from 'vite'; +import type { SSRError } from '../../@types/astro.js'; +import { AstroErrorData, type AstroErrorCodes, type ErrorData } from './errors-data.js'; /** * Get the line and character based on the offset diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 144792fb4..0828f8ff3 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -10,10 +10,9 @@ import { runHookConfigSetup } from '../../integrations/index.js'; import { setUpEnvTs } from '../../vite-plugin-inject-env-ts/index.js'; import { getTimeStat } from '../build/util.js'; import { createVite } from '../create-vite.js'; -import { AstroError, AstroErrorData, createSafeError } from '../errors/index.js'; +import { AstroError, AstroErrorData, createSafeError, isAstroError } from '../errors/index.js'; import { info, type LogOptions } from '../logger/core.js'; import { printHelp } from '../messages.js'; -import { isAstroError } from '../errors/index.js'; export type ProcessExit = 0 | 1;