File tree Expand file tree Collapse file tree 3 files changed +143
-20
lines changed Expand file tree Collapse file tree 3 files changed +143
-20
lines changed Original file line number Diff line number Diff line change 6161 },
6262 "dependencies" : {
6363 "@rollup/plugin-virtual" : " ^3.0.0" ,
64- "matched " : " ^5 .0.1 "
64+ "glob " : " ^11 .0.3 "
6565 },
6666 "devDependencies" : {
6767 "rollup" : " ^4.0.0-24"
Original file line number Diff line number Diff line change 11/* eslint-disable no-param-reassign */
22
33import virtual from '@rollup/plugin-virtual' ;
4- import { promise as matched } from 'matched ' ;
4+ import { glob } from 'glob ' ;
55
66const DEFAULT_OUTPUT = 'multi-entry.js' ;
77const AS_IMPORT = 'import' ;
@@ -57,13 +57,27 @@ export default function multiEntry(conf = {}) {
5757 } ;
5858 } ,
5959
60- buildStart ( options ) {
60+ async buildStart ( options ) {
6161 const patterns = config . include . concat ( config . exclude . map ( ( pattern ) => `!${ pattern } ` ) ) ;
62- const entries = patterns . length
63- ? matched ( patterns , { realpath : true } ) . then ( ( paths ) =>
64- paths . sort ( ) . map ( exporter ) . join ( '\n' )
65- )
66- : Promise . resolve ( '' ) ;
62+
63+ // Split patterns based on includes and excludes
64+ const includePatterns = patterns . filter ( ( pattern ) => ! pattern . startsWith ( '!' ) ) ;
65+ const excludePatterns = patterns
66+ . filter ( ( pattern ) => pattern . startsWith ( '!' ) )
67+ . map ( ( pattern ) => pattern . substring ( 1 ) ) ;
68+
69+ const paths = await Promise . all (
70+ includePatterns . map ( async ( pattern ) =>
71+ glob ( pattern , {
72+ absolute : true ,
73+ ignore : excludePatterns
74+ } )
75+ )
76+ ) ;
77+
78+ const flatPaths = [ ...new Set ( paths . flat ( ) ) ] ;
79+
80+ const entries = flatPaths . length ? flatPaths . map ( exporter ) . join ( '\n' ) : '' ;
6781
6882 virtualisedEntry = virtual ( { [ options . input ] : entries } ) ;
6983 } ,
You can’t perform that action at this time.
0 commit comments