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 7d3ada8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 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
2 changes: 1 addition & 1 deletion packages/rollup-plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface HbPluginOptions {
silent: boolean;
deployEndpoint: string;
deploy: boolean | Deploy;
ignorePaths: Array<string | RegExp>;
ignorePaths: Array<string>;
}

export interface Deploy {
Expand Down

0 comments on commit 7d3ada8

Please sign in to comment.