Skip to content

Commit

Permalink
fix: prioritize pattern over path
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Jul 1, 2024
1 parent b3af099 commit 55d6d87
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions packages/edge-bundler/node/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,18 @@ const generateManifest = ({

const { onError, rateLimit } = singleUserFunctionConfig

if ('excludedPath' in singleUserFunctionConfig) {
addExcludedPatterns(name, manifestFunctionConfig, singleUserFunctionConfig.excludedPath)
} else if ('excludedPattern' in singleUserFunctionConfig && singleUserFunctionConfig.excludedPattern) {
if (
'pattern' in singleUserFunctionConfig &&
singleUserFunctionConfig.pattern &&
'excludedPattern' in singleUserFunctionConfig &&
singleUserFunctionConfig.excludedPattern
) {
const excludedPattern = Array.isArray(singleUserFunctionConfig.excludedPattern)
? singleUserFunctionConfig.excludedPattern
: [singleUserFunctionConfig.excludedPattern]
manifestFunctionConfig[name].excluded_patterns.push(...excludedPattern)
} else if ('excludedPath' in singleUserFunctionConfig) {
addExcludedPatterns(name, manifestFunctionConfig, singleUserFunctionConfig.excludedPath)
}

manifestFunctionConfig[name] = {
Expand All @@ -177,13 +182,18 @@ const generateManifest = ({
const { onError, rateLimit, ...singleInternalFunctionConfigWithoutOnErrorAndRateLimit } =
singleInternalFunctionConfig

if ('excludedPath' in singleInternalFunctionConfig) {
addExcludedPatterns(name, manifestFunctionConfig, singleInternalFunctionConfig.excludedPath)
} else if ('excludedPattern' in singleInternalFunctionConfig && singleInternalFunctionConfig.excludedPattern) {
if (
'pattern' in singleInternalFunctionConfig &&
singleInternalFunctionConfig.pattern &&
'excludedPattern' in singleInternalFunctionConfig &&
singleInternalFunctionConfig.excludedPattern
) {
const excludedPattern = Array.isArray(singleInternalFunctionConfig.excludedPattern)
? singleInternalFunctionConfig.excludedPattern
: [singleInternalFunctionConfig.excludedPattern]
manifestFunctionConfig[name].excluded_patterns.push(...excludedPattern)
} else if ('excludedPath' in singleInternalFunctionConfig) {
addExcludedPatterns(name, manifestFunctionConfig, singleInternalFunctionConfig.excludedPath)
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down

0 comments on commit 55d6d87

Please sign in to comment.