@@ -3,6 +3,7 @@ import { resolve, relative, dirname, basename } from 'path';
33import chalk from 'chalk' ;
44import { map , series } from 'asyncro' ;
55import promisify from 'es6-promisify' ;
6+ import glob from 'glob' ;
67import { rollup , watch } from 'rollup' ;
78import nodent from 'rollup-plugin-nodent' ;
89import commonjs from 'rollup-plugin-commonjs' ;
@@ -46,9 +47,10 @@ export default async function microbundle(options) {
4647 console . warn ( chalk . yellow ( `${ chalk . yellow . inverse ( 'WARN' ) } missing package.json "name" field. Assuming "${ options . pkg . name } ".` ) ) ;
4748 }
4849
49- options . input = [ ] . concat (
50+ options . input = [ ] ;
51+ [ ] . concat (
5052 options . entries && options . entries . length ? options . entries : options . pkg . source || ( await isDir ( resolve ( cwd , 'src' ) ) && 'src/index.js' ) || ( await isFile ( resolve ( cwd , 'index.js' ) ) && 'index.js' ) || options . pkg . module
51- ) . map ( file => resolve ( cwd , file ) ) ;
53+ ) . map ( file => glob . sync ( resolve ( cwd , file ) ) ) . forEach ( file => options . input . push ( ... file ) ) ;
5254
5355 let main = resolve ( cwd , options . output || options . pkg . main || 'dist' ) ;
5456 if ( ! main . match ( / \. [ a - z ] + $ / ) || await isDir ( main ) ) {
@@ -153,7 +155,7 @@ function createConfig(options, entry, format) {
153155
154156 let mainNoExtension = options . output ;
155157 if ( options . multipleEntries ) {
156- let name = entry . match ( / \/ i n d e x ( \. ( u m d | c j s | e s | m ) ) ? \. j s $ / ) ? mainNoExtension : entry ;
158+ let name = entry . match ( / ( \\ | \/ ) i n d e x ( \. ( u m d | c j s | e s | m ) ) ? \. j s $ / ) ? mainNoExtension : entry ;
157159 mainNoExtension = resolve ( dirname ( mainNoExtension ) , basename ( name ) ) ;
158160 }
159161 mainNoExtension = mainNoExtension . replace ( / ( \. ( u m d | c j s | e s | m ) ) ? \. j s $ / , '' ) ;
0 commit comments