From 99518c8d52661eb29c7eddaccb1a4e55e8e1ce8a Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 23 Mar 2022 15:57:53 -0500 Subject: [PATCH] Pin `rollup` to same version as `vite` (#2863) * chore: pin rollup to same version as Vite * fix: improve implicit types * fix: revert rollup change --- packages/astro/src/core/build/scan-based-build.ts | 3 ++- packages/astro/src/vite-plugin-astro/index.ts | 3 ++- packages/astro/src/vite-plugin-build-html/index.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/astro/src/core/build/scan-based-build.ts b/packages/astro/src/core/build/scan-based-build.ts index facaf2466..1a4cf16e4 100644 --- a/packages/astro/src/core/build/scan-based-build.ts +++ b/packages/astro/src/core/build/scan-based-build.ts @@ -1,4 +1,5 @@ import type { ViteDevServer } from 'vite'; +import type { RollupOutput, RollupWatcher } from 'rollup'; import type { AstroConfig, RouteType } from '../../@types/astro'; import type { AllPagesData, PageBuildData } from './types'; import type { LogOptions } from '../logger'; @@ -40,7 +41,7 @@ function routesOfType(type: RouteType, allPages: AllPagesData) { return Object.entries(allPages).filter(entryIsType(type)).reduce(reduceEntries, {}); } -export async function build(opts: ScanBasedBuildOptions) { +export async function build(opts: ScanBasedBuildOptions): Promise { const { allPages, astroConfig, logging, origin, pageNames, routeCache, viteConfig, viteServer } = opts; // Internal maps used to coordinate the HTML and CSS plugins. diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 0f169caa1..829076c6c 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -1,4 +1,5 @@ import type * as vite from 'vite'; +import type { PluginContext } from 'rollup'; import type { AstroConfig } from '../@types/astro'; import type { LogOptions } from '../core/logger.js'; @@ -82,7 +83,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu return id; } }, - async load(id, opts) { + async load(this: PluginContext, id, opts) { const parsedId = parseAstroRequest(id); const query = parsedId.query; if (!id.endsWith('.astro') && !query.astro) { diff --git a/packages/astro/src/vite-plugin-build-html/index.ts b/packages/astro/src/vite-plugin-build-html/index.ts index 37a68e023..1dc6e3392 100644 --- a/packages/astro/src/vite-plugin-build-html/index.ts +++ b/packages/astro/src/vite-plugin-build-html/index.ts @@ -1,7 +1,7 @@ import type { AstroConfig } from '../@types/astro'; import type { LogOptions } from '../core/logger.js'; import type { ViteDevServer, Plugin as VitePlugin } from 'vite'; -import type { OutputChunk, PreRenderedChunk } from 'rollup'; +import type { OutputChunk, PreRenderedChunk, PluginContext } from 'rollup'; import type { AllPagesData } from '../core/build/types'; import type { BuildInternals } from '../core/build/internal'; import parse5 from 'parse5'; @@ -251,7 +251,7 @@ export function rollupPluginAstroScanHTML(options: PluginOptions): VitePlugin { return outputOptions; }, - async generateBundle(_options, bundle) { + async generateBundle(this: PluginContext, _options, bundle) { const facadeIdMap = new Map(); for (const [chunkId, output] of Object.entries(bundle)) { if (output.type === 'chunk') {