Skip to content

Commit 869c5a8

Browse files
fix: discard edge function declarations without a path or pattern (#5299)
1 parent 990da12 commit 869c5a8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/lib/edge-functions/registry.cjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,21 @@ const { NETLIFYDEVERR, NETLIFYDEVLOG, chalk, log, warn, watchDebounced } = requi
1111
*/
1212

1313
/**
14-
* @typedef EdgeFunctionDeclaration
14+
* @typedef EdgeFunctionDeclarationWithPath
1515
* @type {object}
1616
* @property {string} function
1717
* @property {string} path
1818
*/
1919

20+
/**
21+
* @typedef EdgeFunctionDeclarationWithPattern
22+
* @type {object}
23+
* @property {string} function
24+
* @property {RegExp} pattern
25+
*/
26+
27+
/** @typedef {(EdgeFunctionDeclarationWithPath | EdgeFunctionDeclarationWithPattern) } EdgeFunctionDeclaration */
28+
2029
class EdgeFunctionsRegistry {
2130
/**
2231
* @param {Object} opts
@@ -341,7 +350,9 @@ class EdgeFunctionsRegistry {
341350
}
342351
})
343352

344-
return declarations
353+
const filteredDeclarations = declarations.filter((declaration) => 'path' in declaration || 'pattern' in declaration)
354+
355+
return filteredDeclarations
345356
}
346357

347358
processGraph(graph) {

0 commit comments

Comments
 (0)