Skip to content

Commit

Permalink
Fixed incorrect types and imports (#2630)
Browse files Browse the repository at this point in the history
* Fixed incorrect types and imports

* Changeset
  • Loading branch information
JuanM04 committed Feb 23, 2022
1 parent f64840e commit a2128f8
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-tigers-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixed incorrect types and imports
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@proload/plugin-tsm": "^0.1.0",
"@types/babel__core": "^7.1.15",
"@types/debug": "^4.1.7",
"@types/yargs-parser": "^20.2.1",
"@web/parse5-utils": "^1.3.0",
"ci-info": "^3.2.0",
"common-ancestor-path": "^1.0.1",
Expand Down Expand Up @@ -121,7 +122,6 @@
"@types/resolve": "^1.20.1",
"@types/rimraf": "^3.0.2",
"@types/send": "^0.17.1",
"@types/yargs-parser": "^20.2.1",
"chai": "^4.3.4",
"cheerio": "^1.0.0-rc.10",
"execa": "^6.0.0",
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,8 +1,8 @@
import type babel from '@babel/core';
import type * as babel from '@babel/core';
import type { z } from 'zod';
import type { AstroConfigSchema } from '../core/config';
import type { AstroComponentFactory, Metadata } from '../runtime/server';
import type vite from '../core/vite';
import type * as vite from 'vite';

export interface AstroBuiltinProps {
'client:load'?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs';
import * as colors from 'kleur/colors';
import { polyfill } from '@astropub/webapi';
import { performance } from 'perf_hooks';
import vite, { ViteDevServer } from '../vite.js';
import * as vite from 'vite';
import { createVite, ViteConfigWithSSR } from '../create-vite.js';
import { debug, defaultLogOptions, info, levels, timerMessage, warn } from '../logger.js';
import { createRouteManifest } from '../routing/index.js';
Expand Down Expand Up @@ -38,7 +38,7 @@ class AstroBuilder {
private origin: string;
private routeCache: RouteCache;
private manifest: ManifestData;
private viteServer?: ViteDevServer;
private viteServer?: vite.ViteDevServer;
private viteConfig?: ViteConfigWithSSR;

constructor(config: AstroConfig, options: BuildOptions) {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/page-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroConfig, ComponentInstance, ManifestData, RouteData } from '../../@types/astro';
import type { AllPagesData } from './types';
import type { LogOptions } from '../logger';
import type { ViteDevServer } from '../vite.js';
import type { ViteDevServer } from 'vite';

import { fileURLToPath } from 'url';
import * as colors from 'kleur/colors';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/build/scan-based-build.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ViteDevServer } from '../vite.js';
import type { ViteDevServer } from 'vite';
import type { AstroConfig, RouteType } from '../../@types/astro';
import type { AllPagesData, PageBuildData } from './types';
import type { LogOptions } from '../logger';
import type { ViteConfigWithSSR } from '../create-vite.js';

import { fileURLToPath } from 'url';
import vite from '../vite.js';
import * as vite from 'vite';
import { createBuildInternals } from '../../core/build/internal.js';
import { rollupPluginAstroBuildHTML } from '../../vite-plugin-build-html/index.js';
import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js';
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OutputChunk, OutputAsset, RollupOutput } from 'rollup';
import type { Plugin as VitePlugin, UserConfig, Manifest as ViteManifest } from '../vite';
import type { AstroConfig, EndpointHandler, ComponentInstance, ManifestData, Renderer, RouteType } from '../../@types/astro';
import type { Plugin as VitePlugin, UserConfig, Manifest as ViteManifest } from 'vite';
import type { AstroConfig, ComponentInstance, ManifestData, Renderer, RouteType } from '../../@types/astro';
import type { AllPagesData } from './types';
import type { LogOptions } from '../logger';
import type { ViteConfigWithSSR } from '../create-vite';
Expand All @@ -12,7 +12,7 @@ import fs from 'fs';
import npath from 'path';
import { fileURLToPath } from 'url';
import glob from 'fast-glob';
import vite from '../vite.js';
import * as vite from 'vite';
import { debug, error } from '../../core/logger.js';
import { prependForwardSlash, appendForwardSlash } from '../../core/path.js';
import { createBuildInternals } from '../../core/build/internal.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AstroConfig } from '../../@types/astro';
import type { Plugin as VitePlugin } from '../vite';
import type { Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from '../../core/build/internal.js';
import { fileURLToPath } from 'url';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { LogOptions } from './logger';

import { builtinModules } from 'module';
import { fileURLToPath } from 'url';
import vite from './vite.js';
import * as vite from 'vite';
import astroVitePlugin from '../vite-plugin-astro/index.js';
import astroViteServerPlugin from '../vite-plugin-astro-server/index.js';
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { performance } from 'perf_hooks';
import type { AstroConfig } from '../../@types/astro';
import { createVite } from '../create-vite.js';
import { defaultLogOptions, info, LogOptions } from '../logger.js';
import vite from '../vite.js';
import * as vite from 'vite';
import * as msg from '../messages.js';

export interface DevOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/css.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../../vite';
import type * as vite from 'vite';

import path from 'path';
import { viteID } from '../../util.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BuildResult } from 'esbuild';
import type vite from '../../vite';
import type * as vite from 'vite';
import type { SSRError } from '../../../@types/astro';

import eol from 'eol';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/html.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../../vite';
import type * as vite from 'vite';

import htmlparser2 from 'htmlparser2';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../../vite';
import type * as vite from 'vite';
import type { AstroConfig, ComponentInstance, Renderer, RouteData, RuntimeMode } from '../../../@types/astro';
import { LogOptions } from '../../logger.js';
import { fileURLToPath } from 'url';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/dev/renderers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../../vite';
import type * as vite from 'vite';
import type { AstroConfig, Renderer } from '../../../@types/astro';

import { resolveDependency } from '../../util.js';
Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/core/vite.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro-postprocess/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as t from '@babel/types';
import type { Plugin } from '../core/vite';
import type { Plugin } from 'vite';
import type { AstroConfig } from '../@types/astro';

import * as babelTraverse from '@babel/traverse';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro-server/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../core/vite';
import type * as vite from 'vite';
import type http from 'http';
import type { AstroConfig, ManifestData, RouteData } from '../@types/astro';
import { info, LogOptions } from '../core/logger.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/vite-plugin-astro/hmr.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroConfig } from '../@types/astro';
import type { ViteDevServer, ModuleNode, HmrContext } from '../core/vite';
import type { ViteDevServer, ModuleNode, HmrContext } from 'vite';
import type { PluginContext as RollupPluginContext, ResolvedId } from 'rollup';
import { cachedCompilation, invalidateCompilation, isCached } from './compile.js';
import { invalidateCompilation, isCached } from './compile.js';

interface TrackCSSDependenciesOptions {
viteDevServer: ViteDevServer | null;
Expand Down
5 changes: 2 additions & 3 deletions packages/astro/src/vite-plugin-astro/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type vite from '../core/vite';
import type * as vite from 'vite';
import type { AstroConfig } from '../@types/astro';
import type { LogOptions } from '../core/logger.js';

import esbuild from 'esbuild';
import npath from 'path';
import { fileURLToPath, pathToFileURL } from 'url';
import { fileURLToPath } from 'url';
import slash from 'slash';
import { getViteTransform, TransformHook } from './styles.js';
import { parseAstroRequest } from './query.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type vite from '../core/vite';
import type * as vite from 'vite';

import { STYLE_EXTENSIONS } from '../core/render/dev/css.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-build-css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BuildInternals } from '../core/build/internal';

import * as path from 'path';
import esbuild from 'esbuild';
import { Plugin as VitePlugin } from '../core/vite';
import { Plugin as VitePlugin } from 'vite';
import { isCSSRequest } from '../core/render/dev/css.js';

const PLUGIN_NAME = '@astrojs/rollup-plugin-build-css';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-build-css/resolve.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ResolveIdHook, LoadHook } from 'rollup';
import type { ResolvedConfig, Plugin as VitePlugin } from '../core/vite';
import type { ResolvedConfig, Plugin as VitePlugin } from 'vite';

export function getVitePluginByName(viteConfig: ResolvedConfig, pluginName: string): VitePlugin {
const plugin = viteConfig.plugins.find(({ name }) => name === pluginName);
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-build-html/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AstroConfig } from '../@types/astro';
import type { LogOptions } from '../core/logger.js';
import type { ViteDevServer, Plugin as VitePlugin } from '../core/vite';
import type { ViteDevServer, Plugin as VitePlugin } from 'vite';
import type { OutputChunk, PreRenderedChunk } from 'rollup';
import type { AllPagesData } from '../core/build/types';
import type { BuildInternals } from '../core/build/internal';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-config-alias/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as tsr from 'tsconfig-resolver';
import * as path from 'path';
import * as url from 'url';

import type * as vite from '../core/vite';
import type * as vite from 'vite';

/** Result of successfully parsed tsconfig.json or jsconfig.json. */
export declare interface Alias {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-jsx/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TransformResult } from 'rollup';
import type { Plugin, ResolvedConfig } from '../core/vite';
import type { Plugin, ResolvedConfig } from 'vite';
import type { AstroConfig, Renderer } from '../@types/astro';
import type { LogOptions } from '../core/logger.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-markdown/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from '../core/vite';
import type { Plugin } from 'vite';
import type { AstroConfig } from '../@types/astro';

import esbuild from 'esbuild';
Expand Down

0 comments on commit a2128f8

Please sign in to comment.