exclude
Package: @autotracer/plugin-babel-flow · Layer: Build · Type: object · Default: see below
exclude is a build configuration option passed to @autotracer/plugin-babel-flow in your Babel config. It removes files and function names from the eligible set 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. When exclude matches, it wins over include.
This option uses object-key merge with the plugin defaults. If you provide only functions, the default path exclusions are kept. If you provide only paths, the default functions value is kept. Arrays are never concatenated.
By default, the plugin already excludes common test files, build outputs, coverage folders, dependency folders, and test directories. exclude is the setting you use when the default eligible set still includes files or functions that should never be instrumented.
Read together with include, mode, and pragma comments.
Default
{
paths: [
"**/*.test.*",
"**/*.spec.*",
"**/node_modules/**",
"**/dist/**",
"**/build/**",
"**/.next/**",
"**/coverage/**",
"**/tests/**",
"**/test/**",
"**/__tests__/**",
],
functions: [],
}How Exclusion Works
exclude.pathsremoves matching files before function pragmas are considered.exclude.functionsremoves matching function names inside files that are otherwise still eligible.- These exclusions still apply in both
"opt-in"and"opt-out"modes. @tracecannot override an explicit exclude match.
Fields
pathsskips whole files and folders before transformation.functionsskips matching function names inside otherwise eligible files.
Function Name Matching
Function-name filters use the extracted meaningful function name rather than the full emitted 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 are not removed by
exclude.functionsname matching alone.
When To Set It
- Leave the defaults when the built-in test and build-output exclusions are enough.
- Add exclusions when specific files, folders, or function families must stay out of instrumentation even though they are otherwise eligible.
Usage
{
"plugins": [
[
"@autotracer/plugin-babel-flow",
{
"exclude": {
"paths": ["**/*.spec.*", "**/*.test.*", "src/legacy/**"],
"functions": [/^_internal/, "debug*"]
}
}
]
]
}