import { Plugin } from 'vite' ; import { RollupOutput } from 'rollup' ; import pm from 'picomatch' ; export function testEntry ( source ) { return { name : 'test-entry' , enforce : 'pre' , resolveId ( source ) { if ( source === 'index.js' ) return 'index.js' ; } , load ( id ) { if ( id === 'index.js' ) return source ; } } ; } export function getFiles ( bundle , pattern ) { const isMatch = pm ( pattern ) ; return ( Array . isArray ( bundle ) ? bundle [ 0 ] : bundle ) . output . filter ( ( entry ) => isMatch ( entry . fileName ) ) ; }