types: improve coverage (#1585)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/1597/head
Azat S 2 years ago committed by GitHub
parent 9d10b1d5a1
commit 7955760972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,7 +2,7 @@ import ora from 'ora'
import path from 'path' import path from 'path'
import fs from 'fs-extra' import fs from 'fs-extra'
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite' import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
import { RollupOutput } from 'rollup' import { GetModuleInfo, RollupOutput } from 'rollup'
import { slash } from '../utils/slash' import { slash } from '../utils/slash'
import { SiteConfig } from '../config' import { SiteConfig } from '../config'
import { APP_PATH } from '../alias' import { APP_PATH } from '../alias'
@ -90,7 +90,7 @@ export async function bundle(
return 'framework' return 'framework'
} }
if ( if (
isEagerChunk(id, ctx) && isEagerChunk(id, ctx.getModuleInfo) &&
(/@vue\/(runtime|shared|reactivity)/.test(id) || (/@vue\/(runtime|shared|reactivity)/.test(id) ||
/vitepress\/dist\/client/.test(id)) /vitepress\/dist\/client/.test(id))
) { ) {
@ -154,7 +154,7 @@ const cache = new Map<string, boolean>()
/** /**
* Check if a module is statically imported by at least one entry. * Check if a module is statically imported by at least one entry.
*/ */
function isEagerChunk(id: string, { getModuleInfo }: any) { function isEagerChunk(id: string, getModuleInfo: GetModuleInfo) {
if ( if (
id.includes('node_modules') && id.includes('node_modules') &&
!/\.css($|\\?)/.test(id) && !/\.css($|\\?)/.test(id) &&
@ -166,7 +166,7 @@ function isEagerChunk(id: string, { getModuleInfo }: any) {
function staticImportedByEntry( function staticImportedByEntry(
id: string, id: string,
getModuleInfo: any, getModuleInfo: GetModuleInfo,
cache: Map<string, boolean>, cache: Map<string, boolean>,
importStack: string[] = [] importStack: string[] = []
): boolean { ): boolean {

Loading…
Cancel
Save