Code-first Azure Functions HTTP triggers, which ship without a
function.json: C# [HttpTrigger] attributes (isolated worker and
in-process), Python v2 @app.route decorators and Node v4 app.http(...)
calls. Yields declarations only; the route prefix from host.json is the
analyzer's job.
Constants
ARGS = TopLevelSplit::Rules.new
CS_FUNCTION_NAME = /\[\s*(?:Function|FunctionName)(?:Attribute)?\s*\(\s*(?:@?"([^"]*)"|nameof\s*\(\s*(?:[\w.]+\.)?(\w+)\s*\))/
CS_NAMEOF = /\Anameof\s*\(\s*(?:[\w.]+\.)?(\w+)\s*\)\z/
CS_TRIGGER = /\[\s*(?:[\w.]+\.)?(\w*)Trigger(?:Attribute)?\s*[(\]]/
Any binding trigger (TimerTrigger, QueueTrigger, ...): every function
has exactly one, so they delimit which [Function] belongs to which.
CS_VERBATIM = /@"(?:[^"]|"")*"/
JS_APP_IMPORT = /\{[^}]*\bapp\b[^}]*\}\s*(?:from\s*|=\s*require\s*\(\s*)["']@azure\/functions["']/
app must come from @azure/functions: v3-model files import its types
next to an Express app whose routes are not Azure triggers.
JS_ARGS = TopLevelSplit::Rules.new(quotes: "\"'`")
JS_CALL = /(?:(?<![\w$.])app|\bapp\s*\.\s*client)\s*\.\s*(http|get|post|put|patch|deleteRequest)\s*\(/
df.app.client.http(...) is durable-functions' wrapper over app.http.
JS_DEFAULT_METHODS = ["GET", "POST"]
Node v4 trigger.http fills in ['GET', 'POST'] when methods is
omitted; C# and Python leave it empty, which the host reads as any verb.
JS_EXTENSIONS = {".js", ".mjs", ".cjs", ".ts", ".mts", ".cts"}
JS_KEY = /\A["'`]?(\w+)["'`]?\s*:\s*(.*)\z/m
JS_TYPE_SUFFIX = /\s+(?:satisfies|as)\s+[\w.<>]+\s*\z/
KEYWORD_ARG = /\A(\w+)\s*[:=]\s*(.*)\z/m
PY_APP_CLASS = /(?:\A|\.)(FunctionApp|Blueprint|DFApp)\z/
PY_DECORATOR = /^[ \t]*@\w+\s*\.\s*route\s*\(/m
PY_IMPORT = /\bazure(?:\.|\s+import\s+)(?:durable_)?functions\b/
PY_METHOD = /(["'])(\w+)\1|\bHttpMethod\s*\.\s*(\w+)/
QUOTED = /\A([rRuUbBfF@$]*)(["'`])((?:(?!\2)[^\\]|\\.)*)\2\z/m
STRING_TOKENS = /(["'`])((?:(?!\1)[^\\]|\\.)*)\1/
Instance methods
Whether the file declares at least one HTTP trigger in a code-first
programming model. A cheap substring gate runs before each regex.
Source