include
Package: @autotracer/plugin-babel-flow · Layer: Build · Type: object · Default: see below
include is a build configuration option passed to @autotracer/plugin-babel-flow in your Babel config. It defines which files and function names are eligible for instrumentation before pragma comments are evaluated.
paths uses glob patterns matched against the normalized filename Babel passes to the plugin. If a pattern is not absolute and does not already start with **/, AutoTracer also tests it with a leading **/ so project-relative patterns can still match absolute filenames. functions accepts exact names, glob-like strings, or regular expressions.
This option uses object-key merge with the plugin defaults. If you provide only functions, the default paths value is kept. If you provide only paths, the default functions value is kept. Arrays are never concatenated.
By default, the plugin considers every .js, .jsx, .mjs, .ts, .tsx, and .mts file eligible and applies no function-name filter. include is the setting you use when that default eligible set is too broad.
Read together with exclude, mode, and pragma comments when you are narrowing the eligible set.
Default
{
paths: ["**/*.{js,jsx,mjs,ts,tsx,mts}"],
functions: [],
}In the default "opt-out" mode, that means most JS and TS source files start eligible unless another setting removes them.
How Eligibility Works
excluderemoves files beforeincludeis checked.include.pathsdecides which remaining files are eligible for transformation.include.functionsandexclude.functionsdecide which function names inside those eligible files can still be instrumented.- Pragma comments such as
@traceand@trace-disablerun only inside that eligible set.@tracecannot bypass anincludemiss or an explicitexcludematch.
Fields
pathsfilters which files are considered for transformation.functionsfilters which function names inside eligible files can be instrumented.
Function Name Matching
Function-name filters do not match the full emitted colon-delimited name. The Flow Babel plugin first extracts the meaningful function name from that chain.
- Plain nested names such as
outer:innerare filtered asinner. - Wrapper segments such as
useCallback,map, orthenare ignored when Flow can resolve a clearer function name. - Anonymous functions cannot match
include.functionsby name, so they stay out wheninclude.functionsis non-empty.
Usage
{
"plugins": [
[
"@autotracer/plugin-babel-flow",
{
"include": {
"paths": ["src/**/*.{ts,tsx,js,jsx}", "app/**/*.ts"],
"functions": ["handle*", "process*", /^load[A-Z]/]
}
}
]
]
}