Pin rollup to same version as vite (#2863)

* chore: pin rollup to same version as Vite

* fix: improve implicit types

* fix: revert rollup change
This commit is contained in:
Nate Moore 2022-03-23 15:57:53 -05:00 committed by GitHub
parent 29f420bb0e
commit 99518c8d52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

@ -1,4 +1,5 @@
import type { ViteDevServer } from 'vite'; import type { ViteDevServer } from 'vite';
import type { RollupOutput, RollupWatcher } from 'rollup';
import type { AstroConfig, RouteType } from '../../@types/astro'; import type { AstroConfig, RouteType } from '../../@types/astro';
import type { AllPagesData, PageBuildData } from './types'; import type { AllPagesData, PageBuildData } from './types';
import type { LogOptions } from '../logger'; import type { LogOptions } from '../logger';
@ -40,7 +41,7 @@ function routesOfType(type: RouteType, allPages: AllPagesData) {
return Object.entries(allPages).filter(entryIsType(type)).reduce(reduceEntries, {}); return Object.entries(allPages).filter(entryIsType(type)).reduce(reduceEntries, {});
} }
export async function build(opts: ScanBasedBuildOptions) { export async function build(opts: ScanBasedBuildOptions): Promise<RollupOutput | RollupOutput[] | RollupWatcher> {
const { allPages, astroConfig, logging, origin, pageNames, routeCache, viteConfig, viteServer } = opts; const { allPages, astroConfig, logging, origin, pageNames, routeCache, viteConfig, viteServer } = opts;
// Internal maps used to coordinate the HTML and CSS plugins. // Internal maps used to coordinate the HTML and CSS plugins.

View file

@ -1,4 +1,5 @@
import type * as vite from 'vite'; import type * as vite from 'vite';
import type { PluginContext } from 'rollup';
import type { AstroConfig } from '../@types/astro'; import type { AstroConfig } from '../@types/astro';
import type { LogOptions } from '../core/logger.js'; import type { LogOptions } from '../core/logger.js';
@ -82,7 +83,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
return id; return id;
} }
}, },
async load(id, opts) { async load(this: PluginContext, id, opts) {
const parsedId = parseAstroRequest(id); const parsedId = parseAstroRequest(id);
const query = parsedId.query; const query = parsedId.query;
if (!id.endsWith('.astro') && !query.astro) { if (!id.endsWith('.astro') && !query.astro) {

View file

@ -1,7 +1,7 @@
import type { AstroConfig } from '../@types/astro'; import type { AstroConfig } from '../@types/astro';
import type { LogOptions } from '../core/logger.js'; import type { LogOptions } from '../core/logger.js';
import type { ViteDevServer, Plugin as VitePlugin } from 'vite'; 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 { AllPagesData } from '../core/build/types';
import type { BuildInternals } from '../core/build/internal'; import type { BuildInternals } from '../core/build/internal';
import parse5 from 'parse5'; import parse5 from 'parse5';
@ -251,7 +251,7 @@ export function rollupPluginAstroScanHTML(options: PluginOptions): VitePlugin {
return outputOptions; return outputOptions;
}, },
async generateBundle(_options, bundle) { async generateBundle(this: PluginContext, _options, bundle) {
const facadeIdMap = new Map<string, string>(); const facadeIdMap = new Map<string, string>();
for (const [chunkId, output] of Object.entries(bundle)) { for (const [chunkId, output] of Object.entries(bundle)) {
if (output.type === 'chunk') { if (output.type === 'chunk') {