Skip to content

Commit

Permalink
chore: pass array of paths to picomatch, remove regex refs
Browse files Browse the repository at this point in the history
Refs: #1053
  • Loading branch information
subzero10 committed Apr 27, 2023
1 parent e5b7b36 commit 32d3999
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/rollup-plugin/src/rollupUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { SourcemapInfo } from './types'
export function extractSourcemapDataFromBundle (
outputOptions: NormalizedOutputOptions,
bundle: OutputBundle,
ignorePaths: Array<string | RegExp> = []
ignorePaths: Array<string> = []
): SourcemapInfo[] {
const sourceMaps = Object.values(bundle).filter(isSourcemap)

Expand All @@ -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<string | RegExp>) {
for (const ignorePath of ignorePaths) {
const isMatch = picomatch.isMatch(sourceMapInfo.jsFilePath, ignorePath, { basename: true })
if (isMatch) {
return false
}
}
function isNotIgnored(sourceMapInfo: SourcemapInfo, ignorePaths: Array<string>) {
const isMatch = picomatch.isMatch(sourceMapInfo.jsFilePath, ignorePaths, { basename: true })

return true
return !isMatch
}

function formatSourcemapData(
Expand Down

0 comments on commit 32d3999

Please sign in to comment.