Skip to content

Commit

Permalink
chore: import sorting for the astro package
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Feb 27, 2024
1 parent e7dd92d commit f122740
Show file tree
Hide file tree
Showing 106 changed files with 233 additions and 233 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"files": {
"include": ["test/**", "e2e/**", "packages/**"],
"ignore": ["vendor", "dist/**", "packages/astro/**"]
"ignore": ["vendor", "dist/**"]
},
"organizeImports": {
"enabled": true
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/performance/content-benchmark.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-console */

import { fileURLToPath } from 'node:url';
import { bold, cyan, dim } from 'kleur/colors';
import yargs from 'yargs-parser';
import { loadFixture } from '../test/test-utils.js';
import { generatePosts } from './scripts/generate-posts.mjs';
import yargs from 'yargs-parser';
import { cyan, bold, dim } from 'kleur/colors';

// Skip nonessential remark / rehype plugins for a fair comparison.
// This includes heading ID generation, syntax highlighting, GFM, and Smartypants.
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/md/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/mdoc/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import markdoc from "@astrojs/markdoc";
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/mdx/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net';
import type {
MarkdownHeading,
MarkdownMetadata,
Expand All @@ -8,8 +10,6 @@ import type {
ShikiConfig,
} from '@astrojs/markdown-remark';
import type * as babel from '@babel/core';
import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net';
import type * as rollup from 'rollup';
import type * as vite from 'vite';
import type { RemotePattern } from '../assets/utils/remotePattern.js';
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/assets/build/generate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { dim, green } from 'kleur/colors';
import fs, { readFileSync } from 'node:fs';
import { basename, join } from 'node:path/posix';
import { dim, green } from 'kleur/colors';
import type PQueue from 'p-queue';
import type { AstroConfig } from '../../@types/astro.js';
import type { BuildPipeline } from '../../core/build/pipeline.js';
import { getOutDirWithinCwd } from '../../core/build/common.js';
import type { BuildPipeline } from '../../core/build/pipeline.js';
import { getTimeStat } from '../../core/build/util.js';
import { AstroError } from '../../core/errors/errors.js';
import { AstroErrorData } from '../../core/errors/index.js';
Expand All @@ -16,7 +16,7 @@ import { getConfiguredImageService } from '../internal.js';
import type { LocalImageService } from '../services/service.js';
import type { AssetsGlobalStaticImagesList, ImageMetadata, ImageTransform } from '../types.js';
import { isESMImportedImage } from '../utils/imageKind.js';
import { loadRemoteImage, type RemoteCacheEntry } from './remote.js';
import { type RemoteCacheEntry, loadRemoteImage } from './remote.js';

interface GenerationDataUncached {
cached: false;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/endpoint/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import mime from 'mime/lite.js';
import type { APIRoute } from '../../@types/astro.js';
import { getConfiguredImageService } from '../internal.js';
import { etag } from '../utils/etag.js';
import { isRemoteAllowed } from '../utils/remotePattern.js';
// @ts-expect-error
import { imageConfig } from 'astro:assets';
import { isRemoteAllowed } from '../utils/remotePattern.js';

async function loadRemoteImage(src: URL) {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/endpoint/node.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import os from 'os';
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
import { readFile } from 'fs/promises';
import mime from 'mime/lite.js';
import os from 'os';
import type { APIRoute } from '../../@types/astro.js';
import { getConfiguredImageService } from '../internal.js';
import { etag } from '../utils/etag.js';
import { isRemoteAllowed } from '../utils/remotePattern.js';
// @ts-expect-error
import { assetsDir, imageConfig } from 'astro:assets';
import { isRemoteAllowed } from '../utils/remotePattern.js';

function replaceFileSystemReferences(src: string) {
return os.platform().includes('win32') ? src.replace(/^\/@fs\//, '') : src.replace(/^\/@fs/, '');
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/internal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroConfig } from '../@types/astro.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { DEFAULT_HASH_PROPS } from './consts.js';
import { isLocalService, type ImageService } from './services/service.js';
import { type ImageService, isLocalService } from './services/service.js';
import type {
GetImageResult,
ImageTransform,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/services/noop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { baseService, type LocalImageService } from './service.js';
import { type LocalImageService, baseService } from './service.js';

// Empty service used for platforms that neither support Squoosh or Sharp.
const noopService: LocalImageService = {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/services/sharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { FormatEnum, SharpOptions } from 'sharp';
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import {
baseService,
parseQuality,
type BaseServiceTransform,
type LocalImageService,
baseService,
parseQuality,
} from './service.js';

export interface SharpImageServiceConfig {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/services/squoosh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import { imageMetadata } from '../utils/metadata.js';
import {
baseService,
parseQuality,
type BaseServiceTransform,
type LocalImageService,
baseService,
parseQuality,
} from './service.js';
import { processBuffer } from './vendor/squoosh/image-pool.js';
import type { Operation } from './vendor/squoosh/image.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/utils/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageInputFormat, ImageMetadata } from '../types.js';
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';

export async function imageMetadata(
data: Uint8Array,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/utils/transformToPath.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deterministicString } from 'deterministic-object-hash';
import { basename, extname } from 'node:path';
import { deterministicString } from 'deterministic-object-hash';
import { removeQueryString } from '../../core/path.js';
import { shorthash } from '../../runtime/server/shorthash.js';
import type { ImageTransform } from '../types.js';
Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import fsMod, { existsSync, promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import boxen from 'boxen';
import { diffWords } from 'diff';
import { execa } from 'execa';
import { bold, cyan, dim, green, magenta, red, yellow } from 'kleur/colors';
import fsMod, { existsSync, promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import maxSatisfying from 'semver/ranges/max-satisfying.js';
import ora from 'ora';
import preferredPM from 'preferred-pm';
import prompts from 'prompts';
import maxSatisfying from 'semver/ranges/max-satisfying.js';
import type yargs from 'yargs-parser';
import {
loadTSConfig,
Expand All @@ -18,9 +18,9 @@ import {
} from '../../core/config/index.js';
import {
defaultTSConfig,
type frameworkWithTSSettings,
presets,
updateTSConfigForFramework,
type frameworkWithTSSettings,
} from '../../core/config/tsconfig.js';
import type { Logger } from '../../core/logger/core.js';
import * as msg from '../../core/messages.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/cli/check/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import type { Arguments } from 'yargs-parser';
import { ensureProcessNodeEnv } from '../../core/util.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';
import { ensureProcessNodeEnv } from '../../core/util.js';

export async function check(flags: Arguments) {
ensureProcessNodeEnv('production');
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Arguments } from 'yargs-parser';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';
import { resolveConfig } from '../../core/config/config.js';
import type { AstroConfig } from '../../@types/astro.js';
import { resolveConfig } from '../../core/config/config.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';

type DBPackage = {
cli: (args: { flags: Arguments; config: AstroConfig }) => unknown;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/cli/flags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Arguments as Flags } from 'yargs-parser';
import type { AstroInlineConfig } from '../@types/astro.js';
import { Logger, type LogOptions } from '../core/logger/core.js';
import { type LogOptions, Logger } from '../core/logger/core.js';
import { nodeLogDestination } from '../core/logger/node.js';

export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig {
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/info/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import { execSync } from 'node:child_process';
import { arch, platform } from 'node:os';
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import prompts from 'prompts';
import type yargs from 'yargs-parser';
import type { AstroConfig, AstroUserConfig } from '../../@types/astro.js';
import { resolveConfig } from '../../core/config/index.js';
import { ASTRO_VERSION } from '../../core/constants.js';
import { flagsToAstroInlineConfig } from '../flags.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { flagsToAstroInlineConfig } from '../flags.js';

interface InfoOptions {
flags: yargs.Arguments;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/cli/install-package.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { createRequire } from 'node:module';
import { sep } from 'node:path';
import boxen from 'boxen';
import { execa } from 'execa';
import { bold, cyan, dim, magenta } from 'kleur/colors';
Expand All @@ -6,8 +8,6 @@ import prompts from 'prompts';
import resolvePackage from 'resolve';
import whichPm from 'which-pm';
import { type Logger } from '../core/logger/core.js';
import { createRequire } from 'node:module';
import { sep } from 'node:path';
const require = createRequire(import.meta.url);

type GetPackageOptions = {
Expand Down
14 changes: 7 additions & 7 deletions packages/astro/src/cli/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
import type yargs from 'yargs-parser';
import type { AstroSettings } from '../../@types/astro.js';

import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
import { fileURLToPath } from 'node:url';
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';

import { formatWithOptions } from 'node:util';
import dlv from 'dlv';
// @ts-expect-error flattie types are mispackaged
import { flattie } from 'flattie';
import { resolveConfig } from '../../core/config/config.js';
import { createSettings } from '../../core/config/settings.js';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import * as msg from '../../core/messages.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
import { coerce, isValidKey, type PreferenceKey } from '../../preferences/index.js';
import { type PreferenceKey, coerce, isValidKey } from '../../preferences/index.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
// @ts-expect-error flattie types are mispackaged
import { flattie } from 'flattie';
import { formatWithOptions } from 'node:util';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';

interface PreferencesOptions {
flags: yargs.Arguments;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { ZodIssueCode, string as zodString } from 'zod';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { prependForwardSlash } from '../core/path.js';
import {
type AstroComponentFactory,
createComponent,
createHeadAndContent,
renderComponent,
renderScriptElement,
renderTemplate,
renderUniqueStylesheet,
unescapeHTML,
type AstroComponentFactory,
} from '../runtime/server/index.js';
import type { ContentLookupMap } from './utils.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/server-listeners.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { bold, cyan, underline } from 'kleur/colors';
import type fsMod from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { bold, cyan, underline } from 'kleur/colors';
import type { ViteDevServer } from 'vite';
import type { AstroSettings } from '../@types/astro.js';
import { loadTSConfig } from '../core/config/tsconfig.js';
import type { Logger } from '../core/logger/core.js';
import { appendForwardSlash } from '../core/path.js';
import { createContentTypesGenerator } from './types-generator.js';
import { getContentPaths, globalContentConfigObserver, type ContentPaths } from './utils.js';
import { type ContentPaths, getContentPaths, globalContentConfigObserver } from './utils.js';

interface ContentServerListenerParams {
fs: typeof fsMod;
Expand Down
12 changes: 6 additions & 6 deletions packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import glob from 'fast-glob';
import { bold, cyan } from 'kleur/colors';
import type fsMod from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { normalizePath, type ViteDevServer } from 'vite';
import glob from 'fast-glob';
import { bold, cyan } from 'kleur/colors';
import { type ViteDevServer, normalizePath } from 'vite';
import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
import { AstroError } from '../core/errors/errors.js';
import { AstroErrorData } from '../core/errors/index.js';
import type { Logger } from '../core/logger/core.js';
import { isRelativePath } from '../core/path.js';
import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
import {
type ContentConfig,
type ContentObservable,
type ContentPaths,
getContentEntryIdAndSlug,
getContentPaths,
getDataEntryExts,
Expand All @@ -20,9 +23,6 @@ import {
getEntrySlug,
getEntryType,
reloadContentConfigObserver,
type ContentConfig,
type ContentObservable,
type ContentPaths,
} from './utils.js';

type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { slug as githubSlug } from 'github-slugger';
import matter from 'gray-matter';
import fsMod from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { slug as githubSlug } from 'github-slugger';
import matter from 'gray-matter';
import type { PluginContext } from 'rollup';
import { normalizePath, type ViteDevServer } from 'vite';
import { type ViteDevServer, normalizePath } from 'vite';
import { z } from 'zod';
import type {
AstroConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/vite-plugin-content-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
import type { Plugin, Rollup } from 'vite';
import type { AstroSettings } from '../@types/astro.js';
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.js';
import { type BuildInternals, getPageDataByViteID } from '../core/build/internal.js';
import type { AstroBuildPlugin } from '../core/build/plugin.js';
import type { StaticBuildOptions } from '../core/build/types.js';
import type { ModuleLoader } from '../core/module-loader/loader.js';
Expand Down
Loading

0 comments on commit f122740

Please sign in to comment.