diff --git a/src/config.ts b/src/config.ts index 532e93d..0e73540 100644 --- a/src/config.ts +++ b/src/config.ts @@ -26,7 +26,7 @@ export const config: Config = { /** * list of asset files to copy over */ - assets: ['assets/*'], + assets: ['assets/**'], /** * boolean indicating if the interop rollup setting should be enabled diff --git a/src/modules/Bundler.ts b/src/modules/Bundler.ts index 27b778d..264980e 100644 --- a/src/modules/Bundler.ts +++ b/src/modules/Bundler.ts @@ -60,14 +60,25 @@ class Bundler { */ private resolveRegex(pattern: string | RegExp) { if (isString(pattern)) { + // match everything if (pattern === '*') { - return new RegExp('^.*$', 'i'); + return new RegExp('^.*', 'i'); } else { pattern = pattern - .replace(/\./g, '\\.') - .replace(/\*{2}/g, '.*') - .replace(/\*/g, '[^/]+'); - return new RegExp('^' + pattern + '$', 'i'); + .split('/') + .map(current => { + if (current === '*') { + return '[^/]+'; + } else if (current === '**') { + return '.*'; + } else { + return current; + } + }) + .join('/'); + + pattern = pattern.replace(/^\/+/, '^'); + return new RegExp(pattern, 'i'); } } else { return pattern; @@ -238,6 +249,9 @@ class Bundler { const isTypeDefinitionFile = ext === '.d.ts'; const isAssetFile = !isTypeDefinitionFile && !isBuildFile; + if (isAssetFile) { + console.log(config.assets); + } src = oldRelativePath; if (isTypeDefinitionFile && config.cjsConfig.enabled) { result.typeDefinitionFiles.push(current);