From 32d3999efb9a905a3cbe80907eb49f4bad2ca3d7 Mon Sep 17 00:00:00 2001 From: Pangratios Cosma Date: Thu, 27 Apr 2023 08:39:36 +0300 Subject: [PATCH] chore: pass array of paths to picomatch, remove regex refs Refs: #1053 --- packages/rollup-plugin/src/rollupUtils.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/rollup-plugin/src/rollupUtils.ts b/packages/rollup-plugin/src/rollupUtils.ts index d9b79539e..19a87394d 100644 --- a/packages/rollup-plugin/src/rollupUtils.ts +++ b/packages/rollup-plugin/src/rollupUtils.ts @@ -10,7 +10,7 @@ import type { SourcemapInfo } from './types' export function extractSourcemapDataFromBundle ( outputOptions: NormalizedOutputOptions, bundle: OutputBundle, - ignorePaths: Array = [] + ignorePaths: Array = [] ): SourcemapInfo[] { const sourceMaps = Object.values(bundle).filter(isSourcemap) @@ -30,15 +30,10 @@ function isSourcemap(file: OutputAsset | OutputChunk): file is OutputAsset { return !!json.sourcesContent && json.sourcesContent.length > 0 } -function isNotIgnored(sourceMapInfo: SourcemapInfo, ignorePaths: Array) { - for (const ignorePath of ignorePaths) { - const isMatch = picomatch.isMatch(sourceMapInfo.jsFilePath, ignorePath, { basename: true }) - if (isMatch) { - return false - } - } +function isNotIgnored(sourceMapInfo: SourcemapInfo, ignorePaths: Array) { + const isMatch = picomatch.isMatch(sourceMapInfo.jsFilePath, ignorePaths, { basename: true }) - return true + return !isMatch } function formatSourcemapData(